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