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