ltmain.sh revision 7ce7e03c
1f7ec340bSmacallan# ltmain.sh - Provide generalized library-building support services. 2f7ec340bSmacallan# NOTE: Changing this file will not affect anything until you rerun configure. 3f7ec340bSmacallan# 47ce7e03cSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 57ce7e03cSmrg# 2007, 2008 Free Software Foundation, Inc. 6f7ec340bSmacallan# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7f7ec340bSmacallan# 8f7ec340bSmacallan# This program is free software; you can redistribute it and/or modify 9f7ec340bSmacallan# it under the terms of the GNU General Public License as published by 10f7ec340bSmacallan# the Free Software Foundation; either version 2 of the License, or 11f7ec340bSmacallan# (at your option) any later version. 12f7ec340bSmacallan# 13f7ec340bSmacallan# This program is distributed in the hope that it will be useful, but 14f7ec340bSmacallan# WITHOUT ANY WARRANTY; without even the implied warranty of 15f7ec340bSmacallan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16f7ec340bSmacallan# General Public License for more details. 17f7ec340bSmacallan# 18f7ec340bSmacallan# You should have received a copy of the GNU General Public License 19f7ec340bSmacallan# along with this program; if not, write to the Free Software 20f7ec340bSmacallan# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21f7ec340bSmacallan# 22f7ec340bSmacallan# As a special exception to the GNU General Public License, if you 23f7ec340bSmacallan# distribute this file as part of a program that contains a 24f7ec340bSmacallan# configuration script generated by Autoconf, you may include it under 25f7ec340bSmacallan# the same distribution terms that you use for the rest of that program. 26f7ec340bSmacallan 27f7ec340bSmacallanbasename="s,^.*/,,g" 28f7ec340bSmacallan 29f7ec340bSmacallan# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 30f7ec340bSmacallan# is ksh but when the shell is invoked as "sh" and the current value of 31f7ec340bSmacallan# the _XPG environment variable is not equal to 1 (one), the special 32f7ec340bSmacallan# positional parameter $0, within a function call, is the name of the 33f7ec340bSmacallan# function. 34f7ec340bSmacallanprogpath="$0" 35f7ec340bSmacallan 36f7ec340bSmacallan# The name of this program: 37f7ec340bSmacallanprogname=`echo "$progpath" | $SED $basename` 38f7ec340bSmacallanmodename="$progname" 39f7ec340bSmacallan 40f7ec340bSmacallan# Global variables: 41f7ec340bSmacallanEXIT_SUCCESS=0 42f7ec340bSmacallanEXIT_FAILURE=1 43f7ec340bSmacallan 44f7ec340bSmacallanPROGRAM=ltmain.sh 45f7ec340bSmacallanPACKAGE=libtool 467ce7e03cSmrgVERSION="1.5.26 Debian 1.5.26-4" 477ce7e03cSmrgTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" 487ce7e03cSmrg 497ce7e03cSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 507ce7e03cSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 517ce7e03cSmrg emulate sh 527ce7e03cSmrg NULLCMD=: 537ce7e03cSmrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 547ce7e03cSmrg # is contrary to our usage. Disable this feature. 557ce7e03cSmrg alias -g '${1+"$@"}'='"$@"' 56f7ec340bSmacallan setopt NO_GLOB_SUBST 577ce7e03cSmrgelse 587ce7e03cSmrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 59f7ec340bSmacallanfi 607ce7e03cSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 617ce7e03cSmrgDUALCASE=1; export DUALCASE # for MKS sh 62f7ec340bSmacallan 63f7ec340bSmacallan# Check that we have a working $echo. 64f7ec340bSmacallanif test "X$1" = X--no-reexec; then 65f7ec340bSmacallan # Discard the --no-reexec flag, and continue. 66f7ec340bSmacallan shift 67f7ec340bSmacallanelif test "X$1" = X--fallback-echo; then 68f7ec340bSmacallan # Avoid inline document here, it may be left over 69f7ec340bSmacallan : 70f7ec340bSmacallanelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 71f7ec340bSmacallan # Yippee, $echo works! 72f7ec340bSmacallan : 73f7ec340bSmacallanelse 74f7ec340bSmacallan # Restart under the correct shell, and then maybe $echo will work. 75f7ec340bSmacallan exec $SHELL "$progpath" --no-reexec ${1+"$@"} 76f7ec340bSmacallanfi 77f7ec340bSmacallan 78f7ec340bSmacallanif test "X$1" = X--fallback-echo; then 79f7ec340bSmacallan # used as fallback echo 80f7ec340bSmacallan shift 81f7ec340bSmacallan cat <<EOF 82f7ec340bSmacallan$* 83f7ec340bSmacallanEOF 84f7ec340bSmacallan exit $EXIT_SUCCESS 85f7ec340bSmacallanfi 86f7ec340bSmacallan 87f7ec340bSmacallandefault_mode= 88f7ec340bSmacallanhelp="Try \`$progname --help' for more information." 89f7ec340bSmacallanmagic="%%%MAGIC variable%%%" 90f7ec340bSmacallanmkdir="mkdir" 91f7ec340bSmacallanmv="mv -f" 92f7ec340bSmacallanrm="rm -f" 93f7ec340bSmacallan 94f7ec340bSmacallan# Sed substitution that helps us do robust quoting. It backslashifies 95f7ec340bSmacallan# metacharacters that are still active within double-quoted strings. 96f7ec340bSmacallanXsed="${SED}"' -e 1s/^X//' 97f7ec340bSmacallansed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 98f7ec340bSmacallan# test EBCDIC or ASCII 99f7ec340bSmacallancase `echo X|tr X '\101'` in 100f7ec340bSmacallan A) # ASCII based system 101f7ec340bSmacallan # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 102f7ec340bSmacallan SP2NL='tr \040 \012' 103f7ec340bSmacallan NL2SP='tr \015\012 \040\040' 104f7ec340bSmacallan ;; 105f7ec340bSmacallan *) # EBCDIC based system 106f7ec340bSmacallan SP2NL='tr \100 \n' 107f7ec340bSmacallan NL2SP='tr \r\n \100\100' 108f7ec340bSmacallan ;; 109f7ec340bSmacallanesac 110f7ec340bSmacallan 111f7ec340bSmacallan# NLS nuisances. 112f7ec340bSmacallan# Only set LANG and LC_ALL to C if already set. 113f7ec340bSmacallan# These must not be set unconditionally because not all systems understand 114f7ec340bSmacallan# e.g. LANG=C (notably SCO). 115f7ec340bSmacallan# We save the old values to restore during execute mode. 1167ce7e03cSmrglt_env= 1177ce7e03cSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1187ce7e03cSmrgdo 1197ce7e03cSmrg eval "if test \"\${$lt_var+set}\" = set; then 1207ce7e03cSmrg save_$lt_var=\$$lt_var 1217ce7e03cSmrg lt_env=\"$lt_var=\$$lt_var \$lt_env\" 1227ce7e03cSmrg $lt_var=C 1237ce7e03cSmrg export $lt_var 1247ce7e03cSmrg fi" 1257ce7e03cSmrgdone 1267ce7e03cSmrg 1277ce7e03cSmrgif test -n "$lt_env"; then 1287ce7e03cSmrg lt_env="env $lt_env" 129f7ec340bSmacallanfi 130f7ec340bSmacallan 131f7ec340bSmacallan# Make sure IFS has a sensible default 132f7ec340bSmacallanlt_nl=' 133f7ec340bSmacallan' 134f7ec340bSmacallanIFS=" $lt_nl" 135f7ec340bSmacallan 136f7ec340bSmacallanif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 137f7ec340bSmacallan $echo "$modename: not configured to build any kind of library" 1>&2 138f7ec340bSmacallan $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 139f7ec340bSmacallan exit $EXIT_FAILURE 140f7ec340bSmacallanfi 141f7ec340bSmacallan 142f7ec340bSmacallan# Global variables. 143f7ec340bSmacallanmode=$default_mode 144f7ec340bSmacallannonopt= 145f7ec340bSmacallanprev= 146f7ec340bSmacallanprevopt= 147f7ec340bSmacallanrun= 148f7ec340bSmacallanshow="$echo" 149f7ec340bSmacallanshow_help= 150f7ec340bSmacallanexecute_dlfiles= 151f7ec340bSmacallanduplicate_deps=no 152f7ec340bSmacallanpreserve_args= 153f7ec340bSmacallanlo2o="s/\\.lo\$/.${objext}/" 154f7ec340bSmacallano2lo="s/\\.${objext}\$/.lo/" 1557ce7e03cSmrgextracted_archives= 1567ce7e03cSmrgextracted_serial=0 157f7ec340bSmacallan 158f7ec340bSmacallan##################################### 159f7ec340bSmacallan# Shell function definitions: 160f7ec340bSmacallan# This seems to be the best place for them 161f7ec340bSmacallan 162f7ec340bSmacallan# func_mktempdir [string] 163f7ec340bSmacallan# Make a temporary directory that won't clash with other running 164f7ec340bSmacallan# libtool processes, and avoids race conditions if possible. If 165f7ec340bSmacallan# given, STRING is the basename for that directory. 166f7ec340bSmacallanfunc_mktempdir () 167f7ec340bSmacallan{ 168f7ec340bSmacallan my_template="${TMPDIR-/tmp}/${1-$progname}" 169f7ec340bSmacallan 170f7ec340bSmacallan if test "$run" = ":"; then 171f7ec340bSmacallan # Return a directory name, but don't create it in dry-run mode 172f7ec340bSmacallan my_tmpdir="${my_template}-$$" 173f7ec340bSmacallan else 174f7ec340bSmacallan 175f7ec340bSmacallan # If mktemp works, use that first and foremost 176f7ec340bSmacallan my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 177f7ec340bSmacallan 178f7ec340bSmacallan if test ! -d "$my_tmpdir"; then 179f7ec340bSmacallan # Failing that, at least try and use $RANDOM to avoid a race 180f7ec340bSmacallan my_tmpdir="${my_template}-${RANDOM-0}$$" 181f7ec340bSmacallan 182f7ec340bSmacallan save_mktempdir_umask=`umask` 183f7ec340bSmacallan umask 0077 184f7ec340bSmacallan $mkdir "$my_tmpdir" 185f7ec340bSmacallan umask $save_mktempdir_umask 186f7ec340bSmacallan fi 187f7ec340bSmacallan 188f7ec340bSmacallan # If we're not in dry-run mode, bomb out on failure 189f7ec340bSmacallan test -d "$my_tmpdir" || { 190f7ec340bSmacallan $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 191f7ec340bSmacallan exit $EXIT_FAILURE 192f7ec340bSmacallan } 193f7ec340bSmacallan fi 194f7ec340bSmacallan 195f7ec340bSmacallan $echo "X$my_tmpdir" | $Xsed 196f7ec340bSmacallan} 197f7ec340bSmacallan 198f7ec340bSmacallan 199f7ec340bSmacallan# func_win32_libid arg 200f7ec340bSmacallan# return the library type of file 'arg' 201f7ec340bSmacallan# 202f7ec340bSmacallan# Need a lot of goo to handle *both* DLLs and import libs 203f7ec340bSmacallan# Has to be a shell function in order to 'eat' the argument 204f7ec340bSmacallan# that is supplied when $file_magic_command is called. 205f7ec340bSmacallanfunc_win32_libid () 206f7ec340bSmacallan{ 207f7ec340bSmacallan win32_libid_type="unknown" 208f7ec340bSmacallan win32_fileres=`file -L $1 2>/dev/null` 209f7ec340bSmacallan case $win32_fileres in 210f7ec340bSmacallan *ar\ archive\ import\ library*) # definitely import 211f7ec340bSmacallan win32_libid_type="x86 archive import" 212f7ec340bSmacallan ;; 213f7ec340bSmacallan *ar\ archive*) # could be an import, or static 214f7ec340bSmacallan if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 215f7ec340bSmacallan $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 216f7ec340bSmacallan win32_nmres=`eval $NM -f posix -A $1 | \ 2177ce7e03cSmrg $SED -n -e '1,100{ 2187ce7e03cSmrg / I /{ 2197ce7e03cSmrg s,.*,import, 2207ce7e03cSmrg p 2217ce7e03cSmrg q 2227ce7e03cSmrg } 2237ce7e03cSmrg }'` 224f7ec340bSmacallan case $win32_nmres in 225f7ec340bSmacallan import*) win32_libid_type="x86 archive import";; 226f7ec340bSmacallan *) win32_libid_type="x86 archive static";; 227f7ec340bSmacallan esac 228f7ec340bSmacallan fi 229f7ec340bSmacallan ;; 230f7ec340bSmacallan *DLL*) 231f7ec340bSmacallan win32_libid_type="x86 DLL" 232f7ec340bSmacallan ;; 233f7ec340bSmacallan *executable*) # but shell scripts are "executable" too... 234f7ec340bSmacallan case $win32_fileres in 235f7ec340bSmacallan *MS\ Windows\ PE\ Intel*) 236f7ec340bSmacallan win32_libid_type="x86 DLL" 237f7ec340bSmacallan ;; 238f7ec340bSmacallan esac 239f7ec340bSmacallan ;; 240f7ec340bSmacallan esac 241f7ec340bSmacallan $echo $win32_libid_type 242f7ec340bSmacallan} 243f7ec340bSmacallan 244f7ec340bSmacallan 245f7ec340bSmacallan# func_infer_tag arg 246f7ec340bSmacallan# Infer tagged configuration to use if any are available and 247f7ec340bSmacallan# if one wasn't chosen via the "--tag" command line option. 248f7ec340bSmacallan# Only attempt this if the compiler in the base compile 249f7ec340bSmacallan# command doesn't match the default compiler. 250f7ec340bSmacallan# arg is usually of the form 'gcc ...' 251f7ec340bSmacallanfunc_infer_tag () 252f7ec340bSmacallan{ 253f7ec340bSmacallan if test -n "$available_tags" && test -z "$tagname"; then 254f7ec340bSmacallan CC_quoted= 255f7ec340bSmacallan for arg in $CC; do 256f7ec340bSmacallan case $arg in 257f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 258f7ec340bSmacallan arg="\"$arg\"" 259f7ec340bSmacallan ;; 260f7ec340bSmacallan esac 261f7ec340bSmacallan CC_quoted="$CC_quoted $arg" 262f7ec340bSmacallan done 263f7ec340bSmacallan case $@ in 264f7ec340bSmacallan # Blanks in the command may have been stripped by the calling shell, 265f7ec340bSmacallan # but not from the CC environment variable when configure was run. 266f7ec340bSmacallan " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 267f7ec340bSmacallan # Blanks at the start of $base_compile will cause this to fail 268f7ec340bSmacallan # if we don't check for them as well. 269f7ec340bSmacallan *) 270f7ec340bSmacallan for z in $available_tags; do 271f7ec340bSmacallan if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 272f7ec340bSmacallan # Evaluate the configuration. 273f7ec340bSmacallan eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 274f7ec340bSmacallan CC_quoted= 275f7ec340bSmacallan for arg in $CC; do 276f7ec340bSmacallan # Double-quote args containing other shell metacharacters. 277f7ec340bSmacallan case $arg in 278f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 279f7ec340bSmacallan arg="\"$arg\"" 280f7ec340bSmacallan ;; 281f7ec340bSmacallan esac 282f7ec340bSmacallan CC_quoted="$CC_quoted $arg" 283f7ec340bSmacallan done 284f7ec340bSmacallan case "$@ " in 285f7ec340bSmacallan " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 286f7ec340bSmacallan # The compiler in the base compile command matches 287f7ec340bSmacallan # the one in the tagged configuration. 288f7ec340bSmacallan # Assume this is the tagged configuration we want. 289f7ec340bSmacallan tagname=$z 290f7ec340bSmacallan break 291f7ec340bSmacallan ;; 292f7ec340bSmacallan esac 293f7ec340bSmacallan fi 294f7ec340bSmacallan done 295f7ec340bSmacallan # If $tagname still isn't set, then no tagged configuration 296f7ec340bSmacallan # was found and let the user know that the "--tag" command 297f7ec340bSmacallan # line option must be used. 298f7ec340bSmacallan if test -z "$tagname"; then 299f7ec340bSmacallan $echo "$modename: unable to infer tagged configuration" 300f7ec340bSmacallan $echo "$modename: specify a tag with \`--tag'" 1>&2 301f7ec340bSmacallan exit $EXIT_FAILURE 302f7ec340bSmacallan# else 303f7ec340bSmacallan# $echo "$modename: using $tagname tagged configuration" 304f7ec340bSmacallan fi 305f7ec340bSmacallan ;; 306f7ec340bSmacallan esac 307f7ec340bSmacallan fi 308f7ec340bSmacallan} 309f7ec340bSmacallan 310f7ec340bSmacallan 311f7ec340bSmacallan# func_extract_an_archive dir oldlib 312f7ec340bSmacallanfunc_extract_an_archive () 313f7ec340bSmacallan{ 314f7ec340bSmacallan f_ex_an_ar_dir="$1"; shift 315f7ec340bSmacallan f_ex_an_ar_oldlib="$1" 316f7ec340bSmacallan 317f7ec340bSmacallan $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 318f7ec340bSmacallan $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 319f7ec340bSmacallan if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 320f7ec340bSmacallan : 321f7ec340bSmacallan else 322f7ec340bSmacallan $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 323f7ec340bSmacallan exit $EXIT_FAILURE 324f7ec340bSmacallan fi 325f7ec340bSmacallan} 326f7ec340bSmacallan 327f7ec340bSmacallan# func_extract_archives gentop oldlib ... 328f7ec340bSmacallanfunc_extract_archives () 329f7ec340bSmacallan{ 330f7ec340bSmacallan my_gentop="$1"; shift 331f7ec340bSmacallan my_oldlibs=${1+"$@"} 332f7ec340bSmacallan my_oldobjs="" 333f7ec340bSmacallan my_xlib="" 334f7ec340bSmacallan my_xabs="" 335f7ec340bSmacallan my_xdir="" 336f7ec340bSmacallan my_status="" 337f7ec340bSmacallan 338f7ec340bSmacallan $show "${rm}r $my_gentop" 339f7ec340bSmacallan $run ${rm}r "$my_gentop" 340f7ec340bSmacallan $show "$mkdir $my_gentop" 341f7ec340bSmacallan $run $mkdir "$my_gentop" 342f7ec340bSmacallan my_status=$? 343f7ec340bSmacallan if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 344f7ec340bSmacallan exit $my_status 345f7ec340bSmacallan fi 346f7ec340bSmacallan 347f7ec340bSmacallan for my_xlib in $my_oldlibs; do 348f7ec340bSmacallan # Extract the objects. 349f7ec340bSmacallan case $my_xlib in 350f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 351f7ec340bSmacallan *) my_xabs=`pwd`"/$my_xlib" ;; 352f7ec340bSmacallan esac 353f7ec340bSmacallan my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 3547ce7e03cSmrg my_xlib_u=$my_xlib 3557ce7e03cSmrg while :; do 3567ce7e03cSmrg case " $extracted_archives " in 3577ce7e03cSmrg *" $my_xlib_u "*) 3587ce7e03cSmrg extracted_serial=`expr $extracted_serial + 1` 3597ce7e03cSmrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 3607ce7e03cSmrg *) break ;; 3617ce7e03cSmrg esac 3627ce7e03cSmrg done 3637ce7e03cSmrg extracted_archives="$extracted_archives $my_xlib_u" 3647ce7e03cSmrg my_xdir="$my_gentop/$my_xlib_u" 365f7ec340bSmacallan 366f7ec340bSmacallan $show "${rm}r $my_xdir" 367f7ec340bSmacallan $run ${rm}r "$my_xdir" 368f7ec340bSmacallan $show "$mkdir $my_xdir" 369f7ec340bSmacallan $run $mkdir "$my_xdir" 370f7ec340bSmacallan exit_status=$? 371f7ec340bSmacallan if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 372f7ec340bSmacallan exit $exit_status 373f7ec340bSmacallan fi 374f7ec340bSmacallan case $host in 375f7ec340bSmacallan *-darwin*) 376f7ec340bSmacallan $show "Extracting $my_xabs" 377f7ec340bSmacallan # Do not bother doing anything if just a dry run 378f7ec340bSmacallan if test -z "$run"; then 379f7ec340bSmacallan darwin_orig_dir=`pwd` 380f7ec340bSmacallan cd $my_xdir || exit $? 381f7ec340bSmacallan darwin_archive=$my_xabs 382f7ec340bSmacallan darwin_curdir=`pwd` 383f7ec340bSmacallan darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 384f7ec340bSmacallan darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 385f7ec340bSmacallan if test -n "$darwin_arches"; then 386f7ec340bSmacallan darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 387f7ec340bSmacallan darwin_arch= 388f7ec340bSmacallan $show "$darwin_base_archive has multiple architectures $darwin_arches" 389f7ec340bSmacallan for darwin_arch in $darwin_arches ; do 390f7ec340bSmacallan mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 391f7ec340bSmacallan lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 392f7ec340bSmacallan cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 393f7ec340bSmacallan func_extract_an_archive "`pwd`" "${darwin_base_archive}" 394f7ec340bSmacallan cd "$darwin_curdir" 395f7ec340bSmacallan $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 396f7ec340bSmacallan done # $darwin_arches 397f7ec340bSmacallan ## Okay now we have a bunch of thin objects, gotta fatten them up :) 398f7ec340bSmacallan darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 399f7ec340bSmacallan darwin_file= 400f7ec340bSmacallan darwin_files= 401f7ec340bSmacallan for darwin_file in $darwin_filelist; do 402f7ec340bSmacallan darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 403f7ec340bSmacallan lipo -create -output "$darwin_file" $darwin_files 404f7ec340bSmacallan done # $darwin_filelist 405f7ec340bSmacallan ${rm}r unfat-$$ 406f7ec340bSmacallan cd "$darwin_orig_dir" 407f7ec340bSmacallan else 408f7ec340bSmacallan cd "$darwin_orig_dir" 409f7ec340bSmacallan func_extract_an_archive "$my_xdir" "$my_xabs" 410f7ec340bSmacallan fi # $darwin_arches 411f7ec340bSmacallan fi # $run 412f7ec340bSmacallan ;; 413f7ec340bSmacallan *) 414f7ec340bSmacallan func_extract_an_archive "$my_xdir" "$my_xabs" 415f7ec340bSmacallan ;; 416f7ec340bSmacallan esac 417f7ec340bSmacallan my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 418f7ec340bSmacallan done 419f7ec340bSmacallan func_extract_archives_result="$my_oldobjs" 420f7ec340bSmacallan} 421f7ec340bSmacallan# End of Shell function definitions 422f7ec340bSmacallan##################################### 423f7ec340bSmacallan 424f7ec340bSmacallan# Darwin sucks 425f7ec340bSmacallaneval std_shrext=\"$shrext_cmds\" 426f7ec340bSmacallan 427f7ec340bSmacallandisable_libs=no 428f7ec340bSmacallan 429f7ec340bSmacallan# Parse our command line options once, thoroughly. 430f7ec340bSmacallanwhile test "$#" -gt 0 431f7ec340bSmacallando 432f7ec340bSmacallan arg="$1" 433f7ec340bSmacallan shift 434f7ec340bSmacallan 435f7ec340bSmacallan case $arg in 436f7ec340bSmacallan -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 437f7ec340bSmacallan *) optarg= ;; 438f7ec340bSmacallan esac 439f7ec340bSmacallan 440f7ec340bSmacallan # If the previous option needs an argument, assign it. 441f7ec340bSmacallan if test -n "$prev"; then 442f7ec340bSmacallan case $prev in 443f7ec340bSmacallan execute_dlfiles) 444f7ec340bSmacallan execute_dlfiles="$execute_dlfiles $arg" 445f7ec340bSmacallan ;; 446f7ec340bSmacallan tag) 447f7ec340bSmacallan tagname="$arg" 448f7ec340bSmacallan preserve_args="${preserve_args}=$arg" 449f7ec340bSmacallan 450f7ec340bSmacallan # Check whether tagname contains only valid characters 451f7ec340bSmacallan case $tagname in 452f7ec340bSmacallan *[!-_A-Za-z0-9,/]*) 453f7ec340bSmacallan $echo "$progname: invalid tag name: $tagname" 1>&2 454f7ec340bSmacallan exit $EXIT_FAILURE 455f7ec340bSmacallan ;; 456f7ec340bSmacallan esac 457f7ec340bSmacallan 458f7ec340bSmacallan case $tagname in 459f7ec340bSmacallan CC) 460f7ec340bSmacallan # Don't test for the "default" C tag, as we know, it's there, but 461f7ec340bSmacallan # not specially marked. 462f7ec340bSmacallan ;; 463f7ec340bSmacallan *) 464f7ec340bSmacallan if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 465f7ec340bSmacallan taglist="$taglist $tagname" 466f7ec340bSmacallan # Evaluate the configuration. 467f7ec340bSmacallan eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 468f7ec340bSmacallan else 469f7ec340bSmacallan $echo "$progname: ignoring unknown tag $tagname" 1>&2 470f7ec340bSmacallan fi 471f7ec340bSmacallan ;; 472f7ec340bSmacallan esac 473f7ec340bSmacallan ;; 474f7ec340bSmacallan *) 475f7ec340bSmacallan eval "$prev=\$arg" 476f7ec340bSmacallan ;; 477f7ec340bSmacallan esac 478f7ec340bSmacallan 479f7ec340bSmacallan prev= 480f7ec340bSmacallan prevopt= 481f7ec340bSmacallan continue 482f7ec340bSmacallan fi 483f7ec340bSmacallan 484f7ec340bSmacallan # Have we seen a non-optional argument yet? 485f7ec340bSmacallan case $arg in 486f7ec340bSmacallan --help) 487f7ec340bSmacallan show_help=yes 488f7ec340bSmacallan ;; 489f7ec340bSmacallan 490f7ec340bSmacallan --version) 4917ce7e03cSmrg echo "\ 4927ce7e03cSmrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 4937ce7e03cSmrg 4947ce7e03cSmrgCopyright (C) 2008 Free Software Foundation, Inc. 4957ce7e03cSmrgThis is free software; see the source for copying conditions. There is NO 4967ce7e03cSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 497f7ec340bSmacallan exit $? 498f7ec340bSmacallan ;; 499f7ec340bSmacallan 500f7ec340bSmacallan --config) 501f7ec340bSmacallan ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 502f7ec340bSmacallan # Now print the configurations for the tags. 503f7ec340bSmacallan for tagname in $taglist; do 504f7ec340bSmacallan ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 505f7ec340bSmacallan done 506f7ec340bSmacallan exit $? 507f7ec340bSmacallan ;; 508f7ec340bSmacallan 509f7ec340bSmacallan --debug) 510f7ec340bSmacallan $echo "$progname: enabling shell trace mode" 511f7ec340bSmacallan set -x 512f7ec340bSmacallan preserve_args="$preserve_args $arg" 513f7ec340bSmacallan ;; 514f7ec340bSmacallan 515f7ec340bSmacallan --dry-run | -n) 516f7ec340bSmacallan run=: 517f7ec340bSmacallan ;; 518f7ec340bSmacallan 519f7ec340bSmacallan --features) 520f7ec340bSmacallan $echo "host: $host" 521f7ec340bSmacallan if test "$build_libtool_libs" = yes; then 522f7ec340bSmacallan $echo "enable shared libraries" 523f7ec340bSmacallan else 524f7ec340bSmacallan $echo "disable shared libraries" 525f7ec340bSmacallan fi 526f7ec340bSmacallan if test "$build_old_libs" = yes; then 527f7ec340bSmacallan $echo "enable static libraries" 528f7ec340bSmacallan else 529f7ec340bSmacallan $echo "disable static libraries" 530f7ec340bSmacallan fi 531f7ec340bSmacallan exit $? 532f7ec340bSmacallan ;; 533f7ec340bSmacallan 534f7ec340bSmacallan --finish) mode="finish" ;; 535f7ec340bSmacallan 536f7ec340bSmacallan --mode) prevopt="--mode" prev=mode ;; 537f7ec340bSmacallan --mode=*) mode="$optarg" ;; 538f7ec340bSmacallan 539f7ec340bSmacallan --preserve-dup-deps) duplicate_deps="yes" ;; 540f7ec340bSmacallan 541f7ec340bSmacallan --quiet | --silent) 542f7ec340bSmacallan show=: 543f7ec340bSmacallan preserve_args="$preserve_args $arg" 544f7ec340bSmacallan ;; 545f7ec340bSmacallan 546f7ec340bSmacallan --tag) 547f7ec340bSmacallan prevopt="--tag" 548f7ec340bSmacallan prev=tag 549f7ec340bSmacallan preserve_args="$preserve_args --tag" 550f7ec340bSmacallan ;; 551f7ec340bSmacallan --tag=*) 552f7ec340bSmacallan set tag "$optarg" ${1+"$@"} 553f7ec340bSmacallan shift 554f7ec340bSmacallan prev=tag 555f7ec340bSmacallan preserve_args="$preserve_args --tag" 556f7ec340bSmacallan ;; 557f7ec340bSmacallan 558f7ec340bSmacallan -dlopen) 559f7ec340bSmacallan prevopt="-dlopen" 560f7ec340bSmacallan prev=execute_dlfiles 561f7ec340bSmacallan ;; 562f7ec340bSmacallan 563f7ec340bSmacallan -*) 564f7ec340bSmacallan $echo "$modename: unrecognized option \`$arg'" 1>&2 565f7ec340bSmacallan $echo "$help" 1>&2 566f7ec340bSmacallan exit $EXIT_FAILURE 567f7ec340bSmacallan ;; 568f7ec340bSmacallan 569f7ec340bSmacallan *) 570f7ec340bSmacallan nonopt="$arg" 571f7ec340bSmacallan break 572f7ec340bSmacallan ;; 573f7ec340bSmacallan esac 574f7ec340bSmacallandone 575f7ec340bSmacallan 576f7ec340bSmacallanif test -n "$prevopt"; then 577f7ec340bSmacallan $echo "$modename: option \`$prevopt' requires an argument" 1>&2 578f7ec340bSmacallan $echo "$help" 1>&2 579f7ec340bSmacallan exit $EXIT_FAILURE 580f7ec340bSmacallanfi 581f7ec340bSmacallan 582f7ec340bSmacallancase $disable_libs in 583f7ec340bSmacallanno) 584f7ec340bSmacallan ;; 585f7ec340bSmacallanshared) 586f7ec340bSmacallan build_libtool_libs=no 587f7ec340bSmacallan build_old_libs=yes 588f7ec340bSmacallan ;; 589f7ec340bSmacallanstatic) 590f7ec340bSmacallan build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 591f7ec340bSmacallan ;; 592f7ec340bSmacallanesac 593f7ec340bSmacallan 594f7ec340bSmacallan# If this variable is set in any of the actions, the command in it 595f7ec340bSmacallan# will be execed at the end. This prevents here-documents from being 596f7ec340bSmacallan# left over by shells. 597f7ec340bSmacallanexec_cmd= 598f7ec340bSmacallan 599f7ec340bSmacallanif test -z "$show_help"; then 600f7ec340bSmacallan 601f7ec340bSmacallan # Infer the operation mode. 602f7ec340bSmacallan if test -z "$mode"; then 603f7ec340bSmacallan $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 604f7ec340bSmacallan $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 605f7ec340bSmacallan case $nonopt in 606f7ec340bSmacallan *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 607f7ec340bSmacallan mode=link 608f7ec340bSmacallan for arg 609f7ec340bSmacallan do 610f7ec340bSmacallan case $arg in 611f7ec340bSmacallan -c) 612f7ec340bSmacallan mode=compile 613f7ec340bSmacallan break 614f7ec340bSmacallan ;; 615f7ec340bSmacallan esac 616f7ec340bSmacallan done 617f7ec340bSmacallan ;; 618f7ec340bSmacallan *db | *dbx | *strace | *truss) 619f7ec340bSmacallan mode=execute 620f7ec340bSmacallan ;; 621f7ec340bSmacallan *install*|cp|mv) 622f7ec340bSmacallan mode=install 623f7ec340bSmacallan ;; 624f7ec340bSmacallan *rm) 625f7ec340bSmacallan mode=uninstall 626f7ec340bSmacallan ;; 627f7ec340bSmacallan *) 628f7ec340bSmacallan # If we have no mode, but dlfiles were specified, then do execute mode. 629f7ec340bSmacallan test -n "$execute_dlfiles" && mode=execute 630f7ec340bSmacallan 631f7ec340bSmacallan # Just use the default operation mode. 632f7ec340bSmacallan if test -z "$mode"; then 633f7ec340bSmacallan if test -n "$nonopt"; then 634f7ec340bSmacallan $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 635f7ec340bSmacallan else 636f7ec340bSmacallan $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 637f7ec340bSmacallan fi 638f7ec340bSmacallan fi 639f7ec340bSmacallan ;; 640f7ec340bSmacallan esac 641f7ec340bSmacallan fi 642f7ec340bSmacallan 643f7ec340bSmacallan # Only execute mode is allowed to have -dlopen flags. 644f7ec340bSmacallan if test -n "$execute_dlfiles" && test "$mode" != execute; then 645f7ec340bSmacallan $echo "$modename: unrecognized option \`-dlopen'" 1>&2 646f7ec340bSmacallan $echo "$help" 1>&2 647f7ec340bSmacallan exit $EXIT_FAILURE 648f7ec340bSmacallan fi 649f7ec340bSmacallan 650f7ec340bSmacallan # Change the help message to a mode-specific one. 651f7ec340bSmacallan generic_help="$help" 652f7ec340bSmacallan help="Try \`$modename --help --mode=$mode' for more information." 653f7ec340bSmacallan 654f7ec340bSmacallan # These modes are in order of execution frequency so that they run quickly. 655f7ec340bSmacallan case $mode in 656f7ec340bSmacallan # libtool compile mode 657f7ec340bSmacallan compile) 658f7ec340bSmacallan modename="$modename: compile" 659f7ec340bSmacallan # Get the compilation command and the source file. 660f7ec340bSmacallan base_compile= 661f7ec340bSmacallan srcfile="$nonopt" # always keep a non-empty value in "srcfile" 662f7ec340bSmacallan suppress_opt=yes 663f7ec340bSmacallan suppress_output= 664f7ec340bSmacallan arg_mode=normal 665f7ec340bSmacallan libobj= 666f7ec340bSmacallan later= 667f7ec340bSmacallan 668f7ec340bSmacallan for arg 669f7ec340bSmacallan do 670f7ec340bSmacallan case $arg_mode in 671f7ec340bSmacallan arg ) 672f7ec340bSmacallan # do not "continue". Instead, add this to base_compile 673f7ec340bSmacallan lastarg="$arg" 674f7ec340bSmacallan arg_mode=normal 675f7ec340bSmacallan ;; 676f7ec340bSmacallan 677f7ec340bSmacallan target ) 678f7ec340bSmacallan libobj="$arg" 679f7ec340bSmacallan arg_mode=normal 680f7ec340bSmacallan continue 681f7ec340bSmacallan ;; 682f7ec340bSmacallan 683f7ec340bSmacallan normal ) 684f7ec340bSmacallan # Accept any command-line options. 685f7ec340bSmacallan case $arg in 686f7ec340bSmacallan -o) 687f7ec340bSmacallan if test -n "$libobj" ; then 688f7ec340bSmacallan $echo "$modename: you cannot specify \`-o' more than once" 1>&2 689f7ec340bSmacallan exit $EXIT_FAILURE 690f7ec340bSmacallan fi 691f7ec340bSmacallan arg_mode=target 692f7ec340bSmacallan continue 693f7ec340bSmacallan ;; 694f7ec340bSmacallan 695f7ec340bSmacallan -static | -prefer-pic | -prefer-non-pic) 696f7ec340bSmacallan later="$later $arg" 697f7ec340bSmacallan continue 698f7ec340bSmacallan ;; 699f7ec340bSmacallan 700f7ec340bSmacallan -no-suppress) 701f7ec340bSmacallan suppress_opt=no 702f7ec340bSmacallan continue 703f7ec340bSmacallan ;; 704f7ec340bSmacallan 705f7ec340bSmacallan -Xcompiler) 706f7ec340bSmacallan arg_mode=arg # the next one goes into the "base_compile" arg list 707f7ec340bSmacallan continue # The current "srcfile" will either be retained or 708f7ec340bSmacallan ;; # replaced later. I would guess that would be a bug. 709f7ec340bSmacallan 710f7ec340bSmacallan -Wc,*) 711f7ec340bSmacallan args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 712f7ec340bSmacallan lastarg= 713f7ec340bSmacallan save_ifs="$IFS"; IFS=',' 714f7ec340bSmacallan for arg in $args; do 715f7ec340bSmacallan IFS="$save_ifs" 716f7ec340bSmacallan 717f7ec340bSmacallan # Double-quote args containing other shell metacharacters. 718f7ec340bSmacallan # Many Bourne shells cannot handle close brackets correctly 719f7ec340bSmacallan # in scan sets, so we specify it separately. 720f7ec340bSmacallan case $arg in 721f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 722f7ec340bSmacallan arg="\"$arg\"" 723f7ec340bSmacallan ;; 724f7ec340bSmacallan esac 725f7ec340bSmacallan lastarg="$lastarg $arg" 726f7ec340bSmacallan done 727f7ec340bSmacallan IFS="$save_ifs" 728f7ec340bSmacallan lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 729f7ec340bSmacallan 730f7ec340bSmacallan # Add the arguments to base_compile. 731f7ec340bSmacallan base_compile="$base_compile $lastarg" 732f7ec340bSmacallan continue 733f7ec340bSmacallan ;; 734f7ec340bSmacallan 735f7ec340bSmacallan * ) 736f7ec340bSmacallan # Accept the current argument as the source file. 737f7ec340bSmacallan # The previous "srcfile" becomes the current argument. 738f7ec340bSmacallan # 739f7ec340bSmacallan lastarg="$srcfile" 740f7ec340bSmacallan srcfile="$arg" 741f7ec340bSmacallan ;; 742f7ec340bSmacallan esac # case $arg 743f7ec340bSmacallan ;; 744f7ec340bSmacallan esac # case $arg_mode 745f7ec340bSmacallan 746f7ec340bSmacallan # Aesthetically quote the previous argument. 747f7ec340bSmacallan lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 748f7ec340bSmacallan 749f7ec340bSmacallan case $lastarg in 750f7ec340bSmacallan # Double-quote args containing other shell metacharacters. 751f7ec340bSmacallan # Many Bourne shells cannot handle close brackets correctly 752f7ec340bSmacallan # in scan sets, and some SunOS ksh mistreat backslash-escaping 753f7ec340bSmacallan # in scan sets (worked around with variable expansion), 754f7ec340bSmacallan # and furthermore cannot handle '|' '&' '(' ')' in scan sets 755f7ec340bSmacallan # at all, so we specify them separately. 756f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 757f7ec340bSmacallan lastarg="\"$lastarg\"" 758f7ec340bSmacallan ;; 759f7ec340bSmacallan esac 760f7ec340bSmacallan 761f7ec340bSmacallan base_compile="$base_compile $lastarg" 762f7ec340bSmacallan done # for arg 763f7ec340bSmacallan 764f7ec340bSmacallan case $arg_mode in 765f7ec340bSmacallan arg) 766f7ec340bSmacallan $echo "$modename: you must specify an argument for -Xcompile" 767f7ec340bSmacallan exit $EXIT_FAILURE 768f7ec340bSmacallan ;; 769f7ec340bSmacallan target) 770f7ec340bSmacallan $echo "$modename: you must specify a target with \`-o'" 1>&2 771f7ec340bSmacallan exit $EXIT_FAILURE 772f7ec340bSmacallan ;; 773f7ec340bSmacallan *) 774f7ec340bSmacallan # Get the name of the library object. 775f7ec340bSmacallan [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 776f7ec340bSmacallan ;; 777f7ec340bSmacallan esac 778f7ec340bSmacallan 779f7ec340bSmacallan # Recognize several different file suffixes. 780f7ec340bSmacallan # If the user specifies -o file.o, it is replaced with file.lo 781f7ec340bSmacallan xform='[cCFSifmso]' 782f7ec340bSmacallan case $libobj in 783f7ec340bSmacallan *.ada) xform=ada ;; 784f7ec340bSmacallan *.adb) xform=adb ;; 785f7ec340bSmacallan *.ads) xform=ads ;; 786f7ec340bSmacallan *.asm) xform=asm ;; 787f7ec340bSmacallan *.c++) xform=c++ ;; 788f7ec340bSmacallan *.cc) xform=cc ;; 789f7ec340bSmacallan *.ii) xform=ii ;; 790f7ec340bSmacallan *.class) xform=class ;; 791f7ec340bSmacallan *.cpp) xform=cpp ;; 792f7ec340bSmacallan *.cxx) xform=cxx ;; 7937ce7e03cSmrg *.[fF][09]?) xform=[fF][09]. ;; 794f7ec340bSmacallan *.for) xform=for ;; 795f7ec340bSmacallan *.java) xform=java ;; 7967ce7e03cSmrg *.obj) xform=obj ;; 7977ce7e03cSmrg *.sx) xform=sx ;; 798f7ec340bSmacallan esac 799f7ec340bSmacallan 800f7ec340bSmacallan libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 801f7ec340bSmacallan 802f7ec340bSmacallan case $libobj in 803f7ec340bSmacallan *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 804f7ec340bSmacallan *) 805f7ec340bSmacallan $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 806f7ec340bSmacallan exit $EXIT_FAILURE 807f7ec340bSmacallan ;; 808f7ec340bSmacallan esac 809f7ec340bSmacallan 810f7ec340bSmacallan func_infer_tag $base_compile 811f7ec340bSmacallan 812f7ec340bSmacallan for arg in $later; do 813f7ec340bSmacallan case $arg in 814f7ec340bSmacallan -static) 815f7ec340bSmacallan build_old_libs=yes 816f7ec340bSmacallan continue 817f7ec340bSmacallan ;; 818f7ec340bSmacallan 819f7ec340bSmacallan -prefer-pic) 820f7ec340bSmacallan pic_mode=yes 821f7ec340bSmacallan continue 822f7ec340bSmacallan ;; 823f7ec340bSmacallan 824f7ec340bSmacallan -prefer-non-pic) 825f7ec340bSmacallan pic_mode=no 826f7ec340bSmacallan continue 827f7ec340bSmacallan ;; 828f7ec340bSmacallan esac 829f7ec340bSmacallan done 830f7ec340bSmacallan 831f7ec340bSmacallan qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 832f7ec340bSmacallan case $qlibobj in 833f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 834f7ec340bSmacallan qlibobj="\"$qlibobj\"" ;; 835f7ec340bSmacallan esac 836f7ec340bSmacallan test "X$libobj" != "X$qlibobj" \ 837f7ec340bSmacallan && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 838f7ec340bSmacallan && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 839f7ec340bSmacallan objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 840f7ec340bSmacallan xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 841f7ec340bSmacallan if test "X$xdir" = "X$obj"; then 842f7ec340bSmacallan xdir= 843f7ec340bSmacallan else 844f7ec340bSmacallan xdir=$xdir/ 845f7ec340bSmacallan fi 846f7ec340bSmacallan lobj=${xdir}$objdir/$objname 847f7ec340bSmacallan 848f7ec340bSmacallan if test -z "$base_compile"; then 849f7ec340bSmacallan $echo "$modename: you must specify a compilation command" 1>&2 850f7ec340bSmacallan $echo "$help" 1>&2 851f7ec340bSmacallan exit $EXIT_FAILURE 852f7ec340bSmacallan fi 853f7ec340bSmacallan 854f7ec340bSmacallan # Delete any leftover library objects. 855f7ec340bSmacallan if test "$build_old_libs" = yes; then 856f7ec340bSmacallan removelist="$obj $lobj $libobj ${libobj}T" 857f7ec340bSmacallan else 858f7ec340bSmacallan removelist="$lobj $libobj ${libobj}T" 859f7ec340bSmacallan fi 860f7ec340bSmacallan 861f7ec340bSmacallan $run $rm $removelist 862f7ec340bSmacallan trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 863f7ec340bSmacallan 864f7ec340bSmacallan # On Cygwin there's no "real" PIC flag so we must build both object types 865f7ec340bSmacallan case $host_os in 866f7ec340bSmacallan cygwin* | mingw* | pw32* | os2*) 867f7ec340bSmacallan pic_mode=default 868f7ec340bSmacallan ;; 869f7ec340bSmacallan esac 870f7ec340bSmacallan if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 871f7ec340bSmacallan # non-PIC code in shared libraries is not supported 872f7ec340bSmacallan pic_mode=default 873f7ec340bSmacallan fi 874f7ec340bSmacallan 875f7ec340bSmacallan # Calculate the filename of the output object if compiler does 876f7ec340bSmacallan # not support -o with -c 877f7ec340bSmacallan if test "$compiler_c_o" = no; then 878f7ec340bSmacallan output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 879f7ec340bSmacallan lockfile="$output_obj.lock" 880f7ec340bSmacallan removelist="$removelist $output_obj $lockfile" 881f7ec340bSmacallan trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 882f7ec340bSmacallan else 883f7ec340bSmacallan output_obj= 884f7ec340bSmacallan need_locks=no 885f7ec340bSmacallan lockfile= 886f7ec340bSmacallan fi 887f7ec340bSmacallan 888f7ec340bSmacallan # Lock this critical section if it is needed 889f7ec340bSmacallan # We use this script file to make the link, it avoids creating a new file 890f7ec340bSmacallan if test "$need_locks" = yes; then 891f7ec340bSmacallan until $run ln "$progpath" "$lockfile" 2>/dev/null; do 892f7ec340bSmacallan $show "Waiting for $lockfile to be removed" 893f7ec340bSmacallan sleep 2 894f7ec340bSmacallan done 895f7ec340bSmacallan elif test "$need_locks" = warn; then 896f7ec340bSmacallan if test -f "$lockfile"; then 897f7ec340bSmacallan $echo "\ 898f7ec340bSmacallan*** ERROR, $lockfile exists and contains: 899f7ec340bSmacallan`cat $lockfile 2>/dev/null` 900f7ec340bSmacallan 901f7ec340bSmacallanThis indicates that another process is trying to use the same 902f7ec340bSmacallantemporary object file, and libtool could not work around it because 903f7ec340bSmacallanyour compiler does not support \`-c' and \`-o' together. If you 904f7ec340bSmacallanrepeat this compilation, it may succeed, by chance, but you had better 905f7ec340bSmacallanavoid parallel builds (make -j) in this platform, or get a better 906f7ec340bSmacallancompiler." 907f7ec340bSmacallan 908f7ec340bSmacallan $run $rm $removelist 909f7ec340bSmacallan exit $EXIT_FAILURE 910f7ec340bSmacallan fi 911f7ec340bSmacallan $echo "$srcfile" > "$lockfile" 912f7ec340bSmacallan fi 913f7ec340bSmacallan 914f7ec340bSmacallan if test -n "$fix_srcfile_path"; then 915f7ec340bSmacallan eval srcfile=\"$fix_srcfile_path\" 916f7ec340bSmacallan fi 917f7ec340bSmacallan qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 918f7ec340bSmacallan case $qsrcfile in 919f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 920f7ec340bSmacallan qsrcfile="\"$qsrcfile\"" ;; 921f7ec340bSmacallan esac 922f7ec340bSmacallan 923f7ec340bSmacallan $run $rm "$libobj" "${libobj}T" 924f7ec340bSmacallan 925f7ec340bSmacallan # Create a libtool object file (analogous to a ".la" file), 926f7ec340bSmacallan # but don't create it if we're doing a dry run. 927f7ec340bSmacallan test -z "$run" && cat > ${libobj}T <<EOF 928f7ec340bSmacallan# $libobj - a libtool object file 929f7ec340bSmacallan# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 930f7ec340bSmacallan# 931f7ec340bSmacallan# Please DO NOT delete this file! 932f7ec340bSmacallan# It is necessary for linking the library. 933f7ec340bSmacallan 934f7ec340bSmacallan# Name of the PIC object. 935f7ec340bSmacallanEOF 936f7ec340bSmacallan 937f7ec340bSmacallan # Only build a PIC object if we are building libtool libraries. 938f7ec340bSmacallan if test "$build_libtool_libs" = yes; then 939f7ec340bSmacallan # Without this assignment, base_compile gets emptied. 940f7ec340bSmacallan fbsd_hideous_sh_bug=$base_compile 941f7ec340bSmacallan 942f7ec340bSmacallan if test "$pic_mode" != no; then 943f7ec340bSmacallan command="$base_compile $qsrcfile $pic_flag" 944f7ec340bSmacallan else 945f7ec340bSmacallan # Don't build PIC code 946f7ec340bSmacallan command="$base_compile $qsrcfile" 947f7ec340bSmacallan fi 948f7ec340bSmacallan 949f7ec340bSmacallan if test ! -d "${xdir}$objdir"; then 950f7ec340bSmacallan $show "$mkdir ${xdir}$objdir" 951f7ec340bSmacallan $run $mkdir ${xdir}$objdir 952f7ec340bSmacallan exit_status=$? 953f7ec340bSmacallan if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 954f7ec340bSmacallan exit $exit_status 955f7ec340bSmacallan fi 956f7ec340bSmacallan fi 957f7ec340bSmacallan 958f7ec340bSmacallan if test -z "$output_obj"; then 959f7ec340bSmacallan # Place PIC objects in $objdir 960f7ec340bSmacallan command="$command -o $lobj" 961f7ec340bSmacallan fi 962f7ec340bSmacallan 963f7ec340bSmacallan $run $rm "$lobj" "$output_obj" 964f7ec340bSmacallan 965f7ec340bSmacallan $show "$command" 9667ce7e03cSmrg if $run eval $lt_env "$command"; then : 967f7ec340bSmacallan else 968f7ec340bSmacallan test -n "$output_obj" && $run $rm $removelist 969f7ec340bSmacallan exit $EXIT_FAILURE 970f7ec340bSmacallan fi 971f7ec340bSmacallan 972f7ec340bSmacallan if test "$need_locks" = warn && 973f7ec340bSmacallan test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 974f7ec340bSmacallan $echo "\ 975f7ec340bSmacallan*** ERROR, $lockfile contains: 976f7ec340bSmacallan`cat $lockfile 2>/dev/null` 977f7ec340bSmacallan 978f7ec340bSmacallanbut it should contain: 979f7ec340bSmacallan$srcfile 980f7ec340bSmacallan 981f7ec340bSmacallanThis indicates that another process is trying to use the same 982f7ec340bSmacallantemporary object file, and libtool could not work around it because 983f7ec340bSmacallanyour compiler does not support \`-c' and \`-o' together. If you 984f7ec340bSmacallanrepeat this compilation, it may succeed, by chance, but you had better 985f7ec340bSmacallanavoid parallel builds (make -j) in this platform, or get a better 986f7ec340bSmacallancompiler." 987f7ec340bSmacallan 988f7ec340bSmacallan $run $rm $removelist 989f7ec340bSmacallan exit $EXIT_FAILURE 990f7ec340bSmacallan fi 991f7ec340bSmacallan 992f7ec340bSmacallan # Just move the object if needed, then go on to compile the next one 993f7ec340bSmacallan if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 994f7ec340bSmacallan $show "$mv $output_obj $lobj" 995f7ec340bSmacallan if $run $mv $output_obj $lobj; then : 996f7ec340bSmacallan else 997f7ec340bSmacallan error=$? 998f7ec340bSmacallan $run $rm $removelist 999f7ec340bSmacallan exit $error 1000f7ec340bSmacallan fi 1001f7ec340bSmacallan fi 1002f7ec340bSmacallan 1003f7ec340bSmacallan # Append the name of the PIC object to the libtool object file. 1004f7ec340bSmacallan test -z "$run" && cat >> ${libobj}T <<EOF 1005f7ec340bSmacallanpic_object='$objdir/$objname' 1006f7ec340bSmacallan 1007f7ec340bSmacallanEOF 1008f7ec340bSmacallan 1009f7ec340bSmacallan # Allow error messages only from the first compilation. 1010f7ec340bSmacallan if test "$suppress_opt" = yes; then 1011f7ec340bSmacallan suppress_output=' >/dev/null 2>&1' 1012f7ec340bSmacallan fi 1013f7ec340bSmacallan else 1014f7ec340bSmacallan # No PIC object so indicate it doesn't exist in the libtool 1015f7ec340bSmacallan # object file. 1016f7ec340bSmacallan test -z "$run" && cat >> ${libobj}T <<EOF 1017f7ec340bSmacallanpic_object=none 1018f7ec340bSmacallan 1019f7ec340bSmacallanEOF 1020f7ec340bSmacallan fi 1021f7ec340bSmacallan 1022f7ec340bSmacallan # Only build a position-dependent object if we build old libraries. 1023f7ec340bSmacallan if test "$build_old_libs" = yes; then 1024f7ec340bSmacallan if test "$pic_mode" != yes; then 1025f7ec340bSmacallan # Don't build PIC code 1026f7ec340bSmacallan command="$base_compile $qsrcfile" 1027f7ec340bSmacallan else 1028f7ec340bSmacallan command="$base_compile $qsrcfile $pic_flag" 1029f7ec340bSmacallan fi 1030f7ec340bSmacallan if test "$compiler_c_o" = yes; then 1031f7ec340bSmacallan command="$command -o $obj" 1032f7ec340bSmacallan fi 1033f7ec340bSmacallan 1034f7ec340bSmacallan # Suppress compiler output if we already did a PIC compilation. 1035f7ec340bSmacallan command="$command$suppress_output" 1036f7ec340bSmacallan $run $rm "$obj" "$output_obj" 1037f7ec340bSmacallan $show "$command" 10387ce7e03cSmrg if $run eval $lt_env "$command"; then : 1039f7ec340bSmacallan else 1040f7ec340bSmacallan $run $rm $removelist 1041f7ec340bSmacallan exit $EXIT_FAILURE 1042f7ec340bSmacallan fi 1043f7ec340bSmacallan 1044f7ec340bSmacallan if test "$need_locks" = warn && 1045f7ec340bSmacallan test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1046f7ec340bSmacallan $echo "\ 1047f7ec340bSmacallan*** ERROR, $lockfile contains: 1048f7ec340bSmacallan`cat $lockfile 2>/dev/null` 1049f7ec340bSmacallan 1050f7ec340bSmacallanbut it should contain: 1051f7ec340bSmacallan$srcfile 1052f7ec340bSmacallan 1053f7ec340bSmacallanThis indicates that another process is trying to use the same 1054f7ec340bSmacallantemporary object file, and libtool could not work around it because 1055f7ec340bSmacallanyour compiler does not support \`-c' and \`-o' together. If you 1056f7ec340bSmacallanrepeat this compilation, it may succeed, by chance, but you had better 1057f7ec340bSmacallanavoid parallel builds (make -j) in this platform, or get a better 1058f7ec340bSmacallancompiler." 1059f7ec340bSmacallan 1060f7ec340bSmacallan $run $rm $removelist 1061f7ec340bSmacallan exit $EXIT_FAILURE 1062f7ec340bSmacallan fi 1063f7ec340bSmacallan 1064f7ec340bSmacallan # Just move the object if needed 1065f7ec340bSmacallan if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1066f7ec340bSmacallan $show "$mv $output_obj $obj" 1067f7ec340bSmacallan if $run $mv $output_obj $obj; then : 1068f7ec340bSmacallan else 1069f7ec340bSmacallan error=$? 1070f7ec340bSmacallan $run $rm $removelist 1071f7ec340bSmacallan exit $error 1072f7ec340bSmacallan fi 1073f7ec340bSmacallan fi 1074f7ec340bSmacallan 1075f7ec340bSmacallan # Append the name of the non-PIC object the libtool object file. 1076f7ec340bSmacallan # Only append if the libtool object file exists. 1077f7ec340bSmacallan test -z "$run" && cat >> ${libobj}T <<EOF 1078f7ec340bSmacallan# Name of the non-PIC object. 1079f7ec340bSmacallannon_pic_object='$objname' 1080f7ec340bSmacallan 1081f7ec340bSmacallanEOF 1082f7ec340bSmacallan else 1083f7ec340bSmacallan # Append the name of the non-PIC object the libtool object file. 1084f7ec340bSmacallan # Only append if the libtool object file exists. 1085f7ec340bSmacallan test -z "$run" && cat >> ${libobj}T <<EOF 1086f7ec340bSmacallan# Name of the non-PIC object. 1087f7ec340bSmacallannon_pic_object=none 1088f7ec340bSmacallan 1089f7ec340bSmacallanEOF 1090f7ec340bSmacallan fi 1091f7ec340bSmacallan 1092f7ec340bSmacallan $run $mv "${libobj}T" "${libobj}" 1093f7ec340bSmacallan 1094f7ec340bSmacallan # Unlock the critical section if it was locked 1095f7ec340bSmacallan if test "$need_locks" != no; then 1096f7ec340bSmacallan $run $rm "$lockfile" 1097f7ec340bSmacallan fi 1098f7ec340bSmacallan 1099f7ec340bSmacallan exit $EXIT_SUCCESS 1100f7ec340bSmacallan ;; 1101f7ec340bSmacallan 1102f7ec340bSmacallan # libtool link mode 1103f7ec340bSmacallan link | relink) 1104f7ec340bSmacallan modename="$modename: link" 1105f7ec340bSmacallan case $host in 1106f7ec340bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1107f7ec340bSmacallan # It is impossible to link a dll without this setting, and 1108f7ec340bSmacallan # we shouldn't force the makefile maintainer to figure out 1109f7ec340bSmacallan # which system we are compiling for in order to pass an extra 1110f7ec340bSmacallan # flag for every libtool invocation. 1111f7ec340bSmacallan # allow_undefined=no 1112f7ec340bSmacallan 1113f7ec340bSmacallan # FIXME: Unfortunately, there are problems with the above when trying 1114f7ec340bSmacallan # to make a dll which has undefined symbols, in which case not 1115f7ec340bSmacallan # even a static library is built. For now, we need to specify 1116f7ec340bSmacallan # -no-undefined on the libtool link line when we can be certain 1117f7ec340bSmacallan # that all symbols are satisfied, otherwise we get a static library. 1118f7ec340bSmacallan allow_undefined=yes 1119f7ec340bSmacallan ;; 1120f7ec340bSmacallan *) 1121f7ec340bSmacallan allow_undefined=yes 1122f7ec340bSmacallan ;; 1123f7ec340bSmacallan esac 1124f7ec340bSmacallan libtool_args="$nonopt" 1125f7ec340bSmacallan base_compile="$nonopt $@" 1126f7ec340bSmacallan compile_command="$nonopt" 1127f7ec340bSmacallan finalize_command="$nonopt" 1128f7ec340bSmacallan 1129f7ec340bSmacallan compile_rpath= 1130f7ec340bSmacallan finalize_rpath= 1131f7ec340bSmacallan compile_shlibpath= 1132f7ec340bSmacallan finalize_shlibpath= 1133f7ec340bSmacallan convenience= 1134f7ec340bSmacallan old_convenience= 1135f7ec340bSmacallan deplibs= 1136f7ec340bSmacallan old_deplibs= 1137f7ec340bSmacallan compiler_flags= 1138f7ec340bSmacallan linker_flags= 1139f7ec340bSmacallan dllsearchpath= 1140f7ec340bSmacallan lib_search_path=`pwd` 1141f7ec340bSmacallan inst_prefix_dir= 1142f7ec340bSmacallan 1143f7ec340bSmacallan avoid_version=no 1144f7ec340bSmacallan dlfiles= 1145f7ec340bSmacallan dlprefiles= 1146f7ec340bSmacallan dlself=no 1147f7ec340bSmacallan export_dynamic=no 1148f7ec340bSmacallan export_symbols= 1149f7ec340bSmacallan export_symbols_regex= 1150f7ec340bSmacallan generated= 1151f7ec340bSmacallan libobjs= 1152f7ec340bSmacallan ltlibs= 1153f7ec340bSmacallan module=no 1154f7ec340bSmacallan no_install=no 1155f7ec340bSmacallan objs= 1156f7ec340bSmacallan non_pic_objects= 1157f7ec340bSmacallan notinst_path= # paths that contain not-installed libtool libraries 1158f7ec340bSmacallan precious_files_regex= 1159f7ec340bSmacallan prefer_static_libs=no 1160f7ec340bSmacallan preload=no 1161f7ec340bSmacallan prev= 1162f7ec340bSmacallan prevarg= 1163f7ec340bSmacallan release= 1164f7ec340bSmacallan rpath= 1165f7ec340bSmacallan xrpath= 1166f7ec340bSmacallan perm_rpath= 1167f7ec340bSmacallan temp_rpath= 1168f7ec340bSmacallan thread_safe=no 1169f7ec340bSmacallan vinfo= 1170f7ec340bSmacallan vinfo_number=no 11717ce7e03cSmrg single_module="${wl}-single_module" 1172f7ec340bSmacallan 1173f7ec340bSmacallan func_infer_tag $base_compile 1174f7ec340bSmacallan 1175f7ec340bSmacallan # We need to know -static, to get the right output filenames. 1176f7ec340bSmacallan for arg 1177f7ec340bSmacallan do 1178f7ec340bSmacallan case $arg in 11797ce7e03cSmrg -all-static | -static | -static-libtool-libs) 11807ce7e03cSmrg case $arg in 11817ce7e03cSmrg -all-static) 1182f7ec340bSmacallan if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 1183f7ec340bSmacallan $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1184f7ec340bSmacallan fi 1185f7ec340bSmacallan if test -n "$link_static_flag"; then 1186f7ec340bSmacallan dlopen_self=$dlopen_self_static 1187f7ec340bSmacallan fi 1188f7ec340bSmacallan prefer_static_libs=yes 11897ce7e03cSmrg ;; 11907ce7e03cSmrg -static) 1191f7ec340bSmacallan if test -z "$pic_flag" && test -n "$link_static_flag"; then 1192f7ec340bSmacallan dlopen_self=$dlopen_self_static 1193f7ec340bSmacallan fi 1194f7ec340bSmacallan prefer_static_libs=built 11957ce7e03cSmrg ;; 11967ce7e03cSmrg -static-libtool-libs) 11977ce7e03cSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 11987ce7e03cSmrg dlopen_self=$dlopen_self_static 11997ce7e03cSmrg fi 12007ce7e03cSmrg prefer_static_libs=yes 12017ce7e03cSmrg ;; 12027ce7e03cSmrg esac 1203f7ec340bSmacallan build_libtool_libs=no 1204f7ec340bSmacallan build_old_libs=yes 1205f7ec340bSmacallan break 1206f7ec340bSmacallan ;; 1207f7ec340bSmacallan esac 1208f7ec340bSmacallan done 1209f7ec340bSmacallan 1210f7ec340bSmacallan # See if our shared archives depend on static archives. 1211f7ec340bSmacallan test -n "$old_archive_from_new_cmds" && build_old_libs=yes 1212f7ec340bSmacallan 1213f7ec340bSmacallan # Go through the arguments, transforming them on the way. 1214f7ec340bSmacallan while test "$#" -gt 0; do 1215f7ec340bSmacallan arg="$1" 1216f7ec340bSmacallan shift 1217f7ec340bSmacallan case $arg in 1218f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1219f7ec340bSmacallan qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 1220f7ec340bSmacallan ;; 1221f7ec340bSmacallan *) qarg=$arg ;; 1222f7ec340bSmacallan esac 1223f7ec340bSmacallan libtool_args="$libtool_args $qarg" 1224f7ec340bSmacallan 1225f7ec340bSmacallan # If the previous option needs an argument, assign it. 1226f7ec340bSmacallan if test -n "$prev"; then 1227f7ec340bSmacallan case $prev in 1228f7ec340bSmacallan output) 1229f7ec340bSmacallan compile_command="$compile_command @OUTPUT@" 1230f7ec340bSmacallan finalize_command="$finalize_command @OUTPUT@" 1231f7ec340bSmacallan ;; 1232f7ec340bSmacallan esac 1233f7ec340bSmacallan 1234f7ec340bSmacallan case $prev in 1235f7ec340bSmacallan dlfiles|dlprefiles) 1236f7ec340bSmacallan if test "$preload" = no; then 1237f7ec340bSmacallan # Add the symbol object into the linking commands. 1238f7ec340bSmacallan compile_command="$compile_command @SYMFILE@" 1239f7ec340bSmacallan finalize_command="$finalize_command @SYMFILE@" 1240f7ec340bSmacallan preload=yes 1241f7ec340bSmacallan fi 1242f7ec340bSmacallan case $arg in 1243f7ec340bSmacallan *.la | *.lo) ;; # We handle these cases below. 1244f7ec340bSmacallan force) 1245f7ec340bSmacallan if test "$dlself" = no; then 1246f7ec340bSmacallan dlself=needless 1247f7ec340bSmacallan export_dynamic=yes 1248f7ec340bSmacallan fi 1249f7ec340bSmacallan prev= 1250f7ec340bSmacallan continue 1251f7ec340bSmacallan ;; 1252f7ec340bSmacallan self) 1253f7ec340bSmacallan if test "$prev" = dlprefiles; then 1254f7ec340bSmacallan dlself=yes 1255f7ec340bSmacallan elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 1256f7ec340bSmacallan dlself=yes 1257f7ec340bSmacallan else 1258f7ec340bSmacallan dlself=needless 1259f7ec340bSmacallan export_dynamic=yes 1260f7ec340bSmacallan fi 1261f7ec340bSmacallan prev= 1262f7ec340bSmacallan continue 1263f7ec340bSmacallan ;; 1264f7ec340bSmacallan *) 1265f7ec340bSmacallan if test "$prev" = dlfiles; then 1266f7ec340bSmacallan dlfiles="$dlfiles $arg" 1267f7ec340bSmacallan else 1268f7ec340bSmacallan dlprefiles="$dlprefiles $arg" 1269f7ec340bSmacallan fi 1270f7ec340bSmacallan prev= 1271f7ec340bSmacallan continue 1272f7ec340bSmacallan ;; 1273f7ec340bSmacallan esac 1274f7ec340bSmacallan ;; 1275f7ec340bSmacallan expsyms) 1276f7ec340bSmacallan export_symbols="$arg" 1277f7ec340bSmacallan if test ! -f "$arg"; then 1278f7ec340bSmacallan $echo "$modename: symbol file \`$arg' does not exist" 1279f7ec340bSmacallan exit $EXIT_FAILURE 1280f7ec340bSmacallan fi 1281f7ec340bSmacallan prev= 1282f7ec340bSmacallan continue 1283f7ec340bSmacallan ;; 1284f7ec340bSmacallan expsyms_regex) 1285f7ec340bSmacallan export_symbols_regex="$arg" 1286f7ec340bSmacallan prev= 1287f7ec340bSmacallan continue 1288f7ec340bSmacallan ;; 1289f7ec340bSmacallan inst_prefix) 1290f7ec340bSmacallan inst_prefix_dir="$arg" 1291f7ec340bSmacallan prev= 1292f7ec340bSmacallan continue 1293f7ec340bSmacallan ;; 1294f7ec340bSmacallan precious_regex) 1295f7ec340bSmacallan precious_files_regex="$arg" 1296f7ec340bSmacallan prev= 1297f7ec340bSmacallan continue 1298f7ec340bSmacallan ;; 1299f7ec340bSmacallan release) 1300f7ec340bSmacallan release="-$arg" 1301f7ec340bSmacallan prev= 1302f7ec340bSmacallan continue 1303f7ec340bSmacallan ;; 1304f7ec340bSmacallan objectlist) 1305f7ec340bSmacallan if test -f "$arg"; then 1306f7ec340bSmacallan save_arg=$arg 1307f7ec340bSmacallan moreargs= 1308f7ec340bSmacallan for fil in `cat $save_arg` 1309f7ec340bSmacallan do 1310f7ec340bSmacallan# moreargs="$moreargs $fil" 1311f7ec340bSmacallan arg=$fil 1312f7ec340bSmacallan # A libtool-controlled object. 1313f7ec340bSmacallan 1314f7ec340bSmacallan # Check to see that this really is a libtool object. 1315f7ec340bSmacallan if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1316f7ec340bSmacallan pic_object= 1317f7ec340bSmacallan non_pic_object= 1318f7ec340bSmacallan 1319f7ec340bSmacallan # Read the .lo file 1320f7ec340bSmacallan # If there is no directory component, then add one. 1321f7ec340bSmacallan case $arg in 1322f7ec340bSmacallan */* | *\\*) . $arg ;; 1323f7ec340bSmacallan *) . ./$arg ;; 1324f7ec340bSmacallan esac 1325f7ec340bSmacallan 1326f7ec340bSmacallan if test -z "$pic_object" || \ 1327f7ec340bSmacallan test -z "$non_pic_object" || 1328f7ec340bSmacallan test "$pic_object" = none && \ 1329f7ec340bSmacallan test "$non_pic_object" = none; then 1330f7ec340bSmacallan $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1331f7ec340bSmacallan exit $EXIT_FAILURE 1332f7ec340bSmacallan fi 1333f7ec340bSmacallan 1334f7ec340bSmacallan # Extract subdirectory from the argument. 1335f7ec340bSmacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1336f7ec340bSmacallan if test "X$xdir" = "X$arg"; then 1337f7ec340bSmacallan xdir= 1338f7ec340bSmacallan else 1339f7ec340bSmacallan xdir="$xdir/" 1340f7ec340bSmacallan fi 1341f7ec340bSmacallan 1342f7ec340bSmacallan if test "$pic_object" != none; then 1343f7ec340bSmacallan # Prepend the subdirectory the object is found in. 1344f7ec340bSmacallan pic_object="$xdir$pic_object" 1345f7ec340bSmacallan 1346f7ec340bSmacallan if test "$prev" = dlfiles; then 1347f7ec340bSmacallan if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1348f7ec340bSmacallan dlfiles="$dlfiles $pic_object" 1349f7ec340bSmacallan prev= 1350f7ec340bSmacallan continue 1351f7ec340bSmacallan else 1352f7ec340bSmacallan # If libtool objects are unsupported, then we need to preload. 1353f7ec340bSmacallan prev=dlprefiles 1354f7ec340bSmacallan fi 1355f7ec340bSmacallan fi 1356f7ec340bSmacallan 1357f7ec340bSmacallan # CHECK ME: I think I busted this. -Ossama 1358f7ec340bSmacallan if test "$prev" = dlprefiles; then 1359f7ec340bSmacallan # Preload the old-style object. 1360f7ec340bSmacallan dlprefiles="$dlprefiles $pic_object" 1361f7ec340bSmacallan prev= 1362f7ec340bSmacallan fi 1363f7ec340bSmacallan 1364f7ec340bSmacallan # A PIC object. 1365f7ec340bSmacallan libobjs="$libobjs $pic_object" 1366f7ec340bSmacallan arg="$pic_object" 1367f7ec340bSmacallan fi 1368f7ec340bSmacallan 1369f7ec340bSmacallan # Non-PIC object. 1370f7ec340bSmacallan if test "$non_pic_object" != none; then 1371f7ec340bSmacallan # Prepend the subdirectory the object is found in. 1372f7ec340bSmacallan non_pic_object="$xdir$non_pic_object" 1373f7ec340bSmacallan 1374f7ec340bSmacallan # A standard non-PIC object 1375f7ec340bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 1376f7ec340bSmacallan if test -z "$pic_object" || test "$pic_object" = none ; then 1377f7ec340bSmacallan arg="$non_pic_object" 1378f7ec340bSmacallan fi 1379f7ec340bSmacallan else 1380f7ec340bSmacallan # If the PIC object exists, use it instead. 1381f7ec340bSmacallan # $xdir was prepended to $pic_object above. 1382f7ec340bSmacallan non_pic_object="$pic_object" 1383f7ec340bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 1384f7ec340bSmacallan fi 1385f7ec340bSmacallan else 1386f7ec340bSmacallan # Only an error if not doing a dry-run. 1387f7ec340bSmacallan if test -z "$run"; then 1388f7ec340bSmacallan $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1389f7ec340bSmacallan exit $EXIT_FAILURE 1390f7ec340bSmacallan else 1391f7ec340bSmacallan # Dry-run case. 1392f7ec340bSmacallan 1393f7ec340bSmacallan # Extract subdirectory from the argument. 1394f7ec340bSmacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1395f7ec340bSmacallan if test "X$xdir" = "X$arg"; then 1396f7ec340bSmacallan xdir= 1397f7ec340bSmacallan else 1398f7ec340bSmacallan xdir="$xdir/" 1399f7ec340bSmacallan fi 1400f7ec340bSmacallan 1401f7ec340bSmacallan pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1402f7ec340bSmacallan non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1403f7ec340bSmacallan libobjs="$libobjs $pic_object" 1404f7ec340bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 1405f7ec340bSmacallan fi 1406f7ec340bSmacallan fi 1407f7ec340bSmacallan done 1408f7ec340bSmacallan else 1409f7ec340bSmacallan $echo "$modename: link input file \`$save_arg' does not exist" 1410f7ec340bSmacallan exit $EXIT_FAILURE 1411f7ec340bSmacallan fi 1412f7ec340bSmacallan arg=$save_arg 1413f7ec340bSmacallan prev= 1414f7ec340bSmacallan continue 1415f7ec340bSmacallan ;; 1416f7ec340bSmacallan rpath | xrpath) 1417f7ec340bSmacallan # We need an absolute path. 1418f7ec340bSmacallan case $arg in 1419f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 1420f7ec340bSmacallan *) 1421f7ec340bSmacallan $echo "$modename: only absolute run-paths are allowed" 1>&2 1422f7ec340bSmacallan exit $EXIT_FAILURE 1423f7ec340bSmacallan ;; 1424f7ec340bSmacallan esac 1425f7ec340bSmacallan if test "$prev" = rpath; then 1426f7ec340bSmacallan case "$rpath " in 1427f7ec340bSmacallan *" $arg "*) ;; 1428f7ec340bSmacallan *) rpath="$rpath $arg" ;; 1429f7ec340bSmacallan esac 1430f7ec340bSmacallan else 1431f7ec340bSmacallan case "$xrpath " in 1432f7ec340bSmacallan *" $arg "*) ;; 1433f7ec340bSmacallan *) xrpath="$xrpath $arg" ;; 1434f7ec340bSmacallan esac 1435f7ec340bSmacallan fi 1436f7ec340bSmacallan prev= 1437f7ec340bSmacallan continue 1438f7ec340bSmacallan ;; 1439f7ec340bSmacallan xcompiler) 1440f7ec340bSmacallan compiler_flags="$compiler_flags $qarg" 1441f7ec340bSmacallan prev= 1442f7ec340bSmacallan compile_command="$compile_command $qarg" 1443f7ec340bSmacallan finalize_command="$finalize_command $qarg" 1444f7ec340bSmacallan continue 1445f7ec340bSmacallan ;; 1446f7ec340bSmacallan xlinker) 1447f7ec340bSmacallan linker_flags="$linker_flags $qarg" 1448f7ec340bSmacallan compiler_flags="$compiler_flags $wl$qarg" 1449f7ec340bSmacallan prev= 1450f7ec340bSmacallan compile_command="$compile_command $wl$qarg" 1451f7ec340bSmacallan finalize_command="$finalize_command $wl$qarg" 1452f7ec340bSmacallan continue 1453f7ec340bSmacallan ;; 1454f7ec340bSmacallan xcclinker) 1455f7ec340bSmacallan linker_flags="$linker_flags $qarg" 1456f7ec340bSmacallan compiler_flags="$compiler_flags $qarg" 1457f7ec340bSmacallan prev= 1458f7ec340bSmacallan compile_command="$compile_command $qarg" 1459f7ec340bSmacallan finalize_command="$finalize_command $qarg" 1460f7ec340bSmacallan continue 1461f7ec340bSmacallan ;; 1462f7ec340bSmacallan shrext) 1463f7ec340bSmacallan shrext_cmds="$arg" 1464f7ec340bSmacallan prev= 1465f7ec340bSmacallan continue 1466f7ec340bSmacallan ;; 1467f7ec340bSmacallan darwin_framework|darwin_framework_skip) 1468f7ec340bSmacallan test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 1469f7ec340bSmacallan compile_command="$compile_command $arg" 1470f7ec340bSmacallan finalize_command="$finalize_command $arg" 1471f7ec340bSmacallan prev= 1472f7ec340bSmacallan continue 1473f7ec340bSmacallan ;; 1474f7ec340bSmacallan *) 1475f7ec340bSmacallan eval "$prev=\"\$arg\"" 1476f7ec340bSmacallan prev= 1477f7ec340bSmacallan continue 1478f7ec340bSmacallan ;; 1479f7ec340bSmacallan esac 1480f7ec340bSmacallan fi # test -n "$prev" 1481f7ec340bSmacallan 1482f7ec340bSmacallan prevarg="$arg" 1483f7ec340bSmacallan 1484f7ec340bSmacallan case $arg in 1485f7ec340bSmacallan -all-static) 1486f7ec340bSmacallan if test -n "$link_static_flag"; then 1487f7ec340bSmacallan compile_command="$compile_command $link_static_flag" 1488f7ec340bSmacallan finalize_command="$finalize_command $link_static_flag" 1489f7ec340bSmacallan fi 1490f7ec340bSmacallan continue 1491f7ec340bSmacallan ;; 1492f7ec340bSmacallan 1493f7ec340bSmacallan -allow-undefined) 1494f7ec340bSmacallan # FIXME: remove this flag sometime in the future. 1495f7ec340bSmacallan $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1496f7ec340bSmacallan continue 1497f7ec340bSmacallan ;; 1498f7ec340bSmacallan 1499f7ec340bSmacallan -avoid-version) 1500f7ec340bSmacallan avoid_version=yes 1501f7ec340bSmacallan continue 1502f7ec340bSmacallan ;; 1503f7ec340bSmacallan 1504f7ec340bSmacallan -dlopen) 1505f7ec340bSmacallan prev=dlfiles 1506f7ec340bSmacallan continue 1507f7ec340bSmacallan ;; 1508f7ec340bSmacallan 1509f7ec340bSmacallan -dlpreopen) 1510f7ec340bSmacallan prev=dlprefiles 1511f7ec340bSmacallan continue 1512f7ec340bSmacallan ;; 1513f7ec340bSmacallan 1514f7ec340bSmacallan -export-dynamic) 1515f7ec340bSmacallan export_dynamic=yes 1516f7ec340bSmacallan continue 1517f7ec340bSmacallan ;; 1518f7ec340bSmacallan 1519f7ec340bSmacallan -export-symbols | -export-symbols-regex) 1520f7ec340bSmacallan if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1521f7ec340bSmacallan $echo "$modename: more than one -exported-symbols argument is not allowed" 1522f7ec340bSmacallan exit $EXIT_FAILURE 1523f7ec340bSmacallan fi 1524f7ec340bSmacallan if test "X$arg" = "X-export-symbols"; then 1525f7ec340bSmacallan prev=expsyms 1526f7ec340bSmacallan else 1527f7ec340bSmacallan prev=expsyms_regex 1528f7ec340bSmacallan fi 1529f7ec340bSmacallan continue 1530f7ec340bSmacallan ;; 1531f7ec340bSmacallan 1532f7ec340bSmacallan -framework|-arch|-isysroot) 1533f7ec340bSmacallan case " $CC " in 1534f7ec340bSmacallan *" ${arg} ${1} "* | *" ${arg} ${1} "*) 1535f7ec340bSmacallan prev=darwin_framework_skip ;; 1536f7ec340bSmacallan *) compiler_flags="$compiler_flags $arg" 1537f7ec340bSmacallan prev=darwin_framework ;; 1538f7ec340bSmacallan esac 1539f7ec340bSmacallan compile_command="$compile_command $arg" 1540f7ec340bSmacallan finalize_command="$finalize_command $arg" 1541f7ec340bSmacallan continue 1542f7ec340bSmacallan ;; 1543f7ec340bSmacallan 1544f7ec340bSmacallan -inst-prefix-dir) 1545f7ec340bSmacallan prev=inst_prefix 1546f7ec340bSmacallan continue 1547f7ec340bSmacallan ;; 1548f7ec340bSmacallan 1549f7ec340bSmacallan # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1550f7ec340bSmacallan # so, if we see these flags be careful not to treat them like -L 1551f7ec340bSmacallan -L[A-Z][A-Z]*:*) 1552f7ec340bSmacallan case $with_gcc/$host in 1553f7ec340bSmacallan no/*-*-irix* | /*-*-irix*) 1554f7ec340bSmacallan compile_command="$compile_command $arg" 1555f7ec340bSmacallan finalize_command="$finalize_command $arg" 1556f7ec340bSmacallan ;; 1557f7ec340bSmacallan esac 1558f7ec340bSmacallan continue 1559f7ec340bSmacallan ;; 1560f7ec340bSmacallan 1561f7ec340bSmacallan -L*) 1562f7ec340bSmacallan dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1563f7ec340bSmacallan # We need an absolute path. 1564f7ec340bSmacallan case $dir in 1565f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 1566f7ec340bSmacallan *) 1567f7ec340bSmacallan absdir=`cd "$dir" && pwd` 1568f7ec340bSmacallan if test -z "$absdir"; then 1569f7ec340bSmacallan $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1570f7ec340bSmacallan absdir="$dir" 1571f7ec340bSmacallan notinst_path="$notinst_path $dir" 1572f7ec340bSmacallan fi 1573f7ec340bSmacallan dir="$absdir" 1574f7ec340bSmacallan ;; 1575f7ec340bSmacallan esac 1576f7ec340bSmacallan case "$deplibs " in 1577f7ec340bSmacallan *" -L$dir "*) ;; 1578f7ec340bSmacallan *) 1579f7ec340bSmacallan deplibs="$deplibs -L$dir" 1580f7ec340bSmacallan lib_search_path="$lib_search_path $dir" 1581f7ec340bSmacallan ;; 1582f7ec340bSmacallan esac 1583f7ec340bSmacallan case $host in 1584f7ec340bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1585f7ec340bSmacallan testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 1586f7ec340bSmacallan case :$dllsearchpath: in 1587f7ec340bSmacallan *":$dir:"*) ;; 1588f7ec340bSmacallan *) dllsearchpath="$dllsearchpath:$dir";; 1589f7ec340bSmacallan esac 1590f7ec340bSmacallan case :$dllsearchpath: in 1591f7ec340bSmacallan *":$testbindir:"*) ;; 1592f7ec340bSmacallan *) dllsearchpath="$dllsearchpath:$testbindir";; 1593f7ec340bSmacallan esac 1594f7ec340bSmacallan ;; 1595f7ec340bSmacallan esac 1596f7ec340bSmacallan continue 1597f7ec340bSmacallan ;; 1598f7ec340bSmacallan 1599f7ec340bSmacallan -l*) 1600f7ec340bSmacallan if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1601f7ec340bSmacallan case $host in 1602f7ec340bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 1603f7ec340bSmacallan # These systems don't actually have a C or math library (as such) 1604f7ec340bSmacallan continue 1605f7ec340bSmacallan ;; 1606f7ec340bSmacallan *-*-os2*) 1607f7ec340bSmacallan # These systems don't actually have a C library (as such) 1608f7ec340bSmacallan test "X$arg" = "X-lc" && continue 1609f7ec340bSmacallan ;; 1610f7ec340bSmacallan *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1611f7ec340bSmacallan # Do not include libc due to us having libc/libc_r. 1612f7ec340bSmacallan test "X$arg" = "X-lc" && continue 1613f7ec340bSmacallan ;; 1614f7ec340bSmacallan *-*-rhapsody* | *-*-darwin1.[012]) 1615f7ec340bSmacallan # Rhapsody C and math libraries are in the System framework 1616f7ec340bSmacallan deplibs="$deplibs -framework System" 1617f7ec340bSmacallan continue 1618f7ec340bSmacallan ;; 1619f7ec340bSmacallan *-*-sco3.2v5* | *-*-sco5v6*) 1620f7ec340bSmacallan # Causes problems with __ctype 1621f7ec340bSmacallan test "X$arg" = "X-lc" && continue 1622f7ec340bSmacallan ;; 1623f7ec340bSmacallan *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 1624f7ec340bSmacallan # Compiler inserts libc in the correct place for threads to work 1625f7ec340bSmacallan test "X$arg" = "X-lc" && continue 1626f7ec340bSmacallan ;; 1627f7ec340bSmacallan esac 1628f7ec340bSmacallan elif test "X$arg" = "X-lc_r"; then 1629f7ec340bSmacallan case $host in 1630f7ec340bSmacallan *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1631f7ec340bSmacallan # Do not include libc_r directly, use -pthread flag. 1632f7ec340bSmacallan continue 1633f7ec340bSmacallan ;; 1634f7ec340bSmacallan esac 1635f7ec340bSmacallan fi 1636f7ec340bSmacallan deplibs="$deplibs $arg" 1637f7ec340bSmacallan continue 1638f7ec340bSmacallan ;; 1639f7ec340bSmacallan 1640f7ec340bSmacallan # Tru64 UNIX uses -model [arg] to determine the layout of C++ 1641f7ec340bSmacallan # classes, name mangling, and exception handling. 1642f7ec340bSmacallan -model) 1643f7ec340bSmacallan compile_command="$compile_command $arg" 1644f7ec340bSmacallan compiler_flags="$compiler_flags $arg" 1645f7ec340bSmacallan finalize_command="$finalize_command $arg" 1646f7ec340bSmacallan prev=xcompiler 1647f7ec340bSmacallan continue 1648f7ec340bSmacallan ;; 1649f7ec340bSmacallan 16507ce7e03cSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 1651f7ec340bSmacallan compiler_flags="$compiler_flags $arg" 1652f7ec340bSmacallan compile_command="$compile_command $arg" 1653f7ec340bSmacallan finalize_command="$finalize_command $arg" 1654f7ec340bSmacallan continue 1655f7ec340bSmacallan ;; 1656f7ec340bSmacallan 16577ce7e03cSmrg -multi_module) 16587ce7e03cSmrg single_module="${wl}-multi_module" 16597ce7e03cSmrg continue 16607ce7e03cSmrg ;; 16617ce7e03cSmrg 1662f7ec340bSmacallan -module) 1663f7ec340bSmacallan module=yes 1664f7ec340bSmacallan continue 1665f7ec340bSmacallan ;; 1666f7ec340bSmacallan 1667f7ec340bSmacallan # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 1668f7ec340bSmacallan # -r[0-9][0-9]* specifies the processor on the SGI compiler 1669f7ec340bSmacallan # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 1670f7ec340bSmacallan # +DA*, +DD* enable 64-bit mode on the HP compiler 1671f7ec340bSmacallan # -q* pass through compiler args for the IBM compiler 1672f7ec340bSmacallan # -m* pass through architecture-specific compiler args for GCC 1673f7ec340bSmacallan # -m*, -t[45]*, -txscale* pass through architecture-specific 1674f7ec340bSmacallan # compiler args for GCC 16757ce7e03cSmrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 16767ce7e03cSmrg # -F/path gives path to uninstalled frameworks, gcc on darwin 1677f7ec340bSmacallan # @file GCC response files 16787ce7e03cSmrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 16797ce7e03cSmrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 1680f7ec340bSmacallan 1681f7ec340bSmacallan # Unknown arguments in both finalize_command and compile_command need 1682f7ec340bSmacallan # to be aesthetically quoted because they are evaled later. 1683f7ec340bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1684f7ec340bSmacallan case $arg in 1685f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1686f7ec340bSmacallan arg="\"$arg\"" 1687f7ec340bSmacallan ;; 1688f7ec340bSmacallan esac 1689f7ec340bSmacallan compile_command="$compile_command $arg" 1690f7ec340bSmacallan finalize_command="$finalize_command $arg" 1691f7ec340bSmacallan compiler_flags="$compiler_flags $arg" 1692f7ec340bSmacallan continue 1693f7ec340bSmacallan ;; 1694f7ec340bSmacallan 1695f7ec340bSmacallan -shrext) 1696f7ec340bSmacallan prev=shrext 1697f7ec340bSmacallan continue 1698f7ec340bSmacallan ;; 1699f7ec340bSmacallan 1700f7ec340bSmacallan -no-fast-install) 1701f7ec340bSmacallan fast_install=no 1702f7ec340bSmacallan continue 1703f7ec340bSmacallan ;; 1704f7ec340bSmacallan 1705f7ec340bSmacallan -no-install) 1706f7ec340bSmacallan case $host in 17077ce7e03cSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 1708f7ec340bSmacallan # The PATH hackery in wrapper scripts is required on Windows 17097ce7e03cSmrg # and Darwin in order for the loader to find any dlls it needs. 1710f7ec340bSmacallan $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1711f7ec340bSmacallan $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1712f7ec340bSmacallan fast_install=no 1713f7ec340bSmacallan ;; 1714f7ec340bSmacallan *) no_install=yes ;; 1715f7ec340bSmacallan esac 1716f7ec340bSmacallan continue 1717f7ec340bSmacallan ;; 1718f7ec340bSmacallan 1719f7ec340bSmacallan -no-undefined) 1720f7ec340bSmacallan allow_undefined=no 1721f7ec340bSmacallan continue 1722f7ec340bSmacallan ;; 1723f7ec340bSmacallan 1724f7ec340bSmacallan -objectlist) 1725f7ec340bSmacallan prev=objectlist 1726f7ec340bSmacallan continue 1727f7ec340bSmacallan ;; 1728f7ec340bSmacallan 1729f7ec340bSmacallan -o) prev=output ;; 1730f7ec340bSmacallan 1731f7ec340bSmacallan -precious-files-regex) 1732f7ec340bSmacallan prev=precious_regex 1733f7ec340bSmacallan continue 1734f7ec340bSmacallan ;; 1735f7ec340bSmacallan 1736f7ec340bSmacallan -release) 1737f7ec340bSmacallan prev=release 1738f7ec340bSmacallan continue 1739f7ec340bSmacallan ;; 1740f7ec340bSmacallan 1741f7ec340bSmacallan -rpath) 1742f7ec340bSmacallan prev=rpath 1743f7ec340bSmacallan continue 1744f7ec340bSmacallan ;; 1745f7ec340bSmacallan 1746f7ec340bSmacallan -R) 1747f7ec340bSmacallan prev=xrpath 1748f7ec340bSmacallan continue 1749f7ec340bSmacallan ;; 1750f7ec340bSmacallan 1751f7ec340bSmacallan -R*) 1752f7ec340bSmacallan dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1753f7ec340bSmacallan # We need an absolute path. 1754f7ec340bSmacallan case $dir in 1755f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 1756f7ec340bSmacallan *) 1757f7ec340bSmacallan $echo "$modename: only absolute run-paths are allowed" 1>&2 1758f7ec340bSmacallan exit $EXIT_FAILURE 1759f7ec340bSmacallan ;; 1760f7ec340bSmacallan esac 1761f7ec340bSmacallan case "$xrpath " in 1762f7ec340bSmacallan *" $dir "*) ;; 1763f7ec340bSmacallan *) xrpath="$xrpath $dir" ;; 1764f7ec340bSmacallan esac 1765f7ec340bSmacallan continue 1766f7ec340bSmacallan ;; 1767f7ec340bSmacallan 17687ce7e03cSmrg -static | -static-libtool-libs) 1769f7ec340bSmacallan # The effects of -static are defined in a previous loop. 1770f7ec340bSmacallan # We used to do the same as -all-static on platforms that 1771f7ec340bSmacallan # didn't have a PIC flag, but the assumption that the effects 1772f7ec340bSmacallan # would be equivalent was wrong. It would break on at least 1773f7ec340bSmacallan # Digital Unix and AIX. 1774f7ec340bSmacallan continue 1775f7ec340bSmacallan ;; 1776f7ec340bSmacallan 1777f7ec340bSmacallan -thread-safe) 1778f7ec340bSmacallan thread_safe=yes 1779f7ec340bSmacallan continue 1780f7ec340bSmacallan ;; 1781f7ec340bSmacallan 1782f7ec340bSmacallan -version-info) 1783f7ec340bSmacallan prev=vinfo 1784f7ec340bSmacallan continue 1785f7ec340bSmacallan ;; 1786f7ec340bSmacallan -version-number) 1787f7ec340bSmacallan prev=vinfo 1788f7ec340bSmacallan vinfo_number=yes 1789f7ec340bSmacallan continue 1790f7ec340bSmacallan ;; 1791f7ec340bSmacallan 1792f7ec340bSmacallan -Wc,*) 1793f7ec340bSmacallan args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1794f7ec340bSmacallan arg= 1795f7ec340bSmacallan save_ifs="$IFS"; IFS=',' 1796f7ec340bSmacallan for flag in $args; do 1797f7ec340bSmacallan IFS="$save_ifs" 1798f7ec340bSmacallan case $flag in 1799f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1800f7ec340bSmacallan flag="\"$flag\"" 1801f7ec340bSmacallan ;; 1802f7ec340bSmacallan esac 1803f7ec340bSmacallan arg="$arg $wl$flag" 1804f7ec340bSmacallan compiler_flags="$compiler_flags $flag" 1805f7ec340bSmacallan done 1806f7ec340bSmacallan IFS="$save_ifs" 1807f7ec340bSmacallan arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1808f7ec340bSmacallan ;; 1809f7ec340bSmacallan 1810f7ec340bSmacallan -Wl,*) 1811f7ec340bSmacallan args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1812f7ec340bSmacallan arg= 1813f7ec340bSmacallan save_ifs="$IFS"; IFS=',' 1814f7ec340bSmacallan for flag in $args; do 1815f7ec340bSmacallan IFS="$save_ifs" 1816f7ec340bSmacallan case $flag in 1817f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1818f7ec340bSmacallan flag="\"$flag\"" 1819f7ec340bSmacallan ;; 1820f7ec340bSmacallan esac 1821f7ec340bSmacallan arg="$arg $wl$flag" 1822f7ec340bSmacallan compiler_flags="$compiler_flags $wl$flag" 1823f7ec340bSmacallan linker_flags="$linker_flags $flag" 1824f7ec340bSmacallan done 1825f7ec340bSmacallan IFS="$save_ifs" 1826f7ec340bSmacallan arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1827f7ec340bSmacallan ;; 1828f7ec340bSmacallan 1829f7ec340bSmacallan -Xcompiler) 1830f7ec340bSmacallan prev=xcompiler 1831f7ec340bSmacallan continue 1832f7ec340bSmacallan ;; 1833f7ec340bSmacallan 1834f7ec340bSmacallan -Xlinker) 1835f7ec340bSmacallan prev=xlinker 1836f7ec340bSmacallan continue 1837f7ec340bSmacallan ;; 1838f7ec340bSmacallan 1839f7ec340bSmacallan -XCClinker) 1840f7ec340bSmacallan prev=xcclinker 1841f7ec340bSmacallan continue 1842f7ec340bSmacallan ;; 1843f7ec340bSmacallan 1844f7ec340bSmacallan # Some other compiler flag. 1845f7ec340bSmacallan -* | +*) 1846f7ec340bSmacallan # Unknown arguments in both finalize_command and compile_command need 1847f7ec340bSmacallan # to be aesthetically quoted because they are evaled later. 1848f7ec340bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1849f7ec340bSmacallan case $arg in 1850f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1851f7ec340bSmacallan arg="\"$arg\"" 1852f7ec340bSmacallan ;; 1853f7ec340bSmacallan esac 1854f7ec340bSmacallan ;; 1855f7ec340bSmacallan 1856f7ec340bSmacallan *.$objext) 1857f7ec340bSmacallan # A standard object. 1858f7ec340bSmacallan objs="$objs $arg" 1859f7ec340bSmacallan ;; 1860f7ec340bSmacallan 1861f7ec340bSmacallan *.lo) 1862f7ec340bSmacallan # A libtool-controlled object. 1863f7ec340bSmacallan 1864f7ec340bSmacallan # Check to see that this really is a libtool object. 1865f7ec340bSmacallan if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1866f7ec340bSmacallan pic_object= 1867f7ec340bSmacallan non_pic_object= 1868f7ec340bSmacallan 1869f7ec340bSmacallan # Read the .lo file 1870f7ec340bSmacallan # If there is no directory component, then add one. 1871f7ec340bSmacallan case $arg in 1872f7ec340bSmacallan */* | *\\*) . $arg ;; 1873f7ec340bSmacallan *) . ./$arg ;; 1874f7ec340bSmacallan esac 1875f7ec340bSmacallan 1876f7ec340bSmacallan if test -z "$pic_object" || \ 1877f7ec340bSmacallan test -z "$non_pic_object" || 1878f7ec340bSmacallan test "$pic_object" = none && \ 1879f7ec340bSmacallan test "$non_pic_object" = none; then 1880f7ec340bSmacallan $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1881f7ec340bSmacallan exit $EXIT_FAILURE 1882f7ec340bSmacallan fi 1883f7ec340bSmacallan 1884f7ec340bSmacallan # Extract subdirectory from the argument. 1885f7ec340bSmacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1886f7ec340bSmacallan if test "X$xdir" = "X$arg"; then 1887f7ec340bSmacallan xdir= 1888f7ec340bSmacallan else 1889f7ec340bSmacallan xdir="$xdir/" 1890f7ec340bSmacallan fi 1891f7ec340bSmacallan 1892f7ec340bSmacallan if test "$pic_object" != none; then 1893f7ec340bSmacallan # Prepend the subdirectory the object is found in. 1894f7ec340bSmacallan pic_object="$xdir$pic_object" 1895f7ec340bSmacallan 1896f7ec340bSmacallan if test "$prev" = dlfiles; then 1897f7ec340bSmacallan if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1898f7ec340bSmacallan dlfiles="$dlfiles $pic_object" 1899f7ec340bSmacallan prev= 1900f7ec340bSmacallan continue 1901f7ec340bSmacallan else 1902f7ec340bSmacallan # If libtool objects are unsupported, then we need to preload. 1903f7ec340bSmacallan prev=dlprefiles 1904f7ec340bSmacallan fi 1905f7ec340bSmacallan fi 1906f7ec340bSmacallan 1907f7ec340bSmacallan # CHECK ME: I think I busted this. -Ossama 1908f7ec340bSmacallan if test "$prev" = dlprefiles; then 1909f7ec340bSmacallan # Preload the old-style object. 1910f7ec340bSmacallan dlprefiles="$dlprefiles $pic_object" 1911f7ec340bSmacallan prev= 1912f7ec340bSmacallan fi 1913f7ec340bSmacallan 1914f7ec340bSmacallan # A PIC object. 1915f7ec340bSmacallan libobjs="$libobjs $pic_object" 1916f7ec340bSmacallan arg="$pic_object" 1917f7ec340bSmacallan fi 1918f7ec340bSmacallan 1919f7ec340bSmacallan # Non-PIC object. 1920f7ec340bSmacallan if test "$non_pic_object" != none; then 1921f7ec340bSmacallan # Prepend the subdirectory the object is found in. 1922f7ec340bSmacallan non_pic_object="$xdir$non_pic_object" 1923f7ec340bSmacallan 1924f7ec340bSmacallan # A standard non-PIC object 1925f7ec340bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 1926f7ec340bSmacallan if test -z "$pic_object" || test "$pic_object" = none ; then 1927f7ec340bSmacallan arg="$non_pic_object" 1928f7ec340bSmacallan fi 1929f7ec340bSmacallan else 1930f7ec340bSmacallan # If the PIC object exists, use it instead. 1931f7ec340bSmacallan # $xdir was prepended to $pic_object above. 1932f7ec340bSmacallan non_pic_object="$pic_object" 1933f7ec340bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 1934f7ec340bSmacallan fi 1935f7ec340bSmacallan else 1936f7ec340bSmacallan # Only an error if not doing a dry-run. 1937f7ec340bSmacallan if test -z "$run"; then 1938f7ec340bSmacallan $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1939f7ec340bSmacallan exit $EXIT_FAILURE 1940f7ec340bSmacallan else 1941f7ec340bSmacallan # Dry-run case. 1942f7ec340bSmacallan 1943f7ec340bSmacallan # Extract subdirectory from the argument. 1944f7ec340bSmacallan xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1945f7ec340bSmacallan if test "X$xdir" = "X$arg"; then 1946f7ec340bSmacallan xdir= 1947f7ec340bSmacallan else 1948f7ec340bSmacallan xdir="$xdir/" 1949f7ec340bSmacallan fi 1950f7ec340bSmacallan 1951f7ec340bSmacallan pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1952f7ec340bSmacallan non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1953f7ec340bSmacallan libobjs="$libobjs $pic_object" 1954f7ec340bSmacallan non_pic_objects="$non_pic_objects $non_pic_object" 1955f7ec340bSmacallan fi 1956f7ec340bSmacallan fi 1957f7ec340bSmacallan ;; 1958f7ec340bSmacallan 1959f7ec340bSmacallan *.$libext) 1960f7ec340bSmacallan # An archive. 1961f7ec340bSmacallan deplibs="$deplibs $arg" 1962f7ec340bSmacallan old_deplibs="$old_deplibs $arg" 1963f7ec340bSmacallan continue 1964f7ec340bSmacallan ;; 1965f7ec340bSmacallan 1966f7ec340bSmacallan *.la) 1967f7ec340bSmacallan # A libtool-controlled library. 1968f7ec340bSmacallan 1969f7ec340bSmacallan if test "$prev" = dlfiles; then 1970f7ec340bSmacallan # This library was specified with -dlopen. 1971f7ec340bSmacallan dlfiles="$dlfiles $arg" 1972f7ec340bSmacallan prev= 1973f7ec340bSmacallan elif test "$prev" = dlprefiles; then 1974f7ec340bSmacallan # The library was specified with -dlpreopen. 1975f7ec340bSmacallan dlprefiles="$dlprefiles $arg" 1976f7ec340bSmacallan prev= 1977f7ec340bSmacallan else 1978f7ec340bSmacallan deplibs="$deplibs $arg" 1979f7ec340bSmacallan fi 1980f7ec340bSmacallan continue 1981f7ec340bSmacallan ;; 1982f7ec340bSmacallan 1983f7ec340bSmacallan # Some other compiler argument. 1984f7ec340bSmacallan *) 1985f7ec340bSmacallan # Unknown arguments in both finalize_command and compile_command need 1986f7ec340bSmacallan # to be aesthetically quoted because they are evaled later. 1987f7ec340bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1988f7ec340bSmacallan case $arg in 1989f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1990f7ec340bSmacallan arg="\"$arg\"" 1991f7ec340bSmacallan ;; 1992f7ec340bSmacallan esac 1993f7ec340bSmacallan ;; 1994f7ec340bSmacallan esac # arg 1995f7ec340bSmacallan 1996f7ec340bSmacallan # Now actually substitute the argument into the commands. 1997f7ec340bSmacallan if test -n "$arg"; then 1998f7ec340bSmacallan compile_command="$compile_command $arg" 1999f7ec340bSmacallan finalize_command="$finalize_command $arg" 2000f7ec340bSmacallan fi 2001f7ec340bSmacallan done # argument parsing loop 2002f7ec340bSmacallan 2003f7ec340bSmacallan if test -n "$prev"; then 2004f7ec340bSmacallan $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 2005f7ec340bSmacallan $echo "$help" 1>&2 2006f7ec340bSmacallan exit $EXIT_FAILURE 2007f7ec340bSmacallan fi 2008f7ec340bSmacallan 2009f7ec340bSmacallan if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 2010f7ec340bSmacallan eval arg=\"$export_dynamic_flag_spec\" 2011f7ec340bSmacallan compile_command="$compile_command $arg" 2012f7ec340bSmacallan finalize_command="$finalize_command $arg" 2013f7ec340bSmacallan fi 2014f7ec340bSmacallan 2015f7ec340bSmacallan oldlibs= 2016f7ec340bSmacallan # calculate the name of the file, without its directory 2017f7ec340bSmacallan outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 2018f7ec340bSmacallan libobjs_save="$libobjs" 2019f7ec340bSmacallan 2020f7ec340bSmacallan if test -n "$shlibpath_var"; then 2021f7ec340bSmacallan # get the directories listed in $shlibpath_var 2022f7ec340bSmacallan eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 2023f7ec340bSmacallan else 2024f7ec340bSmacallan shlib_search_path= 2025f7ec340bSmacallan fi 2026f7ec340bSmacallan eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 2027f7ec340bSmacallan eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 2028f7ec340bSmacallan 2029f7ec340bSmacallan output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 2030f7ec340bSmacallan if test "X$output_objdir" = "X$output"; then 2031f7ec340bSmacallan output_objdir="$objdir" 2032f7ec340bSmacallan else 2033f7ec340bSmacallan output_objdir="$output_objdir/$objdir" 2034f7ec340bSmacallan fi 2035f7ec340bSmacallan # Create the object directory. 2036f7ec340bSmacallan if test ! -d "$output_objdir"; then 2037f7ec340bSmacallan $show "$mkdir $output_objdir" 2038f7ec340bSmacallan $run $mkdir $output_objdir 2039f7ec340bSmacallan exit_status=$? 2040f7ec340bSmacallan if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 2041f7ec340bSmacallan exit $exit_status 2042f7ec340bSmacallan fi 2043f7ec340bSmacallan fi 2044f7ec340bSmacallan 2045f7ec340bSmacallan # Determine the type of output 2046f7ec340bSmacallan case $output in 2047f7ec340bSmacallan "") 2048f7ec340bSmacallan $echo "$modename: you must specify an output file" 1>&2 2049f7ec340bSmacallan $echo "$help" 1>&2 2050f7ec340bSmacallan exit $EXIT_FAILURE 2051f7ec340bSmacallan ;; 2052f7ec340bSmacallan *.$libext) linkmode=oldlib ;; 2053f7ec340bSmacallan *.lo | *.$objext) linkmode=obj ;; 2054f7ec340bSmacallan *.la) linkmode=lib ;; 2055f7ec340bSmacallan *) linkmode=prog ;; # Anything else should be a program. 2056f7ec340bSmacallan esac 2057f7ec340bSmacallan 2058f7ec340bSmacallan case $host in 2059f7ec340bSmacallan *cygwin* | *mingw* | *pw32*) 2060f7ec340bSmacallan # don't eliminate duplications in $postdeps and $predeps 2061f7ec340bSmacallan duplicate_compiler_generated_deps=yes 2062f7ec340bSmacallan ;; 2063f7ec340bSmacallan *) 2064f7ec340bSmacallan duplicate_compiler_generated_deps=$duplicate_deps 2065f7ec340bSmacallan ;; 2066f7ec340bSmacallan esac 2067f7ec340bSmacallan specialdeplibs= 2068f7ec340bSmacallan 2069f7ec340bSmacallan libs= 2070f7ec340bSmacallan # Find all interdependent deplibs by searching for libraries 2071f7ec340bSmacallan # that are linked more than once (e.g. -la -lb -la) 2072f7ec340bSmacallan for deplib in $deplibs; do 2073f7ec340bSmacallan if test "X$duplicate_deps" = "Xyes" ; then 2074f7ec340bSmacallan case "$libs " in 2075f7ec340bSmacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2076f7ec340bSmacallan esac 2077f7ec340bSmacallan fi 2078f7ec340bSmacallan libs="$libs $deplib" 2079f7ec340bSmacallan done 2080f7ec340bSmacallan 2081f7ec340bSmacallan if test "$linkmode" = lib; then 2082f7ec340bSmacallan libs="$predeps $libs $compiler_lib_search_path $postdeps" 2083f7ec340bSmacallan 2084f7ec340bSmacallan # Compute libraries that are listed more than once in $predeps 2085f7ec340bSmacallan # $postdeps and mark them as special (i.e., whose duplicates are 2086f7ec340bSmacallan # not to be eliminated). 2087f7ec340bSmacallan pre_post_deps= 2088f7ec340bSmacallan if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 2089f7ec340bSmacallan for pre_post_dep in $predeps $postdeps; do 2090f7ec340bSmacallan case "$pre_post_deps " in 2091f7ec340bSmacallan *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 2092f7ec340bSmacallan esac 2093f7ec340bSmacallan pre_post_deps="$pre_post_deps $pre_post_dep" 2094f7ec340bSmacallan done 2095f7ec340bSmacallan fi 2096f7ec340bSmacallan pre_post_deps= 2097f7ec340bSmacallan fi 2098f7ec340bSmacallan 2099f7ec340bSmacallan deplibs= 2100f7ec340bSmacallan newdependency_libs= 2101f7ec340bSmacallan newlib_search_path= 2102f7ec340bSmacallan need_relink=no # whether we're linking any uninstalled libtool libraries 2103f7ec340bSmacallan notinst_deplibs= # not-installed libtool libraries 2104f7ec340bSmacallan case $linkmode in 2105f7ec340bSmacallan lib) 2106f7ec340bSmacallan passes="conv link" 2107f7ec340bSmacallan for file in $dlfiles $dlprefiles; do 2108f7ec340bSmacallan case $file in 2109f7ec340bSmacallan *.la) ;; 2110f7ec340bSmacallan *) 2111f7ec340bSmacallan $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 2112f7ec340bSmacallan exit $EXIT_FAILURE 2113f7ec340bSmacallan ;; 2114f7ec340bSmacallan esac 2115f7ec340bSmacallan done 2116f7ec340bSmacallan ;; 2117f7ec340bSmacallan prog) 2118f7ec340bSmacallan compile_deplibs= 2119f7ec340bSmacallan finalize_deplibs= 2120f7ec340bSmacallan alldeplibs=no 2121f7ec340bSmacallan newdlfiles= 2122f7ec340bSmacallan newdlprefiles= 2123f7ec340bSmacallan passes="conv scan dlopen dlpreopen link" 2124f7ec340bSmacallan ;; 2125f7ec340bSmacallan *) passes="conv" 2126f7ec340bSmacallan ;; 2127f7ec340bSmacallan esac 2128f7ec340bSmacallan for pass in $passes; do 2129f7ec340bSmacallan if test "$linkmode,$pass" = "lib,link" || 2130f7ec340bSmacallan test "$linkmode,$pass" = "prog,scan"; then 2131f7ec340bSmacallan libs="$deplibs" 2132f7ec340bSmacallan deplibs= 2133f7ec340bSmacallan fi 2134f7ec340bSmacallan if test "$linkmode" = prog; then 2135f7ec340bSmacallan case $pass in 2136f7ec340bSmacallan dlopen) libs="$dlfiles" ;; 2137f7ec340bSmacallan dlpreopen) libs="$dlprefiles" ;; 21387ce7e03cSmrg link) 21397ce7e03cSmrg libs="$deplibs %DEPLIBS%" 21407ce7e03cSmrg test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" 21417ce7e03cSmrg ;; 2142f7ec340bSmacallan esac 2143f7ec340bSmacallan fi 2144f7ec340bSmacallan if test "$pass" = dlopen; then 2145f7ec340bSmacallan # Collect dlpreopened libraries 2146f7ec340bSmacallan save_deplibs="$deplibs" 2147f7ec340bSmacallan deplibs= 2148f7ec340bSmacallan fi 2149f7ec340bSmacallan for deplib in $libs; do 2150f7ec340bSmacallan lib= 2151f7ec340bSmacallan found=no 2152f7ec340bSmacallan case $deplib in 21537ce7e03cSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 2154f7ec340bSmacallan if test "$linkmode,$pass" = "prog,link"; then 2155f7ec340bSmacallan compile_deplibs="$deplib $compile_deplibs" 2156f7ec340bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 2157f7ec340bSmacallan else 2158f7ec340bSmacallan compiler_flags="$compiler_flags $deplib" 2159f7ec340bSmacallan fi 2160f7ec340bSmacallan continue 2161f7ec340bSmacallan ;; 2162f7ec340bSmacallan -l*) 2163f7ec340bSmacallan if test "$linkmode" != lib && test "$linkmode" != prog; then 2164f7ec340bSmacallan $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2165f7ec340bSmacallan continue 2166f7ec340bSmacallan fi 2167f7ec340bSmacallan name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 21687ce7e03cSmrg if test "$linkmode" = lib; then 21697ce7e03cSmrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 21707ce7e03cSmrg else 21717ce7e03cSmrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 21727ce7e03cSmrg fi 21737ce7e03cSmrg for searchdir in $searchdirs; do 2174f7ec340bSmacallan for search_ext in .la $std_shrext .so .a; do 2175f7ec340bSmacallan # Search the libtool library 2176f7ec340bSmacallan lib="$searchdir/lib${name}${search_ext}" 2177f7ec340bSmacallan if test -f "$lib"; then 2178f7ec340bSmacallan if test "$search_ext" = ".la"; then 2179f7ec340bSmacallan found=yes 2180f7ec340bSmacallan else 2181f7ec340bSmacallan found=no 2182f7ec340bSmacallan fi 2183f7ec340bSmacallan break 2 2184f7ec340bSmacallan fi 2185f7ec340bSmacallan done 2186f7ec340bSmacallan done 2187f7ec340bSmacallan if test "$found" != yes; then 2188f7ec340bSmacallan # deplib doesn't seem to be a libtool library 2189f7ec340bSmacallan if test "$linkmode,$pass" = "prog,link"; then 2190f7ec340bSmacallan compile_deplibs="$deplib $compile_deplibs" 2191f7ec340bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 2192f7ec340bSmacallan else 2193f7ec340bSmacallan deplibs="$deplib $deplibs" 2194f7ec340bSmacallan test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2195f7ec340bSmacallan fi 2196f7ec340bSmacallan continue 2197f7ec340bSmacallan else # deplib is a libtool library 2198f7ec340bSmacallan # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 2199f7ec340bSmacallan # We need to do some special things here, and not later. 2200f7ec340bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 2201f7ec340bSmacallan case " $predeps $postdeps " in 2202f7ec340bSmacallan *" $deplib "*) 2203f7ec340bSmacallan if (${SED} -e '2q' $lib | 2204f7ec340bSmacallan grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 2205f7ec340bSmacallan library_names= 2206f7ec340bSmacallan old_library= 2207f7ec340bSmacallan case $lib in 2208f7ec340bSmacallan */* | *\\*) . $lib ;; 2209f7ec340bSmacallan *) . ./$lib ;; 2210f7ec340bSmacallan esac 2211f7ec340bSmacallan for l in $old_library $library_names; do 2212f7ec340bSmacallan ll="$l" 2213f7ec340bSmacallan done 2214f7ec340bSmacallan if test "X$ll" = "X$old_library" ; then # only static version available 2215f7ec340bSmacallan found=no 2216f7ec340bSmacallan ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2217f7ec340bSmacallan test "X$ladir" = "X$lib" && ladir="." 2218f7ec340bSmacallan lib=$ladir/$old_library 2219f7ec340bSmacallan if test "$linkmode,$pass" = "prog,link"; then 2220f7ec340bSmacallan compile_deplibs="$deplib $compile_deplibs" 2221f7ec340bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 2222f7ec340bSmacallan else 2223f7ec340bSmacallan deplibs="$deplib $deplibs" 2224f7ec340bSmacallan test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2225f7ec340bSmacallan fi 2226f7ec340bSmacallan continue 2227f7ec340bSmacallan fi 2228f7ec340bSmacallan fi 2229f7ec340bSmacallan ;; 2230f7ec340bSmacallan *) ;; 2231f7ec340bSmacallan esac 2232f7ec340bSmacallan fi 2233f7ec340bSmacallan fi 2234f7ec340bSmacallan ;; # -l 2235f7ec340bSmacallan -L*) 2236f7ec340bSmacallan case $linkmode in 2237f7ec340bSmacallan lib) 2238f7ec340bSmacallan deplibs="$deplib $deplibs" 2239f7ec340bSmacallan test "$pass" = conv && continue 2240f7ec340bSmacallan newdependency_libs="$deplib $newdependency_libs" 2241f7ec340bSmacallan newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2242f7ec340bSmacallan ;; 2243f7ec340bSmacallan prog) 2244f7ec340bSmacallan if test "$pass" = conv; then 2245f7ec340bSmacallan deplibs="$deplib $deplibs" 2246f7ec340bSmacallan continue 2247f7ec340bSmacallan fi 2248f7ec340bSmacallan if test "$pass" = scan; then 2249f7ec340bSmacallan deplibs="$deplib $deplibs" 2250f7ec340bSmacallan else 2251f7ec340bSmacallan compile_deplibs="$deplib $compile_deplibs" 2252f7ec340bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 2253f7ec340bSmacallan fi 2254f7ec340bSmacallan newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2255f7ec340bSmacallan ;; 2256f7ec340bSmacallan *) 2257f7ec340bSmacallan $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 2258f7ec340bSmacallan ;; 2259f7ec340bSmacallan esac # linkmode 2260f7ec340bSmacallan continue 2261f7ec340bSmacallan ;; # -L 2262f7ec340bSmacallan -R*) 2263f7ec340bSmacallan if test "$pass" = link; then 2264f7ec340bSmacallan dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 2265f7ec340bSmacallan # Make sure the xrpath contains only unique directories. 2266f7ec340bSmacallan case "$xrpath " in 2267f7ec340bSmacallan *" $dir "*) ;; 2268f7ec340bSmacallan *) xrpath="$xrpath $dir" ;; 2269f7ec340bSmacallan esac 2270f7ec340bSmacallan fi 2271f7ec340bSmacallan deplibs="$deplib $deplibs" 2272f7ec340bSmacallan continue 2273f7ec340bSmacallan ;; 2274f7ec340bSmacallan *.la) lib="$deplib" ;; 2275f7ec340bSmacallan *.$libext) 2276f7ec340bSmacallan if test "$pass" = conv; then 2277f7ec340bSmacallan deplibs="$deplib $deplibs" 2278f7ec340bSmacallan continue 2279f7ec340bSmacallan fi 2280f7ec340bSmacallan case $linkmode in 2281f7ec340bSmacallan lib) 2282f7ec340bSmacallan valid_a_lib=no 2283f7ec340bSmacallan case $deplibs_check_method in 2284f7ec340bSmacallan match_pattern*) 2285f7ec340bSmacallan set dummy $deplibs_check_method 2286f7ec340bSmacallan match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2287f7ec340bSmacallan if eval $echo \"$deplib\" 2>/dev/null \ 2288f7ec340bSmacallan | $SED 10q \ 2289f7ec340bSmacallan | $EGREP "$match_pattern_regex" > /dev/null; then 2290f7ec340bSmacallan valid_a_lib=yes 2291f7ec340bSmacallan fi 2292f7ec340bSmacallan ;; 2293f7ec340bSmacallan pass_all) 2294f7ec340bSmacallan valid_a_lib=yes 2295f7ec340bSmacallan ;; 2296f7ec340bSmacallan esac 2297f7ec340bSmacallan if test "$valid_a_lib" != yes; then 2298f7ec340bSmacallan $echo 2299f7ec340bSmacallan $echo "*** Warning: Trying to link with static lib archive $deplib." 2300f7ec340bSmacallan $echo "*** I have the capability to make that library automatically link in when" 2301f7ec340bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 2302f7ec340bSmacallan $echo "*** shared version of the library, which you do not appear to have" 2303f7ec340bSmacallan $echo "*** because the file extensions .$libext of this argument makes me believe" 2304f7ec340bSmacallan $echo "*** that it is just a static archive that I should not used here." 2305f7ec340bSmacallan else 2306f7ec340bSmacallan $echo 2307f7ec340bSmacallan $echo "*** Warning: Linking the shared library $output against the" 2308f7ec340bSmacallan $echo "*** static library $deplib is not portable!" 2309f7ec340bSmacallan deplibs="$deplib $deplibs" 2310f7ec340bSmacallan fi 2311f7ec340bSmacallan continue 2312f7ec340bSmacallan ;; 2313f7ec340bSmacallan prog) 2314f7ec340bSmacallan if test "$pass" != link; then 2315f7ec340bSmacallan deplibs="$deplib $deplibs" 2316f7ec340bSmacallan else 2317f7ec340bSmacallan compile_deplibs="$deplib $compile_deplibs" 2318f7ec340bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 2319f7ec340bSmacallan fi 2320f7ec340bSmacallan continue 2321f7ec340bSmacallan ;; 2322f7ec340bSmacallan esac # linkmode 2323f7ec340bSmacallan ;; # *.$libext 2324f7ec340bSmacallan *.lo | *.$objext) 2325f7ec340bSmacallan if test "$pass" = conv; then 2326f7ec340bSmacallan deplibs="$deplib $deplibs" 2327f7ec340bSmacallan elif test "$linkmode" = prog; then 2328f7ec340bSmacallan if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 2329f7ec340bSmacallan # If there is no dlopen support or we're linking statically, 2330f7ec340bSmacallan # we need to preload. 2331f7ec340bSmacallan newdlprefiles="$newdlprefiles $deplib" 2332f7ec340bSmacallan compile_deplibs="$deplib $compile_deplibs" 2333f7ec340bSmacallan finalize_deplibs="$deplib $finalize_deplibs" 2334f7ec340bSmacallan else 2335f7ec340bSmacallan newdlfiles="$newdlfiles $deplib" 2336f7ec340bSmacallan fi 2337f7ec340bSmacallan fi 2338f7ec340bSmacallan continue 2339f7ec340bSmacallan ;; 2340f7ec340bSmacallan %DEPLIBS%) 2341f7ec340bSmacallan alldeplibs=yes 2342f7ec340bSmacallan continue 2343f7ec340bSmacallan ;; 2344f7ec340bSmacallan esac # case $deplib 2345f7ec340bSmacallan if test "$found" = yes || test -f "$lib"; then : 2346f7ec340bSmacallan else 2347f7ec340bSmacallan $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 2348f7ec340bSmacallan exit $EXIT_FAILURE 2349f7ec340bSmacallan fi 2350f7ec340bSmacallan 2351f7ec340bSmacallan # Check to see that this really is a libtool archive. 2352f7ec340bSmacallan if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2353f7ec340bSmacallan else 2354f7ec340bSmacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 2355f7ec340bSmacallan exit $EXIT_FAILURE 2356f7ec340bSmacallan fi 2357f7ec340bSmacallan 2358f7ec340bSmacallan ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2359f7ec340bSmacallan test "X$ladir" = "X$lib" && ladir="." 2360f7ec340bSmacallan 2361f7ec340bSmacallan dlname= 2362f7ec340bSmacallan dlopen= 2363f7ec340bSmacallan dlpreopen= 2364f7ec340bSmacallan libdir= 2365f7ec340bSmacallan library_names= 2366f7ec340bSmacallan old_library= 2367f7ec340bSmacallan # If the library was installed with an old release of libtool, 2368f7ec340bSmacallan # it will not redefine variables installed, or shouldnotlink 2369f7ec340bSmacallan installed=yes 2370f7ec340bSmacallan shouldnotlink=no 2371f7ec340bSmacallan avoidtemprpath= 2372f7ec340bSmacallan 2373f7ec340bSmacallan 2374f7ec340bSmacallan # Read the .la file 2375f7ec340bSmacallan case $lib in 2376f7ec340bSmacallan */* | *\\*) . $lib ;; 2377f7ec340bSmacallan *) . ./$lib ;; 2378f7ec340bSmacallan esac 2379f7ec340bSmacallan 2380f7ec340bSmacallan if test "$linkmode,$pass" = "lib,link" || 2381f7ec340bSmacallan test "$linkmode,$pass" = "prog,scan" || 2382f7ec340bSmacallan { test "$linkmode" != prog && test "$linkmode" != lib; }; then 2383f7ec340bSmacallan test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 2384f7ec340bSmacallan test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 2385f7ec340bSmacallan fi 2386f7ec340bSmacallan 2387f7ec340bSmacallan if test "$pass" = conv; then 2388f7ec340bSmacallan # Only check for convenience libraries 2389f7ec340bSmacallan deplibs="$lib $deplibs" 2390f7ec340bSmacallan if test -z "$libdir"; then 2391f7ec340bSmacallan if test -z "$old_library"; then 2392f7ec340bSmacallan $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2393f7ec340bSmacallan exit $EXIT_FAILURE 2394f7ec340bSmacallan fi 2395f7ec340bSmacallan # It is a libtool convenience library, so add in its objects. 2396f7ec340bSmacallan convenience="$convenience $ladir/$objdir/$old_library" 2397f7ec340bSmacallan old_convenience="$old_convenience $ladir/$objdir/$old_library" 2398f7ec340bSmacallan tmp_libs= 2399f7ec340bSmacallan for deplib in $dependency_libs; do 2400f7ec340bSmacallan deplibs="$deplib $deplibs" 2401f7ec340bSmacallan if test "X$duplicate_deps" = "Xyes" ; then 2402f7ec340bSmacallan case "$tmp_libs " in 2403f7ec340bSmacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2404f7ec340bSmacallan esac 2405f7ec340bSmacallan fi 2406f7ec340bSmacallan tmp_libs="$tmp_libs $deplib" 2407f7ec340bSmacallan done 2408f7ec340bSmacallan elif test "$linkmode" != prog && test "$linkmode" != lib; then 2409f7ec340bSmacallan $echo "$modename: \`$lib' is not a convenience library" 1>&2 2410f7ec340bSmacallan exit $EXIT_FAILURE 2411f7ec340bSmacallan fi 2412f7ec340bSmacallan continue 2413f7ec340bSmacallan fi # $pass = conv 2414f7ec340bSmacallan 2415f7ec340bSmacallan 2416f7ec340bSmacallan # Get the name of the library we link against. 2417f7ec340bSmacallan linklib= 2418f7ec340bSmacallan for l in $old_library $library_names; do 2419f7ec340bSmacallan linklib="$l" 2420f7ec340bSmacallan done 2421f7ec340bSmacallan if test -z "$linklib"; then 2422f7ec340bSmacallan $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2423f7ec340bSmacallan exit $EXIT_FAILURE 2424f7ec340bSmacallan fi 2425f7ec340bSmacallan 2426f7ec340bSmacallan # This library was specified with -dlopen. 2427f7ec340bSmacallan if test "$pass" = dlopen; then 2428f7ec340bSmacallan if test -z "$libdir"; then 2429f7ec340bSmacallan $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 2430f7ec340bSmacallan exit $EXIT_FAILURE 2431f7ec340bSmacallan fi 2432f7ec340bSmacallan if test -z "$dlname" || 2433f7ec340bSmacallan test "$dlopen_support" != yes || 2434f7ec340bSmacallan test "$build_libtool_libs" = no; then 2435f7ec340bSmacallan # If there is no dlname, no dlopen support or we're linking 2436f7ec340bSmacallan # statically, we need to preload. We also need to preload any 2437f7ec340bSmacallan # dependent libraries so libltdl's deplib preloader doesn't 2438f7ec340bSmacallan # bomb out in the load deplibs phase. 2439f7ec340bSmacallan dlprefiles="$dlprefiles $lib $dependency_libs" 2440f7ec340bSmacallan else 2441f7ec340bSmacallan newdlfiles="$newdlfiles $lib" 2442f7ec340bSmacallan fi 2443f7ec340bSmacallan continue 2444f7ec340bSmacallan fi # $pass = dlopen 2445f7ec340bSmacallan 2446f7ec340bSmacallan # We need an absolute path. 2447f7ec340bSmacallan case $ladir in 2448f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 2449f7ec340bSmacallan *) 2450f7ec340bSmacallan abs_ladir=`cd "$ladir" && pwd` 2451f7ec340bSmacallan if test -z "$abs_ladir"; then 2452f7ec340bSmacallan $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 2453f7ec340bSmacallan $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 2454f7ec340bSmacallan abs_ladir="$ladir" 2455f7ec340bSmacallan fi 2456f7ec340bSmacallan ;; 2457f7ec340bSmacallan esac 2458f7ec340bSmacallan laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 2459f7ec340bSmacallan 2460f7ec340bSmacallan # Find the relevant object directory and library name. 2461f7ec340bSmacallan if test "X$installed" = Xyes; then 2462f7ec340bSmacallan if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2463f7ec340bSmacallan $echo "$modename: warning: library \`$lib' was moved." 1>&2 2464f7ec340bSmacallan dir="$ladir" 2465f7ec340bSmacallan absdir="$abs_ladir" 2466f7ec340bSmacallan libdir="$abs_ladir" 2467f7ec340bSmacallan else 2468f7ec340bSmacallan dir="$libdir" 2469f7ec340bSmacallan absdir="$libdir" 2470f7ec340bSmacallan fi 2471f7ec340bSmacallan test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 2472f7ec340bSmacallan else 2473f7ec340bSmacallan if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2474f7ec340bSmacallan dir="$ladir" 2475f7ec340bSmacallan absdir="$abs_ladir" 2476f7ec340bSmacallan # Remove this search path later 2477f7ec340bSmacallan notinst_path="$notinst_path $abs_ladir" 2478f7ec340bSmacallan else 2479f7ec340bSmacallan dir="$ladir/$objdir" 2480f7ec340bSmacallan absdir="$abs_ladir/$objdir" 2481f7ec340bSmacallan # Remove this search path later 2482f7ec340bSmacallan notinst_path="$notinst_path $abs_ladir" 2483f7ec340bSmacallan fi 2484f7ec340bSmacallan fi # $installed = yes 2485f7ec340bSmacallan name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2486f7ec340bSmacallan 2487f7ec340bSmacallan # This library was specified with -dlpreopen. 2488f7ec340bSmacallan if test "$pass" = dlpreopen; then 2489f7ec340bSmacallan if test -z "$libdir"; then 2490f7ec340bSmacallan $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 2491f7ec340bSmacallan exit $EXIT_FAILURE 2492f7ec340bSmacallan fi 2493f7ec340bSmacallan # Prefer using a static library (so that no silly _DYNAMIC symbols 2494f7ec340bSmacallan # are required to link). 2495f7ec340bSmacallan if test -n "$old_library"; then 2496f7ec340bSmacallan newdlprefiles="$newdlprefiles $dir/$old_library" 2497f7ec340bSmacallan # Otherwise, use the dlname, so that lt_dlopen finds it. 2498f7ec340bSmacallan elif test -n "$dlname"; then 2499f7ec340bSmacallan newdlprefiles="$newdlprefiles $dir/$dlname" 2500f7ec340bSmacallan else 2501f7ec340bSmacallan newdlprefiles="$newdlprefiles $dir/$linklib" 2502f7ec340bSmacallan fi 2503f7ec340bSmacallan fi # $pass = dlpreopen 2504f7ec340bSmacallan 2505f7ec340bSmacallan if test -z "$libdir"; then 2506f7ec340bSmacallan # Link the convenience library 2507f7ec340bSmacallan if test "$linkmode" = lib; then 2508f7ec340bSmacallan deplibs="$dir/$old_library $deplibs" 2509f7ec340bSmacallan elif test "$linkmode,$pass" = "prog,link"; then 2510f7ec340bSmacallan compile_deplibs="$dir/$old_library $compile_deplibs" 2511f7ec340bSmacallan finalize_deplibs="$dir/$old_library $finalize_deplibs" 2512f7ec340bSmacallan else 2513f7ec340bSmacallan deplibs="$lib $deplibs" # used for prog,scan pass 2514f7ec340bSmacallan fi 2515f7ec340bSmacallan continue 2516f7ec340bSmacallan fi 2517f7ec340bSmacallan 2518f7ec340bSmacallan 2519f7ec340bSmacallan if test "$linkmode" = prog && test "$pass" != link; then 2520f7ec340bSmacallan newlib_search_path="$newlib_search_path $ladir" 2521f7ec340bSmacallan deplibs="$lib $deplibs" 2522f7ec340bSmacallan 2523f7ec340bSmacallan linkalldeplibs=no 2524f7ec340bSmacallan if test "$link_all_deplibs" != no || test -z "$library_names" || 2525f7ec340bSmacallan test "$build_libtool_libs" = no; then 2526f7ec340bSmacallan linkalldeplibs=yes 2527f7ec340bSmacallan fi 2528f7ec340bSmacallan 2529f7ec340bSmacallan tmp_libs= 2530f7ec340bSmacallan for deplib in $dependency_libs; do 2531f7ec340bSmacallan case $deplib in 2532f7ec340bSmacallan -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 2533f7ec340bSmacallan esac 2534f7ec340bSmacallan # Need to link against all dependency_libs? 2535f7ec340bSmacallan if test "$linkalldeplibs" = yes; then 2536f7ec340bSmacallan deplibs="$deplib $deplibs" 2537f7ec340bSmacallan else 2538f7ec340bSmacallan # Need to hardcode shared library paths 2539f7ec340bSmacallan # or/and link against static libraries 2540f7ec340bSmacallan newdependency_libs="$deplib $newdependency_libs" 2541f7ec340bSmacallan fi 2542f7ec340bSmacallan if test "X$duplicate_deps" = "Xyes" ; then 2543f7ec340bSmacallan case "$tmp_libs " in 2544f7ec340bSmacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2545f7ec340bSmacallan esac 2546f7ec340bSmacallan fi 2547f7ec340bSmacallan tmp_libs="$tmp_libs $deplib" 2548f7ec340bSmacallan done # for deplib 2549f7ec340bSmacallan continue 2550f7ec340bSmacallan fi # $linkmode = prog... 2551f7ec340bSmacallan 2552f7ec340bSmacallan if test "$linkmode,$pass" = "prog,link"; then 2553f7ec340bSmacallan if test -n "$library_names" && 25547ce7e03cSmrg { { test "$prefer_static_libs" = no || 25557ce7e03cSmrg test "$prefer_static_libs,$installed" = "built,yes"; } || 25567ce7e03cSmrg test -z "$old_library"; }; then 2557f7ec340bSmacallan # We need to hardcode the library path 2558f7ec340bSmacallan if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 2559f7ec340bSmacallan # Make sure the rpath contains only unique directories. 2560f7ec340bSmacallan case "$temp_rpath " in 2561f7ec340bSmacallan *" $dir "*) ;; 2562f7ec340bSmacallan *" $absdir "*) ;; 2563f7ec340bSmacallan *) temp_rpath="$temp_rpath $absdir" ;; 2564f7ec340bSmacallan esac 2565f7ec340bSmacallan fi 2566f7ec340bSmacallan 2567f7ec340bSmacallan # Hardcode the library path. 2568f7ec340bSmacallan # Skip directories that are in the system default run-time 2569f7ec340bSmacallan # search path. 2570f7ec340bSmacallan case " $sys_lib_dlsearch_path " in 2571f7ec340bSmacallan *" $absdir "*) ;; 2572f7ec340bSmacallan *) 2573f7ec340bSmacallan case "$compile_rpath " in 2574f7ec340bSmacallan *" $absdir "*) ;; 2575f7ec340bSmacallan *) compile_rpath="$compile_rpath $absdir" 2576f7ec340bSmacallan esac 2577f7ec340bSmacallan ;; 2578f7ec340bSmacallan esac 2579f7ec340bSmacallan case " $sys_lib_dlsearch_path " in 2580f7ec340bSmacallan *" $libdir "*) ;; 2581f7ec340bSmacallan *) 2582f7ec340bSmacallan case "$finalize_rpath " in 2583f7ec340bSmacallan *" $libdir "*) ;; 2584f7ec340bSmacallan *) finalize_rpath="$finalize_rpath $libdir" 2585f7ec340bSmacallan esac 2586f7ec340bSmacallan ;; 2587f7ec340bSmacallan esac 2588f7ec340bSmacallan fi # $linkmode,$pass = prog,link... 2589f7ec340bSmacallan 2590f7ec340bSmacallan if test "$alldeplibs" = yes && 2591f7ec340bSmacallan { test "$deplibs_check_method" = pass_all || 2592f7ec340bSmacallan { test "$build_libtool_libs" = yes && 2593f7ec340bSmacallan test -n "$library_names"; }; }; then 2594f7ec340bSmacallan # We only need to search for static libraries 2595f7ec340bSmacallan continue 2596f7ec340bSmacallan fi 2597f7ec340bSmacallan fi 2598f7ec340bSmacallan 2599f7ec340bSmacallan link_static=no # Whether the deplib will be linked statically 2600f7ec340bSmacallan use_static_libs=$prefer_static_libs 2601f7ec340bSmacallan if test "$use_static_libs" = built && test "$installed" = yes ; then 2602f7ec340bSmacallan use_static_libs=no 2603f7ec340bSmacallan fi 2604f7ec340bSmacallan if test -n "$library_names" && 2605f7ec340bSmacallan { test "$use_static_libs" = no || test -z "$old_library"; }; then 2606f7ec340bSmacallan if test "$installed" = no; then 2607f7ec340bSmacallan notinst_deplibs="$notinst_deplibs $lib" 2608f7ec340bSmacallan need_relink=yes 2609f7ec340bSmacallan fi 2610f7ec340bSmacallan # This is a shared library 2611f7ec340bSmacallan 2612f7ec340bSmacallan # Warn about portability, can't link against -module's on 2613f7ec340bSmacallan # some systems (darwin) 2614f7ec340bSmacallan if test "$shouldnotlink" = yes && test "$pass" = link ; then 2615f7ec340bSmacallan $echo 2616f7ec340bSmacallan if test "$linkmode" = prog; then 2617f7ec340bSmacallan $echo "*** Warning: Linking the executable $output against the loadable module" 2618f7ec340bSmacallan else 2619f7ec340bSmacallan $echo "*** Warning: Linking the shared library $output against the loadable module" 2620f7ec340bSmacallan fi 2621f7ec340bSmacallan $echo "*** $linklib is not portable!" 2622f7ec340bSmacallan fi 2623f7ec340bSmacallan if test "$linkmode" = lib && 2624f7ec340bSmacallan test "$hardcode_into_libs" = yes; then 2625f7ec340bSmacallan # Hardcode the library path. 2626f7ec340bSmacallan # Skip directories that are in the system default run-time 2627f7ec340bSmacallan # search path. 2628f7ec340bSmacallan case " $sys_lib_dlsearch_path " in 2629f7ec340bSmacallan *" $absdir "*) ;; 2630f7ec340bSmacallan *) 2631f7ec340bSmacallan case "$compile_rpath " in 2632f7ec340bSmacallan *" $absdir "*) ;; 2633f7ec340bSmacallan *) compile_rpath="$compile_rpath $absdir" 2634f7ec340bSmacallan esac 2635f7ec340bSmacallan ;; 2636f7ec340bSmacallan esac 2637f7ec340bSmacallan case " $sys_lib_dlsearch_path " in 2638f7ec340bSmacallan *" $libdir "*) ;; 2639f7ec340bSmacallan *) 2640f7ec340bSmacallan case "$finalize_rpath " in 2641f7ec340bSmacallan *" $libdir "*) ;; 2642f7ec340bSmacallan *) finalize_rpath="$finalize_rpath $libdir" 2643f7ec340bSmacallan esac 2644f7ec340bSmacallan ;; 2645f7ec340bSmacallan esac 2646f7ec340bSmacallan fi 2647f7ec340bSmacallan 2648f7ec340bSmacallan if test -n "$old_archive_from_expsyms_cmds"; then 2649f7ec340bSmacallan # figure out the soname 2650f7ec340bSmacallan set dummy $library_names 2651f7ec340bSmacallan realname="$2" 2652f7ec340bSmacallan shift; shift 2653f7ec340bSmacallan libname=`eval \\$echo \"$libname_spec\"` 2654f7ec340bSmacallan # use dlname if we got it. it's perfectly good, no? 2655f7ec340bSmacallan if test -n "$dlname"; then 2656f7ec340bSmacallan soname="$dlname" 2657f7ec340bSmacallan elif test -n "$soname_spec"; then 2658f7ec340bSmacallan # bleh windows 2659f7ec340bSmacallan case $host in 2660f7ec340bSmacallan *cygwin* | mingw*) 2661f7ec340bSmacallan major=`expr $current - $age` 2662f7ec340bSmacallan versuffix="-$major" 2663f7ec340bSmacallan ;; 2664f7ec340bSmacallan esac 2665f7ec340bSmacallan eval soname=\"$soname_spec\" 2666f7ec340bSmacallan else 2667f7ec340bSmacallan soname="$realname" 2668f7ec340bSmacallan fi 2669f7ec340bSmacallan 2670f7ec340bSmacallan # Make a new name for the extract_expsyms_cmds to use 2671f7ec340bSmacallan soroot="$soname" 2672f7ec340bSmacallan soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 2673f7ec340bSmacallan newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 2674f7ec340bSmacallan 2675f7ec340bSmacallan # If the library has no export list, then create one now 2676f7ec340bSmacallan if test -f "$output_objdir/$soname-def"; then : 2677f7ec340bSmacallan else 2678f7ec340bSmacallan $show "extracting exported symbol list from \`$soname'" 2679f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 2680f7ec340bSmacallan cmds=$extract_expsyms_cmds 2681f7ec340bSmacallan for cmd in $cmds; do 2682f7ec340bSmacallan IFS="$save_ifs" 2683f7ec340bSmacallan eval cmd=\"$cmd\" 2684f7ec340bSmacallan $show "$cmd" 2685f7ec340bSmacallan $run eval "$cmd" || exit $? 2686f7ec340bSmacallan done 2687f7ec340bSmacallan IFS="$save_ifs" 2688f7ec340bSmacallan fi 2689f7ec340bSmacallan 2690f7ec340bSmacallan # Create $newlib 2691f7ec340bSmacallan if test -f "$output_objdir/$newlib"; then :; else 2692f7ec340bSmacallan $show "generating import library for \`$soname'" 2693f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 2694f7ec340bSmacallan cmds=$old_archive_from_expsyms_cmds 2695f7ec340bSmacallan for cmd in $cmds; do 2696f7ec340bSmacallan IFS="$save_ifs" 2697f7ec340bSmacallan eval cmd=\"$cmd\" 2698f7ec340bSmacallan $show "$cmd" 2699f7ec340bSmacallan $run eval "$cmd" || exit $? 2700f7ec340bSmacallan done 2701f7ec340bSmacallan IFS="$save_ifs" 2702f7ec340bSmacallan fi 2703f7ec340bSmacallan # make sure the library variables are pointing to the new library 2704f7ec340bSmacallan dir=$output_objdir 2705f7ec340bSmacallan linklib=$newlib 2706f7ec340bSmacallan fi # test -n "$old_archive_from_expsyms_cmds" 2707f7ec340bSmacallan 2708f7ec340bSmacallan if test "$linkmode" = prog || test "$mode" != relink; then 2709f7ec340bSmacallan add_shlibpath= 2710f7ec340bSmacallan add_dir= 2711f7ec340bSmacallan add= 2712f7ec340bSmacallan lib_linked=yes 2713f7ec340bSmacallan case $hardcode_action in 2714f7ec340bSmacallan immediate | unsupported) 2715f7ec340bSmacallan if test "$hardcode_direct" = no; then 2716f7ec340bSmacallan add="$dir/$linklib" 2717f7ec340bSmacallan case $host in 2718f7ec340bSmacallan *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 2719f7ec340bSmacallan *-*-sysv4*uw2*) add_dir="-L$dir" ;; 2720f7ec340bSmacallan *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 2721f7ec340bSmacallan *-*-unixware7*) add_dir="-L$dir" ;; 2722f7ec340bSmacallan *-*-darwin* ) 2723f7ec340bSmacallan # if the lib is a module then we can not link against 2724f7ec340bSmacallan # it, someone is ignoring the new warnings I added 2725f7ec340bSmacallan if /usr/bin/file -L $add 2> /dev/null | 2726f7ec340bSmacallan $EGREP ": [^:]* bundle" >/dev/null ; then 2727f7ec340bSmacallan $echo "** Warning, lib $linklib is a module, not a shared library" 2728f7ec340bSmacallan if test -z "$old_library" ; then 2729f7ec340bSmacallan $echo 2730f7ec340bSmacallan $echo "** And there doesn't seem to be a static archive available" 2731f7ec340bSmacallan $echo "** The link will probably fail, sorry" 2732f7ec340bSmacallan else 2733f7ec340bSmacallan add="$dir/$old_library" 2734f7ec340bSmacallan fi 2735f7ec340bSmacallan fi 2736f7ec340bSmacallan esac 2737f7ec340bSmacallan elif test "$hardcode_minus_L" = no; then 2738f7ec340bSmacallan case $host in 2739f7ec340bSmacallan *-*-sunos*) add_shlibpath="$dir" ;; 2740f7ec340bSmacallan esac 2741f7ec340bSmacallan add_dir="-L$dir" 2742f7ec340bSmacallan add="-l$name" 2743f7ec340bSmacallan elif test "$hardcode_shlibpath_var" = no; then 2744f7ec340bSmacallan add_shlibpath="$dir" 2745f7ec340bSmacallan add="-l$name" 2746f7ec340bSmacallan else 2747f7ec340bSmacallan lib_linked=no 2748f7ec340bSmacallan fi 2749f7ec340bSmacallan ;; 2750f7ec340bSmacallan relink) 2751f7ec340bSmacallan if test "$hardcode_direct" = yes; then 2752f7ec340bSmacallan add="$dir/$linklib" 2753f7ec340bSmacallan elif test "$hardcode_minus_L" = yes; then 2754f7ec340bSmacallan add_dir="-L$dir" 2755f7ec340bSmacallan # Try looking first in the location we're being installed to. 2756f7ec340bSmacallan if test -n "$inst_prefix_dir"; then 2757f7ec340bSmacallan case $libdir in 2758f7ec340bSmacallan [\\/]*) 2759f7ec340bSmacallan add_dir="$add_dir -L$inst_prefix_dir$libdir" 2760f7ec340bSmacallan ;; 2761f7ec340bSmacallan esac 2762f7ec340bSmacallan fi 2763f7ec340bSmacallan add="-l$name" 2764f7ec340bSmacallan elif test "$hardcode_shlibpath_var" = yes; then 2765f7ec340bSmacallan add_shlibpath="$dir" 2766f7ec340bSmacallan add="-l$name" 2767f7ec340bSmacallan else 2768f7ec340bSmacallan lib_linked=no 2769f7ec340bSmacallan fi 2770f7ec340bSmacallan ;; 2771f7ec340bSmacallan *) lib_linked=no ;; 2772f7ec340bSmacallan esac 2773f7ec340bSmacallan 2774f7ec340bSmacallan if test "$lib_linked" != yes; then 2775f7ec340bSmacallan $echo "$modename: configuration error: unsupported hardcode properties" 2776f7ec340bSmacallan exit $EXIT_FAILURE 2777f7ec340bSmacallan fi 2778f7ec340bSmacallan 2779f7ec340bSmacallan if test -n "$add_shlibpath"; then 2780f7ec340bSmacallan case :$compile_shlibpath: in 2781f7ec340bSmacallan *":$add_shlibpath:"*) ;; 2782f7ec340bSmacallan *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2783f7ec340bSmacallan esac 2784f7ec340bSmacallan fi 2785f7ec340bSmacallan if test "$linkmode" = prog; then 2786f7ec340bSmacallan test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2787f7ec340bSmacallan test -n "$add" && compile_deplibs="$add $compile_deplibs" 2788f7ec340bSmacallan else 2789f7ec340bSmacallan test -n "$add_dir" && deplibs="$add_dir $deplibs" 2790f7ec340bSmacallan test -n "$add" && deplibs="$add $deplibs" 2791f7ec340bSmacallan if test "$hardcode_direct" != yes && \ 2792f7ec340bSmacallan test "$hardcode_minus_L" != yes && \ 2793f7ec340bSmacallan test "$hardcode_shlibpath_var" = yes; then 2794f7ec340bSmacallan case :$finalize_shlibpath: in 2795f7ec340bSmacallan *":$libdir:"*) ;; 2796f7ec340bSmacallan *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2797f7ec340bSmacallan esac 2798f7ec340bSmacallan fi 2799f7ec340bSmacallan fi 2800f7ec340bSmacallan fi 2801f7ec340bSmacallan 2802f7ec340bSmacallan if test "$linkmode" = prog || test "$mode" = relink; then 2803f7ec340bSmacallan add_shlibpath= 2804f7ec340bSmacallan add_dir= 2805f7ec340bSmacallan add= 2806f7ec340bSmacallan # Finalize command for both is simple: just hardcode it. 2807f7ec340bSmacallan if test "$hardcode_direct" = yes; then 2808f7ec340bSmacallan add="$libdir/$linklib" 2809f7ec340bSmacallan elif test "$hardcode_minus_L" = yes; then 2810f7ec340bSmacallan add_dir="-L$libdir" 2811f7ec340bSmacallan add="-l$name" 2812f7ec340bSmacallan elif test "$hardcode_shlibpath_var" = yes; then 2813f7ec340bSmacallan case :$finalize_shlibpath: in 2814f7ec340bSmacallan *":$libdir:"*) ;; 2815f7ec340bSmacallan *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2816f7ec340bSmacallan esac 2817f7ec340bSmacallan add="-l$name" 2818f7ec340bSmacallan elif test "$hardcode_automatic" = yes; then 2819f7ec340bSmacallan if test -n "$inst_prefix_dir" && 2820f7ec340bSmacallan test -f "$inst_prefix_dir$libdir/$linklib" ; then 2821f7ec340bSmacallan add="$inst_prefix_dir$libdir/$linklib" 2822f7ec340bSmacallan else 2823f7ec340bSmacallan add="$libdir/$linklib" 2824f7ec340bSmacallan fi 2825f7ec340bSmacallan else 2826f7ec340bSmacallan # We cannot seem to hardcode it, guess we'll fake it. 2827f7ec340bSmacallan add_dir="-L$libdir" 2828f7ec340bSmacallan # Try looking first in the location we're being installed to. 2829f7ec340bSmacallan if test -n "$inst_prefix_dir"; then 2830f7ec340bSmacallan case $libdir in 2831f7ec340bSmacallan [\\/]*) 2832f7ec340bSmacallan add_dir="$add_dir -L$inst_prefix_dir$libdir" 2833f7ec340bSmacallan ;; 2834f7ec340bSmacallan esac 2835f7ec340bSmacallan fi 2836f7ec340bSmacallan add="-l$name" 2837f7ec340bSmacallan fi 2838f7ec340bSmacallan 2839f7ec340bSmacallan if test "$linkmode" = prog; then 2840f7ec340bSmacallan test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2841f7ec340bSmacallan test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2842f7ec340bSmacallan else 2843f7ec340bSmacallan test -n "$add_dir" && deplibs="$add_dir $deplibs" 2844f7ec340bSmacallan test -n "$add" && deplibs="$add $deplibs" 2845f7ec340bSmacallan fi 2846f7ec340bSmacallan fi 2847f7ec340bSmacallan elif test "$linkmode" = prog; then 2848f7ec340bSmacallan # Here we assume that one of hardcode_direct or hardcode_minus_L 2849f7ec340bSmacallan # is not unsupported. This is valid on all known static and 2850f7ec340bSmacallan # shared platforms. 2851f7ec340bSmacallan if test "$hardcode_direct" != unsupported; then 2852f7ec340bSmacallan test -n "$old_library" && linklib="$old_library" 2853f7ec340bSmacallan compile_deplibs="$dir/$linklib $compile_deplibs" 2854f7ec340bSmacallan finalize_deplibs="$dir/$linklib $finalize_deplibs" 2855f7ec340bSmacallan else 2856f7ec340bSmacallan compile_deplibs="-l$name -L$dir $compile_deplibs" 2857f7ec340bSmacallan finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2858f7ec340bSmacallan fi 2859f7ec340bSmacallan elif test "$build_libtool_libs" = yes; then 2860f7ec340bSmacallan # Not a shared library 2861f7ec340bSmacallan if test "$deplibs_check_method" != pass_all; then 2862f7ec340bSmacallan # We're trying link a shared library against a static one 2863f7ec340bSmacallan # but the system doesn't support it. 2864f7ec340bSmacallan 2865f7ec340bSmacallan # Just print a warning and add the library to dependency_libs so 2866f7ec340bSmacallan # that the program can be linked against the static library. 2867f7ec340bSmacallan $echo 2868f7ec340bSmacallan $echo "*** Warning: This system can not link to static lib archive $lib." 2869f7ec340bSmacallan $echo "*** I have the capability to make that library automatically link in when" 2870f7ec340bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 2871f7ec340bSmacallan $echo "*** shared version of the library, which you do not appear to have." 2872f7ec340bSmacallan if test "$module" = yes; then 2873f7ec340bSmacallan $echo "*** But as you try to build a module library, libtool will still create " 2874f7ec340bSmacallan $echo "*** a static module, that should work as long as the dlopening application" 2875f7ec340bSmacallan $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 2876f7ec340bSmacallan if test -z "$global_symbol_pipe"; then 2877f7ec340bSmacallan $echo 2878f7ec340bSmacallan $echo "*** However, this would only work if libtool was able to extract symbol" 2879f7ec340bSmacallan $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2880f7ec340bSmacallan $echo "*** not find such a program. So, this module is probably useless." 2881f7ec340bSmacallan $echo "*** \`nm' from GNU binutils and a full rebuild may help." 2882f7ec340bSmacallan fi 2883f7ec340bSmacallan if test "$build_old_libs" = no; then 2884f7ec340bSmacallan build_libtool_libs=module 2885f7ec340bSmacallan build_old_libs=yes 2886f7ec340bSmacallan else 2887f7ec340bSmacallan build_libtool_libs=no 2888f7ec340bSmacallan fi 2889f7ec340bSmacallan fi 2890f7ec340bSmacallan else 2891f7ec340bSmacallan deplibs="$dir/$old_library $deplibs" 2892f7ec340bSmacallan link_static=yes 2893f7ec340bSmacallan fi 2894f7ec340bSmacallan fi # link shared/static library? 2895f7ec340bSmacallan 2896f7ec340bSmacallan if test "$linkmode" = lib; then 2897f7ec340bSmacallan if test -n "$dependency_libs" && 2898f7ec340bSmacallan { test "$hardcode_into_libs" != yes || 2899f7ec340bSmacallan test "$build_old_libs" = yes || 2900f7ec340bSmacallan test "$link_static" = yes; }; then 2901f7ec340bSmacallan # Extract -R from dependency_libs 2902f7ec340bSmacallan temp_deplibs= 2903f7ec340bSmacallan for libdir in $dependency_libs; do 2904f7ec340bSmacallan case $libdir in 2905f7ec340bSmacallan -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2906f7ec340bSmacallan case " $xrpath " in 2907f7ec340bSmacallan *" $temp_xrpath "*) ;; 2908f7ec340bSmacallan *) xrpath="$xrpath $temp_xrpath";; 2909f7ec340bSmacallan esac;; 2910f7ec340bSmacallan *) temp_deplibs="$temp_deplibs $libdir";; 2911f7ec340bSmacallan esac 2912f7ec340bSmacallan done 2913f7ec340bSmacallan dependency_libs="$temp_deplibs" 2914f7ec340bSmacallan fi 2915f7ec340bSmacallan 2916f7ec340bSmacallan newlib_search_path="$newlib_search_path $absdir" 2917f7ec340bSmacallan # Link against this library 2918f7ec340bSmacallan test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2919f7ec340bSmacallan # ... and its dependency_libs 2920f7ec340bSmacallan tmp_libs= 2921f7ec340bSmacallan for deplib in $dependency_libs; do 2922f7ec340bSmacallan newdependency_libs="$deplib $newdependency_libs" 2923f7ec340bSmacallan if test "X$duplicate_deps" = "Xyes" ; then 2924f7ec340bSmacallan case "$tmp_libs " in 2925f7ec340bSmacallan *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2926f7ec340bSmacallan esac 2927f7ec340bSmacallan fi 2928f7ec340bSmacallan tmp_libs="$tmp_libs $deplib" 2929f7ec340bSmacallan done 2930f7ec340bSmacallan 2931f7ec340bSmacallan if test "$link_all_deplibs" != no; then 2932f7ec340bSmacallan # Add the search paths of all dependency libraries 2933f7ec340bSmacallan for deplib in $dependency_libs; do 2934f7ec340bSmacallan case $deplib in 2935f7ec340bSmacallan -L*) path="$deplib" ;; 2936f7ec340bSmacallan *.la) 2937f7ec340bSmacallan dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2938f7ec340bSmacallan test "X$dir" = "X$deplib" && dir="." 2939f7ec340bSmacallan # We need an absolute path. 2940f7ec340bSmacallan case $dir in 2941f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2942f7ec340bSmacallan *) 2943f7ec340bSmacallan absdir=`cd "$dir" && pwd` 2944f7ec340bSmacallan if test -z "$absdir"; then 2945f7ec340bSmacallan $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2946f7ec340bSmacallan absdir="$dir" 2947f7ec340bSmacallan fi 2948f7ec340bSmacallan ;; 2949f7ec340bSmacallan esac 2950f7ec340bSmacallan if grep "^installed=no" $deplib > /dev/null; then 2951f7ec340bSmacallan path="$absdir/$objdir" 2952f7ec340bSmacallan else 2953f7ec340bSmacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2954f7ec340bSmacallan if test -z "$libdir"; then 2955f7ec340bSmacallan $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2956f7ec340bSmacallan exit $EXIT_FAILURE 2957f7ec340bSmacallan fi 2958f7ec340bSmacallan if test "$absdir" != "$libdir"; then 2959f7ec340bSmacallan $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2960f7ec340bSmacallan fi 2961f7ec340bSmacallan path="$absdir" 2962f7ec340bSmacallan fi 2963f7ec340bSmacallan depdepl= 2964f7ec340bSmacallan case $host in 2965f7ec340bSmacallan *-*-darwin*) 2966f7ec340bSmacallan # we do not want to link against static libs, 2967f7ec340bSmacallan # but need to link against shared 2968f7ec340bSmacallan eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 29697ce7e03cSmrg eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2970f7ec340bSmacallan if test -n "$deplibrary_names" ; then 2971f7ec340bSmacallan for tmp in $deplibrary_names ; do 2972f7ec340bSmacallan depdepl=$tmp 2973f7ec340bSmacallan done 29747ce7e03cSmrg if test -f "$deplibdir/$depdepl" ; then 29757ce7e03cSmrg depdepl="$deplibdir/$depdepl" 29767ce7e03cSmrg elif test -f "$path/$depdepl" ; then 2977f7ec340bSmacallan depdepl="$path/$depdepl" 29787ce7e03cSmrg else 29797ce7e03cSmrg # Can't find it, oh well... 29807ce7e03cSmrg depdepl= 2981f7ec340bSmacallan fi 2982f7ec340bSmacallan # do not add paths which are already there 2983f7ec340bSmacallan case " $newlib_search_path " in 2984f7ec340bSmacallan *" $path "*) ;; 2985f7ec340bSmacallan *) newlib_search_path="$newlib_search_path $path";; 2986f7ec340bSmacallan esac 2987f7ec340bSmacallan fi 2988f7ec340bSmacallan path="" 2989f7ec340bSmacallan ;; 2990f7ec340bSmacallan *) 2991f7ec340bSmacallan path="-L$path" 2992f7ec340bSmacallan ;; 2993f7ec340bSmacallan esac 2994f7ec340bSmacallan ;; 2995f7ec340bSmacallan -l*) 2996f7ec340bSmacallan case $host in 2997f7ec340bSmacallan *-*-darwin*) 2998f7ec340bSmacallan # Again, we only want to link against shared libraries 2999f7ec340bSmacallan eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 3000f7ec340bSmacallan for tmp in $newlib_search_path ; do 3001f7ec340bSmacallan if test -f "$tmp/lib$tmp_libs.dylib" ; then 3002f7ec340bSmacallan eval depdepl="$tmp/lib$tmp_libs.dylib" 3003f7ec340bSmacallan break 3004f7ec340bSmacallan fi 3005f7ec340bSmacallan done 3006f7ec340bSmacallan path="" 3007f7ec340bSmacallan ;; 3008f7ec340bSmacallan *) continue ;; 3009f7ec340bSmacallan esac 3010f7ec340bSmacallan ;; 3011f7ec340bSmacallan *) continue ;; 3012f7ec340bSmacallan esac 3013f7ec340bSmacallan case " $deplibs " in 3014f7ec340bSmacallan *" $path "*) ;; 3015f7ec340bSmacallan *) deplibs="$path $deplibs" ;; 3016f7ec340bSmacallan esac 3017f7ec340bSmacallan case " $deplibs " in 3018f7ec340bSmacallan *" $depdepl "*) ;; 3019f7ec340bSmacallan *) deplibs="$depdepl $deplibs" ;; 3020f7ec340bSmacallan esac 3021f7ec340bSmacallan done 3022f7ec340bSmacallan fi # link_all_deplibs != no 3023f7ec340bSmacallan fi # linkmode = lib 3024f7ec340bSmacallan done # for deplib in $libs 3025f7ec340bSmacallan dependency_libs="$newdependency_libs" 3026f7ec340bSmacallan if test "$pass" = dlpreopen; then 3027f7ec340bSmacallan # Link the dlpreopened libraries before other libraries 3028f7ec340bSmacallan for deplib in $save_deplibs; do 3029f7ec340bSmacallan deplibs="$deplib $deplibs" 3030f7ec340bSmacallan done 3031f7ec340bSmacallan fi 3032f7ec340bSmacallan if test "$pass" != dlopen; then 3033f7ec340bSmacallan if test "$pass" != conv; then 3034f7ec340bSmacallan # Make sure lib_search_path contains only unique directories. 3035f7ec340bSmacallan lib_search_path= 3036f7ec340bSmacallan for dir in $newlib_search_path; do 3037f7ec340bSmacallan case "$lib_search_path " in 3038f7ec340bSmacallan *" $dir "*) ;; 3039f7ec340bSmacallan *) lib_search_path="$lib_search_path $dir" ;; 3040f7ec340bSmacallan esac 3041f7ec340bSmacallan done 3042f7ec340bSmacallan newlib_search_path= 3043f7ec340bSmacallan fi 3044f7ec340bSmacallan 3045f7ec340bSmacallan if test "$linkmode,$pass" != "prog,link"; then 3046f7ec340bSmacallan vars="deplibs" 3047f7ec340bSmacallan else 3048f7ec340bSmacallan vars="compile_deplibs finalize_deplibs" 3049f7ec340bSmacallan fi 3050f7ec340bSmacallan for var in $vars dependency_libs; do 3051f7ec340bSmacallan # Add libraries to $var in reverse order 3052f7ec340bSmacallan eval tmp_libs=\"\$$var\" 3053f7ec340bSmacallan new_libs= 3054f7ec340bSmacallan for deplib in $tmp_libs; do 3055f7ec340bSmacallan # FIXME: Pedantically, this is the right thing to do, so 3056f7ec340bSmacallan # that some nasty dependency loop isn't accidentally 3057f7ec340bSmacallan # broken: 3058f7ec340bSmacallan #new_libs="$deplib $new_libs" 3059f7ec340bSmacallan # Pragmatically, this seems to cause very few problems in 3060f7ec340bSmacallan # practice: 3061f7ec340bSmacallan case $deplib in 3062f7ec340bSmacallan -L*) new_libs="$deplib $new_libs" ;; 3063f7ec340bSmacallan -R*) ;; 3064f7ec340bSmacallan *) 3065f7ec340bSmacallan # And here is the reason: when a library appears more 3066f7ec340bSmacallan # than once as an explicit dependence of a library, or 3067f7ec340bSmacallan # is implicitly linked in more than once by the 3068f7ec340bSmacallan # compiler, it is considered special, and multiple 3069f7ec340bSmacallan # occurrences thereof are not removed. Compare this 3070f7ec340bSmacallan # with having the same library being listed as a 3071f7ec340bSmacallan # dependency of multiple other libraries: in this case, 3072f7ec340bSmacallan # we know (pedantically, we assume) the library does not 3073f7ec340bSmacallan # need to be listed more than once, so we keep only the 3074f7ec340bSmacallan # last copy. This is not always right, but it is rare 3075f7ec340bSmacallan # enough that we require users that really mean to play 3076f7ec340bSmacallan # such unportable linking tricks to link the library 3077f7ec340bSmacallan # using -Wl,-lname, so that libtool does not consider it 3078f7ec340bSmacallan # for duplicate removal. 3079f7ec340bSmacallan case " $specialdeplibs " in 3080f7ec340bSmacallan *" $deplib "*) new_libs="$deplib $new_libs" ;; 3081f7ec340bSmacallan *) 3082f7ec340bSmacallan case " $new_libs " in 3083f7ec340bSmacallan *" $deplib "*) ;; 3084f7ec340bSmacallan *) new_libs="$deplib $new_libs" ;; 3085f7ec340bSmacallan esac 3086f7ec340bSmacallan ;; 3087f7ec340bSmacallan esac 3088f7ec340bSmacallan ;; 3089f7ec340bSmacallan esac 3090f7ec340bSmacallan done 3091f7ec340bSmacallan tmp_libs= 3092f7ec340bSmacallan for deplib in $new_libs; do 3093f7ec340bSmacallan case $deplib in 3094f7ec340bSmacallan -L*) 3095f7ec340bSmacallan case " $tmp_libs " in 3096f7ec340bSmacallan *" $deplib "*) ;; 3097f7ec340bSmacallan *) tmp_libs="$tmp_libs $deplib" ;; 3098f7ec340bSmacallan esac 3099f7ec340bSmacallan ;; 3100f7ec340bSmacallan *) tmp_libs="$tmp_libs $deplib" ;; 3101f7ec340bSmacallan esac 3102f7ec340bSmacallan done 3103f7ec340bSmacallan eval $var=\"$tmp_libs\" 3104f7ec340bSmacallan done # for var 3105f7ec340bSmacallan fi 3106f7ec340bSmacallan # Last step: remove runtime libs from dependency_libs 3107f7ec340bSmacallan # (they stay in deplibs) 3108f7ec340bSmacallan tmp_libs= 3109f7ec340bSmacallan for i in $dependency_libs ; do 3110f7ec340bSmacallan case " $predeps $postdeps $compiler_lib_search_path " in 3111f7ec340bSmacallan *" $i "*) 3112f7ec340bSmacallan i="" 3113f7ec340bSmacallan ;; 3114f7ec340bSmacallan esac 3115f7ec340bSmacallan if test -n "$i" ; then 3116f7ec340bSmacallan tmp_libs="$tmp_libs $i" 3117f7ec340bSmacallan fi 3118f7ec340bSmacallan done 3119f7ec340bSmacallan dependency_libs=$tmp_libs 3120f7ec340bSmacallan done # for pass 3121f7ec340bSmacallan if test "$linkmode" = prog; then 3122f7ec340bSmacallan dlfiles="$newdlfiles" 3123f7ec340bSmacallan dlprefiles="$newdlprefiles" 3124f7ec340bSmacallan fi 3125f7ec340bSmacallan 3126f7ec340bSmacallan case $linkmode in 3127f7ec340bSmacallan oldlib) 31287ce7e03cSmrg case " $deplibs" in 31297ce7e03cSmrg *\ -l* | *\ -L*) 31307ce7e03cSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 31317ce7e03cSmrg esac 3132f7ec340bSmacallan 3133f7ec340bSmacallan if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3134f7ec340bSmacallan $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 3135f7ec340bSmacallan fi 3136f7ec340bSmacallan 3137f7ec340bSmacallan if test -n "$rpath"; then 3138f7ec340bSmacallan $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 3139f7ec340bSmacallan fi 3140f7ec340bSmacallan 3141f7ec340bSmacallan if test -n "$xrpath"; then 3142f7ec340bSmacallan $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 3143f7ec340bSmacallan fi 3144f7ec340bSmacallan 3145f7ec340bSmacallan if test -n "$vinfo"; then 3146f7ec340bSmacallan $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 3147f7ec340bSmacallan fi 3148f7ec340bSmacallan 3149f7ec340bSmacallan if test -n "$release"; then 3150f7ec340bSmacallan $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 3151f7ec340bSmacallan fi 3152f7ec340bSmacallan 3153f7ec340bSmacallan if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3154f7ec340bSmacallan $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 3155f7ec340bSmacallan fi 3156f7ec340bSmacallan 3157f7ec340bSmacallan # Now set the variables for building old libraries. 3158f7ec340bSmacallan build_libtool_libs=no 3159f7ec340bSmacallan oldlibs="$output" 3160f7ec340bSmacallan objs="$objs$old_deplibs" 3161f7ec340bSmacallan ;; 3162f7ec340bSmacallan 3163f7ec340bSmacallan lib) 3164f7ec340bSmacallan # Make sure we only generate libraries of the form `libNAME.la'. 3165f7ec340bSmacallan case $outputname in 3166f7ec340bSmacallan lib*) 3167f7ec340bSmacallan name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 3168f7ec340bSmacallan eval shared_ext=\"$shrext_cmds\" 3169f7ec340bSmacallan eval libname=\"$libname_spec\" 3170f7ec340bSmacallan ;; 3171f7ec340bSmacallan *) 3172f7ec340bSmacallan if test "$module" = no; then 3173f7ec340bSmacallan $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 3174f7ec340bSmacallan $echo "$help" 1>&2 3175f7ec340bSmacallan exit $EXIT_FAILURE 3176f7ec340bSmacallan fi 3177f7ec340bSmacallan if test "$need_lib_prefix" != no; then 3178f7ec340bSmacallan # Add the "lib" prefix for modules if required 3179f7ec340bSmacallan name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3180f7ec340bSmacallan eval shared_ext=\"$shrext_cmds\" 3181f7ec340bSmacallan eval libname=\"$libname_spec\" 3182f7ec340bSmacallan else 3183f7ec340bSmacallan libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3184f7ec340bSmacallan fi 3185f7ec340bSmacallan ;; 3186f7ec340bSmacallan esac 3187f7ec340bSmacallan 3188f7ec340bSmacallan if test -n "$objs"; then 3189f7ec340bSmacallan if test "$deplibs_check_method" != pass_all; then 3190f7ec340bSmacallan $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 3191f7ec340bSmacallan exit $EXIT_FAILURE 3192f7ec340bSmacallan else 3193f7ec340bSmacallan $echo 3194f7ec340bSmacallan $echo "*** Warning: Linking the shared library $output against the non-libtool" 3195f7ec340bSmacallan $echo "*** objects $objs is not portable!" 3196f7ec340bSmacallan libobjs="$libobjs $objs" 3197f7ec340bSmacallan fi 3198f7ec340bSmacallan fi 3199f7ec340bSmacallan 3200f7ec340bSmacallan if test "$dlself" != no; then 3201f7ec340bSmacallan $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 3202f7ec340bSmacallan fi 3203f7ec340bSmacallan 3204f7ec340bSmacallan set dummy $rpath 3205f7ec340bSmacallan if test "$#" -gt 2; then 3206f7ec340bSmacallan $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 3207f7ec340bSmacallan fi 3208f7ec340bSmacallan install_libdir="$2" 3209f7ec340bSmacallan 3210f7ec340bSmacallan oldlibs= 3211f7ec340bSmacallan if test -z "$rpath"; then 3212f7ec340bSmacallan if test "$build_libtool_libs" = yes; then 3213f7ec340bSmacallan # Building a libtool convenience library. 3214f7ec340bSmacallan # Some compilers have problems with a `.al' extension so 3215f7ec340bSmacallan # convenience libraries should have the same extension an 3216f7ec340bSmacallan # archive normally would. 3217f7ec340bSmacallan oldlibs="$output_objdir/$libname.$libext $oldlibs" 3218f7ec340bSmacallan build_libtool_libs=convenience 3219f7ec340bSmacallan build_old_libs=yes 3220f7ec340bSmacallan fi 3221f7ec340bSmacallan 3222f7ec340bSmacallan if test -n "$vinfo"; then 3223f7ec340bSmacallan $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 3224f7ec340bSmacallan fi 3225f7ec340bSmacallan 3226f7ec340bSmacallan if test -n "$release"; then 3227f7ec340bSmacallan $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 3228f7ec340bSmacallan fi 3229f7ec340bSmacallan else 3230f7ec340bSmacallan 3231f7ec340bSmacallan # Parse the version information argument. 3232f7ec340bSmacallan save_ifs="$IFS"; IFS=':' 3233f7ec340bSmacallan set dummy $vinfo 0 0 0 3234f7ec340bSmacallan IFS="$save_ifs" 3235f7ec340bSmacallan 3236f7ec340bSmacallan if test -n "$8"; then 3237f7ec340bSmacallan $echo "$modename: too many parameters to \`-version-info'" 1>&2 3238f7ec340bSmacallan $echo "$help" 1>&2 3239f7ec340bSmacallan exit $EXIT_FAILURE 3240f7ec340bSmacallan fi 3241f7ec340bSmacallan 3242f7ec340bSmacallan # convert absolute version numbers to libtool ages 3243f7ec340bSmacallan # this retains compatibility with .la files and attempts 3244f7ec340bSmacallan # to make the code below a bit more comprehensible 3245f7ec340bSmacallan 3246f7ec340bSmacallan case $vinfo_number in 3247f7ec340bSmacallan yes) 3248f7ec340bSmacallan number_major="$2" 3249f7ec340bSmacallan number_minor="$3" 3250f7ec340bSmacallan number_revision="$4" 3251f7ec340bSmacallan # 3252f7ec340bSmacallan # There are really only two kinds -- those that 3253f7ec340bSmacallan # use the current revision as the major version 3254f7ec340bSmacallan # and those that subtract age and use age as 3255f7ec340bSmacallan # a minor version. But, then there is irix 3256f7ec340bSmacallan # which has an extra 1 added just for fun 3257f7ec340bSmacallan # 3258f7ec340bSmacallan case $version_type in 32597ce7e03cSmrg darwin|linux|osf|windows|none) 3260f7ec340bSmacallan current=`expr $number_major + $number_minor` 3261f7ec340bSmacallan age="$number_minor" 3262f7ec340bSmacallan revision="$number_revision" 3263f7ec340bSmacallan ;; 3264f7ec340bSmacallan freebsd-aout|freebsd-elf|sunos) 3265f7ec340bSmacallan current="$number_major" 3266f7ec340bSmacallan revision="$number_minor" 3267f7ec340bSmacallan age="0" 3268f7ec340bSmacallan ;; 3269f7ec340bSmacallan irix|nonstopux) 32707ce7e03cSmrg current=`expr $number_major + $number_minor` 3271f7ec340bSmacallan age="$number_minor" 3272f7ec340bSmacallan revision="$number_minor" 32737ce7e03cSmrg lt_irix_increment=no 32747ce7e03cSmrg ;; 32757ce7e03cSmrg *) 32767ce7e03cSmrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 32777ce7e03cSmrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 32787ce7e03cSmrg exit $EXIT_FAILURE 3279f7ec340bSmacallan ;; 3280f7ec340bSmacallan esac 3281f7ec340bSmacallan ;; 3282f7ec340bSmacallan no) 3283f7ec340bSmacallan current="$2" 3284f7ec340bSmacallan revision="$3" 3285f7ec340bSmacallan age="$4" 3286f7ec340bSmacallan ;; 3287f7ec340bSmacallan esac 3288f7ec340bSmacallan 3289f7ec340bSmacallan # Check that each of the things are valid numbers. 3290f7ec340bSmacallan case $current in 3291f7ec340bSmacallan 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]) ;; 3292f7ec340bSmacallan *) 3293f7ec340bSmacallan $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 3294f7ec340bSmacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3295f7ec340bSmacallan exit $EXIT_FAILURE 3296f7ec340bSmacallan ;; 3297f7ec340bSmacallan esac 3298f7ec340bSmacallan 3299f7ec340bSmacallan case $revision in 3300f7ec340bSmacallan 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]) ;; 3301f7ec340bSmacallan *) 3302f7ec340bSmacallan $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 3303f7ec340bSmacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3304f7ec340bSmacallan exit $EXIT_FAILURE 3305f7ec340bSmacallan ;; 3306f7ec340bSmacallan esac 3307f7ec340bSmacallan 3308f7ec340bSmacallan case $age in 3309f7ec340bSmacallan 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]) ;; 3310f7ec340bSmacallan *) 3311f7ec340bSmacallan $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 3312f7ec340bSmacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3313f7ec340bSmacallan exit $EXIT_FAILURE 3314f7ec340bSmacallan ;; 3315f7ec340bSmacallan esac 3316f7ec340bSmacallan 3317f7ec340bSmacallan if test "$age" -gt "$current"; then 3318f7ec340bSmacallan $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 3319f7ec340bSmacallan $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3320f7ec340bSmacallan exit $EXIT_FAILURE 3321f7ec340bSmacallan fi 3322f7ec340bSmacallan 3323f7ec340bSmacallan # Calculate the version variables. 3324f7ec340bSmacallan major= 3325f7ec340bSmacallan versuffix= 3326f7ec340bSmacallan verstring= 3327f7ec340bSmacallan case $version_type in 3328f7ec340bSmacallan none) ;; 3329f7ec340bSmacallan 3330f7ec340bSmacallan darwin) 3331f7ec340bSmacallan # Like Linux, but with the current version available in 3332f7ec340bSmacallan # verstring for coding it into the library header 3333f7ec340bSmacallan major=.`expr $current - $age` 3334f7ec340bSmacallan versuffix="$major.$age.$revision" 3335f7ec340bSmacallan # Darwin ld doesn't like 0 for these options... 3336f7ec340bSmacallan minor_current=`expr $current + 1` 33377ce7e03cSmrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 33387ce7e03cSmrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 3339f7ec340bSmacallan ;; 3340f7ec340bSmacallan 3341f7ec340bSmacallan freebsd-aout) 3342f7ec340bSmacallan major=".$current" 3343f7ec340bSmacallan versuffix=".$current.$revision"; 3344f7ec340bSmacallan ;; 3345f7ec340bSmacallan 3346f7ec340bSmacallan freebsd-elf) 3347f7ec340bSmacallan major=".$current" 3348f7ec340bSmacallan versuffix=".$current"; 3349f7ec340bSmacallan ;; 3350f7ec340bSmacallan 3351f7ec340bSmacallan irix | nonstopux) 33527ce7e03cSmrg if test "X$lt_irix_increment" = "Xno"; then 33537ce7e03cSmrg major=`expr $current - $age` 33547ce7e03cSmrg else 33557ce7e03cSmrg major=`expr $current - $age + 1` 33567ce7e03cSmrg fi 3357f7ec340bSmacallan case $version_type in 3358f7ec340bSmacallan nonstopux) verstring_prefix=nonstopux ;; 3359f7ec340bSmacallan *) verstring_prefix=sgi ;; 3360f7ec340bSmacallan esac 3361f7ec340bSmacallan verstring="$verstring_prefix$major.$revision" 3362f7ec340bSmacallan 3363f7ec340bSmacallan # Add in all the interfaces that we are compatible with. 3364f7ec340bSmacallan loop=$revision 3365f7ec340bSmacallan while test "$loop" -ne 0; do 3366f7ec340bSmacallan iface=`expr $revision - $loop` 3367f7ec340bSmacallan loop=`expr $loop - 1` 3368f7ec340bSmacallan verstring="$verstring_prefix$major.$iface:$verstring" 3369f7ec340bSmacallan done 3370f7ec340bSmacallan 3371f7ec340bSmacallan # Before this point, $major must not contain `.'. 3372f7ec340bSmacallan major=.$major 3373f7ec340bSmacallan versuffix="$major.$revision" 3374f7ec340bSmacallan ;; 3375f7ec340bSmacallan 3376f7ec340bSmacallan linux) 3377f7ec340bSmacallan major=.`expr $current - $age` 3378f7ec340bSmacallan versuffix="$major.$age.$revision" 3379f7ec340bSmacallan ;; 3380f7ec340bSmacallan 3381f7ec340bSmacallan osf) 3382f7ec340bSmacallan major=.`expr $current - $age` 3383f7ec340bSmacallan versuffix=".$current.$age.$revision" 3384f7ec340bSmacallan verstring="$current.$age.$revision" 3385f7ec340bSmacallan 3386f7ec340bSmacallan # Add in all the interfaces that we are compatible with. 3387f7ec340bSmacallan loop=$age 3388f7ec340bSmacallan while test "$loop" -ne 0; do 3389f7ec340bSmacallan iface=`expr $current - $loop` 3390f7ec340bSmacallan loop=`expr $loop - 1` 3391f7ec340bSmacallan verstring="$verstring:${iface}.0" 3392f7ec340bSmacallan done 3393f7ec340bSmacallan 3394f7ec340bSmacallan # Make executables depend on our current version. 3395f7ec340bSmacallan verstring="$verstring:${current}.0" 3396f7ec340bSmacallan ;; 3397f7ec340bSmacallan 3398f7ec340bSmacallan sunos) 3399f7ec340bSmacallan major=".$current" 3400f7ec340bSmacallan versuffix=".$current.$revision" 3401f7ec340bSmacallan ;; 3402f7ec340bSmacallan 3403f7ec340bSmacallan windows) 3404f7ec340bSmacallan # Use '-' rather than '.', since we only want one 3405f7ec340bSmacallan # extension on DOS 8.3 filesystems. 3406f7ec340bSmacallan major=`expr $current - $age` 3407f7ec340bSmacallan versuffix="-$major" 3408f7ec340bSmacallan ;; 3409f7ec340bSmacallan 3410f7ec340bSmacallan *) 3411f7ec340bSmacallan $echo "$modename: unknown library version type \`$version_type'" 1>&2 3412f7ec340bSmacallan $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 3413f7ec340bSmacallan exit $EXIT_FAILURE 3414f7ec340bSmacallan ;; 3415f7ec340bSmacallan esac 3416f7ec340bSmacallan 3417f7ec340bSmacallan # Clear the version info if we defaulted, and they specified a release. 3418f7ec340bSmacallan if test -z "$vinfo" && test -n "$release"; then 3419f7ec340bSmacallan major= 3420f7ec340bSmacallan case $version_type in 3421f7ec340bSmacallan darwin) 3422f7ec340bSmacallan # we can't check for "0.0" in archive_cmds due to quoting 3423f7ec340bSmacallan # problems, so we reset it completely 3424f7ec340bSmacallan verstring= 3425f7ec340bSmacallan ;; 3426f7ec340bSmacallan *) 3427f7ec340bSmacallan verstring="0.0" 3428f7ec340bSmacallan ;; 3429f7ec340bSmacallan esac 3430f7ec340bSmacallan if test "$need_version" = no; then 3431f7ec340bSmacallan versuffix= 3432f7ec340bSmacallan else 3433f7ec340bSmacallan versuffix=".0.0" 3434f7ec340bSmacallan fi 3435f7ec340bSmacallan fi 3436f7ec340bSmacallan 3437f7ec340bSmacallan # Remove version info from name if versioning should be avoided 3438f7ec340bSmacallan if test "$avoid_version" = yes && test "$need_version" = no; then 3439f7ec340bSmacallan major= 3440f7ec340bSmacallan versuffix= 3441f7ec340bSmacallan verstring="" 3442f7ec340bSmacallan fi 3443f7ec340bSmacallan 3444f7ec340bSmacallan # Check to see if the archive will have undefined symbols. 3445f7ec340bSmacallan if test "$allow_undefined" = yes; then 3446f7ec340bSmacallan if test "$allow_undefined_flag" = unsupported; then 3447f7ec340bSmacallan $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 3448f7ec340bSmacallan build_libtool_libs=no 3449f7ec340bSmacallan build_old_libs=yes 3450f7ec340bSmacallan fi 3451f7ec340bSmacallan else 3452f7ec340bSmacallan # Don't allow undefined symbols. 3453f7ec340bSmacallan allow_undefined_flag="$no_undefined_flag" 3454f7ec340bSmacallan fi 3455f7ec340bSmacallan fi 3456f7ec340bSmacallan 3457f7ec340bSmacallan if test "$mode" != relink; then 3458f7ec340bSmacallan # Remove our outputs, but don't remove object files since they 3459f7ec340bSmacallan # may have been created when compiling PIC objects. 3460f7ec340bSmacallan removelist= 3461f7ec340bSmacallan tempremovelist=`$echo "$output_objdir/*"` 3462f7ec340bSmacallan for p in $tempremovelist; do 3463f7ec340bSmacallan case $p in 3464f7ec340bSmacallan *.$objext) 3465f7ec340bSmacallan ;; 3466f7ec340bSmacallan $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 3467f7ec340bSmacallan if test "X$precious_files_regex" != "X"; then 3468f7ec340bSmacallan if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 3469f7ec340bSmacallan then 3470f7ec340bSmacallan continue 3471f7ec340bSmacallan fi 3472f7ec340bSmacallan fi 3473f7ec340bSmacallan removelist="$removelist $p" 3474f7ec340bSmacallan ;; 3475f7ec340bSmacallan *) ;; 3476f7ec340bSmacallan esac 3477f7ec340bSmacallan done 3478f7ec340bSmacallan if test -n "$removelist"; then 3479f7ec340bSmacallan $show "${rm}r $removelist" 3480f7ec340bSmacallan $run ${rm}r $removelist 3481f7ec340bSmacallan fi 3482f7ec340bSmacallan fi 3483f7ec340bSmacallan 3484f7ec340bSmacallan # Now set the variables for building old libraries. 3485f7ec340bSmacallan if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 3486f7ec340bSmacallan oldlibs="$oldlibs $output_objdir/$libname.$libext" 3487f7ec340bSmacallan 3488f7ec340bSmacallan # Transform .lo files to .o files. 3489f7ec340bSmacallan oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3490f7ec340bSmacallan fi 3491f7ec340bSmacallan 3492f7ec340bSmacallan # Eliminate all temporary directories. 34937ce7e03cSmrg #for path in $notinst_path; do 34947ce7e03cSmrg # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 34957ce7e03cSmrg # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 34967ce7e03cSmrg # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 34977ce7e03cSmrg #done 3498f7ec340bSmacallan 3499f7ec340bSmacallan if test -n "$xrpath"; then 3500f7ec340bSmacallan # If the user specified any rpath flags, then add them. 3501f7ec340bSmacallan temp_xrpath= 3502f7ec340bSmacallan for libdir in $xrpath; do 3503f7ec340bSmacallan temp_xrpath="$temp_xrpath -R$libdir" 3504f7ec340bSmacallan case "$finalize_rpath " in 3505f7ec340bSmacallan *" $libdir "*) ;; 3506f7ec340bSmacallan *) finalize_rpath="$finalize_rpath $libdir" ;; 3507f7ec340bSmacallan esac 3508f7ec340bSmacallan done 3509f7ec340bSmacallan if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 3510f7ec340bSmacallan dependency_libs="$temp_xrpath $dependency_libs" 3511f7ec340bSmacallan fi 3512f7ec340bSmacallan fi 3513f7ec340bSmacallan 3514f7ec340bSmacallan # Make sure dlfiles contains only unique files that won't be dlpreopened 3515f7ec340bSmacallan old_dlfiles="$dlfiles" 3516f7ec340bSmacallan dlfiles= 3517f7ec340bSmacallan for lib in $old_dlfiles; do 3518f7ec340bSmacallan case " $dlprefiles $dlfiles " in 3519f7ec340bSmacallan *" $lib "*) ;; 3520f7ec340bSmacallan *) dlfiles="$dlfiles $lib" ;; 3521f7ec340bSmacallan esac 3522f7ec340bSmacallan done 3523f7ec340bSmacallan 3524f7ec340bSmacallan # Make sure dlprefiles contains only unique files 3525f7ec340bSmacallan old_dlprefiles="$dlprefiles" 3526f7ec340bSmacallan dlprefiles= 3527f7ec340bSmacallan for lib in $old_dlprefiles; do 3528f7ec340bSmacallan case "$dlprefiles " in 3529f7ec340bSmacallan *" $lib "*) ;; 3530f7ec340bSmacallan *) dlprefiles="$dlprefiles $lib" ;; 3531f7ec340bSmacallan esac 3532f7ec340bSmacallan done 3533f7ec340bSmacallan 3534f7ec340bSmacallan if test "$build_libtool_libs" = yes; then 3535f7ec340bSmacallan if test -n "$rpath"; then 3536f7ec340bSmacallan case $host in 3537f7ec340bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 3538f7ec340bSmacallan # these systems don't actually have a c library (as such)! 3539f7ec340bSmacallan ;; 3540f7ec340bSmacallan *-*-rhapsody* | *-*-darwin1.[012]) 3541f7ec340bSmacallan # Rhapsody C library is in the System framework 3542f7ec340bSmacallan deplibs="$deplibs -framework System" 3543f7ec340bSmacallan ;; 3544f7ec340bSmacallan *-*-netbsd*) 3545f7ec340bSmacallan # Don't link with libc until the a.out ld.so is fixed. 3546f7ec340bSmacallan ;; 3547f7ec340bSmacallan *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3548f7ec340bSmacallan # Do not include libc due to us having libc/libc_r. 3549f7ec340bSmacallan ;; 3550f7ec340bSmacallan *-*-sco3.2v5* | *-*-sco5v6*) 3551f7ec340bSmacallan # Causes problems with __ctype 3552f7ec340bSmacallan ;; 3553f7ec340bSmacallan *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 3554f7ec340bSmacallan # Compiler inserts libc in the correct place for threads to work 3555f7ec340bSmacallan ;; 3556f7ec340bSmacallan *) 3557f7ec340bSmacallan # Add libc to deplibs on all other systems if necessary. 3558f7ec340bSmacallan if test "$build_libtool_need_lc" = "yes"; then 3559f7ec340bSmacallan deplibs="$deplibs -lc" 3560f7ec340bSmacallan fi 3561f7ec340bSmacallan ;; 3562f7ec340bSmacallan esac 3563f7ec340bSmacallan fi 3564f7ec340bSmacallan 3565f7ec340bSmacallan # Transform deplibs into only deplibs that can be linked in shared. 3566f7ec340bSmacallan name_save=$name 3567f7ec340bSmacallan libname_save=$libname 3568f7ec340bSmacallan release_save=$release 3569f7ec340bSmacallan versuffix_save=$versuffix 3570f7ec340bSmacallan major_save=$major 3571f7ec340bSmacallan # I'm not sure if I'm treating the release correctly. I think 3572f7ec340bSmacallan # release should show up in the -l (ie -lgmp5) so we don't want to 3573f7ec340bSmacallan # add it in twice. Is that correct? 3574f7ec340bSmacallan release="" 3575f7ec340bSmacallan versuffix="" 3576f7ec340bSmacallan major="" 3577f7ec340bSmacallan newdeplibs= 3578f7ec340bSmacallan droppeddeps=no 3579f7ec340bSmacallan case $deplibs_check_method in 3580f7ec340bSmacallan pass_all) 3581f7ec340bSmacallan # Don't check for shared/static. Everything works. 3582f7ec340bSmacallan # This might be a little naive. We might want to check 3583f7ec340bSmacallan # whether the library exists or not. But this is on 3584f7ec340bSmacallan # osf3 & osf4 and I'm not really sure... Just 3585f7ec340bSmacallan # implementing what was already the behavior. 3586f7ec340bSmacallan newdeplibs=$deplibs 3587f7ec340bSmacallan ;; 3588f7ec340bSmacallan test_compile) 3589f7ec340bSmacallan # This code stresses the "libraries are programs" paradigm to its 3590f7ec340bSmacallan # limits. Maybe even breaks it. We compile a program, linking it 3591f7ec340bSmacallan # against the deplibs as a proxy for the library. Then we can check 3592f7ec340bSmacallan # whether they linked in statically or dynamically with ldd. 3593f7ec340bSmacallan $rm conftest.c 3594f7ec340bSmacallan cat > conftest.c <<EOF 3595f7ec340bSmacallan int main() { return 0; } 3596f7ec340bSmacallanEOF 3597f7ec340bSmacallan $rm conftest 35987ce7e03cSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 3599f7ec340bSmacallan ldd_output=`ldd conftest` 3600f7ec340bSmacallan for i in $deplibs; do 3601f7ec340bSmacallan name=`expr $i : '-l\(.*\)'` 3602f7ec340bSmacallan # If $name is empty we are operating on a -L argument. 36037ce7e03cSmrg if test "$name" != "" && test "$name" != "0"; then 3604f7ec340bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3605f7ec340bSmacallan case " $predeps $postdeps " in 3606f7ec340bSmacallan *" $i "*) 3607f7ec340bSmacallan newdeplibs="$newdeplibs $i" 3608f7ec340bSmacallan i="" 3609f7ec340bSmacallan ;; 3610f7ec340bSmacallan esac 3611f7ec340bSmacallan fi 3612f7ec340bSmacallan if test -n "$i" ; then 3613f7ec340bSmacallan libname=`eval \\$echo \"$libname_spec\"` 3614f7ec340bSmacallan deplib_matches=`eval \\$echo \"$library_names_spec\"` 3615f7ec340bSmacallan set dummy $deplib_matches 3616f7ec340bSmacallan deplib_match=$2 3617f7ec340bSmacallan if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3618f7ec340bSmacallan newdeplibs="$newdeplibs $i" 3619f7ec340bSmacallan else 3620f7ec340bSmacallan droppeddeps=yes 3621f7ec340bSmacallan $echo 3622f7ec340bSmacallan $echo "*** Warning: dynamic linker does not accept needed library $i." 3623f7ec340bSmacallan $echo "*** I have the capability to make that library automatically link in when" 3624f7ec340bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 3625f7ec340bSmacallan $echo "*** shared version of the library, which I believe you do not have" 3626f7ec340bSmacallan $echo "*** because a test_compile did reveal that the linker did not use it for" 3627f7ec340bSmacallan $echo "*** its dynamic dependency list that programs get resolved with at runtime." 3628f7ec340bSmacallan fi 3629f7ec340bSmacallan fi 3630f7ec340bSmacallan else 3631f7ec340bSmacallan newdeplibs="$newdeplibs $i" 3632f7ec340bSmacallan fi 3633f7ec340bSmacallan done 3634f7ec340bSmacallan else 3635f7ec340bSmacallan # Error occurred in the first compile. Let's try to salvage 3636f7ec340bSmacallan # the situation: Compile a separate program for each library. 3637f7ec340bSmacallan for i in $deplibs; do 3638f7ec340bSmacallan name=`expr $i : '-l\(.*\)'` 3639f7ec340bSmacallan # If $name is empty we are operating on a -L argument. 3640f7ec340bSmacallan if test "$name" != "" && test "$name" != "0"; then 3641f7ec340bSmacallan $rm conftest 36427ce7e03cSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 3643f7ec340bSmacallan ldd_output=`ldd conftest` 3644f7ec340bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3645f7ec340bSmacallan case " $predeps $postdeps " in 3646f7ec340bSmacallan *" $i "*) 3647f7ec340bSmacallan newdeplibs="$newdeplibs $i" 3648f7ec340bSmacallan i="" 3649f7ec340bSmacallan ;; 3650f7ec340bSmacallan esac 3651f7ec340bSmacallan fi 3652f7ec340bSmacallan if test -n "$i" ; then 3653f7ec340bSmacallan libname=`eval \\$echo \"$libname_spec\"` 3654f7ec340bSmacallan deplib_matches=`eval \\$echo \"$library_names_spec\"` 3655f7ec340bSmacallan set dummy $deplib_matches 3656f7ec340bSmacallan deplib_match=$2 3657f7ec340bSmacallan if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3658f7ec340bSmacallan newdeplibs="$newdeplibs $i" 3659f7ec340bSmacallan else 3660f7ec340bSmacallan droppeddeps=yes 3661f7ec340bSmacallan $echo 3662f7ec340bSmacallan $echo "*** Warning: dynamic linker does not accept needed library $i." 3663f7ec340bSmacallan $echo "*** I have the capability to make that library automatically link in when" 3664f7ec340bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 3665f7ec340bSmacallan $echo "*** shared version of the library, which you do not appear to have" 3666f7ec340bSmacallan $echo "*** because a test_compile did reveal that the linker did not use this one" 3667f7ec340bSmacallan $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 3668f7ec340bSmacallan fi 3669f7ec340bSmacallan fi 3670f7ec340bSmacallan else 3671f7ec340bSmacallan droppeddeps=yes 3672f7ec340bSmacallan $echo 3673f7ec340bSmacallan $echo "*** Warning! Library $i is needed by this library but I was not able to" 36747ce7e03cSmrg $echo "*** make it link in! You will probably need to install it or some" 3675f7ec340bSmacallan $echo "*** library that it depends on before this library will be fully" 3676f7ec340bSmacallan $echo "*** functional. Installing it before continuing would be even better." 3677f7ec340bSmacallan fi 3678f7ec340bSmacallan else 3679f7ec340bSmacallan newdeplibs="$newdeplibs $i" 3680f7ec340bSmacallan fi 3681f7ec340bSmacallan done 3682f7ec340bSmacallan fi 3683f7ec340bSmacallan ;; 3684f7ec340bSmacallan file_magic*) 3685f7ec340bSmacallan set dummy $deplibs_check_method 3686f7ec340bSmacallan file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3687f7ec340bSmacallan for a_deplib in $deplibs; do 3688f7ec340bSmacallan name=`expr $a_deplib : '-l\(.*\)'` 3689f7ec340bSmacallan # If $name is empty we are operating on a -L argument. 3690f7ec340bSmacallan if test "$name" != "" && test "$name" != "0"; then 3691f7ec340bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3692f7ec340bSmacallan case " $predeps $postdeps " in 3693f7ec340bSmacallan *" $a_deplib "*) 3694f7ec340bSmacallan newdeplibs="$newdeplibs $a_deplib" 3695f7ec340bSmacallan a_deplib="" 3696f7ec340bSmacallan ;; 3697f7ec340bSmacallan esac 3698f7ec340bSmacallan fi 3699f7ec340bSmacallan if test -n "$a_deplib" ; then 3700f7ec340bSmacallan libname=`eval \\$echo \"$libname_spec\"` 3701f7ec340bSmacallan for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3702f7ec340bSmacallan potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3703f7ec340bSmacallan for potent_lib in $potential_libs; do 3704f7ec340bSmacallan # Follow soft links. 3705f7ec340bSmacallan if ls -lLd "$potent_lib" 2>/dev/null \ 3706f7ec340bSmacallan | grep " -> " >/dev/null; then 3707f7ec340bSmacallan continue 3708f7ec340bSmacallan fi 3709f7ec340bSmacallan # The statement above tries to avoid entering an 3710f7ec340bSmacallan # endless loop below, in case of cyclic links. 3711f7ec340bSmacallan # We might still enter an endless loop, since a link 3712f7ec340bSmacallan # loop can be closed while we follow links, 3713f7ec340bSmacallan # but so what? 3714f7ec340bSmacallan potlib="$potent_lib" 3715f7ec340bSmacallan while test -h "$potlib" 2>/dev/null; do 3716f7ec340bSmacallan potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 3717f7ec340bSmacallan case $potliblink in 3718f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 3719f7ec340bSmacallan *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 3720f7ec340bSmacallan esac 3721f7ec340bSmacallan done 3722f7ec340bSmacallan if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 3723f7ec340bSmacallan | ${SED} 10q \ 3724f7ec340bSmacallan | $EGREP "$file_magic_regex" > /dev/null; then 3725f7ec340bSmacallan newdeplibs="$newdeplibs $a_deplib" 3726f7ec340bSmacallan a_deplib="" 3727f7ec340bSmacallan break 2 3728f7ec340bSmacallan fi 3729f7ec340bSmacallan done 3730f7ec340bSmacallan done 3731f7ec340bSmacallan fi 3732f7ec340bSmacallan if test -n "$a_deplib" ; then 3733f7ec340bSmacallan droppeddeps=yes 3734f7ec340bSmacallan $echo 3735f7ec340bSmacallan $echo "*** Warning: linker path does not have real file for library $a_deplib." 3736f7ec340bSmacallan $echo "*** I have the capability to make that library automatically link in when" 3737f7ec340bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 3738f7ec340bSmacallan $echo "*** shared version of the library, which you do not appear to have" 3739f7ec340bSmacallan $echo "*** because I did check the linker path looking for a file starting" 3740f7ec340bSmacallan if test -z "$potlib" ; then 3741f7ec340bSmacallan $echo "*** with $libname but no candidates were found. (...for file magic test)" 3742f7ec340bSmacallan else 3743f7ec340bSmacallan $echo "*** with $libname and none of the candidates passed a file format test" 3744f7ec340bSmacallan $echo "*** using a file magic. Last file checked: $potlib" 3745f7ec340bSmacallan fi 3746f7ec340bSmacallan fi 3747f7ec340bSmacallan else 3748f7ec340bSmacallan # Add a -L argument. 3749f7ec340bSmacallan newdeplibs="$newdeplibs $a_deplib" 3750f7ec340bSmacallan fi 3751f7ec340bSmacallan done # Gone through all deplibs. 3752f7ec340bSmacallan ;; 3753f7ec340bSmacallan match_pattern*) 3754f7ec340bSmacallan set dummy $deplibs_check_method 3755f7ec340bSmacallan match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3756f7ec340bSmacallan for a_deplib in $deplibs; do 3757f7ec340bSmacallan name=`expr $a_deplib : '-l\(.*\)'` 3758f7ec340bSmacallan # If $name is empty we are operating on a -L argument. 3759f7ec340bSmacallan if test -n "$name" && test "$name" != "0"; then 3760f7ec340bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3761f7ec340bSmacallan case " $predeps $postdeps " in 3762f7ec340bSmacallan *" $a_deplib "*) 3763f7ec340bSmacallan newdeplibs="$newdeplibs $a_deplib" 3764f7ec340bSmacallan a_deplib="" 3765f7ec340bSmacallan ;; 3766f7ec340bSmacallan esac 3767f7ec340bSmacallan fi 3768f7ec340bSmacallan if test -n "$a_deplib" ; then 3769f7ec340bSmacallan libname=`eval \\$echo \"$libname_spec\"` 3770f7ec340bSmacallan for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3771f7ec340bSmacallan potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3772f7ec340bSmacallan for potent_lib in $potential_libs; do 3773f7ec340bSmacallan potlib="$potent_lib" # see symlink-check above in file_magic test 3774f7ec340bSmacallan if eval $echo \"$potent_lib\" 2>/dev/null \ 3775f7ec340bSmacallan | ${SED} 10q \ 3776f7ec340bSmacallan | $EGREP "$match_pattern_regex" > /dev/null; then 3777f7ec340bSmacallan newdeplibs="$newdeplibs $a_deplib" 3778f7ec340bSmacallan a_deplib="" 3779f7ec340bSmacallan break 2 3780f7ec340bSmacallan fi 3781f7ec340bSmacallan done 3782f7ec340bSmacallan done 3783f7ec340bSmacallan fi 3784f7ec340bSmacallan if test -n "$a_deplib" ; then 3785f7ec340bSmacallan droppeddeps=yes 3786f7ec340bSmacallan $echo 3787f7ec340bSmacallan $echo "*** Warning: linker path does not have real file for library $a_deplib." 3788f7ec340bSmacallan $echo "*** I have the capability to make that library automatically link in when" 3789f7ec340bSmacallan $echo "*** you link to this library. But I can only do this if you have a" 3790f7ec340bSmacallan $echo "*** shared version of the library, which you do not appear to have" 3791f7ec340bSmacallan $echo "*** because I did check the linker path looking for a file starting" 3792f7ec340bSmacallan if test -z "$potlib" ; then 3793f7ec340bSmacallan $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 3794f7ec340bSmacallan else 3795f7ec340bSmacallan $echo "*** with $libname and none of the candidates passed a file format test" 3796f7ec340bSmacallan $echo "*** using a regex pattern. Last file checked: $potlib" 3797f7ec340bSmacallan fi 3798f7ec340bSmacallan fi 3799f7ec340bSmacallan else 3800f7ec340bSmacallan # Add a -L argument. 3801f7ec340bSmacallan newdeplibs="$newdeplibs $a_deplib" 3802f7ec340bSmacallan fi 3803f7ec340bSmacallan done # Gone through all deplibs. 3804f7ec340bSmacallan ;; 3805f7ec340bSmacallan none | unknown | *) 3806f7ec340bSmacallan newdeplibs="" 3807f7ec340bSmacallan tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 3808f7ec340bSmacallan -e 's/ -[LR][^ ]*//g'` 3809f7ec340bSmacallan if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3810f7ec340bSmacallan for i in $predeps $postdeps ; do 3811f7ec340bSmacallan # can't use Xsed below, because $i might contain '/' 3812f7ec340bSmacallan tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 3813f7ec340bSmacallan done 3814f7ec340bSmacallan fi 3815f7ec340bSmacallan if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 3816f7ec340bSmacallan | grep . >/dev/null; then 3817f7ec340bSmacallan $echo 3818f7ec340bSmacallan if test "X$deplibs_check_method" = "Xnone"; then 3819f7ec340bSmacallan $echo "*** Warning: inter-library dependencies are not supported in this platform." 3820f7ec340bSmacallan else 3821f7ec340bSmacallan $echo "*** Warning: inter-library dependencies are not known to be supported." 3822f7ec340bSmacallan fi 3823f7ec340bSmacallan $echo "*** All declared inter-library dependencies are being dropped." 3824f7ec340bSmacallan droppeddeps=yes 3825f7ec340bSmacallan fi 3826f7ec340bSmacallan ;; 3827f7ec340bSmacallan esac 3828f7ec340bSmacallan versuffix=$versuffix_save 3829f7ec340bSmacallan major=$major_save 3830f7ec340bSmacallan release=$release_save 3831f7ec340bSmacallan libname=$libname_save 3832f7ec340bSmacallan name=$name_save 3833f7ec340bSmacallan 3834f7ec340bSmacallan case $host in 3835f7ec340bSmacallan *-*-rhapsody* | *-*-darwin1.[012]) 3836f7ec340bSmacallan # On Rhapsody replace the C library is the System framework 3837f7ec340bSmacallan newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 3838f7ec340bSmacallan ;; 3839f7ec340bSmacallan esac 3840f7ec340bSmacallan 3841f7ec340bSmacallan if test "$droppeddeps" = yes; then 3842f7ec340bSmacallan if test "$module" = yes; then 3843f7ec340bSmacallan $echo 3844f7ec340bSmacallan $echo "*** Warning: libtool could not satisfy all declared inter-library" 3845f7ec340bSmacallan $echo "*** dependencies of module $libname. Therefore, libtool will create" 3846f7ec340bSmacallan $echo "*** a static module, that should work as long as the dlopening" 3847f7ec340bSmacallan $echo "*** application is linked with the -dlopen flag." 3848f7ec340bSmacallan if test -z "$global_symbol_pipe"; then 3849f7ec340bSmacallan $echo 3850f7ec340bSmacallan $echo "*** However, this would only work if libtool was able to extract symbol" 3851f7ec340bSmacallan $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 3852f7ec340bSmacallan $echo "*** not find such a program. So, this module is probably useless." 3853f7ec340bSmacallan $echo "*** \`nm' from GNU binutils and a full rebuild may help." 3854f7ec340bSmacallan fi 3855f7ec340bSmacallan if test "$build_old_libs" = no; then 3856f7ec340bSmacallan oldlibs="$output_objdir/$libname.$libext" 3857f7ec340bSmacallan build_libtool_libs=module 3858f7ec340bSmacallan build_old_libs=yes 3859f7ec340bSmacallan else 3860f7ec340bSmacallan build_libtool_libs=no 3861f7ec340bSmacallan fi 3862f7ec340bSmacallan else 3863f7ec340bSmacallan $echo "*** The inter-library dependencies that have been dropped here will be" 3864f7ec340bSmacallan $echo "*** automatically added whenever a program is linked with this library" 3865f7ec340bSmacallan $echo "*** or is declared to -dlopen it." 3866f7ec340bSmacallan 3867f7ec340bSmacallan if test "$allow_undefined" = no; then 3868f7ec340bSmacallan $echo 3869f7ec340bSmacallan $echo "*** Since this library must not contain undefined symbols," 3870f7ec340bSmacallan $echo "*** because either the platform does not support them or" 3871f7ec340bSmacallan $echo "*** it was explicitly requested with -no-undefined," 3872f7ec340bSmacallan $echo "*** libtool will only create a static version of it." 3873f7ec340bSmacallan if test "$build_old_libs" = no; then 3874f7ec340bSmacallan oldlibs="$output_objdir/$libname.$libext" 3875f7ec340bSmacallan build_libtool_libs=module 3876f7ec340bSmacallan build_old_libs=yes 3877f7ec340bSmacallan else 3878f7ec340bSmacallan build_libtool_libs=no 3879f7ec340bSmacallan fi 3880f7ec340bSmacallan fi 3881f7ec340bSmacallan fi 3882f7ec340bSmacallan fi 3883f7ec340bSmacallan # Done checking deplibs! 3884f7ec340bSmacallan deplibs=$newdeplibs 3885f7ec340bSmacallan fi 3886f7ec340bSmacallan 3887f7ec340bSmacallan 3888f7ec340bSmacallan # move library search paths that coincide with paths to not yet 3889f7ec340bSmacallan # installed libraries to the beginning of the library search list 3890f7ec340bSmacallan new_libs= 3891f7ec340bSmacallan for path in $notinst_path; do 3892f7ec340bSmacallan case " $new_libs " in 3893f7ec340bSmacallan *" -L$path/$objdir "*) ;; 3894f7ec340bSmacallan *) 3895f7ec340bSmacallan case " $deplibs " in 3896f7ec340bSmacallan *" -L$path/$objdir "*) 3897f7ec340bSmacallan new_libs="$new_libs -L$path/$objdir" ;; 3898f7ec340bSmacallan esac 3899f7ec340bSmacallan ;; 3900f7ec340bSmacallan esac 3901f7ec340bSmacallan done 3902f7ec340bSmacallan for deplib in $deplibs; do 3903f7ec340bSmacallan case $deplib in 3904f7ec340bSmacallan -L*) 3905f7ec340bSmacallan case " $new_libs " in 3906f7ec340bSmacallan *" $deplib "*) ;; 3907f7ec340bSmacallan *) new_libs="$new_libs $deplib" ;; 3908f7ec340bSmacallan esac 3909f7ec340bSmacallan ;; 3910f7ec340bSmacallan *) new_libs="$new_libs $deplib" ;; 3911f7ec340bSmacallan esac 3912f7ec340bSmacallan done 3913f7ec340bSmacallan deplibs="$new_libs" 3914f7ec340bSmacallan 3915f7ec340bSmacallan 3916f7ec340bSmacallan # All the library-specific variables (install_libdir is set above). 3917f7ec340bSmacallan library_names= 3918f7ec340bSmacallan old_library= 3919f7ec340bSmacallan dlname= 3920f7ec340bSmacallan 3921f7ec340bSmacallan # Test again, we may have decided not to build it any more 3922f7ec340bSmacallan if test "$build_libtool_libs" = yes; then 3923f7ec340bSmacallan if test "$hardcode_into_libs" = yes; then 3924f7ec340bSmacallan # Hardcode the library paths 3925f7ec340bSmacallan hardcode_libdirs= 3926f7ec340bSmacallan dep_rpath= 3927f7ec340bSmacallan rpath="$finalize_rpath" 3928f7ec340bSmacallan test "$mode" != relink && rpath="$compile_rpath$rpath" 3929f7ec340bSmacallan for libdir in $rpath; do 3930f7ec340bSmacallan if test -n "$hardcode_libdir_flag_spec"; then 3931f7ec340bSmacallan if test -n "$hardcode_libdir_separator"; then 3932f7ec340bSmacallan if test -z "$hardcode_libdirs"; then 3933f7ec340bSmacallan hardcode_libdirs="$libdir" 3934f7ec340bSmacallan else 3935f7ec340bSmacallan # Just accumulate the unique libdirs. 3936f7ec340bSmacallan case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3937f7ec340bSmacallan *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3938f7ec340bSmacallan ;; 3939f7ec340bSmacallan *) 3940f7ec340bSmacallan hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3941f7ec340bSmacallan ;; 3942f7ec340bSmacallan esac 3943f7ec340bSmacallan fi 3944f7ec340bSmacallan else 3945f7ec340bSmacallan eval flag=\"$hardcode_libdir_flag_spec\" 3946f7ec340bSmacallan dep_rpath="$dep_rpath $flag" 3947f7ec340bSmacallan fi 3948f7ec340bSmacallan elif test -n "$runpath_var"; then 3949f7ec340bSmacallan case "$perm_rpath " in 3950f7ec340bSmacallan *" $libdir "*) ;; 3951f7ec340bSmacallan *) perm_rpath="$perm_rpath $libdir" ;; 3952f7ec340bSmacallan esac 3953f7ec340bSmacallan fi 3954f7ec340bSmacallan done 3955f7ec340bSmacallan # Substitute the hardcoded libdirs into the rpath. 3956f7ec340bSmacallan if test -n "$hardcode_libdir_separator" && 3957f7ec340bSmacallan test -n "$hardcode_libdirs"; then 3958f7ec340bSmacallan libdir="$hardcode_libdirs" 3959f7ec340bSmacallan if test -n "$hardcode_libdir_flag_spec_ld"; then 39607ce7e03cSmrg case $archive_cmds in 39617ce7e03cSmrg *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 39627ce7e03cSmrg *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 39637ce7e03cSmrg esac 3964f7ec340bSmacallan else 3965f7ec340bSmacallan eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3966f7ec340bSmacallan fi 3967f7ec340bSmacallan fi 3968f7ec340bSmacallan if test -n "$runpath_var" && test -n "$perm_rpath"; then 3969f7ec340bSmacallan # We should set the runpath_var. 3970f7ec340bSmacallan rpath= 3971f7ec340bSmacallan for dir in $perm_rpath; do 3972f7ec340bSmacallan rpath="$rpath$dir:" 3973f7ec340bSmacallan done 3974f7ec340bSmacallan eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3975f7ec340bSmacallan fi 3976f7ec340bSmacallan test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3977f7ec340bSmacallan fi 3978f7ec340bSmacallan 3979f7ec340bSmacallan shlibpath="$finalize_shlibpath" 3980f7ec340bSmacallan test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 3981f7ec340bSmacallan if test -n "$shlibpath"; then 3982f7ec340bSmacallan eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 3983f7ec340bSmacallan fi 3984f7ec340bSmacallan 3985f7ec340bSmacallan # Get the real and link names of the library. 3986f7ec340bSmacallan eval shared_ext=\"$shrext_cmds\" 3987f7ec340bSmacallan eval library_names=\"$library_names_spec\" 3988f7ec340bSmacallan set dummy $library_names 3989f7ec340bSmacallan realname="$2" 3990f7ec340bSmacallan shift; shift 3991f7ec340bSmacallan 3992f7ec340bSmacallan if test -n "$soname_spec"; then 3993f7ec340bSmacallan eval soname=\"$soname_spec\" 3994f7ec340bSmacallan else 3995f7ec340bSmacallan soname="$realname" 3996f7ec340bSmacallan fi 3997f7ec340bSmacallan if test -z "$dlname"; then 3998f7ec340bSmacallan dlname=$soname 3999f7ec340bSmacallan fi 4000f7ec340bSmacallan 4001f7ec340bSmacallan lib="$output_objdir/$realname" 4002f7ec340bSmacallan linknames= 4003f7ec340bSmacallan for link 4004f7ec340bSmacallan do 4005f7ec340bSmacallan linknames="$linknames $link" 4006f7ec340bSmacallan done 4007f7ec340bSmacallan 4008f7ec340bSmacallan # Use standard objects if they are pic 4009f7ec340bSmacallan test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4010f7ec340bSmacallan 4011f7ec340bSmacallan # Prepare the list of exported symbols 4012f7ec340bSmacallan if test -z "$export_symbols"; then 4013f7ec340bSmacallan if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 4014f7ec340bSmacallan $show "generating symbol list for \`$libname.la'" 4015f7ec340bSmacallan export_symbols="$output_objdir/$libname.exp" 4016f7ec340bSmacallan $run $rm $export_symbols 4017f7ec340bSmacallan cmds=$export_symbols_cmds 4018f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 4019f7ec340bSmacallan for cmd in $cmds; do 4020f7ec340bSmacallan IFS="$save_ifs" 4021f7ec340bSmacallan eval cmd=\"$cmd\" 4022f7ec340bSmacallan if len=`expr "X$cmd" : ".*"` && 4023f7ec340bSmacallan test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4024f7ec340bSmacallan $show "$cmd" 4025f7ec340bSmacallan $run eval "$cmd" || exit $? 4026f7ec340bSmacallan skipped_export=false 4027f7ec340bSmacallan else 4028f7ec340bSmacallan # The command line is too long to execute in one step. 4029f7ec340bSmacallan $show "using reloadable object file for export list..." 4030f7ec340bSmacallan skipped_export=: 4031f7ec340bSmacallan # Break out early, otherwise skipped_export may be 4032f7ec340bSmacallan # set to false by a later but shorter cmd. 4033f7ec340bSmacallan break 4034f7ec340bSmacallan fi 4035f7ec340bSmacallan done 4036f7ec340bSmacallan IFS="$save_ifs" 4037f7ec340bSmacallan if test -n "$export_symbols_regex"; then 4038f7ec340bSmacallan $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 4039f7ec340bSmacallan $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 4040f7ec340bSmacallan $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 4041f7ec340bSmacallan $run eval '$mv "${export_symbols}T" "$export_symbols"' 4042f7ec340bSmacallan fi 4043f7ec340bSmacallan fi 4044f7ec340bSmacallan fi 4045f7ec340bSmacallan 4046f7ec340bSmacallan if test -n "$export_symbols" && test -n "$include_expsyms"; then 4047f7ec340bSmacallan $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 4048f7ec340bSmacallan fi 4049f7ec340bSmacallan 4050f7ec340bSmacallan tmp_deplibs= 4051f7ec340bSmacallan for test_deplib in $deplibs; do 4052f7ec340bSmacallan case " $convenience " in 4053f7ec340bSmacallan *" $test_deplib "*) ;; 4054f7ec340bSmacallan *) 4055f7ec340bSmacallan tmp_deplibs="$tmp_deplibs $test_deplib" 4056f7ec340bSmacallan ;; 4057f7ec340bSmacallan esac 4058f7ec340bSmacallan done 4059f7ec340bSmacallan deplibs="$tmp_deplibs" 4060f7ec340bSmacallan 4061f7ec340bSmacallan if test -n "$convenience"; then 4062f7ec340bSmacallan if test -n "$whole_archive_flag_spec"; then 4063f7ec340bSmacallan save_libobjs=$libobjs 4064f7ec340bSmacallan eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4065f7ec340bSmacallan else 4066f7ec340bSmacallan gentop="$output_objdir/${outputname}x" 4067f7ec340bSmacallan generated="$generated $gentop" 4068f7ec340bSmacallan 4069f7ec340bSmacallan func_extract_archives $gentop $convenience 4070f7ec340bSmacallan libobjs="$libobjs $func_extract_archives_result" 4071f7ec340bSmacallan fi 4072f7ec340bSmacallan fi 4073f7ec340bSmacallan 4074f7ec340bSmacallan if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 4075f7ec340bSmacallan eval flag=\"$thread_safe_flag_spec\" 4076f7ec340bSmacallan linker_flags="$linker_flags $flag" 4077f7ec340bSmacallan fi 4078f7ec340bSmacallan 4079f7ec340bSmacallan # Make a backup of the uninstalled library when relinking 4080f7ec340bSmacallan if test "$mode" = relink; then 4081f7ec340bSmacallan $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 4082f7ec340bSmacallan fi 4083f7ec340bSmacallan 4084f7ec340bSmacallan # Do each of the archive commands. 4085f7ec340bSmacallan if test "$module" = yes && test -n "$module_cmds" ; then 4086f7ec340bSmacallan if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4087f7ec340bSmacallan eval test_cmds=\"$module_expsym_cmds\" 4088f7ec340bSmacallan cmds=$module_expsym_cmds 4089f7ec340bSmacallan else 4090f7ec340bSmacallan eval test_cmds=\"$module_cmds\" 4091f7ec340bSmacallan cmds=$module_cmds 4092f7ec340bSmacallan fi 4093f7ec340bSmacallan else 4094f7ec340bSmacallan if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4095f7ec340bSmacallan eval test_cmds=\"$archive_expsym_cmds\" 4096f7ec340bSmacallan cmds=$archive_expsym_cmds 4097f7ec340bSmacallan else 4098f7ec340bSmacallan eval test_cmds=\"$archive_cmds\" 4099f7ec340bSmacallan cmds=$archive_cmds 4100f7ec340bSmacallan fi 4101f7ec340bSmacallan fi 4102f7ec340bSmacallan 4103f7ec340bSmacallan if test "X$skipped_export" != "X:" && 4104f7ec340bSmacallan len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4105f7ec340bSmacallan test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4106f7ec340bSmacallan : 4107f7ec340bSmacallan else 4108f7ec340bSmacallan # The command line is too long to link in one step, link piecewise. 4109f7ec340bSmacallan $echo "creating reloadable object files..." 4110f7ec340bSmacallan 4111f7ec340bSmacallan # Save the value of $output and $libobjs because we want to 4112f7ec340bSmacallan # use them later. If we have whole_archive_flag_spec, we 4113f7ec340bSmacallan # want to use save_libobjs as it was before 4114f7ec340bSmacallan # whole_archive_flag_spec was expanded, because we can't 4115f7ec340bSmacallan # assume the linker understands whole_archive_flag_spec. 4116f7ec340bSmacallan # This may have to be revisited, in case too many 4117f7ec340bSmacallan # convenience libraries get linked in and end up exceeding 4118f7ec340bSmacallan # the spec. 4119f7ec340bSmacallan if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4120f7ec340bSmacallan save_libobjs=$libobjs 4121f7ec340bSmacallan fi 4122f7ec340bSmacallan save_output=$output 4123f7ec340bSmacallan output_la=`$echo "X$output" | $Xsed -e "$basename"` 4124f7ec340bSmacallan 4125f7ec340bSmacallan # Clear the reloadable object creation command queue and 4126f7ec340bSmacallan # initialize k to one. 4127f7ec340bSmacallan test_cmds= 4128f7ec340bSmacallan concat_cmds= 4129f7ec340bSmacallan objlist= 4130f7ec340bSmacallan delfiles= 4131f7ec340bSmacallan last_robj= 4132f7ec340bSmacallan k=1 4133f7ec340bSmacallan output=$output_objdir/$output_la-${k}.$objext 4134f7ec340bSmacallan # Loop over the list of objects to be linked. 4135f7ec340bSmacallan for obj in $save_libobjs 4136f7ec340bSmacallan do 4137f7ec340bSmacallan eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4138f7ec340bSmacallan if test "X$objlist" = X || 4139f7ec340bSmacallan { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4140f7ec340bSmacallan test "$len" -le "$max_cmd_len"; }; then 4141f7ec340bSmacallan objlist="$objlist $obj" 4142f7ec340bSmacallan else 4143f7ec340bSmacallan # The command $test_cmds is almost too long, add a 4144f7ec340bSmacallan # command to the queue. 4145f7ec340bSmacallan if test "$k" -eq 1 ; then 4146f7ec340bSmacallan # The first file doesn't have a previous command to add. 4147f7ec340bSmacallan eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 4148f7ec340bSmacallan else 4149f7ec340bSmacallan # All subsequent reloadable object files will link in 4150f7ec340bSmacallan # the last one created. 4151f7ec340bSmacallan eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4152f7ec340bSmacallan fi 4153f7ec340bSmacallan last_robj=$output_objdir/$output_la-${k}.$objext 4154f7ec340bSmacallan k=`expr $k + 1` 4155f7ec340bSmacallan output=$output_objdir/$output_la-${k}.$objext 4156f7ec340bSmacallan objlist=$obj 4157f7ec340bSmacallan len=1 4158f7ec340bSmacallan fi 4159f7ec340bSmacallan done 4160f7ec340bSmacallan # Handle the remaining objects by creating one last 4161f7ec340bSmacallan # reloadable object file. All subsequent reloadable object 4162f7ec340bSmacallan # files will link in the last one created. 4163f7ec340bSmacallan test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4164f7ec340bSmacallan eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 4165f7ec340bSmacallan 4166f7ec340bSmacallan if ${skipped_export-false}; then 4167f7ec340bSmacallan $show "generating symbol list for \`$libname.la'" 4168f7ec340bSmacallan export_symbols="$output_objdir/$libname.exp" 4169f7ec340bSmacallan $run $rm $export_symbols 4170f7ec340bSmacallan libobjs=$output 4171f7ec340bSmacallan # Append the command to create the export file. 4172f7ec340bSmacallan eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4173f7ec340bSmacallan fi 4174f7ec340bSmacallan 4175f7ec340bSmacallan # Set up a command to remove the reloadable object files 4176f7ec340bSmacallan # after they are used. 4177f7ec340bSmacallan i=0 4178f7ec340bSmacallan while test "$i" -lt "$k" 4179f7ec340bSmacallan do 4180f7ec340bSmacallan i=`expr $i + 1` 4181f7ec340bSmacallan delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 4182f7ec340bSmacallan done 4183f7ec340bSmacallan 4184f7ec340bSmacallan $echo "creating a temporary reloadable object file: $output" 4185f7ec340bSmacallan 4186f7ec340bSmacallan # Loop through the commands generated above and execute them. 4187f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 4188f7ec340bSmacallan for cmd in $concat_cmds; do 4189f7ec340bSmacallan IFS="$save_ifs" 4190f7ec340bSmacallan $show "$cmd" 4191f7ec340bSmacallan $run eval "$cmd" || exit $? 4192f7ec340bSmacallan done 4193f7ec340bSmacallan IFS="$save_ifs" 4194f7ec340bSmacallan 4195f7ec340bSmacallan libobjs=$output 4196f7ec340bSmacallan # Restore the value of output. 4197f7ec340bSmacallan output=$save_output 4198f7ec340bSmacallan 4199f7ec340bSmacallan if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 4200f7ec340bSmacallan eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4201f7ec340bSmacallan fi 4202f7ec340bSmacallan # Expand the library linking commands again to reset the 4203f7ec340bSmacallan # value of $libobjs for piecewise linking. 4204f7ec340bSmacallan 4205f7ec340bSmacallan # Do each of the archive commands. 4206f7ec340bSmacallan if test "$module" = yes && test -n "$module_cmds" ; then 4207f7ec340bSmacallan if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4208f7ec340bSmacallan cmds=$module_expsym_cmds 4209f7ec340bSmacallan else 4210f7ec340bSmacallan cmds=$module_cmds 4211f7ec340bSmacallan fi 4212f7ec340bSmacallan else 4213f7ec340bSmacallan if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4214f7ec340bSmacallan cmds=$archive_expsym_cmds 4215f7ec340bSmacallan else 4216f7ec340bSmacallan cmds=$archive_cmds 4217f7ec340bSmacallan fi 4218f7ec340bSmacallan fi 4219f7ec340bSmacallan 4220f7ec340bSmacallan # Append the command to remove the reloadable object files 4221f7ec340bSmacallan # to the just-reset $cmds. 4222f7ec340bSmacallan eval cmds=\"\$cmds~\$rm $delfiles\" 4223f7ec340bSmacallan fi 4224f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 4225f7ec340bSmacallan for cmd in $cmds; do 4226f7ec340bSmacallan IFS="$save_ifs" 4227f7ec340bSmacallan eval cmd=\"$cmd\" 4228f7ec340bSmacallan $show "$cmd" 4229f7ec340bSmacallan $run eval "$cmd" || { 4230f7ec340bSmacallan lt_exit=$? 4231f7ec340bSmacallan 4232f7ec340bSmacallan # Restore the uninstalled library and exit 4233f7ec340bSmacallan if test "$mode" = relink; then 4234f7ec340bSmacallan $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 4235f7ec340bSmacallan fi 4236f7ec340bSmacallan 4237f7ec340bSmacallan exit $lt_exit 4238f7ec340bSmacallan } 4239f7ec340bSmacallan done 4240f7ec340bSmacallan IFS="$save_ifs" 4241f7ec340bSmacallan 4242f7ec340bSmacallan # Restore the uninstalled library and exit 4243f7ec340bSmacallan if test "$mode" = relink; then 4244f7ec340bSmacallan $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4245f7ec340bSmacallan 4246f7ec340bSmacallan if test -n "$convenience"; then 4247f7ec340bSmacallan if test -z "$whole_archive_flag_spec"; then 4248f7ec340bSmacallan $show "${rm}r $gentop" 4249f7ec340bSmacallan $run ${rm}r "$gentop" 4250f7ec340bSmacallan fi 4251f7ec340bSmacallan fi 4252f7ec340bSmacallan 4253f7ec340bSmacallan exit $EXIT_SUCCESS 4254f7ec340bSmacallan fi 4255f7ec340bSmacallan 4256f7ec340bSmacallan # Create links to the real library. 4257f7ec340bSmacallan for linkname in $linknames; do 4258f7ec340bSmacallan if test "$realname" != "$linkname"; then 4259f7ec340bSmacallan $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 4260f7ec340bSmacallan $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 4261f7ec340bSmacallan fi 4262f7ec340bSmacallan done 4263f7ec340bSmacallan 4264f7ec340bSmacallan # If -module or -export-dynamic was specified, set the dlname. 4265f7ec340bSmacallan if test "$module" = yes || test "$export_dynamic" = yes; then 4266f7ec340bSmacallan # On all known operating systems, these are identical. 4267f7ec340bSmacallan dlname="$soname" 4268f7ec340bSmacallan fi 4269f7ec340bSmacallan fi 4270f7ec340bSmacallan ;; 4271f7ec340bSmacallan 4272f7ec340bSmacallan obj) 42737ce7e03cSmrg case " $deplibs" in 42747ce7e03cSmrg *\ -l* | *\ -L*) 42757ce7e03cSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 42767ce7e03cSmrg esac 4277f7ec340bSmacallan 4278f7ec340bSmacallan if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4279f7ec340bSmacallan $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 4280f7ec340bSmacallan fi 4281f7ec340bSmacallan 4282f7ec340bSmacallan if test -n "$rpath"; then 4283f7ec340bSmacallan $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 4284f7ec340bSmacallan fi 4285f7ec340bSmacallan 4286f7ec340bSmacallan if test -n "$xrpath"; then 4287f7ec340bSmacallan $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 4288f7ec340bSmacallan fi 4289f7ec340bSmacallan 4290f7ec340bSmacallan if test -n "$vinfo"; then 4291f7ec340bSmacallan $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 4292f7ec340bSmacallan fi 4293f7ec340bSmacallan 4294f7ec340bSmacallan if test -n "$release"; then 4295f7ec340bSmacallan $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 4296f7ec340bSmacallan fi 4297f7ec340bSmacallan 4298f7ec340bSmacallan case $output in 4299f7ec340bSmacallan *.lo) 4300f7ec340bSmacallan if test -n "$objs$old_deplibs"; then 4301f7ec340bSmacallan $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 4302f7ec340bSmacallan exit $EXIT_FAILURE 4303f7ec340bSmacallan fi 4304f7ec340bSmacallan libobj="$output" 4305f7ec340bSmacallan obj=`$echo "X$output" | $Xsed -e "$lo2o"` 4306f7ec340bSmacallan ;; 4307f7ec340bSmacallan *) 4308f7ec340bSmacallan libobj= 4309f7ec340bSmacallan obj="$output" 4310f7ec340bSmacallan ;; 4311f7ec340bSmacallan esac 4312f7ec340bSmacallan 4313f7ec340bSmacallan # Delete the old objects. 4314f7ec340bSmacallan $run $rm $obj $libobj 4315f7ec340bSmacallan 4316f7ec340bSmacallan # Objects from convenience libraries. This assumes 4317f7ec340bSmacallan # single-version convenience libraries. Whenever we create 4318f7ec340bSmacallan # different ones for PIC/non-PIC, this we'll have to duplicate 4319f7ec340bSmacallan # the extraction. 4320f7ec340bSmacallan reload_conv_objs= 4321f7ec340bSmacallan gentop= 4322f7ec340bSmacallan # reload_cmds runs $LD directly, so let us get rid of 43237ce7e03cSmrg # -Wl from whole_archive_flag_spec and hope we can get by with 43247ce7e03cSmrg # turning comma into space.. 4325f7ec340bSmacallan wl= 4326f7ec340bSmacallan 4327f7ec340bSmacallan if test -n "$convenience"; then 4328f7ec340bSmacallan if test -n "$whole_archive_flag_spec"; then 43297ce7e03cSmrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 43307ce7e03cSmrg reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 4331f7ec340bSmacallan else 4332f7ec340bSmacallan gentop="$output_objdir/${obj}x" 4333f7ec340bSmacallan generated="$generated $gentop" 4334f7ec340bSmacallan 4335f7ec340bSmacallan func_extract_archives $gentop $convenience 4336f7ec340bSmacallan reload_conv_objs="$reload_objs $func_extract_archives_result" 4337f7ec340bSmacallan fi 4338f7ec340bSmacallan fi 4339f7ec340bSmacallan 4340f7ec340bSmacallan # Create the old-style object. 4341f7ec340bSmacallan 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 4342f7ec340bSmacallan 4343f7ec340bSmacallan output="$obj" 4344f7ec340bSmacallan cmds=$reload_cmds 4345f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 4346f7ec340bSmacallan for cmd in $cmds; do 4347f7ec340bSmacallan IFS="$save_ifs" 4348f7ec340bSmacallan eval cmd=\"$cmd\" 4349f7ec340bSmacallan $show "$cmd" 4350f7ec340bSmacallan $run eval "$cmd" || exit $? 4351f7ec340bSmacallan done 4352f7ec340bSmacallan IFS="$save_ifs" 4353f7ec340bSmacallan 4354f7ec340bSmacallan # Exit if we aren't doing a library object file. 4355f7ec340bSmacallan if test -z "$libobj"; then 4356f7ec340bSmacallan if test -n "$gentop"; then 4357f7ec340bSmacallan $show "${rm}r $gentop" 4358f7ec340bSmacallan $run ${rm}r $gentop 4359f7ec340bSmacallan fi 4360f7ec340bSmacallan 4361f7ec340bSmacallan exit $EXIT_SUCCESS 4362f7ec340bSmacallan fi 4363f7ec340bSmacallan 4364f7ec340bSmacallan if test "$build_libtool_libs" != yes; then 4365f7ec340bSmacallan if test -n "$gentop"; then 4366f7ec340bSmacallan $show "${rm}r $gentop" 4367f7ec340bSmacallan $run ${rm}r $gentop 4368f7ec340bSmacallan fi 4369f7ec340bSmacallan 4370f7ec340bSmacallan # Create an invalid libtool object if no PIC, so that we don't 4371f7ec340bSmacallan # accidentally link it into a program. 4372f7ec340bSmacallan # $show "echo timestamp > $libobj" 4373f7ec340bSmacallan # $run eval "echo timestamp > $libobj" || exit $? 4374f7ec340bSmacallan exit $EXIT_SUCCESS 4375f7ec340bSmacallan fi 4376f7ec340bSmacallan 4377f7ec340bSmacallan if test -n "$pic_flag" || test "$pic_mode" != default; then 4378f7ec340bSmacallan # Only do commands if we really have different PIC objects. 4379f7ec340bSmacallan reload_objs="$libobjs $reload_conv_objs" 4380f7ec340bSmacallan output="$libobj" 4381f7ec340bSmacallan cmds=$reload_cmds 4382f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 4383f7ec340bSmacallan for cmd in $cmds; do 4384f7ec340bSmacallan IFS="$save_ifs" 4385f7ec340bSmacallan eval cmd=\"$cmd\" 4386f7ec340bSmacallan $show "$cmd" 4387f7ec340bSmacallan $run eval "$cmd" || exit $? 4388f7ec340bSmacallan done 4389f7ec340bSmacallan IFS="$save_ifs" 4390f7ec340bSmacallan fi 4391f7ec340bSmacallan 4392f7ec340bSmacallan if test -n "$gentop"; then 4393f7ec340bSmacallan $show "${rm}r $gentop" 4394f7ec340bSmacallan $run ${rm}r $gentop 4395f7ec340bSmacallan fi 4396f7ec340bSmacallan 4397f7ec340bSmacallan exit $EXIT_SUCCESS 4398f7ec340bSmacallan ;; 4399f7ec340bSmacallan 4400f7ec340bSmacallan prog) 4401f7ec340bSmacallan case $host in 4402f7ec340bSmacallan *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 4403f7ec340bSmacallan esac 4404f7ec340bSmacallan if test -n "$vinfo"; then 4405f7ec340bSmacallan $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 4406f7ec340bSmacallan fi 4407f7ec340bSmacallan 4408f7ec340bSmacallan if test -n "$release"; then 4409f7ec340bSmacallan $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 4410f7ec340bSmacallan fi 4411f7ec340bSmacallan 4412f7ec340bSmacallan if test "$preload" = yes; then 4413f7ec340bSmacallan if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 4414f7ec340bSmacallan test "$dlopen_self_static" = unknown; then 4415f7ec340bSmacallan $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 4416f7ec340bSmacallan fi 4417f7ec340bSmacallan fi 4418f7ec340bSmacallan 4419f7ec340bSmacallan case $host in 4420f7ec340bSmacallan *-*-rhapsody* | *-*-darwin1.[012]) 4421f7ec340bSmacallan # On Rhapsody replace the C library is the System framework 4422f7ec340bSmacallan compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4423f7ec340bSmacallan finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4424f7ec340bSmacallan ;; 4425f7ec340bSmacallan esac 4426f7ec340bSmacallan 4427f7ec340bSmacallan case $host in 4428f7ec340bSmacallan *darwin*) 4429f7ec340bSmacallan # Don't allow lazy linking, it breaks C++ global constructors 4430f7ec340bSmacallan if test "$tagname" = CXX ; then 4431f7ec340bSmacallan compile_command="$compile_command ${wl}-bind_at_load" 4432f7ec340bSmacallan finalize_command="$finalize_command ${wl}-bind_at_load" 4433f7ec340bSmacallan fi 4434f7ec340bSmacallan ;; 4435f7ec340bSmacallan esac 4436f7ec340bSmacallan 4437f7ec340bSmacallan 4438f7ec340bSmacallan # move library search paths that coincide with paths to not yet 4439f7ec340bSmacallan # installed libraries to the beginning of the library search list 4440f7ec340bSmacallan new_libs= 4441f7ec340bSmacallan for path in $notinst_path; do 4442f7ec340bSmacallan case " $new_libs " in 4443f7ec340bSmacallan *" -L$path/$objdir "*) ;; 4444f7ec340bSmacallan *) 4445f7ec340bSmacallan case " $compile_deplibs " in 4446f7ec340bSmacallan *" -L$path/$objdir "*) 4447f7ec340bSmacallan new_libs="$new_libs -L$path/$objdir" ;; 4448f7ec340bSmacallan esac 4449f7ec340bSmacallan ;; 4450f7ec340bSmacallan esac 4451f7ec340bSmacallan done 4452f7ec340bSmacallan for deplib in $compile_deplibs; do 4453f7ec340bSmacallan case $deplib in 4454f7ec340bSmacallan -L*) 4455f7ec340bSmacallan case " $new_libs " in 4456f7ec340bSmacallan *" $deplib "*) ;; 4457f7ec340bSmacallan *) new_libs="$new_libs $deplib" ;; 4458f7ec340bSmacallan esac 4459f7ec340bSmacallan ;; 4460f7ec340bSmacallan *) new_libs="$new_libs $deplib" ;; 4461f7ec340bSmacallan esac 4462f7ec340bSmacallan done 4463f7ec340bSmacallan compile_deplibs="$new_libs" 4464f7ec340bSmacallan 4465f7ec340bSmacallan 4466f7ec340bSmacallan compile_command="$compile_command $compile_deplibs" 4467f7ec340bSmacallan finalize_command="$finalize_command $finalize_deplibs" 4468f7ec340bSmacallan 4469f7ec340bSmacallan if test -n "$rpath$xrpath"; then 4470f7ec340bSmacallan # If the user specified any rpath flags, then add them. 4471f7ec340bSmacallan for libdir in $rpath $xrpath; do 4472f7ec340bSmacallan # This is the magic to use -rpath. 4473f7ec340bSmacallan case "$finalize_rpath " in 4474f7ec340bSmacallan *" $libdir "*) ;; 4475f7ec340bSmacallan *) finalize_rpath="$finalize_rpath $libdir" ;; 4476f7ec340bSmacallan esac 4477f7ec340bSmacallan done 4478f7ec340bSmacallan fi 4479f7ec340bSmacallan 4480f7ec340bSmacallan # Now hardcode the library paths 4481f7ec340bSmacallan rpath= 4482f7ec340bSmacallan hardcode_libdirs= 4483f7ec340bSmacallan for libdir in $compile_rpath $finalize_rpath; do 4484f7ec340bSmacallan if test -n "$hardcode_libdir_flag_spec"; then 4485f7ec340bSmacallan if test -n "$hardcode_libdir_separator"; then 4486f7ec340bSmacallan if test -z "$hardcode_libdirs"; then 4487f7ec340bSmacallan hardcode_libdirs="$libdir" 4488f7ec340bSmacallan else 4489f7ec340bSmacallan # Just accumulate the unique libdirs. 4490f7ec340bSmacallan case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4491f7ec340bSmacallan *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4492f7ec340bSmacallan ;; 4493f7ec340bSmacallan *) 4494f7ec340bSmacallan hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4495f7ec340bSmacallan ;; 4496f7ec340bSmacallan esac 4497f7ec340bSmacallan fi 4498f7ec340bSmacallan else 4499f7ec340bSmacallan eval flag=\"$hardcode_libdir_flag_spec\" 4500f7ec340bSmacallan rpath="$rpath $flag" 4501f7ec340bSmacallan fi 4502f7ec340bSmacallan elif test -n "$runpath_var"; then 4503f7ec340bSmacallan case "$perm_rpath " in 4504f7ec340bSmacallan *" $libdir "*) ;; 4505f7ec340bSmacallan *) perm_rpath="$perm_rpath $libdir" ;; 4506f7ec340bSmacallan esac 4507f7ec340bSmacallan fi 4508f7ec340bSmacallan case $host in 4509f7ec340bSmacallan *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4510f7ec340bSmacallan testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 4511f7ec340bSmacallan case :$dllsearchpath: in 4512f7ec340bSmacallan *":$libdir:"*) ;; 4513f7ec340bSmacallan *) dllsearchpath="$dllsearchpath:$libdir";; 4514f7ec340bSmacallan esac 4515f7ec340bSmacallan case :$dllsearchpath: in 4516f7ec340bSmacallan *":$testbindir:"*) ;; 4517f7ec340bSmacallan *) dllsearchpath="$dllsearchpath:$testbindir";; 4518f7ec340bSmacallan esac 4519f7ec340bSmacallan ;; 4520f7ec340bSmacallan esac 4521f7ec340bSmacallan done 4522f7ec340bSmacallan # Substitute the hardcoded libdirs into the rpath. 4523f7ec340bSmacallan if test -n "$hardcode_libdir_separator" && 4524f7ec340bSmacallan test -n "$hardcode_libdirs"; then 4525f7ec340bSmacallan libdir="$hardcode_libdirs" 4526f7ec340bSmacallan eval rpath=\" $hardcode_libdir_flag_spec\" 4527f7ec340bSmacallan fi 4528f7ec340bSmacallan compile_rpath="$rpath" 4529f7ec340bSmacallan 4530f7ec340bSmacallan rpath= 4531f7ec340bSmacallan hardcode_libdirs= 4532f7ec340bSmacallan for libdir in $finalize_rpath; do 4533f7ec340bSmacallan if test -n "$hardcode_libdir_flag_spec"; then 4534f7ec340bSmacallan if test -n "$hardcode_libdir_separator"; then 4535f7ec340bSmacallan if test -z "$hardcode_libdirs"; then 4536f7ec340bSmacallan hardcode_libdirs="$libdir" 4537f7ec340bSmacallan else 4538f7ec340bSmacallan # Just accumulate the unique libdirs. 4539f7ec340bSmacallan case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4540f7ec340bSmacallan *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4541f7ec340bSmacallan ;; 4542f7ec340bSmacallan *) 4543f7ec340bSmacallan hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4544f7ec340bSmacallan ;; 4545f7ec340bSmacallan esac 4546f7ec340bSmacallan fi 4547f7ec340bSmacallan else 4548f7ec340bSmacallan eval flag=\"$hardcode_libdir_flag_spec\" 4549f7ec340bSmacallan rpath="$rpath $flag" 4550f7ec340bSmacallan fi 4551f7ec340bSmacallan elif test -n "$runpath_var"; then 4552f7ec340bSmacallan case "$finalize_perm_rpath " in 4553f7ec340bSmacallan *" $libdir "*) ;; 4554f7ec340bSmacallan *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 4555f7ec340bSmacallan esac 4556f7ec340bSmacallan fi 4557f7ec340bSmacallan done 4558f7ec340bSmacallan # Substitute the hardcoded libdirs into the rpath. 4559f7ec340bSmacallan if test -n "$hardcode_libdir_separator" && 4560f7ec340bSmacallan test -n "$hardcode_libdirs"; then 4561f7ec340bSmacallan libdir="$hardcode_libdirs" 4562f7ec340bSmacallan eval rpath=\" $hardcode_libdir_flag_spec\" 4563f7ec340bSmacallan fi 4564f7ec340bSmacallan finalize_rpath="$rpath" 4565f7ec340bSmacallan 4566f7ec340bSmacallan if test -n "$libobjs" && test "$build_old_libs" = yes; then 4567f7ec340bSmacallan # Transform all the library objects into standard objects. 4568f7ec340bSmacallan compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4569f7ec340bSmacallan finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4570f7ec340bSmacallan fi 4571f7ec340bSmacallan 4572f7ec340bSmacallan dlsyms= 4573f7ec340bSmacallan if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4574f7ec340bSmacallan if test -n "$NM" && test -n "$global_symbol_pipe"; then 4575f7ec340bSmacallan dlsyms="${outputname}S.c" 4576f7ec340bSmacallan else 4577f7ec340bSmacallan $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 4578f7ec340bSmacallan fi 4579f7ec340bSmacallan fi 4580f7ec340bSmacallan 4581f7ec340bSmacallan if test -n "$dlsyms"; then 4582f7ec340bSmacallan case $dlsyms in 4583f7ec340bSmacallan "") ;; 4584f7ec340bSmacallan *.c) 4585f7ec340bSmacallan # Discover the nlist of each of the dlfiles. 4586f7ec340bSmacallan nlist="$output_objdir/${outputname}.nm" 4587f7ec340bSmacallan 4588f7ec340bSmacallan $show "$rm $nlist ${nlist}S ${nlist}T" 4589f7ec340bSmacallan $run $rm "$nlist" "${nlist}S" "${nlist}T" 4590f7ec340bSmacallan 4591f7ec340bSmacallan # Parse the name list into a source file. 4592f7ec340bSmacallan $show "creating $output_objdir/$dlsyms" 4593f7ec340bSmacallan 4594f7ec340bSmacallan test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 4595f7ec340bSmacallan/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 4596f7ec340bSmacallan/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 4597f7ec340bSmacallan 4598f7ec340bSmacallan#ifdef __cplusplus 4599f7ec340bSmacallanextern \"C\" { 4600f7ec340bSmacallan#endif 4601f7ec340bSmacallan 4602f7ec340bSmacallan/* Prevent the only kind of declaration conflicts we can make. */ 4603f7ec340bSmacallan#define lt_preloaded_symbols some_other_symbol 4604f7ec340bSmacallan 4605f7ec340bSmacallan/* External symbol declarations for the compiler. */\ 4606f7ec340bSmacallan" 4607f7ec340bSmacallan 4608f7ec340bSmacallan if test "$dlself" = yes; then 4609f7ec340bSmacallan $show "generating symbol list for \`$output'" 4610f7ec340bSmacallan 4611f7ec340bSmacallan test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 4612f7ec340bSmacallan 4613f7ec340bSmacallan # Add our own program objects to the symbol list. 4614f7ec340bSmacallan progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4615f7ec340bSmacallan for arg in $progfiles; do 4616f7ec340bSmacallan $show "extracting global C symbols from \`$arg'" 4617f7ec340bSmacallan $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4618f7ec340bSmacallan done 4619f7ec340bSmacallan 4620f7ec340bSmacallan if test -n "$exclude_expsyms"; then 4621f7ec340bSmacallan $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4622f7ec340bSmacallan $run eval '$mv "$nlist"T "$nlist"' 4623f7ec340bSmacallan fi 4624f7ec340bSmacallan 4625f7ec340bSmacallan if test -n "$export_symbols_regex"; then 4626f7ec340bSmacallan $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4627f7ec340bSmacallan $run eval '$mv "$nlist"T "$nlist"' 4628f7ec340bSmacallan fi 4629f7ec340bSmacallan 4630f7ec340bSmacallan # Prepare the list of exported symbols 4631f7ec340bSmacallan if test -z "$export_symbols"; then 4632f7ec340bSmacallan export_symbols="$output_objdir/$outputname.exp" 4633f7ec340bSmacallan $run $rm $export_symbols 4634f7ec340bSmacallan $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4635f7ec340bSmacallan case $host in 4636f7ec340bSmacallan *cygwin* | *mingw* ) 4637f7ec340bSmacallan $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4638f7ec340bSmacallan $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4639f7ec340bSmacallan ;; 4640f7ec340bSmacallan esac 4641f7ec340bSmacallan else 4642f7ec340bSmacallan $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4643f7ec340bSmacallan $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4644f7ec340bSmacallan $run eval 'mv "$nlist"T "$nlist"' 4645f7ec340bSmacallan case $host in 4646f7ec340bSmacallan *cygwin* | *mingw* ) 4647f7ec340bSmacallan $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4648f7ec340bSmacallan $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4649f7ec340bSmacallan ;; 4650f7ec340bSmacallan esac 4651f7ec340bSmacallan fi 4652f7ec340bSmacallan fi 4653f7ec340bSmacallan 4654f7ec340bSmacallan for arg in $dlprefiles; do 4655f7ec340bSmacallan $show "extracting global C symbols from \`$arg'" 4656f7ec340bSmacallan name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 4657f7ec340bSmacallan $run eval '$echo ": $name " >> "$nlist"' 4658f7ec340bSmacallan $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4659f7ec340bSmacallan done 4660f7ec340bSmacallan 4661f7ec340bSmacallan if test -z "$run"; then 4662f7ec340bSmacallan # Make sure we have at least an empty file. 4663f7ec340bSmacallan test -f "$nlist" || : > "$nlist" 4664f7ec340bSmacallan 4665f7ec340bSmacallan if test -n "$exclude_expsyms"; then 4666f7ec340bSmacallan $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4667f7ec340bSmacallan $mv "$nlist"T "$nlist" 4668f7ec340bSmacallan fi 4669f7ec340bSmacallan 4670f7ec340bSmacallan # Try sorting and uniquifying the output. 4671f7ec340bSmacallan if grep -v "^: " < "$nlist" | 4672f7ec340bSmacallan if sort -k 3 </dev/null >/dev/null 2>&1; then 4673f7ec340bSmacallan sort -k 3 4674f7ec340bSmacallan else 4675f7ec340bSmacallan sort +2 4676f7ec340bSmacallan fi | 4677f7ec340bSmacallan uniq > "$nlist"S; then 4678f7ec340bSmacallan : 4679f7ec340bSmacallan else 4680f7ec340bSmacallan grep -v "^: " < "$nlist" > "$nlist"S 4681f7ec340bSmacallan fi 4682f7ec340bSmacallan 4683f7ec340bSmacallan if test -f "$nlist"S; then 4684f7ec340bSmacallan eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 4685f7ec340bSmacallan else 4686f7ec340bSmacallan $echo '/* NONE */' >> "$output_objdir/$dlsyms" 4687f7ec340bSmacallan fi 4688f7ec340bSmacallan 4689f7ec340bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 4690f7ec340bSmacallan 4691f7ec340bSmacallan#undef lt_preloaded_symbols 4692f7ec340bSmacallan 4693f7ec340bSmacallan#if defined (__STDC__) && __STDC__ 4694f7ec340bSmacallan# define lt_ptr void * 4695f7ec340bSmacallan#else 4696f7ec340bSmacallan# define lt_ptr char * 4697f7ec340bSmacallan# define const 4698f7ec340bSmacallan#endif 4699f7ec340bSmacallan 4700f7ec340bSmacallan/* The mapping between symbol names and symbols. */ 4701f7ec340bSmacallan" 4702f7ec340bSmacallan 4703f7ec340bSmacallan case $host in 4704f7ec340bSmacallan *cygwin* | *mingw* ) 4705f7ec340bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 4706f7ec340bSmacallan/* DATA imports from DLLs on WIN32 can't be const, because 4707f7ec340bSmacallan runtime relocations are performed -- see ld's documentation 4708f7ec340bSmacallan on pseudo-relocs */ 4709f7ec340bSmacallanstruct { 4710f7ec340bSmacallan" 4711f7ec340bSmacallan ;; 4712f7ec340bSmacallan * ) 4713f7ec340bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 4714f7ec340bSmacallanconst struct { 4715f7ec340bSmacallan" 4716f7ec340bSmacallan ;; 4717f7ec340bSmacallan esac 4718f7ec340bSmacallan 4719f7ec340bSmacallan 4720f7ec340bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 4721f7ec340bSmacallan const char *name; 4722f7ec340bSmacallan lt_ptr address; 4723f7ec340bSmacallan} 4724f7ec340bSmacallanlt_preloaded_symbols[] = 4725f7ec340bSmacallan{\ 4726f7ec340bSmacallan" 4727f7ec340bSmacallan 4728f7ec340bSmacallan eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 4729f7ec340bSmacallan 4730f7ec340bSmacallan $echo >> "$output_objdir/$dlsyms" "\ 4731f7ec340bSmacallan {0, (lt_ptr) 0} 4732f7ec340bSmacallan}; 4733f7ec340bSmacallan 4734f7ec340bSmacallan/* This works around a problem in FreeBSD linker */ 4735f7ec340bSmacallan#ifdef FREEBSD_WORKAROUND 4736f7ec340bSmacallanstatic const void *lt_preloaded_setup() { 4737f7ec340bSmacallan return lt_preloaded_symbols; 4738f7ec340bSmacallan} 4739f7ec340bSmacallan#endif 4740f7ec340bSmacallan 4741f7ec340bSmacallan#ifdef __cplusplus 4742f7ec340bSmacallan} 4743f7ec340bSmacallan#endif\ 4744f7ec340bSmacallan" 4745f7ec340bSmacallan fi 4746f7ec340bSmacallan 4747f7ec340bSmacallan pic_flag_for_symtable= 4748f7ec340bSmacallan case $host in 4749f7ec340bSmacallan # compiling the symbol table file with pic_flag works around 4750f7ec340bSmacallan # a FreeBSD bug that causes programs to crash when -lm is 4751f7ec340bSmacallan # linked before any other PIC object. But we must not use 4752f7ec340bSmacallan # pic_flag when linking with -static. The problem exists in 4753f7ec340bSmacallan # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 4754f7ec340bSmacallan *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 4755f7ec340bSmacallan case "$compile_command " in 4756f7ec340bSmacallan *" -static "*) ;; 4757f7ec340bSmacallan *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 4758f7ec340bSmacallan esac;; 4759f7ec340bSmacallan *-*-hpux*) 4760f7ec340bSmacallan case "$compile_command " in 4761f7ec340bSmacallan *" -static "*) ;; 4762f7ec340bSmacallan *) pic_flag_for_symtable=" $pic_flag";; 4763f7ec340bSmacallan esac 4764f7ec340bSmacallan esac 4765f7ec340bSmacallan 4766f7ec340bSmacallan # Now compile the dynamic symbol file. 4767f7ec340bSmacallan $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4768f7ec340bSmacallan $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 4769f7ec340bSmacallan 4770f7ec340bSmacallan # Clean up the generated files. 4771f7ec340bSmacallan $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4772f7ec340bSmacallan $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4773f7ec340bSmacallan 4774f7ec340bSmacallan # Transform the symbol file into the correct name. 4775f7ec340bSmacallan case $host in 4776f7ec340bSmacallan *cygwin* | *mingw* ) 4777f7ec340bSmacallan if test -f "$output_objdir/${outputname}.def" ; then 47787ce7e03cSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 47797ce7e03cSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4780f7ec340bSmacallan else 47817ce7e03cSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47827ce7e03cSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4783f7ec340bSmacallan fi 4784f7ec340bSmacallan ;; 4785f7ec340bSmacallan * ) 47867ce7e03cSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47877ce7e03cSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4788f7ec340bSmacallan ;; 4789f7ec340bSmacallan esac 4790f7ec340bSmacallan ;; 4791f7ec340bSmacallan *) 4792f7ec340bSmacallan $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4793f7ec340bSmacallan exit $EXIT_FAILURE 4794f7ec340bSmacallan ;; 4795f7ec340bSmacallan esac 4796f7ec340bSmacallan else 4797f7ec340bSmacallan # We keep going just in case the user didn't refer to 4798f7ec340bSmacallan # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 4799f7ec340bSmacallan # really was required. 4800f7ec340bSmacallan 4801f7ec340bSmacallan # Nullify the symbol file. 48027ce7e03cSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 48037ce7e03cSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4804f7ec340bSmacallan fi 4805f7ec340bSmacallan 4806f7ec340bSmacallan if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 4807f7ec340bSmacallan # Replace the output file specification. 48087ce7e03cSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 4809f7ec340bSmacallan link_command="$compile_command$compile_rpath" 4810f7ec340bSmacallan 4811f7ec340bSmacallan # We have no uninstalled library dependencies, so finalize right now. 4812f7ec340bSmacallan $show "$link_command" 4813f7ec340bSmacallan $run eval "$link_command" 4814f7ec340bSmacallan exit_status=$? 4815f7ec340bSmacallan 4816f7ec340bSmacallan # Delete the generated files. 4817f7ec340bSmacallan if test -n "$dlsyms"; then 4818f7ec340bSmacallan $show "$rm $output_objdir/${outputname}S.${objext}" 4819f7ec340bSmacallan $run $rm "$output_objdir/${outputname}S.${objext}" 4820f7ec340bSmacallan fi 4821f7ec340bSmacallan 4822f7ec340bSmacallan exit $exit_status 4823f7ec340bSmacallan fi 4824f7ec340bSmacallan 4825f7ec340bSmacallan if test -n "$shlibpath_var"; then 4826f7ec340bSmacallan # We should set the shlibpath_var 4827f7ec340bSmacallan rpath= 4828f7ec340bSmacallan for dir in $temp_rpath; do 4829f7ec340bSmacallan case $dir in 4830f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) 4831f7ec340bSmacallan # Absolute path. 4832f7ec340bSmacallan rpath="$rpath$dir:" 4833f7ec340bSmacallan ;; 4834f7ec340bSmacallan *) 4835f7ec340bSmacallan # Relative path: add a thisdir entry. 4836f7ec340bSmacallan rpath="$rpath\$thisdir/$dir:" 4837f7ec340bSmacallan ;; 4838f7ec340bSmacallan esac 4839f7ec340bSmacallan done 4840f7ec340bSmacallan temp_rpath="$rpath" 4841f7ec340bSmacallan fi 4842f7ec340bSmacallan 4843f7ec340bSmacallan if test -n "$compile_shlibpath$finalize_shlibpath"; then 4844f7ec340bSmacallan compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 4845f7ec340bSmacallan fi 4846f7ec340bSmacallan if test -n "$finalize_shlibpath"; then 4847f7ec340bSmacallan finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 4848f7ec340bSmacallan fi 4849f7ec340bSmacallan 4850f7ec340bSmacallan compile_var= 4851f7ec340bSmacallan finalize_var= 4852f7ec340bSmacallan if test -n "$runpath_var"; then 4853f7ec340bSmacallan if test -n "$perm_rpath"; then 4854f7ec340bSmacallan # We should set the runpath_var. 4855f7ec340bSmacallan rpath= 4856f7ec340bSmacallan for dir in $perm_rpath; do 4857f7ec340bSmacallan rpath="$rpath$dir:" 4858f7ec340bSmacallan done 4859f7ec340bSmacallan compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 4860f7ec340bSmacallan fi 4861f7ec340bSmacallan if test -n "$finalize_perm_rpath"; then 4862f7ec340bSmacallan # We should set the runpath_var. 4863f7ec340bSmacallan rpath= 4864f7ec340bSmacallan for dir in $finalize_perm_rpath; do 4865f7ec340bSmacallan rpath="$rpath$dir:" 4866f7ec340bSmacallan done 4867f7ec340bSmacallan finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 4868f7ec340bSmacallan fi 4869f7ec340bSmacallan fi 4870f7ec340bSmacallan 4871f7ec340bSmacallan if test "$no_install" = yes; then 4872f7ec340bSmacallan # We don't need to create a wrapper script. 4873f7ec340bSmacallan link_command="$compile_var$compile_command$compile_rpath" 4874f7ec340bSmacallan # Replace the output file specification. 4875f7ec340bSmacallan link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4876f7ec340bSmacallan # Delete the old output file. 4877f7ec340bSmacallan $run $rm $output 4878f7ec340bSmacallan # Link the executable and exit 4879f7ec340bSmacallan $show "$link_command" 4880f7ec340bSmacallan $run eval "$link_command" || exit $? 4881f7ec340bSmacallan exit $EXIT_SUCCESS 4882f7ec340bSmacallan fi 4883f7ec340bSmacallan 4884f7ec340bSmacallan if test "$hardcode_action" = relink; then 4885f7ec340bSmacallan # Fast installation is not supported 4886f7ec340bSmacallan link_command="$compile_var$compile_command$compile_rpath" 4887f7ec340bSmacallan relink_command="$finalize_var$finalize_command$finalize_rpath" 4888f7ec340bSmacallan 4889f7ec340bSmacallan $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 4890f7ec340bSmacallan $echo "$modename: \`$output' will be relinked during installation" 1>&2 4891f7ec340bSmacallan else 4892f7ec340bSmacallan if test "$fast_install" != no; then 4893f7ec340bSmacallan link_command="$finalize_var$compile_command$finalize_rpath" 4894f7ec340bSmacallan if test "$fast_install" = yes; then 48957ce7e03cSmrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 4896f7ec340bSmacallan else 4897f7ec340bSmacallan # fast_install is set to needless 4898f7ec340bSmacallan relink_command= 4899f7ec340bSmacallan fi 4900f7ec340bSmacallan else 4901f7ec340bSmacallan link_command="$compile_var$compile_command$compile_rpath" 4902f7ec340bSmacallan relink_command="$finalize_var$finalize_command$finalize_rpath" 4903f7ec340bSmacallan fi 4904f7ec340bSmacallan fi 4905f7ec340bSmacallan 4906f7ec340bSmacallan # Replace the output file specification. 4907f7ec340bSmacallan link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 4908f7ec340bSmacallan 4909f7ec340bSmacallan # Delete the old output files. 4910f7ec340bSmacallan $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 4911f7ec340bSmacallan 4912f7ec340bSmacallan $show "$link_command" 4913f7ec340bSmacallan $run eval "$link_command" || exit $? 4914f7ec340bSmacallan 4915f7ec340bSmacallan # Now create the wrapper script. 4916f7ec340bSmacallan $show "creating $output" 4917f7ec340bSmacallan 4918f7ec340bSmacallan # Quote the relink command for shipping. 4919f7ec340bSmacallan if test -n "$relink_command"; then 4920f7ec340bSmacallan # Preserve any variables that may affect compiler behavior 4921f7ec340bSmacallan for var in $variables_saved_for_relink; do 4922f7ec340bSmacallan if eval test -z \"\${$var+set}\"; then 4923f7ec340bSmacallan relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4924f7ec340bSmacallan elif eval var_value=\$$var; test -z "$var_value"; then 4925f7ec340bSmacallan relink_command="$var=; export $var; $relink_command" 4926f7ec340bSmacallan else 4927f7ec340bSmacallan var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4928f7ec340bSmacallan relink_command="$var=\"$var_value\"; export $var; $relink_command" 4929f7ec340bSmacallan fi 4930f7ec340bSmacallan done 4931f7ec340bSmacallan relink_command="(cd `pwd`; $relink_command)" 49327ce7e03cSmrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 4933f7ec340bSmacallan fi 4934f7ec340bSmacallan 4935f7ec340bSmacallan # Quote $echo for shipping. 4936f7ec340bSmacallan if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 4937f7ec340bSmacallan case $progpath in 4938f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 4939f7ec340bSmacallan *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 4940f7ec340bSmacallan esac 4941f7ec340bSmacallan qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 4942f7ec340bSmacallan else 4943f7ec340bSmacallan qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 4944f7ec340bSmacallan fi 4945f7ec340bSmacallan 4946f7ec340bSmacallan # Only actually do things if our run command is non-null. 4947f7ec340bSmacallan if test -z "$run"; then 4948f7ec340bSmacallan # win32 will think the script is a binary if it has 4949f7ec340bSmacallan # a .exe suffix, so we strip it off here. 4950f7ec340bSmacallan case $output in 4951f7ec340bSmacallan *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 4952f7ec340bSmacallan esac 4953f7ec340bSmacallan # test for cygwin because mv fails w/o .exe extensions 4954f7ec340bSmacallan case $host in 4955f7ec340bSmacallan *cygwin*) 4956f7ec340bSmacallan exeext=.exe 4957f7ec340bSmacallan outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4958f7ec340bSmacallan *) exeext= ;; 4959f7ec340bSmacallan esac 4960f7ec340bSmacallan case $host in 4961f7ec340bSmacallan *cygwin* | *mingw* ) 4962f7ec340bSmacallan output_name=`basename $output` 4963f7ec340bSmacallan output_path=`dirname $output` 4964f7ec340bSmacallan cwrappersource="$output_path/$objdir/lt-$output_name.c" 4965f7ec340bSmacallan cwrapper="$output_path/$output_name.exe" 4966f7ec340bSmacallan $rm $cwrappersource $cwrapper 4967f7ec340bSmacallan trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4968f7ec340bSmacallan 4969f7ec340bSmacallan cat > $cwrappersource <<EOF 4970f7ec340bSmacallan 4971f7ec340bSmacallan/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4972f7ec340bSmacallan Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4973f7ec340bSmacallan 4974f7ec340bSmacallan The $output program cannot be directly executed until all the libtool 4975f7ec340bSmacallan libraries that it depends on are installed. 4976f7ec340bSmacallan 4977f7ec340bSmacallan This wrapper executable should never be moved out of the build directory. 4978f7ec340bSmacallan If it is, it will not operate correctly. 4979f7ec340bSmacallan 4980f7ec340bSmacallan Currently, it simply execs the wrapper *script* "/bin/sh $output", 4981f7ec340bSmacallan but could eventually absorb all of the scripts functionality and 4982f7ec340bSmacallan exec $objdir/$outputname directly. 4983f7ec340bSmacallan*/ 4984f7ec340bSmacallanEOF 4985f7ec340bSmacallan cat >> $cwrappersource<<"EOF" 4986f7ec340bSmacallan#include <stdio.h> 4987f7ec340bSmacallan#include <stdlib.h> 4988f7ec340bSmacallan#include <unistd.h> 4989f7ec340bSmacallan#include <malloc.h> 4990f7ec340bSmacallan#include <stdarg.h> 4991f7ec340bSmacallan#include <assert.h> 4992f7ec340bSmacallan#include <string.h> 4993f7ec340bSmacallan#include <ctype.h> 4994f7ec340bSmacallan#include <sys/stat.h> 4995f7ec340bSmacallan 4996f7ec340bSmacallan#if defined(PATH_MAX) 4997f7ec340bSmacallan# define LT_PATHMAX PATH_MAX 4998f7ec340bSmacallan#elif defined(MAXPATHLEN) 4999f7ec340bSmacallan# define LT_PATHMAX MAXPATHLEN 5000f7ec340bSmacallan#else 5001f7ec340bSmacallan# define LT_PATHMAX 1024 5002f7ec340bSmacallan#endif 5003f7ec340bSmacallan 5004f7ec340bSmacallan#ifndef DIR_SEPARATOR 5005f7ec340bSmacallan# define DIR_SEPARATOR '/' 5006f7ec340bSmacallan# define PATH_SEPARATOR ':' 5007f7ec340bSmacallan#endif 5008f7ec340bSmacallan 5009f7ec340bSmacallan#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 5010f7ec340bSmacallan defined (__OS2__) 5011f7ec340bSmacallan# define HAVE_DOS_BASED_FILE_SYSTEM 5012f7ec340bSmacallan# ifndef DIR_SEPARATOR_2 5013f7ec340bSmacallan# define DIR_SEPARATOR_2 '\\' 5014f7ec340bSmacallan# endif 5015f7ec340bSmacallan# ifndef PATH_SEPARATOR_2 5016f7ec340bSmacallan# define PATH_SEPARATOR_2 ';' 5017f7ec340bSmacallan# endif 5018f7ec340bSmacallan#endif 5019f7ec340bSmacallan 5020f7ec340bSmacallan#ifndef DIR_SEPARATOR_2 5021f7ec340bSmacallan# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 5022f7ec340bSmacallan#else /* DIR_SEPARATOR_2 */ 5023f7ec340bSmacallan# define IS_DIR_SEPARATOR(ch) \ 5024f7ec340bSmacallan (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 5025f7ec340bSmacallan#endif /* DIR_SEPARATOR_2 */ 5026f7ec340bSmacallan 5027f7ec340bSmacallan#ifndef PATH_SEPARATOR_2 5028f7ec340bSmacallan# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 5029f7ec340bSmacallan#else /* PATH_SEPARATOR_2 */ 5030f7ec340bSmacallan# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 5031f7ec340bSmacallan#endif /* PATH_SEPARATOR_2 */ 5032f7ec340bSmacallan 5033f7ec340bSmacallan#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 5034f7ec340bSmacallan#define XFREE(stale) do { \ 5035f7ec340bSmacallan if (stale) { free ((void *) stale); stale = 0; } \ 5036f7ec340bSmacallan} while (0) 5037f7ec340bSmacallan 5038f7ec340bSmacallan/* -DDEBUG is fairly common in CFLAGS. */ 5039f7ec340bSmacallan#undef DEBUG 5040f7ec340bSmacallan#if defined DEBUGWRAPPER 5041f7ec340bSmacallan# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 5042f7ec340bSmacallan#else 5043f7ec340bSmacallan# define DEBUG(format, ...) 5044f7ec340bSmacallan#endif 5045f7ec340bSmacallan 5046f7ec340bSmacallanconst char *program_name = NULL; 5047f7ec340bSmacallan 5048f7ec340bSmacallanvoid * xmalloc (size_t num); 5049f7ec340bSmacallanchar * xstrdup (const char *string); 5050f7ec340bSmacallanconst char * base_name (const char *name); 5051f7ec340bSmacallanchar * find_executable(const char *wrapper); 5052f7ec340bSmacallanint check_executable(const char *path); 5053f7ec340bSmacallanchar * strendzap(char *str, const char *pat); 5054f7ec340bSmacallanvoid lt_fatal (const char *message, ...); 5055f7ec340bSmacallan 5056f7ec340bSmacallanint 5057f7ec340bSmacallanmain (int argc, char *argv[]) 5058f7ec340bSmacallan{ 5059f7ec340bSmacallan char **newargz; 5060f7ec340bSmacallan int i; 5061f7ec340bSmacallan 5062f7ec340bSmacallan program_name = (char *) xstrdup (base_name (argv[0])); 5063f7ec340bSmacallan DEBUG("(main) argv[0] : %s\n",argv[0]); 5064f7ec340bSmacallan DEBUG("(main) program_name : %s\n",program_name); 5065f7ec340bSmacallan newargz = XMALLOC(char *, argc+2); 5066f7ec340bSmacallanEOF 5067f7ec340bSmacallan 5068f7ec340bSmacallan cat >> $cwrappersource <<EOF 5069f7ec340bSmacallan newargz[0] = (char *) xstrdup("$SHELL"); 5070f7ec340bSmacallanEOF 5071f7ec340bSmacallan 5072f7ec340bSmacallan cat >> $cwrappersource <<"EOF" 5073f7ec340bSmacallan newargz[1] = find_executable(argv[0]); 5074f7ec340bSmacallan if (newargz[1] == NULL) 5075f7ec340bSmacallan lt_fatal("Couldn't find %s", argv[0]); 5076f7ec340bSmacallan DEBUG("(main) found exe at : %s\n",newargz[1]); 5077f7ec340bSmacallan /* we know the script has the same name, without the .exe */ 5078f7ec340bSmacallan /* so make sure newargz[1] doesn't end in .exe */ 5079f7ec340bSmacallan strendzap(newargz[1],".exe"); 5080f7ec340bSmacallan for (i = 1; i < argc; i++) 5081f7ec340bSmacallan newargz[i+1] = xstrdup(argv[i]); 5082f7ec340bSmacallan newargz[argc+1] = NULL; 5083f7ec340bSmacallan 5084f7ec340bSmacallan for (i=0; i<argc+1; i++) 5085f7ec340bSmacallan { 5086f7ec340bSmacallan DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 5087f7ec340bSmacallan ; 5088f7ec340bSmacallan } 5089f7ec340bSmacallan 5090f7ec340bSmacallanEOF 5091f7ec340bSmacallan 5092f7ec340bSmacallan case $host_os in 5093f7ec340bSmacallan mingw*) 5094f7ec340bSmacallan cat >> $cwrappersource <<EOF 5095f7ec340bSmacallan execv("$SHELL",(char const **)newargz); 5096f7ec340bSmacallanEOF 5097f7ec340bSmacallan ;; 5098f7ec340bSmacallan *) 5099f7ec340bSmacallan cat >> $cwrappersource <<EOF 5100f7ec340bSmacallan execv("$SHELL",newargz); 5101f7ec340bSmacallanEOF 5102f7ec340bSmacallan ;; 5103f7ec340bSmacallan esac 5104f7ec340bSmacallan 5105f7ec340bSmacallan cat >> $cwrappersource <<"EOF" 5106f7ec340bSmacallan return 127; 5107f7ec340bSmacallan} 5108f7ec340bSmacallan 5109f7ec340bSmacallanvoid * 5110f7ec340bSmacallanxmalloc (size_t num) 5111f7ec340bSmacallan{ 5112f7ec340bSmacallan void * p = (void *) malloc (num); 5113f7ec340bSmacallan if (!p) 5114f7ec340bSmacallan lt_fatal ("Memory exhausted"); 5115f7ec340bSmacallan 5116f7ec340bSmacallan return p; 5117f7ec340bSmacallan} 5118f7ec340bSmacallan 5119f7ec340bSmacallanchar * 5120f7ec340bSmacallanxstrdup (const char *string) 5121f7ec340bSmacallan{ 5122f7ec340bSmacallan return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5123f7ec340bSmacallan; 5124f7ec340bSmacallan} 5125f7ec340bSmacallan 5126f7ec340bSmacallanconst char * 5127f7ec340bSmacallanbase_name (const char *name) 5128f7ec340bSmacallan{ 5129f7ec340bSmacallan const char *base; 5130f7ec340bSmacallan 5131f7ec340bSmacallan#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5132f7ec340bSmacallan /* Skip over the disk name in MSDOS pathnames. */ 5133f7ec340bSmacallan if (isalpha ((unsigned char)name[0]) && name[1] == ':') 5134f7ec340bSmacallan name += 2; 5135f7ec340bSmacallan#endif 5136f7ec340bSmacallan 5137f7ec340bSmacallan for (base = name; *name; name++) 5138f7ec340bSmacallan if (IS_DIR_SEPARATOR (*name)) 5139f7ec340bSmacallan base = name + 1; 5140f7ec340bSmacallan return base; 5141f7ec340bSmacallan} 5142f7ec340bSmacallan 5143f7ec340bSmacallanint 5144f7ec340bSmacallancheck_executable(const char * path) 5145f7ec340bSmacallan{ 5146f7ec340bSmacallan struct stat st; 5147f7ec340bSmacallan 5148f7ec340bSmacallan DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 5149f7ec340bSmacallan if ((!path) || (!*path)) 5150f7ec340bSmacallan return 0; 5151f7ec340bSmacallan 5152f7ec340bSmacallan if ((stat (path, &st) >= 0) && 5153f7ec340bSmacallan ( 5154f7ec340bSmacallan /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 5155f7ec340bSmacallan#if defined (S_IXOTH) 5156f7ec340bSmacallan ((st.st_mode & S_IXOTH) == S_IXOTH) || 5157f7ec340bSmacallan#endif 5158f7ec340bSmacallan#if defined (S_IXGRP) 5159f7ec340bSmacallan ((st.st_mode & S_IXGRP) == S_IXGRP) || 5160f7ec340bSmacallan#endif 5161f7ec340bSmacallan ((st.st_mode & S_IXUSR) == S_IXUSR)) 5162f7ec340bSmacallan ) 5163f7ec340bSmacallan return 1; 5164f7ec340bSmacallan else 5165f7ec340bSmacallan return 0; 5166f7ec340bSmacallan} 5167f7ec340bSmacallan 5168f7ec340bSmacallan/* Searches for the full path of the wrapper. Returns 5169f7ec340bSmacallan newly allocated full path name if found, NULL otherwise */ 5170f7ec340bSmacallanchar * 5171f7ec340bSmacallanfind_executable (const char* wrapper) 5172f7ec340bSmacallan{ 5173f7ec340bSmacallan int has_slash = 0; 5174f7ec340bSmacallan const char* p; 5175f7ec340bSmacallan const char* p_next; 5176f7ec340bSmacallan /* static buffer for getcwd */ 5177f7ec340bSmacallan char tmp[LT_PATHMAX + 1]; 5178f7ec340bSmacallan int tmp_len; 5179f7ec340bSmacallan char* concat_name; 5180f7ec340bSmacallan 5181f7ec340bSmacallan DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 5182f7ec340bSmacallan 5183f7ec340bSmacallan if ((wrapper == NULL) || (*wrapper == '\0')) 5184f7ec340bSmacallan return NULL; 5185f7ec340bSmacallan 5186f7ec340bSmacallan /* Absolute path? */ 5187f7ec340bSmacallan#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5188f7ec340bSmacallan if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 5189f7ec340bSmacallan { 5190f7ec340bSmacallan concat_name = xstrdup (wrapper); 5191f7ec340bSmacallan if (check_executable(concat_name)) 5192f7ec340bSmacallan return concat_name; 5193f7ec340bSmacallan XFREE(concat_name); 5194f7ec340bSmacallan } 5195f7ec340bSmacallan else 5196f7ec340bSmacallan { 5197f7ec340bSmacallan#endif 5198f7ec340bSmacallan if (IS_DIR_SEPARATOR (wrapper[0])) 5199f7ec340bSmacallan { 5200f7ec340bSmacallan concat_name = xstrdup (wrapper); 5201f7ec340bSmacallan if (check_executable(concat_name)) 5202f7ec340bSmacallan return concat_name; 5203f7ec340bSmacallan XFREE(concat_name); 5204f7ec340bSmacallan } 5205f7ec340bSmacallan#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5206f7ec340bSmacallan } 5207f7ec340bSmacallan#endif 5208f7ec340bSmacallan 5209f7ec340bSmacallan for (p = wrapper; *p; p++) 5210f7ec340bSmacallan if (*p == '/') 5211f7ec340bSmacallan { 5212f7ec340bSmacallan has_slash = 1; 5213f7ec340bSmacallan break; 5214f7ec340bSmacallan } 5215f7ec340bSmacallan if (!has_slash) 5216f7ec340bSmacallan { 5217f7ec340bSmacallan /* no slashes; search PATH */ 5218f7ec340bSmacallan const char* path = getenv ("PATH"); 5219f7ec340bSmacallan if (path != NULL) 5220f7ec340bSmacallan { 5221f7ec340bSmacallan for (p = path; *p; p = p_next) 5222f7ec340bSmacallan { 5223f7ec340bSmacallan const char* q; 5224f7ec340bSmacallan size_t p_len; 5225f7ec340bSmacallan for (q = p; *q; q++) 5226f7ec340bSmacallan if (IS_PATH_SEPARATOR(*q)) 5227f7ec340bSmacallan break; 5228f7ec340bSmacallan p_len = q - p; 5229f7ec340bSmacallan p_next = (*q == '\0' ? q : q + 1); 5230f7ec340bSmacallan if (p_len == 0) 5231f7ec340bSmacallan { 5232f7ec340bSmacallan /* empty path: current directory */ 5233f7ec340bSmacallan if (getcwd (tmp, LT_PATHMAX) == NULL) 5234f7ec340bSmacallan lt_fatal ("getcwd failed"); 5235f7ec340bSmacallan tmp_len = strlen(tmp); 5236f7ec340bSmacallan concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5237f7ec340bSmacallan memcpy (concat_name, tmp, tmp_len); 5238f7ec340bSmacallan concat_name[tmp_len] = '/'; 5239f7ec340bSmacallan strcpy (concat_name + tmp_len + 1, wrapper); 5240f7ec340bSmacallan } 5241f7ec340bSmacallan else 5242f7ec340bSmacallan { 5243f7ec340bSmacallan concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 5244f7ec340bSmacallan memcpy (concat_name, p, p_len); 5245f7ec340bSmacallan concat_name[p_len] = '/'; 5246f7ec340bSmacallan strcpy (concat_name + p_len + 1, wrapper); 5247f7ec340bSmacallan } 5248f7ec340bSmacallan if (check_executable(concat_name)) 5249f7ec340bSmacallan return concat_name; 5250f7ec340bSmacallan XFREE(concat_name); 5251f7ec340bSmacallan } 5252f7ec340bSmacallan } 5253f7ec340bSmacallan /* not found in PATH; assume curdir */ 5254f7ec340bSmacallan } 5255f7ec340bSmacallan /* Relative path | not found in path: prepend cwd */ 5256f7ec340bSmacallan if (getcwd (tmp, LT_PATHMAX) == NULL) 5257f7ec340bSmacallan lt_fatal ("getcwd failed"); 5258f7ec340bSmacallan tmp_len = strlen(tmp); 5259f7ec340bSmacallan concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5260f7ec340bSmacallan memcpy (concat_name, tmp, tmp_len); 5261f7ec340bSmacallan concat_name[tmp_len] = '/'; 5262f7ec340bSmacallan strcpy (concat_name + tmp_len + 1, wrapper); 5263f7ec340bSmacallan 5264f7ec340bSmacallan if (check_executable(concat_name)) 5265f7ec340bSmacallan return concat_name; 5266f7ec340bSmacallan XFREE(concat_name); 5267f7ec340bSmacallan return NULL; 5268f7ec340bSmacallan} 5269f7ec340bSmacallan 5270f7ec340bSmacallanchar * 5271f7ec340bSmacallanstrendzap(char *str, const char *pat) 5272f7ec340bSmacallan{ 5273f7ec340bSmacallan size_t len, patlen; 5274f7ec340bSmacallan 5275f7ec340bSmacallan assert(str != NULL); 5276f7ec340bSmacallan assert(pat != NULL); 5277f7ec340bSmacallan 5278f7ec340bSmacallan len = strlen(str); 5279f7ec340bSmacallan patlen = strlen(pat); 5280f7ec340bSmacallan 5281f7ec340bSmacallan if (patlen <= len) 5282f7ec340bSmacallan { 5283f7ec340bSmacallan str += len - patlen; 5284f7ec340bSmacallan if (strcmp(str, pat) == 0) 5285f7ec340bSmacallan *str = '\0'; 5286f7ec340bSmacallan } 5287f7ec340bSmacallan return str; 5288f7ec340bSmacallan} 5289f7ec340bSmacallan 5290f7ec340bSmacallanstatic void 5291f7ec340bSmacallanlt_error_core (int exit_status, const char * mode, 5292f7ec340bSmacallan const char * message, va_list ap) 5293f7ec340bSmacallan{ 5294f7ec340bSmacallan fprintf (stderr, "%s: %s: ", program_name, mode); 5295f7ec340bSmacallan vfprintf (stderr, message, ap); 5296f7ec340bSmacallan fprintf (stderr, ".\n"); 5297f7ec340bSmacallan 5298f7ec340bSmacallan if (exit_status >= 0) 5299f7ec340bSmacallan exit (exit_status); 5300f7ec340bSmacallan} 5301f7ec340bSmacallan 5302f7ec340bSmacallanvoid 5303f7ec340bSmacallanlt_fatal (const char *message, ...) 5304f7ec340bSmacallan{ 5305f7ec340bSmacallan va_list ap; 5306f7ec340bSmacallan va_start (ap, message); 5307f7ec340bSmacallan lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5308f7ec340bSmacallan va_end (ap); 5309f7ec340bSmacallan} 5310f7ec340bSmacallanEOF 5311f7ec340bSmacallan # we should really use a build-platform specific compiler 5312f7ec340bSmacallan # here, but OTOH, the wrappers (shell script and this C one) 5313f7ec340bSmacallan # are only useful if you want to execute the "real" binary. 5314f7ec340bSmacallan # Since the "real" binary is built for $host, then this 5315f7ec340bSmacallan # wrapper might as well be built for $host, too. 5316f7ec340bSmacallan $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 5317f7ec340bSmacallan ;; 5318f7ec340bSmacallan esac 5319f7ec340bSmacallan $rm $output 5320f7ec340bSmacallan trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5321f7ec340bSmacallan 5322f7ec340bSmacallan $echo > $output "\ 5323f7ec340bSmacallan#! $SHELL 5324f7ec340bSmacallan 5325f7ec340bSmacallan# $output - temporary wrapper script for $objdir/$outputname 5326f7ec340bSmacallan# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5327f7ec340bSmacallan# 5328f7ec340bSmacallan# The $output program cannot be directly executed until all the libtool 5329f7ec340bSmacallan# libraries that it depends on are installed. 5330f7ec340bSmacallan# 5331f7ec340bSmacallan# This wrapper script should never be moved out of the build directory. 5332f7ec340bSmacallan# If it is, it will not operate correctly. 5333f7ec340bSmacallan 5334f7ec340bSmacallan# Sed substitution that helps us do robust quoting. It backslashifies 5335f7ec340bSmacallan# metacharacters that are still active within double-quoted strings. 5336f7ec340bSmacallanXsed='${SED} -e 1s/^X//' 5337f7ec340bSmacallansed_quote_subst='$sed_quote_subst' 5338f7ec340bSmacallan 53397ce7e03cSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 53407ce7e03cSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 53417ce7e03cSmrg emulate sh 53427ce7e03cSmrg NULLCMD=: 53437ce7e03cSmrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 53447ce7e03cSmrg # is contrary to our usage. Disable this feature. 53457ce7e03cSmrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 53467ce7e03cSmrg setopt NO_GLOB_SUBST 53477ce7e03cSmrgelse 53487ce7e03cSmrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 53497ce7e03cSmrgfi 53507ce7e03cSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 53517ce7e03cSmrgDUALCASE=1; export DUALCASE # for MKS sh 53527ce7e03cSmrg 5353f7ec340bSmacallan# The HP-UX ksh and POSIX shell print the target directory to stdout 5354f7ec340bSmacallan# if CDPATH is set. 5355f7ec340bSmacallan(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5356f7ec340bSmacallan 5357f7ec340bSmacallanrelink_command=\"$relink_command\" 5358f7ec340bSmacallan 5359f7ec340bSmacallan# This environment variable determines our operation mode. 5360f7ec340bSmacallanif test \"\$libtool_install_magic\" = \"$magic\"; then 5361f7ec340bSmacallan # install mode needs the following variable: 5362f7ec340bSmacallan notinst_deplibs='$notinst_deplibs' 5363f7ec340bSmacallanelse 5364f7ec340bSmacallan # When we are sourced in execute mode, \$file and \$echo are already set. 5365f7ec340bSmacallan if test \"\$libtool_execute_magic\" != \"$magic\"; then 5366f7ec340bSmacallan echo=\"$qecho\" 5367f7ec340bSmacallan file=\"\$0\" 5368f7ec340bSmacallan # Make sure echo works. 5369f7ec340bSmacallan if test \"X\$1\" = X--no-reexec; then 5370f7ec340bSmacallan # Discard the --no-reexec flag, and continue. 5371f7ec340bSmacallan shift 5372f7ec340bSmacallan elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 5373f7ec340bSmacallan # Yippee, \$echo works! 5374f7ec340bSmacallan : 5375f7ec340bSmacallan else 5376f7ec340bSmacallan # Restart under the correct shell, and then maybe \$echo will work. 5377f7ec340bSmacallan exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 5378f7ec340bSmacallan fi 5379f7ec340bSmacallan fi\ 5380f7ec340bSmacallan" 5381f7ec340bSmacallan $echo >> $output "\ 5382f7ec340bSmacallan 5383f7ec340bSmacallan # Find the directory that this script lives in. 5384f7ec340bSmacallan thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 5385f7ec340bSmacallan test \"x\$thisdir\" = \"x\$file\" && thisdir=. 5386f7ec340bSmacallan 5387f7ec340bSmacallan # Follow symbolic links until we get to the real thisdir. 5388f7ec340bSmacallan file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 5389f7ec340bSmacallan while test -n \"\$file\"; do 5390f7ec340bSmacallan destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 5391f7ec340bSmacallan 5392f7ec340bSmacallan # If there was a directory component, then change thisdir. 5393f7ec340bSmacallan if test \"x\$destdir\" != \"x\$file\"; then 5394f7ec340bSmacallan case \"\$destdir\" in 5395f7ec340bSmacallan [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5396f7ec340bSmacallan *) thisdir=\"\$thisdir/\$destdir\" ;; 5397f7ec340bSmacallan esac 5398f7ec340bSmacallan fi 5399f7ec340bSmacallan 5400f7ec340bSmacallan file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 5401f7ec340bSmacallan file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 5402f7ec340bSmacallan done 5403f7ec340bSmacallan 5404f7ec340bSmacallan # Try to get the absolute directory name. 5405f7ec340bSmacallan absdir=\`cd \"\$thisdir\" && pwd\` 5406f7ec340bSmacallan test -n \"\$absdir\" && thisdir=\"\$absdir\" 5407f7ec340bSmacallan" 5408f7ec340bSmacallan 5409f7ec340bSmacallan if test "$fast_install" = yes; then 5410f7ec340bSmacallan $echo >> $output "\ 5411f7ec340bSmacallan program=lt-'$outputname'$exeext 5412f7ec340bSmacallan progdir=\"\$thisdir/$objdir\" 5413f7ec340bSmacallan 5414f7ec340bSmacallan if test ! -f \"\$progdir/\$program\" || \\ 5415f7ec340bSmacallan { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 5416f7ec340bSmacallan test \"X\$file\" != \"X\$progdir/\$program\"; }; then 5417f7ec340bSmacallan 5418f7ec340bSmacallan file=\"\$\$-\$program\" 5419f7ec340bSmacallan 5420f7ec340bSmacallan if test ! -d \"\$progdir\"; then 5421f7ec340bSmacallan $mkdir \"\$progdir\" 5422f7ec340bSmacallan else 5423f7ec340bSmacallan $rm \"\$progdir/\$file\" 5424f7ec340bSmacallan fi" 5425f7ec340bSmacallan 5426f7ec340bSmacallan $echo >> $output "\ 5427f7ec340bSmacallan 5428f7ec340bSmacallan # relink executable if necessary 5429f7ec340bSmacallan if test -n \"\$relink_command\"; then 5430f7ec340bSmacallan if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5431f7ec340bSmacallan else 5432f7ec340bSmacallan $echo \"\$relink_command_output\" >&2 5433f7ec340bSmacallan $rm \"\$progdir/\$file\" 5434f7ec340bSmacallan exit $EXIT_FAILURE 5435f7ec340bSmacallan fi 5436f7ec340bSmacallan fi 5437f7ec340bSmacallan 5438f7ec340bSmacallan $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5439f7ec340bSmacallan { $rm \"\$progdir/\$program\"; 5440f7ec340bSmacallan $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5441f7ec340bSmacallan $rm \"\$progdir/\$file\" 5442f7ec340bSmacallan fi" 5443f7ec340bSmacallan else 5444f7ec340bSmacallan $echo >> $output "\ 5445f7ec340bSmacallan program='$outputname' 5446f7ec340bSmacallan progdir=\"\$thisdir/$objdir\" 5447f7ec340bSmacallan" 5448f7ec340bSmacallan fi 5449f7ec340bSmacallan 5450f7ec340bSmacallan $echo >> $output "\ 5451f7ec340bSmacallan 5452f7ec340bSmacallan if test -f \"\$progdir/\$program\"; then" 5453f7ec340bSmacallan 5454f7ec340bSmacallan # Export our shlibpath_var if we have one. 5455f7ec340bSmacallan if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5456f7ec340bSmacallan $echo >> $output "\ 5457f7ec340bSmacallan # Add our own library path to $shlibpath_var 5458f7ec340bSmacallan $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 5459f7ec340bSmacallan 5460f7ec340bSmacallan # Some systems cannot cope with colon-terminated $shlibpath_var 5461f7ec340bSmacallan # The second colon is a workaround for a bug in BeOS R4 sed 5462f7ec340bSmacallan $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 5463f7ec340bSmacallan 5464f7ec340bSmacallan export $shlibpath_var 5465f7ec340bSmacallan" 5466f7ec340bSmacallan fi 5467f7ec340bSmacallan 5468f7ec340bSmacallan # fixup the dll searchpath if we need to. 5469f7ec340bSmacallan if test -n "$dllsearchpath"; then 5470f7ec340bSmacallan $echo >> $output "\ 5471f7ec340bSmacallan # Add the dll search path components to the executable PATH 5472f7ec340bSmacallan PATH=$dllsearchpath:\$PATH 5473f7ec340bSmacallan" 5474f7ec340bSmacallan fi 5475f7ec340bSmacallan 5476f7ec340bSmacallan $echo >> $output "\ 5477f7ec340bSmacallan if test \"\$libtool_execute_magic\" != \"$magic\"; then 5478f7ec340bSmacallan # Run the actual program with our arguments. 5479f7ec340bSmacallan" 5480f7ec340bSmacallan case $host in 5481f7ec340bSmacallan # Backslashes separate directories on plain windows 5482f7ec340bSmacallan *-*-mingw | *-*-os2*) 5483f7ec340bSmacallan $echo >> $output "\ 5484f7ec340bSmacallan exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5485f7ec340bSmacallan" 5486f7ec340bSmacallan ;; 5487f7ec340bSmacallan 5488f7ec340bSmacallan *) 5489f7ec340bSmacallan $echo >> $output "\ 5490f7ec340bSmacallan exec \"\$progdir/\$program\" \${1+\"\$@\"} 5491f7ec340bSmacallan" 5492f7ec340bSmacallan ;; 5493f7ec340bSmacallan esac 5494f7ec340bSmacallan $echo >> $output "\ 54957ce7e03cSmrg \$echo \"\$0: cannot exec \$program \$*\" 5496f7ec340bSmacallan exit $EXIT_FAILURE 5497f7ec340bSmacallan fi 5498f7ec340bSmacallan else 5499f7ec340bSmacallan # The program doesn't exist. 5500f7ec340bSmacallan \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 5501f7ec340bSmacallan \$echo \"This script is just a wrapper for \$program.\" 1>&2 5502f7ec340bSmacallan $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5503f7ec340bSmacallan exit $EXIT_FAILURE 5504f7ec340bSmacallan fi 5505f7ec340bSmacallanfi\ 5506f7ec340bSmacallan" 5507f7ec340bSmacallan chmod +x $output 5508f7ec340bSmacallan fi 5509f7ec340bSmacallan exit $EXIT_SUCCESS 5510f7ec340bSmacallan ;; 5511f7ec340bSmacallan esac 5512f7ec340bSmacallan 5513f7ec340bSmacallan # See if we need to build an old-fashioned archive. 5514f7ec340bSmacallan for oldlib in $oldlibs; do 5515f7ec340bSmacallan 5516f7ec340bSmacallan if test "$build_libtool_libs" = convenience; then 5517f7ec340bSmacallan oldobjs="$libobjs_save" 5518f7ec340bSmacallan addlibs="$convenience" 5519f7ec340bSmacallan build_libtool_libs=no 5520f7ec340bSmacallan else 5521f7ec340bSmacallan if test "$build_libtool_libs" = module; then 5522f7ec340bSmacallan oldobjs="$libobjs_save" 5523f7ec340bSmacallan build_libtool_libs=no 5524f7ec340bSmacallan else 5525f7ec340bSmacallan oldobjs="$old_deplibs $non_pic_objects" 5526f7ec340bSmacallan fi 5527f7ec340bSmacallan addlibs="$old_convenience" 5528f7ec340bSmacallan fi 5529f7ec340bSmacallan 5530f7ec340bSmacallan if test -n "$addlibs"; then 5531f7ec340bSmacallan gentop="$output_objdir/${outputname}x" 5532f7ec340bSmacallan generated="$generated $gentop" 5533f7ec340bSmacallan 5534f7ec340bSmacallan func_extract_archives $gentop $addlibs 5535f7ec340bSmacallan oldobjs="$oldobjs $func_extract_archives_result" 5536f7ec340bSmacallan fi 5537f7ec340bSmacallan 5538f7ec340bSmacallan # Do each command in the archive commands. 5539f7ec340bSmacallan if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5540f7ec340bSmacallan cmds=$old_archive_from_new_cmds 5541f7ec340bSmacallan else 5542f7ec340bSmacallan # POSIX demands no paths to be encoded in archives. We have 5543f7ec340bSmacallan # to avoid creating archives with duplicate basenames if we 5544f7ec340bSmacallan # might have to extract them afterwards, e.g., when creating a 5545f7ec340bSmacallan # static archive out of a convenience library, or when linking 5546f7ec340bSmacallan # the entirety of a libtool archive into another (currently 5547f7ec340bSmacallan # not supported by libtool). 5548f7ec340bSmacallan if (for obj in $oldobjs 5549f7ec340bSmacallan do 5550f7ec340bSmacallan $echo "X$obj" | $Xsed -e 's%^.*/%%' 5551f7ec340bSmacallan done | sort | sort -uc >/dev/null 2>&1); then 5552f7ec340bSmacallan : 5553f7ec340bSmacallan else 5554f7ec340bSmacallan $echo "copying selected object files to avoid basename conflicts..." 5555f7ec340bSmacallan 5556f7ec340bSmacallan if test -z "$gentop"; then 5557f7ec340bSmacallan gentop="$output_objdir/${outputname}x" 5558f7ec340bSmacallan generated="$generated $gentop" 5559f7ec340bSmacallan 5560f7ec340bSmacallan $show "${rm}r $gentop" 5561f7ec340bSmacallan $run ${rm}r "$gentop" 5562f7ec340bSmacallan $show "$mkdir $gentop" 5563f7ec340bSmacallan $run $mkdir "$gentop" 5564f7ec340bSmacallan exit_status=$? 5565f7ec340bSmacallan if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 5566f7ec340bSmacallan exit $exit_status 5567f7ec340bSmacallan fi 5568f7ec340bSmacallan fi 5569f7ec340bSmacallan 5570f7ec340bSmacallan save_oldobjs=$oldobjs 5571f7ec340bSmacallan oldobjs= 5572f7ec340bSmacallan counter=1 5573f7ec340bSmacallan for obj in $save_oldobjs 5574f7ec340bSmacallan do 5575f7ec340bSmacallan objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 5576f7ec340bSmacallan case " $oldobjs " in 5577f7ec340bSmacallan " ") oldobjs=$obj ;; 5578f7ec340bSmacallan *[\ /]"$objbase "*) 5579f7ec340bSmacallan while :; do 5580f7ec340bSmacallan # Make sure we don't pick an alternate name that also 5581f7ec340bSmacallan # overlaps. 5582f7ec340bSmacallan newobj=lt$counter-$objbase 5583f7ec340bSmacallan counter=`expr $counter + 1` 5584f7ec340bSmacallan case " $oldobjs " in 5585f7ec340bSmacallan *[\ /]"$newobj "*) ;; 5586f7ec340bSmacallan *) if test ! -f "$gentop/$newobj"; then break; fi ;; 5587f7ec340bSmacallan esac 5588f7ec340bSmacallan done 5589f7ec340bSmacallan $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 5590f7ec340bSmacallan $run ln "$obj" "$gentop/$newobj" || 5591f7ec340bSmacallan $run cp "$obj" "$gentop/$newobj" 5592f7ec340bSmacallan oldobjs="$oldobjs $gentop/$newobj" 5593f7ec340bSmacallan ;; 5594f7ec340bSmacallan *) oldobjs="$oldobjs $obj" ;; 5595f7ec340bSmacallan esac 5596f7ec340bSmacallan done 5597f7ec340bSmacallan fi 5598f7ec340bSmacallan 5599f7ec340bSmacallan eval cmds=\"$old_archive_cmds\" 5600f7ec340bSmacallan 5601f7ec340bSmacallan if len=`expr "X$cmds" : ".*"` && 5602f7ec340bSmacallan test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5603f7ec340bSmacallan cmds=$old_archive_cmds 5604f7ec340bSmacallan else 5605f7ec340bSmacallan # the command line is too long to link in one step, link in parts 5606f7ec340bSmacallan $echo "using piecewise archive linking..." 5607f7ec340bSmacallan save_RANLIB=$RANLIB 5608f7ec340bSmacallan RANLIB=: 5609f7ec340bSmacallan objlist= 5610f7ec340bSmacallan concat_cmds= 5611f7ec340bSmacallan save_oldobjs=$oldobjs 5612f7ec340bSmacallan 5613f7ec340bSmacallan # Is there a better way of finding the last object in the list? 5614f7ec340bSmacallan for obj in $save_oldobjs 5615f7ec340bSmacallan do 5616f7ec340bSmacallan last_oldobj=$obj 5617f7ec340bSmacallan done 5618f7ec340bSmacallan for obj in $save_oldobjs 5619f7ec340bSmacallan do 5620f7ec340bSmacallan oldobjs="$objlist $obj" 5621f7ec340bSmacallan objlist="$objlist $obj" 5622f7ec340bSmacallan eval test_cmds=\"$old_archive_cmds\" 5623f7ec340bSmacallan if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5624f7ec340bSmacallan test "$len" -le "$max_cmd_len"; then 5625f7ec340bSmacallan : 5626f7ec340bSmacallan else 5627f7ec340bSmacallan # the above command should be used before it gets too long 5628f7ec340bSmacallan oldobjs=$objlist 5629f7ec340bSmacallan if test "$obj" = "$last_oldobj" ; then 5630f7ec340bSmacallan RANLIB=$save_RANLIB 5631f7ec340bSmacallan fi 5632f7ec340bSmacallan test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5633f7ec340bSmacallan eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 5634f7ec340bSmacallan objlist= 5635f7ec340bSmacallan fi 5636f7ec340bSmacallan done 5637f7ec340bSmacallan RANLIB=$save_RANLIB 5638f7ec340bSmacallan oldobjs=$objlist 5639f7ec340bSmacallan if test "X$oldobjs" = "X" ; then 5640f7ec340bSmacallan eval cmds=\"\$concat_cmds\" 5641f7ec340bSmacallan else 5642f7ec340bSmacallan eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 5643f7ec340bSmacallan fi 5644f7ec340bSmacallan fi 5645f7ec340bSmacallan fi 5646f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 5647f7ec340bSmacallan for cmd in $cmds; do 5648f7ec340bSmacallan eval cmd=\"$cmd\" 5649f7ec340bSmacallan IFS="$save_ifs" 5650f7ec340bSmacallan $show "$cmd" 5651f7ec340bSmacallan $run eval "$cmd" || exit $? 5652f7ec340bSmacallan done 5653f7ec340bSmacallan IFS="$save_ifs" 5654f7ec340bSmacallan done 5655f7ec340bSmacallan 5656f7ec340bSmacallan if test -n "$generated"; then 5657f7ec340bSmacallan $show "${rm}r$generated" 5658f7ec340bSmacallan $run ${rm}r$generated 5659f7ec340bSmacallan fi 5660f7ec340bSmacallan 5661f7ec340bSmacallan # Now create the libtool archive. 5662f7ec340bSmacallan case $output in 5663f7ec340bSmacallan *.la) 5664f7ec340bSmacallan old_library= 5665f7ec340bSmacallan test "$build_old_libs" = yes && old_library="$libname.$libext" 5666f7ec340bSmacallan $show "creating $output" 5667f7ec340bSmacallan 5668f7ec340bSmacallan # Preserve any variables that may affect compiler behavior 5669f7ec340bSmacallan for var in $variables_saved_for_relink; do 5670f7ec340bSmacallan if eval test -z \"\${$var+set}\"; then 5671f7ec340bSmacallan relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 5672f7ec340bSmacallan elif eval var_value=\$$var; test -z "$var_value"; then 5673f7ec340bSmacallan relink_command="$var=; export $var; $relink_command" 5674f7ec340bSmacallan else 5675f7ec340bSmacallan var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 5676f7ec340bSmacallan relink_command="$var=\"$var_value\"; export $var; $relink_command" 5677f7ec340bSmacallan fi 5678f7ec340bSmacallan done 5679f7ec340bSmacallan # Quote the link command for shipping. 5680f7ec340bSmacallan relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 56817ce7e03cSmrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 5682f7ec340bSmacallan if test "$hardcode_automatic" = yes ; then 5683f7ec340bSmacallan relink_command= 5684f7ec340bSmacallan fi 5685f7ec340bSmacallan 5686f7ec340bSmacallan 5687f7ec340bSmacallan # Only create the output if not a dry run. 5688f7ec340bSmacallan if test -z "$run"; then 5689f7ec340bSmacallan for installed in no yes; do 5690f7ec340bSmacallan if test "$installed" = yes; then 5691f7ec340bSmacallan if test -z "$install_libdir"; then 5692f7ec340bSmacallan break 5693f7ec340bSmacallan fi 5694f7ec340bSmacallan output="$output_objdir/$outputname"i 5695f7ec340bSmacallan # Replace all uninstalled libtool libraries with the installed ones 5696f7ec340bSmacallan newdependency_libs= 5697f7ec340bSmacallan for deplib in $dependency_libs; do 5698f7ec340bSmacallan case $deplib in 5699f7ec340bSmacallan *.la) 5700f7ec340bSmacallan name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 5701f7ec340bSmacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5702f7ec340bSmacallan if test -z "$libdir"; then 5703f7ec340bSmacallan $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 5704f7ec340bSmacallan exit $EXIT_FAILURE 5705f7ec340bSmacallan fi 5706f7ec340bSmacallan newdependency_libs="$newdependency_libs $libdir/$name" 5707f7ec340bSmacallan ;; 5708f7ec340bSmacallan *) newdependency_libs="$newdependency_libs $deplib" ;; 5709f7ec340bSmacallan esac 5710f7ec340bSmacallan done 5711f7ec340bSmacallan dependency_libs="$newdependency_libs" 5712f7ec340bSmacallan newdlfiles= 5713f7ec340bSmacallan for lib in $dlfiles; do 5714f7ec340bSmacallan name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5715f7ec340bSmacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5716f7ec340bSmacallan if test -z "$libdir"; then 5717f7ec340bSmacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5718f7ec340bSmacallan exit $EXIT_FAILURE 5719f7ec340bSmacallan fi 5720f7ec340bSmacallan newdlfiles="$newdlfiles $libdir/$name" 5721f7ec340bSmacallan done 5722f7ec340bSmacallan dlfiles="$newdlfiles" 5723f7ec340bSmacallan newdlprefiles= 5724f7ec340bSmacallan for lib in $dlprefiles; do 5725f7ec340bSmacallan name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5726f7ec340bSmacallan eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5727f7ec340bSmacallan if test -z "$libdir"; then 5728f7ec340bSmacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5729f7ec340bSmacallan exit $EXIT_FAILURE 5730f7ec340bSmacallan fi 5731f7ec340bSmacallan newdlprefiles="$newdlprefiles $libdir/$name" 5732f7ec340bSmacallan done 5733f7ec340bSmacallan dlprefiles="$newdlprefiles" 5734f7ec340bSmacallan else 5735f7ec340bSmacallan newdlfiles= 5736f7ec340bSmacallan for lib in $dlfiles; do 5737f7ec340bSmacallan case $lib in 5738f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5739f7ec340bSmacallan *) abs=`pwd`"/$lib" ;; 5740f7ec340bSmacallan esac 5741f7ec340bSmacallan newdlfiles="$newdlfiles $abs" 5742f7ec340bSmacallan done 5743f7ec340bSmacallan dlfiles="$newdlfiles" 5744f7ec340bSmacallan newdlprefiles= 5745f7ec340bSmacallan for lib in $dlprefiles; do 5746f7ec340bSmacallan case $lib in 5747f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5748f7ec340bSmacallan *) abs=`pwd`"/$lib" ;; 5749f7ec340bSmacallan esac 5750f7ec340bSmacallan newdlprefiles="$newdlprefiles $abs" 5751f7ec340bSmacallan done 5752f7ec340bSmacallan dlprefiles="$newdlprefiles" 5753f7ec340bSmacallan fi 5754f7ec340bSmacallan $rm $output 5755f7ec340bSmacallan # place dlname in correct position for cygwin 5756f7ec340bSmacallan tdlname=$dlname 5757f7ec340bSmacallan case $host,$output,$installed,$module,$dlname in 5758f7ec340bSmacallan *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 5759f7ec340bSmacallan esac 5760f7ec340bSmacallan $echo > $output "\ 5761f7ec340bSmacallan# $outputname - a libtool library file 5762f7ec340bSmacallan# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5763f7ec340bSmacallan# 5764f7ec340bSmacallan# Please DO NOT delete this file! 5765f7ec340bSmacallan# It is necessary for linking the library. 5766f7ec340bSmacallan 5767f7ec340bSmacallan# The name that we can dlopen(3). 5768f7ec340bSmacallandlname='$tdlname' 5769f7ec340bSmacallan 5770f7ec340bSmacallan# Names of this library. 5771f7ec340bSmacallanlibrary_names='$library_names' 5772f7ec340bSmacallan 5773f7ec340bSmacallan# The name of the static archive. 5774f7ec340bSmacallanold_library='$old_library' 5775f7ec340bSmacallan 5776f7ec340bSmacallan# Libraries that this one depends upon. 5777f7ec340bSmacallandependency_libs='$dependency_libs' 5778f7ec340bSmacallan 5779f7ec340bSmacallan# Version information for $libname. 5780f7ec340bSmacallancurrent=$current 5781f7ec340bSmacallanage=$age 5782f7ec340bSmacallanrevision=$revision 5783f7ec340bSmacallan 5784f7ec340bSmacallan# Is this an already installed library? 5785f7ec340bSmacallaninstalled=$installed 5786f7ec340bSmacallan 5787f7ec340bSmacallan# Should we warn about portability when linking against -modules? 5788f7ec340bSmacallanshouldnotlink=$module 5789f7ec340bSmacallan 5790f7ec340bSmacallan# Files to dlopen/dlpreopen 5791f7ec340bSmacallandlopen='$dlfiles' 5792f7ec340bSmacallandlpreopen='$dlprefiles' 5793f7ec340bSmacallan 5794f7ec340bSmacallan# Directory that this library needs to be installed in: 5795f7ec340bSmacallanlibdir='$install_libdir'" 5796f7ec340bSmacallan if test "$installed" = no && test "$need_relink" = yes; then 5797f7ec340bSmacallan $echo >> $output "\ 5798f7ec340bSmacallanrelink_command=\"$relink_command\"" 5799f7ec340bSmacallan fi 5800f7ec340bSmacallan done 5801f7ec340bSmacallan fi 5802f7ec340bSmacallan 5803f7ec340bSmacallan # Do a symbolic link so that the libtool archive can be found in 5804f7ec340bSmacallan # LD_LIBRARY_PATH before the program is installed. 5805f7ec340bSmacallan $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 5806f7ec340bSmacallan $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 5807f7ec340bSmacallan ;; 5808f7ec340bSmacallan esac 5809f7ec340bSmacallan exit $EXIT_SUCCESS 5810f7ec340bSmacallan ;; 5811f7ec340bSmacallan 5812f7ec340bSmacallan # libtool install mode 5813f7ec340bSmacallan install) 5814f7ec340bSmacallan modename="$modename: install" 5815f7ec340bSmacallan 5816f7ec340bSmacallan # There may be an optional sh(1) argument at the beginning of 5817f7ec340bSmacallan # install_prog (especially on Windows NT). 5818f7ec340bSmacallan if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5819f7ec340bSmacallan # Allow the use of GNU shtool's install command. 5820f7ec340bSmacallan $echo "X$nonopt" | grep shtool > /dev/null; then 5821f7ec340bSmacallan # Aesthetically quote it. 5822f7ec340bSmacallan arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5823f7ec340bSmacallan case $arg in 5824f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5825f7ec340bSmacallan arg="\"$arg\"" 5826f7ec340bSmacallan ;; 5827f7ec340bSmacallan esac 5828f7ec340bSmacallan install_prog="$arg " 5829f7ec340bSmacallan arg="$1" 5830f7ec340bSmacallan shift 5831f7ec340bSmacallan else 5832f7ec340bSmacallan install_prog= 5833f7ec340bSmacallan arg=$nonopt 5834f7ec340bSmacallan fi 5835f7ec340bSmacallan 5836f7ec340bSmacallan # The real first argument should be the name of the installation program. 5837f7ec340bSmacallan # Aesthetically quote it. 5838f7ec340bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5839f7ec340bSmacallan case $arg in 5840f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5841f7ec340bSmacallan arg="\"$arg\"" 5842f7ec340bSmacallan ;; 5843f7ec340bSmacallan esac 5844f7ec340bSmacallan install_prog="$install_prog$arg" 5845f7ec340bSmacallan 5846f7ec340bSmacallan # We need to accept at least all the BSD install flags. 5847f7ec340bSmacallan dest= 5848f7ec340bSmacallan files= 5849f7ec340bSmacallan opts= 5850f7ec340bSmacallan prev= 5851f7ec340bSmacallan install_type= 5852f7ec340bSmacallan isdir=no 5853f7ec340bSmacallan stripme= 5854f7ec340bSmacallan for arg 5855f7ec340bSmacallan do 5856f7ec340bSmacallan if test -n "$dest"; then 5857f7ec340bSmacallan files="$files $dest" 5858f7ec340bSmacallan dest=$arg 5859f7ec340bSmacallan continue 5860f7ec340bSmacallan fi 5861f7ec340bSmacallan 5862f7ec340bSmacallan case $arg in 5863f7ec340bSmacallan -d) isdir=yes ;; 5864f7ec340bSmacallan -f) 5865f7ec340bSmacallan case " $install_prog " in 5866f7ec340bSmacallan *[\\\ /]cp\ *) ;; 5867f7ec340bSmacallan *) prev=$arg ;; 5868f7ec340bSmacallan esac 5869f7ec340bSmacallan ;; 5870f7ec340bSmacallan -g | -m | -o) prev=$arg ;; 5871f7ec340bSmacallan -s) 5872f7ec340bSmacallan stripme=" -s" 5873f7ec340bSmacallan continue 5874f7ec340bSmacallan ;; 5875f7ec340bSmacallan -*) 5876f7ec340bSmacallan ;; 5877f7ec340bSmacallan *) 5878f7ec340bSmacallan # If the previous option needed an argument, then skip it. 5879f7ec340bSmacallan if test -n "$prev"; then 5880f7ec340bSmacallan prev= 5881f7ec340bSmacallan else 5882f7ec340bSmacallan dest=$arg 5883f7ec340bSmacallan continue 5884f7ec340bSmacallan fi 5885f7ec340bSmacallan ;; 5886f7ec340bSmacallan esac 5887f7ec340bSmacallan 5888f7ec340bSmacallan # Aesthetically quote the argument. 5889f7ec340bSmacallan arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5890f7ec340bSmacallan case $arg in 5891f7ec340bSmacallan *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5892f7ec340bSmacallan arg="\"$arg\"" 5893f7ec340bSmacallan ;; 5894f7ec340bSmacallan esac 5895f7ec340bSmacallan install_prog="$install_prog $arg" 5896f7ec340bSmacallan done 5897f7ec340bSmacallan 5898f7ec340bSmacallan if test -z "$install_prog"; then 5899f7ec340bSmacallan $echo "$modename: you must specify an install program" 1>&2 5900f7ec340bSmacallan $echo "$help" 1>&2 5901f7ec340bSmacallan exit $EXIT_FAILURE 5902f7ec340bSmacallan fi 5903f7ec340bSmacallan 5904f7ec340bSmacallan if test -n "$prev"; then 5905f7ec340bSmacallan $echo "$modename: the \`$prev' option requires an argument" 1>&2 5906f7ec340bSmacallan $echo "$help" 1>&2 5907f7ec340bSmacallan exit $EXIT_FAILURE 5908f7ec340bSmacallan fi 5909f7ec340bSmacallan 5910f7ec340bSmacallan if test -z "$files"; then 5911f7ec340bSmacallan if test -z "$dest"; then 5912f7ec340bSmacallan $echo "$modename: no file or destination specified" 1>&2 5913f7ec340bSmacallan else 5914f7ec340bSmacallan $echo "$modename: you must specify a destination" 1>&2 5915f7ec340bSmacallan fi 5916f7ec340bSmacallan $echo "$help" 1>&2 5917f7ec340bSmacallan exit $EXIT_FAILURE 5918f7ec340bSmacallan fi 5919f7ec340bSmacallan 5920f7ec340bSmacallan # Strip any trailing slash from the destination. 5921f7ec340bSmacallan dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 5922f7ec340bSmacallan 5923f7ec340bSmacallan # Check to see that the destination is a directory. 5924f7ec340bSmacallan test -d "$dest" && isdir=yes 5925f7ec340bSmacallan if test "$isdir" = yes; then 5926f7ec340bSmacallan destdir="$dest" 5927f7ec340bSmacallan destname= 5928f7ec340bSmacallan else 5929f7ec340bSmacallan destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 5930f7ec340bSmacallan test "X$destdir" = "X$dest" && destdir=. 5931f7ec340bSmacallan destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 5932f7ec340bSmacallan 5933f7ec340bSmacallan # Not a directory, so check to see that there is only one file specified. 5934f7ec340bSmacallan set dummy $files 5935f7ec340bSmacallan if test "$#" -gt 2; then 5936f7ec340bSmacallan $echo "$modename: \`$dest' is not a directory" 1>&2 5937f7ec340bSmacallan $echo "$help" 1>&2 5938f7ec340bSmacallan exit $EXIT_FAILURE 5939f7ec340bSmacallan fi 5940f7ec340bSmacallan fi 5941f7ec340bSmacallan case $destdir in 5942f7ec340bSmacallan [\\/]* | [A-Za-z]:[\\/]*) ;; 5943f7ec340bSmacallan *) 5944f7ec340bSmacallan for file in $files; do 5945f7ec340bSmacallan case $file in 5946f7ec340bSmacallan *.lo) ;; 5947f7ec340bSmacallan *) 5948f7ec340bSmacallan $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 5949f7ec340bSmacallan $echo "$help" 1>&2 5950f7ec340bSmacallan exit $EXIT_FAILURE 5951f7ec340bSmacallan ;; 5952f7ec340bSmacallan esac 5953f7ec340bSmacallan done 5954f7ec340bSmacallan ;; 5955f7ec340bSmacallan esac 5956f7ec340bSmacallan 5957f7ec340bSmacallan # This variable tells wrapper scripts just to set variables rather 5958f7ec340bSmacallan # than running their programs. 5959f7ec340bSmacallan libtool_install_magic="$magic" 5960f7ec340bSmacallan 5961f7ec340bSmacallan staticlibs= 5962f7ec340bSmacallan future_libdirs= 5963f7ec340bSmacallan current_libdirs= 5964f7ec340bSmacallan for file in $files; do 5965f7ec340bSmacallan 5966f7ec340bSmacallan # Do each installation. 5967f7ec340bSmacallan case $file in 5968f7ec340bSmacallan *.$libext) 5969f7ec340bSmacallan # Do the static libraries later. 5970f7ec340bSmacallan staticlibs="$staticlibs $file" 5971f7ec340bSmacallan ;; 5972f7ec340bSmacallan 5973f7ec340bSmacallan *.la) 5974f7ec340bSmacallan # Check to see that this really is a libtool archive. 5975f7ec340bSmacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 5976f7ec340bSmacallan else 5977f7ec340bSmacallan $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 5978f7ec340bSmacallan $echo "$help" 1>&2 5979f7ec340bSmacallan exit $EXIT_FAILURE 5980f7ec340bSmacallan fi 5981f7ec340bSmacallan 5982f7ec340bSmacallan library_names= 5983f7ec340bSmacallan old_library= 5984f7ec340bSmacallan relink_command= 5985f7ec340bSmacallan # If there is no directory component, then add one. 5986f7ec340bSmacallan case $file in 5987f7ec340bSmacallan */* | *\\*) . $file ;; 5988f7ec340bSmacallan *) . ./$file ;; 5989f7ec340bSmacallan esac 5990f7ec340bSmacallan 5991f7ec340bSmacallan # Add the libdir to current_libdirs if it is the destination. 5992f7ec340bSmacallan if test "X$destdir" = "X$libdir"; then 5993f7ec340bSmacallan case "$current_libdirs " in 5994f7ec340bSmacallan *" $libdir "*) ;; 5995f7ec340bSmacallan *) current_libdirs="$current_libdirs $libdir" ;; 5996f7ec340bSmacallan esac 5997f7ec340bSmacallan else 5998f7ec340bSmacallan # Note the libdir as a future libdir. 5999f7ec340bSmacallan case "$future_libdirs " in 6000f7ec340bSmacallan *" $libdir "*) ;; 6001f7ec340bSmacallan *) future_libdirs="$future_libdirs $libdir" ;; 6002f7ec340bSmacallan esac 6003f7ec340bSmacallan fi 6004f7ec340bSmacallan 6005f7ec340bSmacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 6006f7ec340bSmacallan test "X$dir" = "X$file/" && dir= 6007f7ec340bSmacallan dir="$dir$objdir" 6008f7ec340bSmacallan 6009f7ec340bSmacallan if test -n "$relink_command"; then 6010f7ec340bSmacallan # Determine the prefix the user has applied to our future dir. 6011f7ec340bSmacallan inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 6012f7ec340bSmacallan 6013f7ec340bSmacallan # Don't allow the user to place us outside of our expected 6014f7ec340bSmacallan # location b/c this prevents finding dependent libraries that 6015f7ec340bSmacallan # are installed to the same prefix. 6016f7ec340bSmacallan # At present, this check doesn't affect windows .dll's that 6017f7ec340bSmacallan # are installed into $libdir/../bin (currently, that works fine) 6018f7ec340bSmacallan # but it's something to keep an eye on. 6019f7ec340bSmacallan if test "$inst_prefix_dir" = "$destdir"; then 6020f7ec340bSmacallan $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 6021f7ec340bSmacallan exit $EXIT_FAILURE 6022f7ec340bSmacallan fi 6023f7ec340bSmacallan 6024f7ec340bSmacallan if test -n "$inst_prefix_dir"; then 6025f7ec340bSmacallan # Stick the inst_prefix_dir data into the link command. 60267ce7e03cSmrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 6027f7ec340bSmacallan else 60287ce7e03cSmrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 6029f7ec340bSmacallan fi 6030f7ec340bSmacallan 6031f7ec340bSmacallan $echo "$modename: warning: relinking \`$file'" 1>&2 6032f7ec340bSmacallan $show "$relink_command" 6033f7ec340bSmacallan if $run eval "$relink_command"; then : 6034f7ec340bSmacallan else 6035f7ec340bSmacallan $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6036f7ec340bSmacallan exit $EXIT_FAILURE 6037f7ec340bSmacallan fi 6038f7ec340bSmacallan fi 6039f7ec340bSmacallan 6040f7ec340bSmacallan # See the names of the shared library. 6041f7ec340bSmacallan set dummy $library_names 6042f7ec340bSmacallan if test -n "$2"; then 6043f7ec340bSmacallan realname="$2" 6044f7ec340bSmacallan shift 6045f7ec340bSmacallan shift 6046f7ec340bSmacallan 6047f7ec340bSmacallan srcname="$realname" 6048f7ec340bSmacallan test -n "$relink_command" && srcname="$realname"T 6049f7ec340bSmacallan 6050f7ec340bSmacallan # Install the shared library and build the symlinks. 6051f7ec340bSmacallan $show "$install_prog $dir/$srcname $destdir/$realname" 6052f7ec340bSmacallan $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 6053f7ec340bSmacallan if test -n "$stripme" && test -n "$striplib"; then 6054f7ec340bSmacallan $show "$striplib $destdir/$realname" 6055f7ec340bSmacallan $run eval "$striplib $destdir/$realname" || exit $? 6056f7ec340bSmacallan fi 6057f7ec340bSmacallan 6058f7ec340bSmacallan if test "$#" -gt 0; then 6059f7ec340bSmacallan # Delete the old symlinks, and create new ones. 6060f7ec340bSmacallan # Try `ln -sf' first, because the `ln' binary might depend on 6061f7ec340bSmacallan # the symlink we replace! Solaris /bin/ln does not understand -f, 6062f7ec340bSmacallan # so we also need to try rm && ln -s. 6063f7ec340bSmacallan for linkname 6064f7ec340bSmacallan do 6065f7ec340bSmacallan if test "$linkname" != "$realname"; then 6066f7ec340bSmacallan $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6067f7ec340bSmacallan $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6068f7ec340bSmacallan fi 6069f7ec340bSmacallan done 6070f7ec340bSmacallan fi 6071f7ec340bSmacallan 6072f7ec340bSmacallan # Do each command in the postinstall commands. 6073f7ec340bSmacallan lib="$destdir/$realname" 6074f7ec340bSmacallan cmds=$postinstall_cmds 6075f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 6076f7ec340bSmacallan for cmd in $cmds; do 6077f7ec340bSmacallan IFS="$save_ifs" 6078f7ec340bSmacallan eval cmd=\"$cmd\" 6079f7ec340bSmacallan $show "$cmd" 6080f7ec340bSmacallan $run eval "$cmd" || { 6081f7ec340bSmacallan lt_exit=$? 6082f7ec340bSmacallan 6083f7ec340bSmacallan # Restore the uninstalled library and exit 6084f7ec340bSmacallan if test "$mode" = relink; then 6085f7ec340bSmacallan $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 6086f7ec340bSmacallan fi 6087f7ec340bSmacallan 6088f7ec340bSmacallan exit $lt_exit 6089f7ec340bSmacallan } 6090f7ec340bSmacallan done 6091f7ec340bSmacallan IFS="$save_ifs" 6092f7ec340bSmacallan fi 6093f7ec340bSmacallan 6094f7ec340bSmacallan # Install the pseudo-library for information purposes. 6095f7ec340bSmacallan name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6096f7ec340bSmacallan instname="$dir/$name"i 6097f7ec340bSmacallan $show "$install_prog $instname $destdir/$name" 6098f7ec340bSmacallan $run eval "$install_prog $instname $destdir/$name" || exit $? 6099f7ec340bSmacallan 6100f7ec340bSmacallan # Maybe install the static library, too. 6101f7ec340bSmacallan test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 6102f7ec340bSmacallan ;; 6103f7ec340bSmacallan 6104f7ec340bSmacallan *.lo) 6105f7ec340bSmacallan # Install (i.e. copy) a libtool object. 6106f7ec340bSmacallan 6107f7ec340bSmacallan # Figure out destination file name, if it wasn't already specified. 6108f7ec340bSmacallan if test -n "$destname"; then 6109f7ec340bSmacallan destfile="$destdir/$destname" 6110f7ec340bSmacallan else 6111f7ec340bSmacallan destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6112f7ec340bSmacallan destfile="$destdir/$destfile" 6113f7ec340bSmacallan fi 6114f7ec340bSmacallan 6115f7ec340bSmacallan # Deduce the name of the destination old-style object file. 6116f7ec340bSmacallan case $destfile in 6117f7ec340bSmacallan *.lo) 6118f7ec340bSmacallan staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 6119f7ec340bSmacallan ;; 6120f7ec340bSmacallan *.$objext) 6121f7ec340bSmacallan staticdest="$destfile" 6122f7ec340bSmacallan destfile= 6123f7ec340bSmacallan ;; 6124f7ec340bSmacallan *) 6125f7ec340bSmacallan $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 6126f7ec340bSmacallan $echo "$help" 1>&2 6127f7ec340bSmacallan exit $EXIT_FAILURE 6128f7ec340bSmacallan ;; 6129f7ec340bSmacallan esac 6130f7ec340bSmacallan 6131f7ec340bSmacallan # Install the libtool object if requested. 6132f7ec340bSmacallan if test -n "$destfile"; then 6133f7ec340bSmacallan $show "$install_prog $file $destfile" 6134f7ec340bSmacallan $run eval "$install_prog $file $destfile" || exit $? 6135f7ec340bSmacallan fi 6136f7ec340bSmacallan 6137f7ec340bSmacallan # Install the old object if enabled. 6138f7ec340bSmacallan if test "$build_old_libs" = yes; then 6139f7ec340bSmacallan # Deduce the name of the old-style object file. 6140f7ec340bSmacallan staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 6141f7ec340bSmacallan 6142f7ec340bSmacallan $show "$install_prog $staticobj $staticdest" 6143f7ec340bSmacallan $run eval "$install_prog \$staticobj \$staticdest" || exit $? 6144f7ec340bSmacallan fi 6145f7ec340bSmacallan exit $EXIT_SUCCESS 6146f7ec340bSmacallan ;; 6147f7ec340bSmacallan 6148f7ec340bSmacallan *) 6149f7ec340bSmacallan # Figure out destination file name, if it wasn't already specified. 6150f7ec340bSmacallan if test -n "$destname"; then 6151f7ec340bSmacallan destfile="$destdir/$destname" 6152f7ec340bSmacallan else 6153f7ec340bSmacallan destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6154f7ec340bSmacallan destfile="$destdir/$destfile" 6155f7ec340bSmacallan fi 6156f7ec340bSmacallan 6157f7ec340bSmacallan # If the file is missing, and there is a .exe on the end, strip it 6158f7ec340bSmacallan # because it is most likely a libtool script we actually want to 6159f7ec340bSmacallan # install 6160f7ec340bSmacallan stripped_ext="" 6161f7ec340bSmacallan case $file in 6162f7ec340bSmacallan *.exe) 6163f7ec340bSmacallan if test ! -f "$file"; then 6164f7ec340bSmacallan file=`$echo $file|${SED} 's,.exe$,,'` 6165f7ec340bSmacallan stripped_ext=".exe" 6166f7ec340bSmacallan fi 6167f7ec340bSmacallan ;; 6168f7ec340bSmacallan esac 6169f7ec340bSmacallan 6170f7ec340bSmacallan # Do a test to see if this is really a libtool program. 6171f7ec340bSmacallan case $host in 6172f7ec340bSmacallan *cygwin*|*mingw*) 6173f7ec340bSmacallan wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 6174f7ec340bSmacallan ;; 6175f7ec340bSmacallan *) 6176f7ec340bSmacallan wrapper=$file 6177f7ec340bSmacallan ;; 6178f7ec340bSmacallan esac 6179f7ec340bSmacallan if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6180f7ec340bSmacallan notinst_deplibs= 6181f7ec340bSmacallan relink_command= 6182f7ec340bSmacallan 6183f7ec340bSmacallan # Note that it is not necessary on cygwin/mingw to append a dot to 6184f7ec340bSmacallan # foo even if both foo and FILE.exe exist: automatic-append-.exe 6185f7ec340bSmacallan # behavior happens only for exec(3), not for open(2)! Also, sourcing 6186f7ec340bSmacallan # `FILE.' does not work on cygwin managed mounts. 6187f7ec340bSmacallan # 6188f7ec340bSmacallan # If there is no directory component, then add one. 6189f7ec340bSmacallan case $wrapper in 6190f7ec340bSmacallan */* | *\\*) . ${wrapper} ;; 6191f7ec340bSmacallan *) . ./${wrapper} ;; 6192f7ec340bSmacallan esac 6193f7ec340bSmacallan 6194f7ec340bSmacallan # Check the variables that should have been set. 6195f7ec340bSmacallan if test -z "$notinst_deplibs"; then 6196f7ec340bSmacallan $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6197f7ec340bSmacallan exit $EXIT_FAILURE 6198f7ec340bSmacallan fi 6199f7ec340bSmacallan 6200f7ec340bSmacallan finalize=yes 6201f7ec340bSmacallan for lib in $notinst_deplibs; do 6202f7ec340bSmacallan # Check to see that each library is installed. 6203f7ec340bSmacallan libdir= 6204f7ec340bSmacallan if test -f "$lib"; then 6205f7ec340bSmacallan # If there is no directory component, then add one. 6206f7ec340bSmacallan case $lib in 6207f7ec340bSmacallan */* | *\\*) . $lib ;; 6208f7ec340bSmacallan *) . ./$lib ;; 6209f7ec340bSmacallan esac 6210f7ec340bSmacallan fi 6211f7ec340bSmacallan libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 6212f7ec340bSmacallan if test -n "$libdir" && test ! -f "$libfile"; then 6213f7ec340bSmacallan $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 6214f7ec340bSmacallan finalize=no 6215f7ec340bSmacallan fi 6216f7ec340bSmacallan done 6217f7ec340bSmacallan 6218f7ec340bSmacallan relink_command= 6219f7ec340bSmacallan # Note that it is not necessary on cygwin/mingw to append a dot to 6220f7ec340bSmacallan # foo even if both foo and FILE.exe exist: automatic-append-.exe 6221f7ec340bSmacallan # behavior happens only for exec(3), not for open(2)! Also, sourcing 6222f7ec340bSmacallan # `FILE.' does not work on cygwin managed mounts. 6223f7ec340bSmacallan # 6224f7ec340bSmacallan # If there is no directory component, then add one. 6225f7ec340bSmacallan case $wrapper in 6226f7ec340bSmacallan */* | *\\*) . ${wrapper} ;; 6227f7ec340bSmacallan *) . ./${wrapper} ;; 6228f7ec340bSmacallan esac 6229f7ec340bSmacallan 6230f7ec340bSmacallan outputname= 6231f7ec340bSmacallan if test "$fast_install" = no && test -n "$relink_command"; then 6232f7ec340bSmacallan if test "$finalize" = yes && test -z "$run"; then 6233f7ec340bSmacallan tmpdir=`func_mktempdir` 6234f7ec340bSmacallan file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6235f7ec340bSmacallan outputname="$tmpdir/$file" 6236f7ec340bSmacallan # Replace the output file specification. 62377ce7e03cSmrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 6238f7ec340bSmacallan 6239f7ec340bSmacallan $show "$relink_command" 6240f7ec340bSmacallan if $run eval "$relink_command"; then : 6241f7ec340bSmacallan else 6242f7ec340bSmacallan $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6243f7ec340bSmacallan ${rm}r "$tmpdir" 6244f7ec340bSmacallan continue 6245f7ec340bSmacallan fi 6246f7ec340bSmacallan file="$outputname" 6247f7ec340bSmacallan else 6248f7ec340bSmacallan $echo "$modename: warning: cannot relink \`$file'" 1>&2 6249f7ec340bSmacallan fi 6250f7ec340bSmacallan else 6251f7ec340bSmacallan # Install the binary that we compiled earlier. 6252f7ec340bSmacallan file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 6253f7ec340bSmacallan fi 6254f7ec340bSmacallan fi 6255f7ec340bSmacallan 6256f7ec340bSmacallan # remove .exe since cygwin /usr/bin/install will append another 6257f7ec340bSmacallan # one anyway 6258f7ec340bSmacallan case $install_prog,$host in 6259f7ec340bSmacallan */usr/bin/install*,*cygwin*) 6260f7ec340bSmacallan case $file:$destfile in 6261f7ec340bSmacallan *.exe:*.exe) 6262f7ec340bSmacallan # this is ok 6263f7ec340bSmacallan ;; 6264f7ec340bSmacallan *.exe:*) 6265f7ec340bSmacallan destfile=$destfile.exe 6266f7ec340bSmacallan ;; 6267f7ec340bSmacallan *:*.exe) 6268f7ec340bSmacallan destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 6269f7ec340bSmacallan ;; 6270f7ec340bSmacallan esac 6271f7ec340bSmacallan ;; 6272f7ec340bSmacallan esac 6273f7ec340bSmacallan $show "$install_prog$stripme $file $destfile" 6274f7ec340bSmacallan $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 6275f7ec340bSmacallan test -n "$outputname" && ${rm}r "$tmpdir" 6276f7ec340bSmacallan ;; 6277f7ec340bSmacallan esac 6278f7ec340bSmacallan done 6279f7ec340bSmacallan 6280f7ec340bSmacallan for file in $staticlibs; do 6281f7ec340bSmacallan name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6282f7ec340bSmacallan 6283f7ec340bSmacallan # Set up the ranlib parameters. 6284f7ec340bSmacallan oldlib="$destdir/$name" 6285f7ec340bSmacallan 6286f7ec340bSmacallan $show "$install_prog $file $oldlib" 6287f7ec340bSmacallan $run eval "$install_prog \$file \$oldlib" || exit $? 6288f7ec340bSmacallan 6289f7ec340bSmacallan if test -n "$stripme" && test -n "$old_striplib"; then 6290f7ec340bSmacallan $show "$old_striplib $oldlib" 6291f7ec340bSmacallan $run eval "$old_striplib $oldlib" || exit $? 6292f7ec340bSmacallan fi 6293f7ec340bSmacallan 6294f7ec340bSmacallan # Do each command in the postinstall commands. 6295f7ec340bSmacallan cmds=$old_postinstall_cmds 6296f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 6297f7ec340bSmacallan for cmd in $cmds; do 6298f7ec340bSmacallan IFS="$save_ifs" 6299f7ec340bSmacallan eval cmd=\"$cmd\" 6300f7ec340bSmacallan $show "$cmd" 6301f7ec340bSmacallan $run eval "$cmd" || exit $? 6302f7ec340bSmacallan done 6303f7ec340bSmacallan IFS="$save_ifs" 6304f7ec340bSmacallan done 6305f7ec340bSmacallan 6306f7ec340bSmacallan if test -n "$future_libdirs"; then 6307f7ec340bSmacallan $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 6308f7ec340bSmacallan fi 6309f7ec340bSmacallan 6310f7ec340bSmacallan if test -n "$current_libdirs"; then 6311f7ec340bSmacallan # Maybe just do a dry run. 6312f7ec340bSmacallan test -n "$run" && current_libdirs=" -n$current_libdirs" 6313f7ec340bSmacallan exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 6314f7ec340bSmacallan else 6315f7ec340bSmacallan exit $EXIT_SUCCESS 6316f7ec340bSmacallan fi 6317f7ec340bSmacallan ;; 6318f7ec340bSmacallan 6319f7ec340bSmacallan # libtool finish mode 6320f7ec340bSmacallan finish) 6321f7ec340bSmacallan modename="$modename: finish" 6322f7ec340bSmacallan libdirs="$nonopt" 6323f7ec340bSmacallan admincmds= 6324f7ec340bSmacallan 6325f7ec340bSmacallan if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 6326f7ec340bSmacallan for dir 6327f7ec340bSmacallan do 6328f7ec340bSmacallan libdirs="$libdirs $dir" 6329f7ec340bSmacallan done 6330f7ec340bSmacallan 6331f7ec340bSmacallan for libdir in $libdirs; do 6332f7ec340bSmacallan if test -n "$finish_cmds"; then 6333f7ec340bSmacallan # Do each command in the finish commands. 6334f7ec340bSmacallan cmds=$finish_cmds 6335f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 6336f7ec340bSmacallan for cmd in $cmds; do 6337f7ec340bSmacallan IFS="$save_ifs" 6338f7ec340bSmacallan eval cmd=\"$cmd\" 6339f7ec340bSmacallan $show "$cmd" 6340f7ec340bSmacallan $run eval "$cmd" || admincmds="$admincmds 6341f7ec340bSmacallan $cmd" 6342f7ec340bSmacallan done 6343f7ec340bSmacallan IFS="$save_ifs" 6344f7ec340bSmacallan fi 6345f7ec340bSmacallan if test -n "$finish_eval"; then 6346f7ec340bSmacallan # Do the single finish_eval. 6347f7ec340bSmacallan eval cmds=\"$finish_eval\" 6348f7ec340bSmacallan $run eval "$cmds" || admincmds="$admincmds 6349f7ec340bSmacallan $cmds" 6350f7ec340bSmacallan fi 6351f7ec340bSmacallan done 6352f7ec340bSmacallan fi 6353f7ec340bSmacallan 6354f7ec340bSmacallan # Exit here if they wanted silent mode. 6355f7ec340bSmacallan test "$show" = : && exit $EXIT_SUCCESS 6356f7ec340bSmacallan 6357f7ec340bSmacallan $echo "X----------------------------------------------------------------------" | $Xsed 6358f7ec340bSmacallan $echo "Libraries have been installed in:" 6359f7ec340bSmacallan for libdir in $libdirs; do 6360f7ec340bSmacallan $echo " $libdir" 6361f7ec340bSmacallan done 6362f7ec340bSmacallan $echo 6363f7ec340bSmacallan $echo "If you ever happen to want to link against installed libraries" 6364f7ec340bSmacallan $echo "in a given directory, LIBDIR, you must either use libtool, and" 6365f7ec340bSmacallan $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 6366f7ec340bSmacallan $echo "flag during linking and do at least one of the following:" 6367f7ec340bSmacallan if test -n "$shlibpath_var"; then 6368f7ec340bSmacallan $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 6369f7ec340bSmacallan $echo " during execution" 6370f7ec340bSmacallan fi 6371f7ec340bSmacallan if test -n "$runpath_var"; then 6372f7ec340bSmacallan $echo " - add LIBDIR to the \`$runpath_var' environment variable" 6373f7ec340bSmacallan $echo " during linking" 6374f7ec340bSmacallan fi 6375f7ec340bSmacallan if test -n "$hardcode_libdir_flag_spec"; then 6376f7ec340bSmacallan libdir=LIBDIR 6377f7ec340bSmacallan eval flag=\"$hardcode_libdir_flag_spec\" 6378f7ec340bSmacallan 6379f7ec340bSmacallan $echo " - use the \`$flag' linker flag" 6380f7ec340bSmacallan fi 6381f7ec340bSmacallan if test -n "$admincmds"; then 6382f7ec340bSmacallan $echo " - have your system administrator run these commands:$admincmds" 6383f7ec340bSmacallan fi 6384f7ec340bSmacallan if test -f /etc/ld.so.conf; then 6385f7ec340bSmacallan $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6386f7ec340bSmacallan fi 6387f7ec340bSmacallan $echo 6388f7ec340bSmacallan $echo "See any operating system documentation about shared libraries for" 6389f7ec340bSmacallan $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6390f7ec340bSmacallan $echo "X----------------------------------------------------------------------" | $Xsed 6391f7ec340bSmacallan exit $EXIT_SUCCESS 6392f7ec340bSmacallan ;; 6393f7ec340bSmacallan 6394f7ec340bSmacallan # libtool execute mode 6395f7ec340bSmacallan execute) 6396f7ec340bSmacallan modename="$modename: execute" 6397f7ec340bSmacallan 6398f7ec340bSmacallan # The first argument is the command name. 6399f7ec340bSmacallan cmd="$nonopt" 6400f7ec340bSmacallan if test -z "$cmd"; then 6401f7ec340bSmacallan $echo "$modename: you must specify a COMMAND" 1>&2 6402f7ec340bSmacallan $echo "$help" 6403f7ec340bSmacallan exit $EXIT_FAILURE 6404f7ec340bSmacallan fi 6405f7ec340bSmacallan 6406f7ec340bSmacallan # Handle -dlopen flags immediately. 6407f7ec340bSmacallan for file in $execute_dlfiles; do 6408f7ec340bSmacallan if test ! -f "$file"; then 6409f7ec340bSmacallan $echo "$modename: \`$file' is not a file" 1>&2 6410f7ec340bSmacallan $echo "$help" 1>&2 6411f7ec340bSmacallan exit $EXIT_FAILURE 6412f7ec340bSmacallan fi 6413f7ec340bSmacallan 6414f7ec340bSmacallan dir= 6415f7ec340bSmacallan case $file in 6416f7ec340bSmacallan *.la) 6417f7ec340bSmacallan # Check to see that this really is a libtool archive. 6418f7ec340bSmacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 6419f7ec340bSmacallan else 6420f7ec340bSmacallan $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 6421f7ec340bSmacallan $echo "$help" 1>&2 6422f7ec340bSmacallan exit $EXIT_FAILURE 6423f7ec340bSmacallan fi 6424f7ec340bSmacallan 6425f7ec340bSmacallan # Read the libtool library. 6426f7ec340bSmacallan dlname= 6427f7ec340bSmacallan library_names= 6428f7ec340bSmacallan 6429f7ec340bSmacallan # If there is no directory component, then add one. 6430f7ec340bSmacallan case $file in 6431f7ec340bSmacallan */* | *\\*) . $file ;; 6432f7ec340bSmacallan *) . ./$file ;; 6433f7ec340bSmacallan esac 6434f7ec340bSmacallan 6435f7ec340bSmacallan # Skip this library if it cannot be dlopened. 6436f7ec340bSmacallan if test -z "$dlname"; then 6437f7ec340bSmacallan # Warn if it was a shared library. 6438f7ec340bSmacallan test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 6439f7ec340bSmacallan continue 6440f7ec340bSmacallan fi 6441f7ec340bSmacallan 6442f7ec340bSmacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6443f7ec340bSmacallan test "X$dir" = "X$file" && dir=. 6444f7ec340bSmacallan 6445f7ec340bSmacallan if test -f "$dir/$objdir/$dlname"; then 6446f7ec340bSmacallan dir="$dir/$objdir" 6447f7ec340bSmacallan else 64487ce7e03cSmrg if test ! -f "$dir/$dlname"; then 64497ce7e03cSmrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 64507ce7e03cSmrg exit $EXIT_FAILURE 64517ce7e03cSmrg fi 6452f7ec340bSmacallan fi 6453f7ec340bSmacallan ;; 6454f7ec340bSmacallan 6455f7ec340bSmacallan *.lo) 6456f7ec340bSmacallan # Just add the directory containing the .lo file. 6457f7ec340bSmacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6458f7ec340bSmacallan test "X$dir" = "X$file" && dir=. 6459f7ec340bSmacallan ;; 6460f7ec340bSmacallan 6461f7ec340bSmacallan *) 6462f7ec340bSmacallan $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 6463f7ec340bSmacallan continue 6464f7ec340bSmacallan ;; 6465f7ec340bSmacallan esac 6466f7ec340bSmacallan 6467f7ec340bSmacallan # Get the absolute pathname. 6468f7ec340bSmacallan absdir=`cd "$dir" && pwd` 6469f7ec340bSmacallan test -n "$absdir" && dir="$absdir" 6470f7ec340bSmacallan 6471f7ec340bSmacallan # Now add the directory to shlibpath_var. 6472f7ec340bSmacallan if eval "test -z \"\$$shlibpath_var\""; then 6473f7ec340bSmacallan eval "$shlibpath_var=\"\$dir\"" 6474f7ec340bSmacallan else 6475f7ec340bSmacallan eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 6476f7ec340bSmacallan fi 6477f7ec340bSmacallan done 6478f7ec340bSmacallan 6479f7ec340bSmacallan # This variable tells wrapper scripts just to set shlibpath_var 6480f7ec340bSmacallan # rather than running their programs. 6481f7ec340bSmacallan libtool_execute_magic="$magic" 6482f7ec340bSmacallan 6483f7ec340bSmacallan # Check if any of the arguments is a wrapper script. 6484f7ec340bSmacallan args= 6485f7ec340bSmacallan for file 6486f7ec340bSmacallan do 6487f7ec340bSmacallan case $file in 6488f7ec340bSmacallan -*) ;; 6489f7ec340bSmacallan *) 6490f7ec340bSmacallan # Do a test to see if this is really a libtool program. 6491f7ec340bSmacallan if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6492f7ec340bSmacallan # If there is no directory component, then add one. 6493f7ec340bSmacallan case $file in 6494f7ec340bSmacallan */* | *\\*) . $file ;; 6495f7ec340bSmacallan *) . ./$file ;; 6496f7ec340bSmacallan esac 6497f7ec340bSmacallan 6498f7ec340bSmacallan # Transform arg to wrapped name. 6499f7ec340bSmacallan file="$progdir/$program" 6500f7ec340bSmacallan fi 6501f7ec340bSmacallan ;; 6502f7ec340bSmacallan esac 6503f7ec340bSmacallan # Quote arguments (to preserve shell metacharacters). 6504f7ec340bSmacallan file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 6505f7ec340bSmacallan args="$args \"$file\"" 6506f7ec340bSmacallan done 6507f7ec340bSmacallan 6508f7ec340bSmacallan if test -z "$run"; then 6509f7ec340bSmacallan if test -n "$shlibpath_var"; then 6510f7ec340bSmacallan # Export the shlibpath_var. 6511f7ec340bSmacallan eval "export $shlibpath_var" 6512f7ec340bSmacallan fi 6513f7ec340bSmacallan 6514f7ec340bSmacallan # Restore saved environment variables 65157ce7e03cSmrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 65167ce7e03cSmrg do 65177ce7e03cSmrg eval "if test \"\${save_$lt_var+set}\" = set; then 65187ce7e03cSmrg $lt_var=\$save_$lt_var; export $lt_var 65197ce7e03cSmrg fi" 65207ce7e03cSmrg done 6521f7ec340bSmacallan 6522f7ec340bSmacallan # Now prepare to actually exec the command. 6523f7ec340bSmacallan exec_cmd="\$cmd$args" 6524f7ec340bSmacallan else 6525f7ec340bSmacallan # Display what would be done. 6526f7ec340bSmacallan if test -n "$shlibpath_var"; then 6527f7ec340bSmacallan eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 6528f7ec340bSmacallan $echo "export $shlibpath_var" 6529f7ec340bSmacallan fi 6530f7ec340bSmacallan $echo "$cmd$args" 6531f7ec340bSmacallan exit $EXIT_SUCCESS 6532f7ec340bSmacallan fi 6533f7ec340bSmacallan ;; 6534f7ec340bSmacallan 6535f7ec340bSmacallan # libtool clean and uninstall mode 6536f7ec340bSmacallan clean | uninstall) 6537f7ec340bSmacallan modename="$modename: $mode" 6538f7ec340bSmacallan rm="$nonopt" 6539f7ec340bSmacallan files= 6540f7ec340bSmacallan rmforce= 6541f7ec340bSmacallan exit_status=0 6542f7ec340bSmacallan 6543f7ec340bSmacallan # This variable tells wrapper scripts just to set variables rather 6544f7ec340bSmacallan # than running their programs. 6545f7ec340bSmacallan libtool_install_magic="$magic" 6546f7ec340bSmacallan 6547f7ec340bSmacallan for arg 6548f7ec340bSmacallan do 6549f7ec340bSmacallan case $arg in 6550f7ec340bSmacallan -f) rm="$rm $arg"; rmforce=yes ;; 6551f7ec340bSmacallan -*) rm="$rm $arg" ;; 6552f7ec340bSmacallan *) files="$files $arg" ;; 6553f7ec340bSmacallan esac 6554f7ec340bSmacallan done 6555f7ec340bSmacallan 6556f7ec340bSmacallan if test -z "$rm"; then 6557f7ec340bSmacallan $echo "$modename: you must specify an RM program" 1>&2 6558f7ec340bSmacallan $echo "$help" 1>&2 6559f7ec340bSmacallan exit $EXIT_FAILURE 6560f7ec340bSmacallan fi 6561f7ec340bSmacallan 6562f7ec340bSmacallan rmdirs= 6563f7ec340bSmacallan 6564f7ec340bSmacallan origobjdir="$objdir" 6565f7ec340bSmacallan for file in $files; do 6566f7ec340bSmacallan dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6567f7ec340bSmacallan if test "X$dir" = "X$file"; then 6568f7ec340bSmacallan dir=. 6569f7ec340bSmacallan objdir="$origobjdir" 6570f7ec340bSmacallan else 6571f7ec340bSmacallan objdir="$dir/$origobjdir" 6572f7ec340bSmacallan fi 6573f7ec340bSmacallan name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6574f7ec340bSmacallan test "$mode" = uninstall && objdir="$dir" 6575f7ec340bSmacallan 6576f7ec340bSmacallan # Remember objdir for removal later, being careful to avoid duplicates 6577f7ec340bSmacallan if test "$mode" = clean; then 6578f7ec340bSmacallan case " $rmdirs " in 6579f7ec340bSmacallan *" $objdir "*) ;; 6580f7ec340bSmacallan *) rmdirs="$rmdirs $objdir" ;; 6581f7ec340bSmacallan esac 6582f7ec340bSmacallan fi 6583f7ec340bSmacallan 6584f7ec340bSmacallan # Don't error if the file doesn't exist and rm -f was used. 6585f7ec340bSmacallan if (test -L "$file") >/dev/null 2>&1 \ 6586f7ec340bSmacallan || (test -h "$file") >/dev/null 2>&1 \ 6587f7ec340bSmacallan || test -f "$file"; then 6588f7ec340bSmacallan : 6589f7ec340bSmacallan elif test -d "$file"; then 6590f7ec340bSmacallan exit_status=1 6591f7ec340bSmacallan continue 6592f7ec340bSmacallan elif test "$rmforce" = yes; then 6593f7ec340bSmacallan continue 6594f7ec340bSmacallan fi 6595f7ec340bSmacallan 6596f7ec340bSmacallan rmfiles="$file" 6597f7ec340bSmacallan 6598f7ec340bSmacallan case $name in 6599f7ec340bSmacallan *.la) 6600f7ec340bSmacallan # Possibly a libtool archive, so verify it. 6601f7ec340bSmacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6602f7ec340bSmacallan . $dir/$name 6603f7ec340bSmacallan 6604f7ec340bSmacallan # Delete the libtool libraries and symlinks. 6605f7ec340bSmacallan for n in $library_names; do 6606f7ec340bSmacallan rmfiles="$rmfiles $objdir/$n" 6607f7ec340bSmacallan done 6608f7ec340bSmacallan test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6609f7ec340bSmacallan 6610f7ec340bSmacallan case "$mode" in 6611f7ec340bSmacallan clean) 6612f7ec340bSmacallan case " $library_names " in 6613f7ec340bSmacallan # " " in the beginning catches empty $dlname 6614f7ec340bSmacallan *" $dlname "*) ;; 6615f7ec340bSmacallan *) rmfiles="$rmfiles $objdir/$dlname" ;; 6616f7ec340bSmacallan esac 6617f7ec340bSmacallan test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 6618f7ec340bSmacallan ;; 6619f7ec340bSmacallan uninstall) 6620f7ec340bSmacallan if test -n "$library_names"; then 6621f7ec340bSmacallan # Do each command in the postuninstall commands. 6622f7ec340bSmacallan cmds=$postuninstall_cmds 6623f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 6624f7ec340bSmacallan for cmd in $cmds; do 6625f7ec340bSmacallan IFS="$save_ifs" 6626f7ec340bSmacallan eval cmd=\"$cmd\" 6627f7ec340bSmacallan $show "$cmd" 6628f7ec340bSmacallan $run eval "$cmd" 6629f7ec340bSmacallan if test "$?" -ne 0 && test "$rmforce" != yes; then 6630f7ec340bSmacallan exit_status=1 6631f7ec340bSmacallan fi 6632f7ec340bSmacallan done 6633f7ec340bSmacallan IFS="$save_ifs" 6634f7ec340bSmacallan fi 6635f7ec340bSmacallan 6636f7ec340bSmacallan if test -n "$old_library"; then 6637f7ec340bSmacallan # Do each command in the old_postuninstall commands. 6638f7ec340bSmacallan cmds=$old_postuninstall_cmds 6639f7ec340bSmacallan save_ifs="$IFS"; IFS='~' 6640f7ec340bSmacallan for cmd in $cmds; do 6641f7ec340bSmacallan IFS="$save_ifs" 6642f7ec340bSmacallan eval cmd=\"$cmd\" 6643f7ec340bSmacallan $show "$cmd" 6644f7ec340bSmacallan $run eval "$cmd" 6645f7ec340bSmacallan if test "$?" -ne 0 && test "$rmforce" != yes; then 6646f7ec340bSmacallan exit_status=1 6647f7ec340bSmacallan fi 6648f7ec340bSmacallan done 6649f7ec340bSmacallan IFS="$save_ifs" 6650f7ec340bSmacallan fi 6651f7ec340bSmacallan # FIXME: should reinstall the best remaining shared library. 6652f7ec340bSmacallan ;; 6653f7ec340bSmacallan esac 6654f7ec340bSmacallan fi 6655f7ec340bSmacallan ;; 6656f7ec340bSmacallan 6657f7ec340bSmacallan *.lo) 6658f7ec340bSmacallan # Possibly a libtool object, so verify it. 6659f7ec340bSmacallan if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6660f7ec340bSmacallan 6661f7ec340bSmacallan # Read the .lo file 6662f7ec340bSmacallan . $dir/$name 6663f7ec340bSmacallan 6664f7ec340bSmacallan # Add PIC object to the list of files to remove. 6665f7ec340bSmacallan if test -n "$pic_object" \ 6666f7ec340bSmacallan && test "$pic_object" != none; then 6667f7ec340bSmacallan rmfiles="$rmfiles $dir/$pic_object" 6668f7ec340bSmacallan fi 6669f7ec340bSmacallan 6670f7ec340bSmacallan # Add non-PIC object to the list of files to remove. 6671f7ec340bSmacallan if test -n "$non_pic_object" \ 6672f7ec340bSmacallan && test "$non_pic_object" != none; then 6673f7ec340bSmacallan rmfiles="$rmfiles $dir/$non_pic_object" 6674f7ec340bSmacallan fi 6675f7ec340bSmacallan fi 6676f7ec340bSmacallan ;; 6677f7ec340bSmacallan 6678f7ec340bSmacallan *) 6679f7ec340bSmacallan if test "$mode" = clean ; then 6680f7ec340bSmacallan noexename=$name 6681f7ec340bSmacallan case $file in 6682f7ec340bSmacallan *.exe) 6683f7ec340bSmacallan file=`$echo $file|${SED} 's,.exe$,,'` 6684f7ec340bSmacallan noexename=`$echo $name|${SED} 's,.exe$,,'` 6685f7ec340bSmacallan # $file with .exe has already been added to rmfiles, 6686f7ec340bSmacallan # add $file without .exe 6687f7ec340bSmacallan rmfiles="$rmfiles $file" 6688f7ec340bSmacallan ;; 6689f7ec340bSmacallan esac 6690f7ec340bSmacallan # Do a test to see if this is a libtool program. 6691f7ec340bSmacallan if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6692f7ec340bSmacallan relink_command= 6693f7ec340bSmacallan . $dir/$noexename 6694f7ec340bSmacallan 6695f7ec340bSmacallan # note $name still contains .exe if it was in $file originally 6696f7ec340bSmacallan # as does the version of $file that was added into $rmfiles 6697f7ec340bSmacallan rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 6698f7ec340bSmacallan if test "$fast_install" = yes && test -n "$relink_command"; then 6699f7ec340bSmacallan rmfiles="$rmfiles $objdir/lt-$name" 6700f7ec340bSmacallan fi 6701f7ec340bSmacallan if test "X$noexename" != "X$name" ; then 6702f7ec340bSmacallan rmfiles="$rmfiles $objdir/lt-${noexename}.c" 6703f7ec340bSmacallan fi 6704f7ec340bSmacallan fi 6705f7ec340bSmacallan fi 6706f7ec340bSmacallan ;; 6707f7ec340bSmacallan esac 6708f7ec340bSmacallan $show "$rm $rmfiles" 6709f7ec340bSmacallan $run $rm $rmfiles || exit_status=1 6710f7ec340bSmacallan done 6711f7ec340bSmacallan objdir="$origobjdir" 6712f7ec340bSmacallan 6713f7ec340bSmacallan # Try to remove the ${objdir}s in the directories where we deleted files 6714f7ec340bSmacallan for dir in $rmdirs; do 6715f7ec340bSmacallan if test -d "$dir"; then 6716f7ec340bSmacallan $show "rmdir $dir" 6717f7ec340bSmacallan $run rmdir $dir >/dev/null 2>&1 6718f7ec340bSmacallan fi 6719f7ec340bSmacallan done 6720f7ec340bSmacallan 6721f7ec340bSmacallan exit $exit_status 6722f7ec340bSmacallan ;; 6723f7ec340bSmacallan 6724f7ec340bSmacallan "") 6725f7ec340bSmacallan $echo "$modename: you must specify a MODE" 1>&2 6726f7ec340bSmacallan $echo "$generic_help" 1>&2 6727f7ec340bSmacallan exit $EXIT_FAILURE 6728f7ec340bSmacallan ;; 6729f7ec340bSmacallan esac 6730f7ec340bSmacallan 6731f7ec340bSmacallan if test -z "$exec_cmd"; then 6732f7ec340bSmacallan $echo "$modename: invalid operation mode \`$mode'" 1>&2 6733f7ec340bSmacallan $echo "$generic_help" 1>&2 6734f7ec340bSmacallan exit $EXIT_FAILURE 6735f7ec340bSmacallan fi 6736f7ec340bSmacallanfi # test -z "$show_help" 6737f7ec340bSmacallan 6738f7ec340bSmacallanif test -n "$exec_cmd"; then 6739f7ec340bSmacallan eval exec $exec_cmd 6740f7ec340bSmacallan exit $EXIT_FAILURE 6741f7ec340bSmacallanfi 6742f7ec340bSmacallan 6743f7ec340bSmacallan# We need to display help for each of the modes. 6744f7ec340bSmacallancase $mode in 6745f7ec340bSmacallan"") $echo \ 6746f7ec340bSmacallan"Usage: $modename [OPTION]... [MODE-ARG]... 6747f7ec340bSmacallan 6748f7ec340bSmacallanProvide generalized library-building support services. 6749f7ec340bSmacallan 6750f7ec340bSmacallan --config show all configuration variables 6751f7ec340bSmacallan --debug enable verbose shell tracing 6752f7ec340bSmacallan-n, --dry-run display commands without modifying any files 6753f7ec340bSmacallan --features display basic configuration information and exit 6754f7ec340bSmacallan --finish same as \`--mode=finish' 6755f7ec340bSmacallan --help display this help message and exit 6756f7ec340bSmacallan --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 6757f7ec340bSmacallan --quiet same as \`--silent' 6758f7ec340bSmacallan --silent don't print informational messages 6759f7ec340bSmacallan --tag=TAG use configuration variables from tag TAG 6760f7ec340bSmacallan --version print version information 6761f7ec340bSmacallan 6762f7ec340bSmacallanMODE must be one of the following: 6763f7ec340bSmacallan 6764f7ec340bSmacallan clean remove files from the build directory 6765f7ec340bSmacallan compile compile a source file into a libtool object 6766f7ec340bSmacallan execute automatically set library path, then run a program 6767f7ec340bSmacallan finish complete the installation of libtool libraries 6768f7ec340bSmacallan install install libraries or executables 6769f7ec340bSmacallan link create a library or an executable 6770f7ec340bSmacallan uninstall remove libraries from an installed directory 6771f7ec340bSmacallan 6772f7ec340bSmacallanMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 6773f7ec340bSmacallana more detailed description of MODE. 6774f7ec340bSmacallan 6775f7ec340bSmacallanReport bugs to <bug-libtool@gnu.org>." 6776f7ec340bSmacallan exit $EXIT_SUCCESS 6777f7ec340bSmacallan ;; 6778f7ec340bSmacallan 6779f7ec340bSmacallanclean) 6780f7ec340bSmacallan $echo \ 6781f7ec340bSmacallan"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 6782f7ec340bSmacallan 6783f7ec340bSmacallanRemove files from the build directory. 6784f7ec340bSmacallan 6785f7ec340bSmacallanRM is the name of the program to use to delete files associated with each FILE 6786f7ec340bSmacallan(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6787f7ec340bSmacallanto RM. 6788f7ec340bSmacallan 6789f7ec340bSmacallanIf FILE is a libtool library, object or program, all the files associated 6790f7ec340bSmacallanwith it are deleted. Otherwise, only FILE itself is deleted using RM." 6791f7ec340bSmacallan ;; 6792f7ec340bSmacallan 6793f7ec340bSmacallancompile) 6794f7ec340bSmacallan $echo \ 6795f7ec340bSmacallan"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 6796f7ec340bSmacallan 6797f7ec340bSmacallanCompile a source file into a libtool library object. 6798f7ec340bSmacallan 6799f7ec340bSmacallanThis mode accepts the following additional options: 6800f7ec340bSmacallan 6801f7ec340bSmacallan -o OUTPUT-FILE set the output file name to OUTPUT-FILE 6802f7ec340bSmacallan -prefer-pic try to building PIC objects only 6803f7ec340bSmacallan -prefer-non-pic try to building non-PIC objects only 6804f7ec340bSmacallan -static always build a \`.o' file suitable for static linking 6805f7ec340bSmacallan 6806f7ec340bSmacallanCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 6807f7ec340bSmacallanfrom the given SOURCEFILE. 6808f7ec340bSmacallan 6809f7ec340bSmacallanThe output file name is determined by removing the directory component from 6810f7ec340bSmacallanSOURCEFILE, then substituting the C source code suffix \`.c' with the 6811f7ec340bSmacallanlibrary object suffix, \`.lo'." 6812f7ec340bSmacallan ;; 6813f7ec340bSmacallan 6814f7ec340bSmacallanexecute) 6815f7ec340bSmacallan $echo \ 6816f7ec340bSmacallan"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 6817f7ec340bSmacallan 6818f7ec340bSmacallanAutomatically set library path, then run a program. 6819f7ec340bSmacallan 6820f7ec340bSmacallanThis mode accepts the following additional options: 6821f7ec340bSmacallan 6822f7ec340bSmacallan -dlopen FILE add the directory containing FILE to the library path 6823f7ec340bSmacallan 6824f7ec340bSmacallanThis mode sets the library path environment variable according to \`-dlopen' 6825f7ec340bSmacallanflags. 6826f7ec340bSmacallan 6827f7ec340bSmacallanIf any of the ARGS are libtool executable wrappers, then they are translated 6828f7ec340bSmacallaninto their corresponding uninstalled binary, and any of their required library 6829f7ec340bSmacallandirectories are added to the library path. 6830f7ec340bSmacallan 6831f7ec340bSmacallanThen, COMMAND is executed, with ARGS as arguments." 6832f7ec340bSmacallan ;; 6833f7ec340bSmacallan 6834f7ec340bSmacallanfinish) 6835f7ec340bSmacallan $echo \ 6836f7ec340bSmacallan"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 6837f7ec340bSmacallan 6838f7ec340bSmacallanComplete the installation of libtool libraries. 6839f7ec340bSmacallan 6840f7ec340bSmacallanEach LIBDIR is a directory that contains libtool libraries. 6841f7ec340bSmacallan 6842f7ec340bSmacallanThe commands that this mode executes may require superuser privileges. Use 6843f7ec340bSmacallanthe \`--dry-run' option if you just want to see what would be executed." 6844f7ec340bSmacallan ;; 6845f7ec340bSmacallan 6846f7ec340bSmacallaninstall) 6847f7ec340bSmacallan $echo \ 6848f7ec340bSmacallan"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 6849f7ec340bSmacallan 6850f7ec340bSmacallanInstall executables or libraries. 6851f7ec340bSmacallan 6852f7ec340bSmacallanINSTALL-COMMAND is the installation command. The first component should be 6853f7ec340bSmacallaneither the \`install' or \`cp' program. 6854f7ec340bSmacallan 6855f7ec340bSmacallanThe rest of the components are interpreted as arguments to that command (only 6856f7ec340bSmacallanBSD-compatible install options are recognized)." 6857f7ec340bSmacallan ;; 6858f7ec340bSmacallan 6859f7ec340bSmacallanlink) 6860f7ec340bSmacallan $echo \ 6861f7ec340bSmacallan"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 6862f7ec340bSmacallan 6863f7ec340bSmacallanLink object files or libraries together to form another library, or to 6864f7ec340bSmacallancreate an executable program. 6865f7ec340bSmacallan 6866f7ec340bSmacallanLINK-COMMAND is a command using the C compiler that you would use to create 6867f7ec340bSmacallana program from several object files. 6868f7ec340bSmacallan 6869f7ec340bSmacallanThe following components of LINK-COMMAND are treated specially: 6870f7ec340bSmacallan 6871f7ec340bSmacallan -all-static do not do any dynamic linking at all 6872f7ec340bSmacallan -avoid-version do not add a version suffix if possible 6873f7ec340bSmacallan -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 6874f7ec340bSmacallan -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 6875f7ec340bSmacallan -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 6876f7ec340bSmacallan -export-symbols SYMFILE 68777ce7e03cSmrg try to export only the symbols listed in SYMFILE 6878f7ec340bSmacallan -export-symbols-regex REGEX 68797ce7e03cSmrg try to export only the symbols matching REGEX 6880f7ec340bSmacallan -LLIBDIR search LIBDIR for required installed libraries 6881f7ec340bSmacallan -lNAME OUTPUT-FILE requires the installed library libNAME 6882f7ec340bSmacallan -module build a library that can dlopened 6883f7ec340bSmacallan -no-fast-install disable the fast-install mode 6884f7ec340bSmacallan -no-install link a not-installable executable 6885f7ec340bSmacallan -no-undefined declare that a library does not refer to external symbols 6886f7ec340bSmacallan -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 6887f7ec340bSmacallan -objectlist FILE Use a list of object files found in FILE to specify objects 6888f7ec340bSmacallan -precious-files-regex REGEX 6889f7ec340bSmacallan don't remove output files matching REGEX 6890f7ec340bSmacallan -release RELEASE specify package release information 6891f7ec340bSmacallan -rpath LIBDIR the created library will eventually be installed in LIBDIR 6892f7ec340bSmacallan -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 68937ce7e03cSmrg -static do not do any dynamic linking of uninstalled libtool libraries 68947ce7e03cSmrg -static-libtool-libs 68957ce7e03cSmrg do not do any dynamic linking of libtool libraries 6896f7ec340bSmacallan -version-info CURRENT[:REVISION[:AGE]] 68977ce7e03cSmrg specify library version info [each variable defaults to 0] 6898f7ec340bSmacallan 6899f7ec340bSmacallanAll other options (arguments beginning with \`-') are ignored. 6900f7ec340bSmacallan 6901f7ec340bSmacallanEvery other argument is treated as a filename. Files ending in \`.la' are 6902f7ec340bSmacallantreated as uninstalled libtool libraries, other files are standard or library 6903f7ec340bSmacallanobject files. 6904f7ec340bSmacallan 6905f7ec340bSmacallanIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 6906f7ec340bSmacallanonly library objects (\`.lo' files) may be specified, and \`-rpath' is 6907f7ec340bSmacallanrequired, except when creating a convenience library. 6908f7ec340bSmacallan 6909f7ec340bSmacallanIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 6910f7ec340bSmacallanusing \`ar' and \`ranlib', or on Windows using \`lib'. 6911f7ec340bSmacallan 6912f7ec340bSmacallanIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 6913f7ec340bSmacallanis created, otherwise an executable program is created." 6914f7ec340bSmacallan ;; 6915f7ec340bSmacallan 6916f7ec340bSmacallanuninstall) 6917f7ec340bSmacallan $echo \ 6918f7ec340bSmacallan"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 6919f7ec340bSmacallan 6920f7ec340bSmacallanRemove libraries from an installation directory. 6921f7ec340bSmacallan 6922f7ec340bSmacallanRM is the name of the program to use to delete files associated with each FILE 6923f7ec340bSmacallan(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6924f7ec340bSmacallanto RM. 6925f7ec340bSmacallan 6926f7ec340bSmacallanIf FILE is a libtool library, all the files associated with it are deleted. 6927f7ec340bSmacallanOtherwise, only FILE itself is deleted using RM." 6928f7ec340bSmacallan ;; 6929f7ec340bSmacallan 6930f7ec340bSmacallan*) 6931f7ec340bSmacallan $echo "$modename: invalid operation mode \`$mode'" 1>&2 6932f7ec340bSmacallan $echo "$help" 1>&2 6933f7ec340bSmacallan exit $EXIT_FAILURE 6934f7ec340bSmacallan ;; 6935f7ec340bSmacallanesac 6936f7ec340bSmacallan 6937f7ec340bSmacallan$echo 6938f7ec340bSmacallan$echo "Try \`$modename --help' for more information about other modes." 6939f7ec340bSmacallan 6940f7ec340bSmacallanexit $? 6941f7ec340bSmacallan 6942f7ec340bSmacallan# The TAGs below are defined such that we never get into a situation 6943f7ec340bSmacallan# in which we disable both kinds of libraries. Given conflicting 6944f7ec340bSmacallan# choices, we go for a static library, that is the most portable, 6945f7ec340bSmacallan# since we can't tell whether shared libraries were disabled because 6946f7ec340bSmacallan# the user asked for that or because the platform doesn't support 6947f7ec340bSmacallan# them. This is particularly important on AIX, because we don't 6948f7ec340bSmacallan# support having both static and shared libraries enabled at the same 6949f7ec340bSmacallan# time on that platform, so we default to a shared-only configuration. 6950f7ec340bSmacallan# If a disable-shared tag is given, we'll fallback to a static-only 6951f7ec340bSmacallan# configuration. But we'll never go from static-only to shared-only. 6952f7ec340bSmacallan 6953f7ec340bSmacallan# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6954f7ec340bSmacallandisable_libs=shared 6955f7ec340bSmacallan# ### END LIBTOOL TAG CONFIG: disable-shared 6956f7ec340bSmacallan 6957f7ec340bSmacallan# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6958f7ec340bSmacallandisable_libs=static 6959f7ec340bSmacallan# ### END LIBTOOL TAG CONFIG: disable-static 6960f7ec340bSmacallan 6961f7ec340bSmacallan# Local Variables: 6962f7ec340bSmacallan# mode:shell-script 6963f7ec340bSmacallan# sh-indentation:2 6964f7ec340bSmacallan# End: 6965