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