ltmain.sh revision 518bcf38
1518bcf38Smrg# ltmain.sh - Provide generalized library-building support services. 2518bcf38Smrg# NOTE: Changing this file will not affect anything until you rerun configure. 3518bcf38Smrg# 4518bcf38Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 5518bcf38Smrg# 2007, 2008 Free Software Foundation, Inc. 6518bcf38Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7518bcf38Smrg# 8518bcf38Smrg# This program is free software; you can redistribute it and/or modify 9c35d236eSmrg# it under the terms of the GNU General Public License as published by 10c35d236eSmrg# the Free Software Foundation; either version 2 of the License, or 11c35d236eSmrg# (at your option) any later version. 12c35d236eSmrg# 13518bcf38Smrg# This program is distributed in the hope that it will be useful, but 14c35d236eSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 15c35d236eSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16c35d236eSmrg# General Public License for more details. 17c35d236eSmrg# 18c35d236eSmrg# You should have received a copy of the GNU General Public License 19518bcf38Smrg# along with this program; if not, write to the Free Software 20518bcf38Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21f55e6a01Smrg# 22518bcf38Smrg# As a special exception to the GNU General Public License, if you 23518bcf38Smrg# distribute this file as part of a program that contains a 24518bcf38Smrg# configuration script generated by Autoconf, you may include it under 25518bcf38Smrg# the same distribution terms that you use for the rest of that program. 26518bcf38Smrg 27518bcf38Smrgbasename="s,^.*/,,g" 28518bcf38Smrg 29518bcf38Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 30518bcf38Smrg# is ksh but when the shell is invoked as "sh" and the current value of 31518bcf38Smrg# the _XPG environment variable is not equal to 1 (one), the special 32518bcf38Smrg# positional parameter $0, within a function call, is the name of the 33518bcf38Smrg# function. 34518bcf38Smrgprogpath="$0" 35518bcf38Smrg 36518bcf38Smrg# The name of this program: 37518bcf38Smrgprogname=`echo "$progpath" | $SED $basename` 38518bcf38Smrgmodename="$progname" 39518bcf38Smrg 40518bcf38Smrg# Global variables: 41518bcf38SmrgEXIT_SUCCESS=0 42518bcf38SmrgEXIT_FAILURE=1 43c35d236eSmrg 44c35d236eSmrgPROGRAM=ltmain.sh 45c35d236eSmrgPACKAGE=libtool 46518bcf38SmrgVERSION=1.5.26 47518bcf38SmrgTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" 48c35d236eSmrg 49518bcf38Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 504f6cd06fSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 514f6cd06fSmrg emulate sh 524f6cd06fSmrg NULLCMD=: 534f6cd06fSmrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 544f6cd06fSmrg # is contrary to our usage. Disable this feature. 554f6cd06fSmrg alias -g '${1+"$@"}'='"$@"' 56c35d236eSmrg setopt NO_GLOB_SUBST 574f6cd06fSmrgelse 584f6cd06fSmrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 59c35d236eSmrgfi 60f55e6a01SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 61f55e6a01SmrgDUALCASE=1; export DUALCASE # for MKS sh 62c35d236eSmrg 63518bcf38Smrg# Check that we have a working $echo. 64518bcf38Smrgif test "X$1" = X--no-reexec; then 65518bcf38Smrg # Discard the --no-reexec flag, and continue. 66518bcf38Smrg shift 67518bcf38Smrgelif test "X$1" = X--fallback-echo; then 68518bcf38Smrg # Avoid inline document here, it may be left over 69518bcf38Smrg : 70518bcf38Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 71518bcf38Smrg # Yippee, $echo works! 72518bcf38Smrg : 73518bcf38Smrgelse 74518bcf38Smrg # Restart under the correct shell, and then maybe $echo will work. 75518bcf38Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 76518bcf38Smrgfi 77518bcf38Smrg 78518bcf38Smrgif test "X$1" = X--fallback-echo; then 79518bcf38Smrg # used as fallback echo 80518bcf38Smrg shift 81518bcf38Smrg cat <<EOF 82518bcf38Smrg$* 83518bcf38SmrgEOF 84518bcf38Smrg exit $EXIT_SUCCESS 85518bcf38Smrgfi 86518bcf38Smrg 87518bcf38Smrgdefault_mode= 88518bcf38Smrghelp="Try \`$progname --help' for more information." 89518bcf38Smrgmagic="%%%MAGIC variable%%%" 90518bcf38Smrgmkdir="mkdir" 91518bcf38Smrgmv="mv -f" 92518bcf38Smrgrm="rm -f" 93518bcf38Smrg 94518bcf38Smrg# Sed substitution that helps us do robust quoting. It backslashifies 95518bcf38Smrg# metacharacters that are still active within double-quoted strings. 96518bcf38SmrgXsed="${SED}"' -e 1s/^X//' 97518bcf38Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 98518bcf38Smrg# test EBCDIC or ASCII 99518bcf38Smrgcase `echo X|tr X '\101'` in 100518bcf38Smrg A) # ASCII based system 101518bcf38Smrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 102518bcf38Smrg SP2NL='tr \040 \012' 103518bcf38Smrg NL2SP='tr \015\012 \040\040' 104518bcf38Smrg ;; 105518bcf38Smrg *) # EBCDIC based system 106518bcf38Smrg SP2NL='tr \100 \n' 107518bcf38Smrg NL2SP='tr \r\n \100\100' 108518bcf38Smrg ;; 109518bcf38Smrgesac 110518bcf38Smrg 111518bcf38Smrg# NLS nuisances. 112c35d236eSmrg# Only set LANG and LC_ALL to C if already set. 113c35d236eSmrg# These must not be set unconditionally because not all systems understand 114c35d236eSmrg# e.g. LANG=C (notably SCO). 115518bcf38Smrg# We save the old values to restore during execute mode. 116518bcf38Smrglt_env= 117f55e6a01Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1184f6cd06fSmrgdo 1194f6cd06fSmrg eval "if test \"\${$lt_var+set}\" = set; then 120518bcf38Smrg save_$lt_var=\$$lt_var 121518bcf38Smrg lt_env=\"$lt_var=\$$lt_var \$lt_env\" 122518bcf38Smrg $lt_var=C 123f55e6a01Smrg export $lt_var 124f55e6a01Smrg fi" 1254f6cd06fSmrgdone 126c35d236eSmrg 127518bcf38Smrgif test -n "$lt_env"; then 128518bcf38Smrg lt_env="env $lt_env" 129518bcf38Smrgfi 130f55e6a01Smrg 131c35d236eSmrg# Make sure IFS has a sensible default 132c35d236eSmrglt_nl=' 133c35d236eSmrg' 134c35d236eSmrgIFS=" $lt_nl" 135c35d236eSmrg 136518bcf38Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 137518bcf38Smrg $echo "$modename: not configured to build any kind of library" 1>&2 138518bcf38Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 139518bcf38Smrg exit $EXIT_FAILURE 140518bcf38Smrgfi 141f55e6a01Smrg 142518bcf38Smrg# Global variables. 143518bcf38Smrgmode=$default_mode 144518bcf38Smrgnonopt= 145518bcf38Smrgprev= 146518bcf38Smrgprevopt= 147518bcf38Smrgrun= 148518bcf38Smrgshow="$echo" 149518bcf38Smrgshow_help= 150518bcf38Smrgexecute_dlfiles= 151518bcf38Smrgduplicate_deps=no 152518bcf38Smrgpreserve_args= 153518bcf38Smrglo2o="s/\\.lo\$/.${objext}/" 154518bcf38Smrgo2lo="s/\\.${objext}\$/.lo/" 155518bcf38Smrgextracted_archives= 156518bcf38Smrgextracted_serial=0 157c35d236eSmrg 158518bcf38Smrg##################################### 159518bcf38Smrg# Shell function definitions: 160518bcf38Smrg# This seems to be the best place for them 161c35d236eSmrg 162c35d236eSmrg# func_mktempdir [string] 163c35d236eSmrg# Make a temporary directory that won't clash with other running 164c35d236eSmrg# libtool processes, and avoids race conditions if possible. If 165c35d236eSmrg# given, STRING is the basename for that directory. 166c35d236eSmrgfunc_mktempdir () 167c35d236eSmrg{ 168c35d236eSmrg my_template="${TMPDIR-/tmp}/${1-$progname}" 169c35d236eSmrg 170518bcf38Smrg if test "$run" = ":"; then 171c35d236eSmrg # Return a directory name, but don't create it in dry-run mode 172c35d236eSmrg my_tmpdir="${my_template}-$$" 173c35d236eSmrg else 174c35d236eSmrg 175c35d236eSmrg # If mktemp works, use that first and foremost 176c35d236eSmrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 177c35d236eSmrg 178c35d236eSmrg if test ! -d "$my_tmpdir"; then 179518bcf38Smrg # Failing that, at least try and use $RANDOM to avoid a race 180518bcf38Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 181c35d236eSmrg 182518bcf38Smrg save_mktempdir_umask=`umask` 183518bcf38Smrg umask 0077 184518bcf38Smrg $mkdir "$my_tmpdir" 185518bcf38Smrg umask $save_mktempdir_umask 186c35d236eSmrg fi 187c35d236eSmrg 188c35d236eSmrg # If we're not in dry-run mode, bomb out on failure 189518bcf38Smrg test -d "$my_tmpdir" || { 190518bcf38Smrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 191518bcf38Smrg exit $EXIT_FAILURE 192518bcf38Smrg } 193c35d236eSmrg fi 194c35d236eSmrg 195518bcf38Smrg $echo "X$my_tmpdir" | $Xsed 196c35d236eSmrg} 197c35d236eSmrg 198c35d236eSmrg 199518bcf38Smrg# func_win32_libid arg 200518bcf38Smrg# return the library type of file 'arg' 201518bcf38Smrg# 202518bcf38Smrg# Need a lot of goo to handle *both* DLLs and import libs 203518bcf38Smrg# Has to be a shell function in order to 'eat' the argument 204518bcf38Smrg# that is supplied when $file_magic_command is called. 205518bcf38Smrgfunc_win32_libid () 206c35d236eSmrg{ 207518bcf38Smrg win32_libid_type="unknown" 208518bcf38Smrg win32_fileres=`file -L $1 2>/dev/null` 209518bcf38Smrg case $win32_fileres in 210518bcf38Smrg *ar\ archive\ import\ library*) # definitely import 211518bcf38Smrg win32_libid_type="x86 archive import" 212518bcf38Smrg ;; 213518bcf38Smrg *ar\ archive*) # could be an import, or static 214518bcf38Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 215518bcf38Smrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 216518bcf38Smrg win32_nmres=`eval $NM -f posix -A $1 | \ 217518bcf38Smrg $SED -n -e '1,100{ 218518bcf38Smrg / I /{ 219518bcf38Smrg s,.*,import, 220518bcf38Smrg p 221518bcf38Smrg q 222518bcf38Smrg } 223518bcf38Smrg }'` 224518bcf38Smrg case $win32_nmres in 225518bcf38Smrg import*) win32_libid_type="x86 archive import";; 226518bcf38Smrg *) win32_libid_type="x86 archive static";; 227518bcf38Smrg esac 228518bcf38Smrg fi 229518bcf38Smrg ;; 230518bcf38Smrg *DLL*) 231518bcf38Smrg win32_libid_type="x86 DLL" 232518bcf38Smrg ;; 233518bcf38Smrg *executable*) # but shell scripts are "executable" too... 234518bcf38Smrg case $win32_fileres in 235518bcf38Smrg *MS\ Windows\ PE\ Intel*) 236518bcf38Smrg win32_libid_type="x86 DLL" 237518bcf38Smrg ;; 238c35d236eSmrg esac 239518bcf38Smrg ;; 240518bcf38Smrg esac 241518bcf38Smrg $echo $win32_libid_type 242c35d236eSmrg} 243c35d236eSmrg 244c35d236eSmrg 245518bcf38Smrg# func_infer_tag arg 246518bcf38Smrg# Infer tagged configuration to use if any are available and 247518bcf38Smrg# if one wasn't chosen via the "--tag" command line option. 248518bcf38Smrg# Only attempt this if the compiler in the base compile 249518bcf38Smrg# command doesn't match the default compiler. 250518bcf38Smrg# arg is usually of the form 'gcc ...' 251518bcf38Smrgfunc_infer_tag () 252c35d236eSmrg{ 253518bcf38Smrg if test -n "$available_tags" && test -z "$tagname"; then 254518bcf38Smrg CC_quoted= 255518bcf38Smrg for arg in $CC; do 256518bcf38Smrg case $arg in 257518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 258518bcf38Smrg arg="\"$arg\"" 259518bcf38Smrg ;; 260518bcf38Smrg esac 261518bcf38Smrg CC_quoted="$CC_quoted $arg" 262518bcf38Smrg done 263518bcf38Smrg case $@ in 264518bcf38Smrg # Blanks in the command may have been stripped by the calling shell, 265518bcf38Smrg # but not from the CC environment variable when configure was run. 266518bcf38Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 267518bcf38Smrg # Blanks at the start of $base_compile will cause this to fail 268518bcf38Smrg # if we don't check for them as well. 269c35d236eSmrg *) 270518bcf38Smrg for z in $available_tags; do 271518bcf38Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 272518bcf38Smrg # Evaluate the configuration. 273518bcf38Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 274518bcf38Smrg CC_quoted= 275518bcf38Smrg for arg in $CC; do 276518bcf38Smrg # Double-quote args containing other shell metacharacters. 277518bcf38Smrg case $arg in 278518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 279518bcf38Smrg arg="\"$arg\"" 280518bcf38Smrg ;; 281518bcf38Smrg esac 282518bcf38Smrg CC_quoted="$CC_quoted $arg" 283518bcf38Smrg done 284518bcf38Smrg case "$@ " in 285518bcf38Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 286518bcf38Smrg # The compiler in the base compile command matches 287518bcf38Smrg # the one in the tagged configuration. 288518bcf38Smrg # Assume this is the tagged configuration we want. 289518bcf38Smrg tagname=$z 290518bcf38Smrg break 291518bcf38Smrg ;; 292518bcf38Smrg esac 293518bcf38Smrg fi 294518bcf38Smrg done 295518bcf38Smrg # If $tagname still isn't set, then no tagged configuration 296518bcf38Smrg # was found and let the user know that the "--tag" command 297518bcf38Smrg # line option must be used. 298518bcf38Smrg if test -z "$tagname"; then 299518bcf38Smrg $echo "$modename: unable to infer tagged configuration" 300518bcf38Smrg $echo "$modename: specify a tag with \`--tag'" 1>&2 301518bcf38Smrg exit $EXIT_FAILURE 302518bcf38Smrg# else 303518bcf38Smrg# $echo "$modename: using $tagname tagged configuration" 304518bcf38Smrg fi 305518bcf38Smrg ;; 306518bcf38Smrg esac 307518bcf38Smrg fi 308c35d236eSmrg} 309c35d236eSmrg 310c35d236eSmrg 311518bcf38Smrg# func_extract_an_archive dir oldlib 312518bcf38Smrgfunc_extract_an_archive () 313c35d236eSmrg{ 314518bcf38Smrg f_ex_an_ar_dir="$1"; shift 315518bcf38Smrg f_ex_an_ar_oldlib="$1" 316f55e6a01Smrg 317518bcf38Smrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 318518bcf38Smrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 319518bcf38Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 320518bcf38Smrg : 321518bcf38Smrg else 322518bcf38Smrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 323518bcf38Smrg exit $EXIT_FAILURE 324c35d236eSmrg fi 325c35d236eSmrg} 326c35d236eSmrg 327518bcf38Smrg# func_extract_archives gentop oldlib ... 328518bcf38Smrgfunc_extract_archives () 329c35d236eSmrg{ 330518bcf38Smrg my_gentop="$1"; shift 331518bcf38Smrg my_oldlibs=${1+"$@"} 332518bcf38Smrg my_oldobjs="" 333518bcf38Smrg my_xlib="" 334518bcf38Smrg my_xabs="" 335518bcf38Smrg my_xdir="" 336518bcf38Smrg my_status="" 337518bcf38Smrg 338518bcf38Smrg $show "${rm}r $my_gentop" 339518bcf38Smrg $run ${rm}r "$my_gentop" 340518bcf38Smrg $show "$mkdir $my_gentop" 341518bcf38Smrg $run $mkdir "$my_gentop" 342518bcf38Smrg my_status=$? 343518bcf38Smrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 344518bcf38Smrg exit $my_status 345c35d236eSmrg fi 346c35d236eSmrg 347518bcf38Smrg for my_xlib in $my_oldlibs; do 348518bcf38Smrg # Extract the objects. 349518bcf38Smrg case $my_xlib in 350518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 351518bcf38Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 352518bcf38Smrg esac 353518bcf38Smrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 354518bcf38Smrg my_xlib_u=$my_xlib 355518bcf38Smrg while :; do 356518bcf38Smrg case " $extracted_archives " in 357518bcf38Smrg *" $my_xlib_u "*) 358518bcf38Smrg extracted_serial=`expr $extracted_serial + 1` 359518bcf38Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 360518bcf38Smrg *) break ;; 361518bcf38Smrg esac 362518bcf38Smrg done 363518bcf38Smrg extracted_archives="$extracted_archives $my_xlib_u" 364518bcf38Smrg my_xdir="$my_gentop/$my_xlib_u" 365f55e6a01Smrg 366518bcf38Smrg $show "${rm}r $my_xdir" 367518bcf38Smrg $run ${rm}r "$my_xdir" 368518bcf38Smrg $show "$mkdir $my_xdir" 369518bcf38Smrg $run $mkdir "$my_xdir" 370518bcf38Smrg exit_status=$? 371518bcf38Smrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 372518bcf38Smrg exit $exit_status 373518bcf38Smrg fi 374518bcf38Smrg case $host in 375518bcf38Smrg *-darwin*) 376518bcf38Smrg $show "Extracting $my_xabs" 377518bcf38Smrg # Do not bother doing anything if just a dry run 378518bcf38Smrg if test -z "$run"; then 379518bcf38Smrg darwin_orig_dir=`pwd` 380518bcf38Smrg cd $my_xdir || exit $? 381518bcf38Smrg darwin_archive=$my_xabs 382518bcf38Smrg darwin_curdir=`pwd` 383518bcf38Smrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 384518bcf38Smrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 385518bcf38Smrg if test -n "$darwin_arches"; then 386518bcf38Smrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 387518bcf38Smrg darwin_arch= 388518bcf38Smrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 389518bcf38Smrg for darwin_arch in $darwin_arches ; do 390518bcf38Smrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 391518bcf38Smrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 392518bcf38Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 393518bcf38Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 394518bcf38Smrg cd "$darwin_curdir" 395518bcf38Smrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 396518bcf38Smrg done # $darwin_arches 397518bcf38Smrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 398518bcf38Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 399518bcf38Smrg darwin_file= 400518bcf38Smrg darwin_files= 401518bcf38Smrg for darwin_file in $darwin_filelist; do 402518bcf38Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 403518bcf38Smrg lipo -create -output "$darwin_file" $darwin_files 404518bcf38Smrg done # $darwin_filelist 405518bcf38Smrg ${rm}r unfat-$$ 406518bcf38Smrg cd "$darwin_orig_dir" 407518bcf38Smrg else 408518bcf38Smrg cd "$darwin_orig_dir" 409518bcf38Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 410518bcf38Smrg fi # $darwin_arches 411518bcf38Smrg fi # $run 412518bcf38Smrg ;; 413518bcf38Smrg *) 414518bcf38Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 415518bcf38Smrg ;; 416518bcf38Smrg esac 417518bcf38Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 418518bcf38Smrg done 419518bcf38Smrg func_extract_archives_result="$my_oldobjs" 420c35d236eSmrg} 421518bcf38Smrg# End of Shell function definitions 422518bcf38Smrg##################################### 423c35d236eSmrg 424518bcf38Smrg# Darwin sucks 425518bcf38Smrgeval std_shrext=\"$shrext_cmds\" 426f55e6a01Smrg 427518bcf38Smrgdisable_libs=no 428f55e6a01Smrg 429518bcf38Smrg# Parse our command line options once, thoroughly. 430518bcf38Smrgwhile test "$#" -gt 0 431518bcf38Smrgdo 432518bcf38Smrg arg="$1" 433c35d236eSmrg shift 434c35d236eSmrg 435518bcf38Smrg case $arg in 436518bcf38Smrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 437518bcf38Smrg *) optarg= ;; 438518bcf38Smrg esac 439c35d236eSmrg 440518bcf38Smrg # If the previous option needs an argument, assign it. 441518bcf38Smrg if test -n "$prev"; then 442518bcf38Smrg case $prev in 443518bcf38Smrg execute_dlfiles) 444518bcf38Smrg execute_dlfiles="$execute_dlfiles $arg" 445518bcf38Smrg ;; 446518bcf38Smrg tag) 447518bcf38Smrg tagname="$arg" 448518bcf38Smrg preserve_args="${preserve_args}=$arg" 449518bcf38Smrg 450518bcf38Smrg # Check whether tagname contains only valid characters 451518bcf38Smrg case $tagname in 452518bcf38Smrg *[!-_A-Za-z0-9,/]*) 453518bcf38Smrg $echo "$progname: invalid tag name: $tagname" 1>&2 454518bcf38Smrg exit $EXIT_FAILURE 455518bcf38Smrg ;; 456518bcf38Smrg esac 457c35d236eSmrg 458518bcf38Smrg case $tagname in 459518bcf38Smrg CC) 460518bcf38Smrg # Don't test for the "default" C tag, as we know, it's there, but 461518bcf38Smrg # not specially marked. 462518bcf38Smrg ;; 463518bcf38Smrg *) 464518bcf38Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 465518bcf38Smrg taglist="$taglist $tagname" 466518bcf38Smrg # Evaluate the configuration. 467518bcf38Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 468518bcf38Smrg else 469518bcf38Smrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 470518bcf38Smrg fi 471518bcf38Smrg ;; 472518bcf38Smrg esac 473518bcf38Smrg ;; 474518bcf38Smrg *) 475518bcf38Smrg eval "$prev=\$arg" 476518bcf38Smrg ;; 477518bcf38Smrg esac 478c35d236eSmrg 479518bcf38Smrg prev= 480518bcf38Smrg prevopt= 481518bcf38Smrg continue 482518bcf38Smrg fi 483c35d236eSmrg 484518bcf38Smrg # Have we seen a non-optional argument yet? 485518bcf38Smrg case $arg in 486518bcf38Smrg --help) 487518bcf38Smrg show_help=yes 488518bcf38Smrg ;; 489c35d236eSmrg 490518bcf38Smrg --version) 491518bcf38Smrg echo "\ 492518bcf38Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 493f55e6a01Smrg 494518bcf38SmrgCopyright (C) 2008 Free Software Foundation, Inc. 495518bcf38SmrgThis is free software; see the source for copying conditions. There is NO 496518bcf38Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 497518bcf38Smrg exit $? 498518bcf38Smrg ;; 499f55e6a01Smrg 500518bcf38Smrg --config) 501518bcf38Smrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 502c35d236eSmrg # Now print the configurations for the tags. 503c35d236eSmrg for tagname in $taglist; do 504518bcf38Smrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 505c35d236eSmrg done 506f55e6a01Smrg exit $? 507518bcf38Smrg ;; 508c35d236eSmrg 509518bcf38Smrg --debug) 510518bcf38Smrg $echo "$progname: enabling shell trace mode" 511518bcf38Smrg set -x 512518bcf38Smrg preserve_args="$preserve_args $arg" 513518bcf38Smrg ;; 514518bcf38Smrg 515518bcf38Smrg --dry-run | -n) 516518bcf38Smrg run=: 517518bcf38Smrg ;; 518518bcf38Smrg 519518bcf38Smrg --features) 520518bcf38Smrg $echo "host: $host" 521c35d236eSmrg if test "$build_libtool_libs" = yes; then 522518bcf38Smrg $echo "enable shared libraries" 523c35d236eSmrg else 524518bcf38Smrg $echo "disable shared libraries" 525c35d236eSmrg fi 526c35d236eSmrg if test "$build_old_libs" = yes; then 527518bcf38Smrg $echo "enable static libraries" 528c35d236eSmrg else 529518bcf38Smrg $echo "disable static libraries" 530c35d236eSmrg fi 531c35d236eSmrg exit $? 532518bcf38Smrg ;; 533c35d236eSmrg 534518bcf38Smrg --finish) mode="finish" ;; 535c35d236eSmrg 536518bcf38Smrg --mode) prevopt="--mode" prev=mode ;; 537518bcf38Smrg --mode=*) mode="$optarg" ;; 538f55e6a01Smrg 539518bcf38Smrg --preserve-dup-deps) duplicate_deps="yes" ;; 540c35d236eSmrg 541518bcf38Smrg --quiet | --silent) 542518bcf38Smrg show=: 543518bcf38Smrg preserve_args="$preserve_args $arg" 544c35d236eSmrg ;; 545518bcf38Smrg 546518bcf38Smrg --tag) 547518bcf38Smrg prevopt="--tag" 548518bcf38Smrg prev=tag 549518bcf38Smrg preserve_args="$preserve_args --tag" 550c35d236eSmrg ;; 551518bcf38Smrg --tag=*) 552518bcf38Smrg set tag "$optarg" ${1+"$@"} 553518bcf38Smrg shift 554518bcf38Smrg prev=tag 555518bcf38Smrg preserve_args="$preserve_args --tag" 556c35d236eSmrg ;; 557518bcf38Smrg 558518bcf38Smrg -dlopen) 559518bcf38Smrg prevopt="-dlopen" 560518bcf38Smrg prev=execute_dlfiles 561f55e6a01Smrg ;; 562518bcf38Smrg 563518bcf38Smrg -*) 564518bcf38Smrg $echo "$modename: unrecognized option \`$arg'" 1>&2 565518bcf38Smrg $echo "$help" 1>&2 566518bcf38Smrg exit $EXIT_FAILURE 567f55e6a01Smrg ;; 568518bcf38Smrg 569518bcf38Smrg *) 570518bcf38Smrg nonopt="$arg" 571518bcf38Smrg break 572c35d236eSmrg ;; 573c35d236eSmrg esac 574518bcf38Smrgdone 575c35d236eSmrg 576518bcf38Smrgif test -n "$prevopt"; then 577518bcf38Smrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 578518bcf38Smrg $echo "$help" 1>&2 579518bcf38Smrg exit $EXIT_FAILURE 580518bcf38Smrgfi 581f55e6a01Smrg 582518bcf38Smrgcase $disable_libs in 583518bcf38Smrgno) 584518bcf38Smrg ;; 585518bcf38Smrgshared) 586518bcf38Smrg build_libtool_libs=no 587518bcf38Smrg build_old_libs=yes 588518bcf38Smrg ;; 589518bcf38Smrgstatic) 590518bcf38Smrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 591518bcf38Smrg ;; 592518bcf38Smrgesac 593f55e6a01Smrg 594518bcf38Smrg# If this variable is set in any of the actions, the command in it 595518bcf38Smrg# will be execed at the end. This prevents here-documents from being 596518bcf38Smrg# left over by shells. 597518bcf38Smrgexec_cmd= 598f55e6a01Smrg 599518bcf38Smrgif test -z "$show_help"; then 600f55e6a01Smrg 601518bcf38Smrg # Infer the operation mode. 602518bcf38Smrg if test -z "$mode"; then 603518bcf38Smrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 604518bcf38Smrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 605518bcf38Smrg case $nonopt in 606518bcf38Smrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 607518bcf38Smrg mode=link 608518bcf38Smrg for arg 609518bcf38Smrg do 610518bcf38Smrg case $arg in 611518bcf38Smrg -c) 612518bcf38Smrg mode=compile 613518bcf38Smrg break 614518bcf38Smrg ;; 615518bcf38Smrg esac 616518bcf38Smrg done 617c35d236eSmrg ;; 618518bcf38Smrg *db | *dbx | *strace | *truss) 619518bcf38Smrg mode=execute 620f55e6a01Smrg ;; 621518bcf38Smrg *install*|cp|mv) 622518bcf38Smrg mode=install 623518bcf38Smrg ;; 624518bcf38Smrg *rm) 625518bcf38Smrg mode=uninstall 626518bcf38Smrg ;; 627518bcf38Smrg *) 628518bcf38Smrg # If we have no mode, but dlfiles were specified, then do execute mode. 629518bcf38Smrg test -n "$execute_dlfiles" && mode=execute 630f55e6a01Smrg 631518bcf38Smrg # Just use the default operation mode. 632518bcf38Smrg if test -z "$mode"; then 633518bcf38Smrg if test -n "$nonopt"; then 634518bcf38Smrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 635518bcf38Smrg else 636518bcf38Smrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 637518bcf38Smrg fi 638c35d236eSmrg fi 639518bcf38Smrg ;; 640518bcf38Smrg esac 641c35d236eSmrg fi 642c35d236eSmrg 643c35d236eSmrg # Only execute mode is allowed to have -dlopen flags. 644c35d236eSmrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 645518bcf38Smrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 646518bcf38Smrg $echo "$help" 1>&2 647c35d236eSmrg exit $EXIT_FAILURE 648c35d236eSmrg fi 649c35d236eSmrg 650c35d236eSmrg # Change the help message to a mode-specific one. 651c35d236eSmrg generic_help="$help" 652518bcf38Smrg help="Try \`$modename --help --mode=$mode' for more information." 653c35d236eSmrg 654518bcf38Smrg # These modes are in order of execution frequency so that they run quickly. 655518bcf38Smrg case $mode in 656518bcf38Smrg # libtool compile mode 657518bcf38Smrg compile) 658518bcf38Smrg modename="$modename: compile" 659518bcf38Smrg # Get the compilation command and the source file. 660518bcf38Smrg base_compile= 661518bcf38Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 662518bcf38Smrg suppress_opt=yes 663518bcf38Smrg suppress_output= 664518bcf38Smrg arg_mode=normal 665518bcf38Smrg libobj= 666518bcf38Smrg later= 667c35d236eSmrg 668518bcf38Smrg for arg 669518bcf38Smrg do 670518bcf38Smrg case $arg_mode in 671518bcf38Smrg arg ) 672518bcf38Smrg # do not "continue". Instead, add this to base_compile 673518bcf38Smrg lastarg="$arg" 674518bcf38Smrg arg_mode=normal 675518bcf38Smrg ;; 676c35d236eSmrg 677518bcf38Smrg target ) 678518bcf38Smrg libobj="$arg" 679518bcf38Smrg arg_mode=normal 680518bcf38Smrg continue 681518bcf38Smrg ;; 682c35d236eSmrg 683518bcf38Smrg normal ) 684518bcf38Smrg # Accept any command-line options. 685518bcf38Smrg case $arg in 686518bcf38Smrg -o) 687518bcf38Smrg if test -n "$libobj" ; then 688518bcf38Smrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 689518bcf38Smrg exit $EXIT_FAILURE 690518bcf38Smrg fi 691518bcf38Smrg arg_mode=target 692518bcf38Smrg continue 693518bcf38Smrg ;; 694c35d236eSmrg 695518bcf38Smrg -static | -prefer-pic | -prefer-non-pic) 696518bcf38Smrg later="$later $arg" 697518bcf38Smrg continue 698518bcf38Smrg ;; 699f55e6a01Smrg 700f55e6a01Smrg -no-suppress) 701f55e6a01Smrg suppress_opt=no 702f55e6a01Smrg continue 703f55e6a01Smrg ;; 704c35d236eSmrg 705c35d236eSmrg -Xcompiler) 706c35d236eSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 707c35d236eSmrg continue # The current "srcfile" will either be retained or 708c35d236eSmrg ;; # replaced later. I would guess that would be a bug. 709c35d236eSmrg 710c35d236eSmrg -Wc,*) 711518bcf38Smrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 712c35d236eSmrg lastarg= 713c35d236eSmrg save_ifs="$IFS"; IFS=',' 714518bcf38Smrg for arg in $args; do 715c35d236eSmrg IFS="$save_ifs" 716518bcf38Smrg 717518bcf38Smrg # Double-quote args containing other shell metacharacters. 718518bcf38Smrg # Many Bourne shells cannot handle close brackets correctly 719518bcf38Smrg # in scan sets, so we specify it separately. 720518bcf38Smrg case $arg in 721518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 722518bcf38Smrg arg="\"$arg\"" 723518bcf38Smrg ;; 724518bcf38Smrg esac 725518bcf38Smrg lastarg="$lastarg $arg" 726c35d236eSmrg done 727c35d236eSmrg IFS="$save_ifs" 728518bcf38Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 729c35d236eSmrg 730c35d236eSmrg # Add the arguments to base_compile. 731c35d236eSmrg base_compile="$base_compile $lastarg" 732c35d236eSmrg continue 733c35d236eSmrg ;; 734c35d236eSmrg 735518bcf38Smrg * ) 736c35d236eSmrg # Accept the current argument as the source file. 737c35d236eSmrg # The previous "srcfile" becomes the current argument. 738c35d236eSmrg # 739c35d236eSmrg lastarg="$srcfile" 740c35d236eSmrg srcfile="$arg" 741c35d236eSmrg ;; 742c35d236eSmrg esac # case $arg 743c35d236eSmrg ;; 744c35d236eSmrg esac # case $arg_mode 745c35d236eSmrg 746c35d236eSmrg # Aesthetically quote the previous argument. 747518bcf38Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 748518bcf38Smrg 749518bcf38Smrg case $lastarg in 750518bcf38Smrg # Double-quote args containing other shell metacharacters. 751518bcf38Smrg # Many Bourne shells cannot handle close brackets correctly 752518bcf38Smrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 753518bcf38Smrg # in scan sets (worked around with variable expansion), 754518bcf38Smrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 755518bcf38Smrg # at all, so we specify them separately. 756518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 757518bcf38Smrg lastarg="\"$lastarg\"" 758518bcf38Smrg ;; 759518bcf38Smrg esac 760518bcf38Smrg 761518bcf38Smrg base_compile="$base_compile $lastarg" 762c35d236eSmrg done # for arg 763c35d236eSmrg 764c35d236eSmrg case $arg_mode in 765c35d236eSmrg arg) 766518bcf38Smrg $echo "$modename: you must specify an argument for -Xcompile" 767518bcf38Smrg exit $EXIT_FAILURE 768c35d236eSmrg ;; 769c35d236eSmrg target) 770518bcf38Smrg $echo "$modename: you must specify a target with \`-o'" 1>&2 771518bcf38Smrg exit $EXIT_FAILURE 772c35d236eSmrg ;; 773c35d236eSmrg *) 774c35d236eSmrg # Get the name of the library object. 775518bcf38Smrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 776c35d236eSmrg ;; 777c35d236eSmrg esac 778c35d236eSmrg 779c35d236eSmrg # Recognize several different file suffixes. 780c35d236eSmrg # If the user specifies -o file.o, it is replaced with file.lo 781518bcf38Smrg xform='[cCFSifmso]' 782c35d236eSmrg case $libobj in 783518bcf38Smrg *.ada) xform=ada ;; 784518bcf38Smrg *.adb) xform=adb ;; 785518bcf38Smrg *.ads) xform=ads ;; 786518bcf38Smrg *.asm) xform=asm ;; 787518bcf38Smrg *.c++) xform=c++ ;; 788518bcf38Smrg *.cc) xform=cc ;; 789518bcf38Smrg *.ii) xform=ii ;; 790518bcf38Smrg *.class) xform=class ;; 791518bcf38Smrg *.cpp) xform=cpp ;; 792518bcf38Smrg *.cxx) xform=cxx ;; 793518bcf38Smrg *.[fF][09]?) xform=[fF][09]. ;; 794518bcf38Smrg *.for) xform=for ;; 795518bcf38Smrg *.java) xform=java ;; 796518bcf38Smrg *.obj) xform=obj ;; 797518bcf38Smrg *.sx) xform=sx ;; 798c35d236eSmrg esac 799c35d236eSmrg 800518bcf38Smrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 801518bcf38Smrg 802c35d236eSmrg case $libobj in 803518bcf38Smrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 804c35d236eSmrg *) 805518bcf38Smrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 806518bcf38Smrg exit $EXIT_FAILURE 807c35d236eSmrg ;; 808c35d236eSmrg esac 809c35d236eSmrg 810c35d236eSmrg func_infer_tag $base_compile 811c35d236eSmrg 812c35d236eSmrg for arg in $later; do 813c35d236eSmrg case $arg in 814c35d236eSmrg -static) 815c35d236eSmrg build_old_libs=yes 816c35d236eSmrg continue 817c35d236eSmrg ;; 818c35d236eSmrg 819c35d236eSmrg -prefer-pic) 820c35d236eSmrg pic_mode=yes 821c35d236eSmrg continue 822c35d236eSmrg ;; 823c35d236eSmrg 824c35d236eSmrg -prefer-non-pic) 825c35d236eSmrg pic_mode=no 826c35d236eSmrg continue 827c35d236eSmrg ;; 828c35d236eSmrg esac 829c35d236eSmrg done 830c35d236eSmrg 831518bcf38Smrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 832518bcf38Smrg case $qlibobj in 833518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 834518bcf38Smrg qlibobj="\"$qlibobj\"" ;; 835518bcf38Smrg esac 836518bcf38Smrg test "X$libobj" != "X$qlibobj" \ 837518bcf38Smrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 838518bcf38Smrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 839518bcf38Smrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 840518bcf38Smrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 841518bcf38Smrg if test "X$xdir" = "X$obj"; then 842518bcf38Smrg xdir= 843518bcf38Smrg else 844518bcf38Smrg xdir=$xdir/ 845518bcf38Smrg fi 846c35d236eSmrg lobj=${xdir}$objdir/$objname 847c35d236eSmrg 848518bcf38Smrg if test -z "$base_compile"; then 849518bcf38Smrg $echo "$modename: you must specify a compilation command" 1>&2 850518bcf38Smrg $echo "$help" 1>&2 851518bcf38Smrg exit $EXIT_FAILURE 852518bcf38Smrg fi 853c35d236eSmrg 854c35d236eSmrg # Delete any leftover library objects. 855c35d236eSmrg if test "$build_old_libs" = yes; then 856c35d236eSmrg removelist="$obj $lobj $libobj ${libobj}T" 857c35d236eSmrg else 858c35d236eSmrg removelist="$lobj $libobj ${libobj}T" 859c35d236eSmrg fi 860c35d236eSmrg 861518bcf38Smrg $run $rm $removelist 862518bcf38Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 863518bcf38Smrg 864c35d236eSmrg # On Cygwin there's no "real" PIC flag so we must build both object types 865c35d236eSmrg case $host_os in 866518bcf38Smrg cygwin* | mingw* | pw32* | os2*) 867c35d236eSmrg pic_mode=default 868c35d236eSmrg ;; 869c35d236eSmrg esac 870c35d236eSmrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 871c35d236eSmrg # non-PIC code in shared libraries is not supported 872c35d236eSmrg pic_mode=default 873c35d236eSmrg fi 874c35d236eSmrg 875c35d236eSmrg # Calculate the filename of the output object if compiler does 876c35d236eSmrg # not support -o with -c 877c35d236eSmrg if test "$compiler_c_o" = no; then 878518bcf38Smrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 879c35d236eSmrg lockfile="$output_obj.lock" 880518bcf38Smrg removelist="$removelist $output_obj $lockfile" 881518bcf38Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 882c35d236eSmrg else 883c35d236eSmrg output_obj= 884c35d236eSmrg need_locks=no 885c35d236eSmrg lockfile= 886c35d236eSmrg fi 887c35d236eSmrg 888c35d236eSmrg # Lock this critical section if it is needed 889c35d236eSmrg # We use this script file to make the link, it avoids creating a new file 890c35d236eSmrg if test "$need_locks" = yes; then 891518bcf38Smrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 892518bcf38Smrg $show "Waiting for $lockfile to be removed" 893c35d236eSmrg sleep 2 894c35d236eSmrg done 895c35d236eSmrg elif test "$need_locks" = warn; then 896c35d236eSmrg if test -f "$lockfile"; then 897518bcf38Smrg $echo "\ 898c35d236eSmrg*** ERROR, $lockfile exists and contains: 899c35d236eSmrg`cat $lockfile 2>/dev/null` 900c35d236eSmrg 901c35d236eSmrgThis indicates that another process is trying to use the same 902c35d236eSmrgtemporary object file, and libtool could not work around it because 903c35d236eSmrgyour compiler does not support \`-c' and \`-o' together. If you 904c35d236eSmrgrepeat this compilation, it may succeed, by chance, but you had better 905c35d236eSmrgavoid parallel builds (make -j) in this platform, or get a better 906c35d236eSmrgcompiler." 907c35d236eSmrg 908518bcf38Smrg $run $rm $removelist 909c35d236eSmrg exit $EXIT_FAILURE 910c35d236eSmrg fi 911518bcf38Smrg $echo "$srcfile" > "$lockfile" 912c35d236eSmrg fi 913c35d236eSmrg 914c35d236eSmrg if test -n "$fix_srcfile_path"; then 915c35d236eSmrg eval srcfile=\"$fix_srcfile_path\" 916c35d236eSmrg fi 917518bcf38Smrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 918518bcf38Smrg case $qsrcfile in 919518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 920518bcf38Smrg qsrcfile="\"$qsrcfile\"" ;; 921518bcf38Smrg esac 922518bcf38Smrg 923518bcf38Smrg $run $rm "$libobj" "${libobj}T" 924518bcf38Smrg 925518bcf38Smrg # Create a libtool object file (analogous to a ".la" file), 926518bcf38Smrg # but don't create it if we're doing a dry run. 927518bcf38Smrg test -z "$run" && cat > ${libobj}T <<EOF 928518bcf38Smrg# $libobj - a libtool object file 929518bcf38Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 930518bcf38Smrg# 931518bcf38Smrg# Please DO NOT delete this file! 932518bcf38Smrg# It is necessary for linking the library. 933518bcf38Smrg 934518bcf38Smrg# Name of the PIC object. 935518bcf38SmrgEOF 936c35d236eSmrg 937c35d236eSmrg # Only build a PIC object if we are building libtool libraries. 938c35d236eSmrg if test "$build_libtool_libs" = yes; then 939c35d236eSmrg # Without this assignment, base_compile gets emptied. 940c35d236eSmrg fbsd_hideous_sh_bug=$base_compile 941c35d236eSmrg 942c35d236eSmrg if test "$pic_mode" != no; then 943c35d236eSmrg command="$base_compile $qsrcfile $pic_flag" 944c35d236eSmrg else 945c35d236eSmrg # Don't build PIC code 946c35d236eSmrg command="$base_compile $qsrcfile" 947c35d236eSmrg fi 948c35d236eSmrg 949518bcf38Smrg if test ! -d "${xdir}$objdir"; then 950518bcf38Smrg $show "$mkdir ${xdir}$objdir" 951518bcf38Smrg $run $mkdir ${xdir}$objdir 952518bcf38Smrg exit_status=$? 953518bcf38Smrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 954518bcf38Smrg exit $exit_status 955518bcf38Smrg fi 956518bcf38Smrg fi 957c35d236eSmrg 958c35d236eSmrg if test -z "$output_obj"; then 959c35d236eSmrg # Place PIC objects in $objdir 960c35d236eSmrg command="$command -o $lobj" 961c35d236eSmrg fi 962c35d236eSmrg 963518bcf38Smrg $run $rm "$lobj" "$output_obj" 964518bcf38Smrg 965518bcf38Smrg $show "$command" 966518bcf38Smrg if $run eval $lt_env "$command"; then : 967518bcf38Smrg else 968518bcf38Smrg test -n "$output_obj" && $run $rm $removelist 969518bcf38Smrg exit $EXIT_FAILURE 970518bcf38Smrg fi 971c35d236eSmrg 972c35d236eSmrg if test "$need_locks" = warn && 973c35d236eSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 974518bcf38Smrg $echo "\ 975c35d236eSmrg*** ERROR, $lockfile contains: 976c35d236eSmrg`cat $lockfile 2>/dev/null` 977c35d236eSmrg 978c35d236eSmrgbut it should contain: 979c35d236eSmrg$srcfile 980c35d236eSmrg 981c35d236eSmrgThis indicates that another process is trying to use the same 982c35d236eSmrgtemporary object file, and libtool could not work around it because 983c35d236eSmrgyour compiler does not support \`-c' and \`-o' together. If you 984c35d236eSmrgrepeat this compilation, it may succeed, by chance, but you had better 985c35d236eSmrgavoid parallel builds (make -j) in this platform, or get a better 986c35d236eSmrgcompiler." 987c35d236eSmrg 988518bcf38Smrg $run $rm $removelist 989c35d236eSmrg exit $EXIT_FAILURE 990c35d236eSmrg fi 991c35d236eSmrg 992c35d236eSmrg # Just move the object if needed, then go on to compile the next one 993c35d236eSmrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 994518bcf38Smrg $show "$mv $output_obj $lobj" 995518bcf38Smrg if $run $mv $output_obj $lobj; then : 996518bcf38Smrg else 997518bcf38Smrg error=$? 998518bcf38Smrg $run $rm $removelist 999518bcf38Smrg exit $error 1000518bcf38Smrg fi 1001c35d236eSmrg fi 1002c35d236eSmrg 1003518bcf38Smrg # Append the name of the PIC object to the libtool object file. 1004518bcf38Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1005518bcf38Smrgpic_object='$objdir/$objname' 1006518bcf38Smrg 1007518bcf38SmrgEOF 1008518bcf38Smrg 1009c35d236eSmrg # Allow error messages only from the first compilation. 1010c35d236eSmrg if test "$suppress_opt" = yes; then 1011518bcf38Smrg suppress_output=' >/dev/null 2>&1' 1012c35d236eSmrg fi 1013518bcf38Smrg else 1014518bcf38Smrg # No PIC object so indicate it doesn't exist in the libtool 1015518bcf38Smrg # object file. 1016518bcf38Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1017518bcf38Smrgpic_object=none 1018518bcf38Smrg 1019518bcf38SmrgEOF 1020c35d236eSmrg fi 1021c35d236eSmrg 1022c35d236eSmrg # Only build a position-dependent object if we build old libraries. 1023c35d236eSmrg if test "$build_old_libs" = yes; then 1024c35d236eSmrg if test "$pic_mode" != yes; then 1025c35d236eSmrg # Don't build PIC code 1026518bcf38Smrg command="$base_compile $qsrcfile" 1027c35d236eSmrg else 1028c35d236eSmrg command="$base_compile $qsrcfile $pic_flag" 1029c35d236eSmrg fi 1030c35d236eSmrg if test "$compiler_c_o" = yes; then 1031c35d236eSmrg command="$command -o $obj" 1032c35d236eSmrg fi 1033c35d236eSmrg 1034c35d236eSmrg # Suppress compiler output if we already did a PIC compilation. 1035c35d236eSmrg command="$command$suppress_output" 1036518bcf38Smrg $run $rm "$obj" "$output_obj" 1037518bcf38Smrg $show "$command" 1038518bcf38Smrg if $run eval $lt_env "$command"; then : 1039518bcf38Smrg else 1040518bcf38Smrg $run $rm $removelist 1041518bcf38Smrg exit $EXIT_FAILURE 1042518bcf38Smrg fi 1043c35d236eSmrg 1044c35d236eSmrg if test "$need_locks" = warn && 1045c35d236eSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1046518bcf38Smrg $echo "\ 1047c35d236eSmrg*** ERROR, $lockfile contains: 1048c35d236eSmrg`cat $lockfile 2>/dev/null` 1049c35d236eSmrg 1050c35d236eSmrgbut it should contain: 1051c35d236eSmrg$srcfile 1052c35d236eSmrg 1053c35d236eSmrgThis indicates that another process is trying to use the same 1054c35d236eSmrgtemporary object file, and libtool could not work around it because 1055c35d236eSmrgyour compiler does not support \`-c' and \`-o' together. If you 1056c35d236eSmrgrepeat this compilation, it may succeed, by chance, but you had better 1057c35d236eSmrgavoid parallel builds (make -j) in this platform, or get a better 1058c35d236eSmrgcompiler." 1059c35d236eSmrg 1060518bcf38Smrg $run $rm $removelist 1061c35d236eSmrg exit $EXIT_FAILURE 1062c35d236eSmrg fi 1063c35d236eSmrg 1064c35d236eSmrg # Just move the object if needed 1065c35d236eSmrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1066518bcf38Smrg $show "$mv $output_obj $obj" 1067518bcf38Smrg if $run $mv $output_obj $obj; then : 1068518bcf38Smrg else 1069518bcf38Smrg error=$? 1070518bcf38Smrg $run $rm $removelist 1071518bcf38Smrg exit $error 1072518bcf38Smrg fi 1073c35d236eSmrg fi 1074518bcf38Smrg 1075518bcf38Smrg # Append the name of the non-PIC object the libtool object file. 1076518bcf38Smrg # Only append if the libtool object file exists. 1077518bcf38Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1078518bcf38Smrg# Name of the non-PIC object. 1079518bcf38Smrgnon_pic_object='$objname' 1080518bcf38Smrg 1081518bcf38SmrgEOF 1082518bcf38Smrg else 1083518bcf38Smrg # Append the name of the non-PIC object the libtool object file. 1084518bcf38Smrg # Only append if the libtool object file exists. 1085518bcf38Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1086518bcf38Smrg# Name of the non-PIC object. 1087518bcf38Smrgnon_pic_object=none 1088518bcf38Smrg 1089518bcf38SmrgEOF 1090f55e6a01Smrg fi 1091c35d236eSmrg 1092518bcf38Smrg $run $mv "${libobj}T" "${libobj}" 1093c35d236eSmrg 1094518bcf38Smrg # Unlock the critical section if it was locked 1095518bcf38Smrg if test "$need_locks" != no; then 1096518bcf38Smrg $run $rm "$lockfile" 1097518bcf38Smrg fi 1098c35d236eSmrg 1099f55e6a01Smrg exit $EXIT_SUCCESS 1100518bcf38Smrg ;; 1101c35d236eSmrg 1102518bcf38Smrg # libtool link mode 1103518bcf38Smrg link | relink) 1104518bcf38Smrg modename="$modename: link" 1105518bcf38Smrg case $host in 1106518bcf38Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1107518bcf38Smrg # It is impossible to link a dll without this setting, and 1108518bcf38Smrg # we shouldn't force the makefile maintainer to figure out 1109518bcf38Smrg # which system we are compiling for in order to pass an extra 1110518bcf38Smrg # flag for every libtool invocation. 1111518bcf38Smrg # allow_undefined=no 1112c35d236eSmrg 1113518bcf38Smrg # FIXME: Unfortunately, there are problems with the above when trying 1114518bcf38Smrg # to make a dll which has undefined symbols, in which case not 1115518bcf38Smrg # even a static library is built. For now, we need to specify 1116518bcf38Smrg # -no-undefined on the libtool link line when we can be certain 1117518bcf38Smrg # that all symbols are satisfied, otherwise we get a static library. 1118518bcf38Smrg allow_undefined=yes 1119518bcf38Smrg ;; 1120518bcf38Smrg *) 1121518bcf38Smrg allow_undefined=yes 1122518bcf38Smrg ;; 1123518bcf38Smrg esac 1124518bcf38Smrg libtool_args="$nonopt" 1125518bcf38Smrg base_compile="$nonopt $@" 1126518bcf38Smrg compile_command="$nonopt" 1127518bcf38Smrg finalize_command="$nonopt" 1128c35d236eSmrg 1129518bcf38Smrg compile_rpath= 1130518bcf38Smrg finalize_rpath= 1131518bcf38Smrg compile_shlibpath= 1132518bcf38Smrg finalize_shlibpath= 1133518bcf38Smrg convenience= 1134518bcf38Smrg old_convenience= 1135518bcf38Smrg deplibs= 1136518bcf38Smrg old_deplibs= 1137518bcf38Smrg compiler_flags= 1138518bcf38Smrg linker_flags= 1139518bcf38Smrg dllsearchpath= 1140518bcf38Smrg lib_search_path=`pwd` 1141518bcf38Smrg inst_prefix_dir= 1142c35d236eSmrg 1143518bcf38Smrg avoid_version=no 1144518bcf38Smrg dlfiles= 1145518bcf38Smrg dlprefiles= 1146518bcf38Smrg dlself=no 1147518bcf38Smrg export_dynamic=no 1148518bcf38Smrg export_symbols= 1149518bcf38Smrg export_symbols_regex= 1150518bcf38Smrg generated= 1151518bcf38Smrg libobjs= 1152518bcf38Smrg ltlibs= 1153518bcf38Smrg module=no 1154518bcf38Smrg no_install=no 1155518bcf38Smrg objs= 1156518bcf38Smrg non_pic_objects= 1157518bcf38Smrg notinst_path= # paths that contain not-installed libtool libraries 1158518bcf38Smrg precious_files_regex= 1159518bcf38Smrg prefer_static_libs=no 1160518bcf38Smrg preload=no 1161518bcf38Smrg prev= 1162518bcf38Smrg prevarg= 1163518bcf38Smrg release= 1164518bcf38Smrg rpath= 1165518bcf38Smrg xrpath= 1166518bcf38Smrg perm_rpath= 1167518bcf38Smrg temp_rpath= 1168518bcf38Smrg thread_safe=no 1169518bcf38Smrg vinfo= 1170518bcf38Smrg vinfo_number=no 1171518bcf38Smrg single_module="${wl}-single_module" 1172c35d236eSmrg 1173518bcf38Smrg func_infer_tag $base_compile 1174c35d236eSmrg 1175518bcf38Smrg # We need to know -static, to get the right output filenames. 1176518bcf38Smrg for arg 1177518bcf38Smrg do 1178518bcf38Smrg case $arg in 1179518bcf38Smrg -all-static | -static | -static-libtool-libs) 1180518bcf38Smrg case $arg in 1181518bcf38Smrg -all-static) 1182518bcf38Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 1183518bcf38Smrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1184518bcf38Smrg fi 1185518bcf38Smrg if test -n "$link_static_flag"; then 1186518bcf38Smrg dlopen_self=$dlopen_self_static 1187518bcf38Smrg fi 1188518bcf38Smrg prefer_static_libs=yes 1189518bcf38Smrg ;; 1190518bcf38Smrg -static) 1191518bcf38Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 1192518bcf38Smrg dlopen_self=$dlopen_self_static 1193518bcf38Smrg fi 1194518bcf38Smrg prefer_static_libs=built 1195518bcf38Smrg ;; 1196518bcf38Smrg -static-libtool-libs) 1197518bcf38Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 1198518bcf38Smrg dlopen_self=$dlopen_self_static 1199518bcf38Smrg fi 1200518bcf38Smrg prefer_static_libs=yes 1201518bcf38Smrg ;; 1202518bcf38Smrg esac 1203518bcf38Smrg build_libtool_libs=no 1204518bcf38Smrg build_old_libs=yes 1205518bcf38Smrg break 1206518bcf38Smrg ;; 1207518bcf38Smrg esac 1208518bcf38Smrg done 1209c35d236eSmrg 1210518bcf38Smrg # See if our shared archives depend on static archives. 1211518bcf38Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 1212c35d236eSmrg 1213518bcf38Smrg # Go through the arguments, transforming them on the way. 1214518bcf38Smrg while test "$#" -gt 0; do 1215518bcf38Smrg arg="$1" 1216518bcf38Smrg shift 1217518bcf38Smrg case $arg in 1218518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1219518bcf38Smrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 1220518bcf38Smrg ;; 1221518bcf38Smrg *) qarg=$arg ;; 1222518bcf38Smrg esac 1223518bcf38Smrg libtool_args="$libtool_args $qarg" 1224c35d236eSmrg 1225518bcf38Smrg # If the previous option needs an argument, assign it. 1226518bcf38Smrg if test -n "$prev"; then 1227518bcf38Smrg case $prev in 1228518bcf38Smrg output) 1229518bcf38Smrg compile_command="$compile_command @OUTPUT@" 1230518bcf38Smrg finalize_command="$finalize_command @OUTPUT@" 1231518bcf38Smrg ;; 1232518bcf38Smrg esac 1233c35d236eSmrg 1234518bcf38Smrg case $prev in 1235518bcf38Smrg dlfiles|dlprefiles) 1236518bcf38Smrg if test "$preload" = no; then 1237518bcf38Smrg # Add the symbol object into the linking commands. 1238518bcf38Smrg compile_command="$compile_command @SYMFILE@" 1239518bcf38Smrg finalize_command="$finalize_command @SYMFILE@" 1240518bcf38Smrg preload=yes 1241518bcf38Smrg fi 1242518bcf38Smrg case $arg in 1243518bcf38Smrg *.la | *.lo) ;; # We handle these cases below. 1244518bcf38Smrg force) 1245518bcf38Smrg if test "$dlself" = no; then 1246518bcf38Smrg dlself=needless 1247518bcf38Smrg export_dynamic=yes 1248518bcf38Smrg fi 1249518bcf38Smrg prev= 1250518bcf38Smrg continue 1251518bcf38Smrg ;; 1252518bcf38Smrg self) 1253518bcf38Smrg if test "$prev" = dlprefiles; then 1254518bcf38Smrg dlself=yes 1255518bcf38Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 1256518bcf38Smrg dlself=yes 1257518bcf38Smrg else 1258518bcf38Smrg dlself=needless 1259518bcf38Smrg export_dynamic=yes 1260518bcf38Smrg fi 1261518bcf38Smrg prev= 1262518bcf38Smrg continue 1263518bcf38Smrg ;; 1264518bcf38Smrg *) 1265518bcf38Smrg if test "$prev" = dlfiles; then 1266518bcf38Smrg dlfiles="$dlfiles $arg" 1267518bcf38Smrg else 1268518bcf38Smrg dlprefiles="$dlprefiles $arg" 1269518bcf38Smrg fi 1270518bcf38Smrg prev= 1271518bcf38Smrg continue 1272518bcf38Smrg ;; 1273518bcf38Smrg esac 1274518bcf38Smrg ;; 1275518bcf38Smrg expsyms) 1276518bcf38Smrg export_symbols="$arg" 1277518bcf38Smrg if test ! -f "$arg"; then 1278518bcf38Smrg $echo "$modename: symbol file \`$arg' does not exist" 1279518bcf38Smrg exit $EXIT_FAILURE 1280518bcf38Smrg fi 1281518bcf38Smrg prev= 1282518bcf38Smrg continue 1283518bcf38Smrg ;; 1284518bcf38Smrg expsyms_regex) 1285518bcf38Smrg export_symbols_regex="$arg" 1286518bcf38Smrg prev= 1287518bcf38Smrg continue 1288518bcf38Smrg ;; 1289518bcf38Smrg inst_prefix) 1290518bcf38Smrg inst_prefix_dir="$arg" 1291518bcf38Smrg prev= 1292518bcf38Smrg continue 1293518bcf38Smrg ;; 1294518bcf38Smrg precious_regex) 1295518bcf38Smrg precious_files_regex="$arg" 1296518bcf38Smrg prev= 1297518bcf38Smrg continue 1298518bcf38Smrg ;; 1299518bcf38Smrg release) 1300518bcf38Smrg release="-$arg" 1301518bcf38Smrg prev= 1302518bcf38Smrg continue 1303518bcf38Smrg ;; 1304518bcf38Smrg objectlist) 1305518bcf38Smrg if test -f "$arg"; then 1306518bcf38Smrg save_arg=$arg 1307518bcf38Smrg moreargs= 1308518bcf38Smrg for fil in `cat $save_arg` 1309518bcf38Smrg do 1310518bcf38Smrg# moreargs="$moreargs $fil" 1311518bcf38Smrg arg=$fil 1312518bcf38Smrg # A libtool-controlled object. 1313c35d236eSmrg 1314518bcf38Smrg # Check to see that this really is a libtool object. 1315518bcf38Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1316518bcf38Smrg pic_object= 1317518bcf38Smrg non_pic_object= 1318c35d236eSmrg 1319518bcf38Smrg # Read the .lo file 1320518bcf38Smrg # If there is no directory component, then add one. 1321518bcf38Smrg case $arg in 1322518bcf38Smrg */* | *\\*) . $arg ;; 1323518bcf38Smrg *) . ./$arg ;; 1324518bcf38Smrg esac 1325c35d236eSmrg 1326518bcf38Smrg if test -z "$pic_object" || \ 1327518bcf38Smrg test -z "$non_pic_object" || 1328518bcf38Smrg test "$pic_object" = none && \ 1329518bcf38Smrg test "$non_pic_object" = none; then 1330518bcf38Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1331518bcf38Smrg exit $EXIT_FAILURE 1332518bcf38Smrg fi 1333c35d236eSmrg 1334518bcf38Smrg # Extract subdirectory from the argument. 1335518bcf38Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1336518bcf38Smrg if test "X$xdir" = "X$arg"; then 1337518bcf38Smrg xdir= 1338518bcf38Smrg else 1339518bcf38Smrg xdir="$xdir/" 1340518bcf38Smrg fi 1341c35d236eSmrg 1342518bcf38Smrg if test "$pic_object" != none; then 1343518bcf38Smrg # Prepend the subdirectory the object is found in. 1344518bcf38Smrg pic_object="$xdir$pic_object" 1345c35d236eSmrg 1346518bcf38Smrg if test "$prev" = dlfiles; then 1347518bcf38Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1348518bcf38Smrg dlfiles="$dlfiles $pic_object" 1349518bcf38Smrg prev= 1350518bcf38Smrg continue 1351518bcf38Smrg else 1352518bcf38Smrg # If libtool objects are unsupported, then we need to preload. 1353518bcf38Smrg prev=dlprefiles 1354518bcf38Smrg fi 1355518bcf38Smrg fi 1356c35d236eSmrg 1357518bcf38Smrg # CHECK ME: I think I busted this. -Ossama 1358518bcf38Smrg if test "$prev" = dlprefiles; then 1359518bcf38Smrg # Preload the old-style object. 1360518bcf38Smrg dlprefiles="$dlprefiles $pic_object" 1361518bcf38Smrg prev= 1362518bcf38Smrg fi 1363c35d236eSmrg 1364518bcf38Smrg # A PIC object. 1365518bcf38Smrg libobjs="$libobjs $pic_object" 1366518bcf38Smrg arg="$pic_object" 1367518bcf38Smrg fi 1368c35d236eSmrg 1369518bcf38Smrg # Non-PIC object. 1370518bcf38Smrg if test "$non_pic_object" != none; then 1371518bcf38Smrg # Prepend the subdirectory the object is found in. 1372518bcf38Smrg non_pic_object="$xdir$non_pic_object" 1373c35d236eSmrg 1374518bcf38Smrg # A standard non-PIC object 1375518bcf38Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1376518bcf38Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 1377518bcf38Smrg arg="$non_pic_object" 1378518bcf38Smrg fi 1379518bcf38Smrg else 1380518bcf38Smrg # If the PIC object exists, use it instead. 1381518bcf38Smrg # $xdir was prepended to $pic_object above. 1382518bcf38Smrg non_pic_object="$pic_object" 1383518bcf38Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1384518bcf38Smrg fi 1385518bcf38Smrg else 1386518bcf38Smrg # Only an error if not doing a dry-run. 1387518bcf38Smrg if test -z "$run"; then 1388518bcf38Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1389518bcf38Smrg exit $EXIT_FAILURE 1390518bcf38Smrg else 1391518bcf38Smrg # Dry-run case. 1392c35d236eSmrg 1393518bcf38Smrg # Extract subdirectory from the argument. 1394518bcf38Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1395518bcf38Smrg if test "X$xdir" = "X$arg"; then 1396518bcf38Smrg xdir= 1397518bcf38Smrg else 1398518bcf38Smrg xdir="$xdir/" 1399518bcf38Smrg fi 1400c35d236eSmrg 1401518bcf38Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1402518bcf38Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1403518bcf38Smrg libobjs="$libobjs $pic_object" 1404518bcf38Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1405518bcf38Smrg fi 1406518bcf38Smrg fi 1407518bcf38Smrg done 1408518bcf38Smrg else 1409518bcf38Smrg $echo "$modename: link input file \`$save_arg' does not exist" 1410518bcf38Smrg exit $EXIT_FAILURE 1411518bcf38Smrg fi 1412518bcf38Smrg arg=$save_arg 1413518bcf38Smrg prev= 1414518bcf38Smrg continue 1415518bcf38Smrg ;; 1416518bcf38Smrg rpath | xrpath) 1417518bcf38Smrg # We need an absolute path. 1418518bcf38Smrg case $arg in 1419518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1420518bcf38Smrg *) 1421518bcf38Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 1422518bcf38Smrg exit $EXIT_FAILURE 1423518bcf38Smrg ;; 1424518bcf38Smrg esac 1425518bcf38Smrg if test "$prev" = rpath; then 1426518bcf38Smrg case "$rpath " in 1427518bcf38Smrg *" $arg "*) ;; 1428518bcf38Smrg *) rpath="$rpath $arg" ;; 1429518bcf38Smrg esac 1430518bcf38Smrg else 1431518bcf38Smrg case "$xrpath " in 1432518bcf38Smrg *" $arg "*) ;; 1433518bcf38Smrg *) xrpath="$xrpath $arg" ;; 1434518bcf38Smrg esac 1435518bcf38Smrg fi 1436518bcf38Smrg prev= 1437518bcf38Smrg continue 1438518bcf38Smrg ;; 1439518bcf38Smrg xcompiler) 1440518bcf38Smrg compiler_flags="$compiler_flags $qarg" 1441518bcf38Smrg prev= 1442518bcf38Smrg compile_command="$compile_command $qarg" 1443518bcf38Smrg finalize_command="$finalize_command $qarg" 1444518bcf38Smrg continue 1445518bcf38Smrg ;; 1446518bcf38Smrg xlinker) 1447518bcf38Smrg linker_flags="$linker_flags $qarg" 1448518bcf38Smrg compiler_flags="$compiler_flags $wl$qarg" 1449518bcf38Smrg prev= 1450518bcf38Smrg compile_command="$compile_command $wl$qarg" 1451518bcf38Smrg finalize_command="$finalize_command $wl$qarg" 1452518bcf38Smrg continue 1453518bcf38Smrg ;; 1454518bcf38Smrg xcclinker) 1455518bcf38Smrg linker_flags="$linker_flags $qarg" 1456518bcf38Smrg compiler_flags="$compiler_flags $qarg" 1457518bcf38Smrg prev= 1458518bcf38Smrg compile_command="$compile_command $qarg" 1459518bcf38Smrg finalize_command="$finalize_command $qarg" 1460518bcf38Smrg continue 1461518bcf38Smrg ;; 1462518bcf38Smrg shrext) 1463518bcf38Smrg shrext_cmds="$arg" 1464518bcf38Smrg prev= 1465518bcf38Smrg continue 1466518bcf38Smrg ;; 1467518bcf38Smrg darwin_framework|darwin_framework_skip) 1468518bcf38Smrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 1469518bcf38Smrg compile_command="$compile_command $arg" 1470518bcf38Smrg finalize_command="$finalize_command $arg" 1471518bcf38Smrg prev= 1472518bcf38Smrg continue 1473518bcf38Smrg ;; 1474518bcf38Smrg *) 1475518bcf38Smrg eval "$prev=\"\$arg\"" 1476518bcf38Smrg prev= 1477518bcf38Smrg continue 1478518bcf38Smrg ;; 1479518bcf38Smrg esac 1480518bcf38Smrg fi # test -n "$prev" 1481c35d236eSmrg 1482518bcf38Smrg prevarg="$arg" 1483c35d236eSmrg 1484518bcf38Smrg case $arg in 1485518bcf38Smrg -all-static) 1486518bcf38Smrg if test -n "$link_static_flag"; then 1487518bcf38Smrg compile_command="$compile_command $link_static_flag" 1488518bcf38Smrg finalize_command="$finalize_command $link_static_flag" 1489518bcf38Smrg fi 1490518bcf38Smrg continue 1491518bcf38Smrg ;; 1492c35d236eSmrg 1493518bcf38Smrg -allow-undefined) 1494518bcf38Smrg # FIXME: remove this flag sometime in the future. 1495518bcf38Smrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1496518bcf38Smrg continue 1497518bcf38Smrg ;; 1498c35d236eSmrg 1499518bcf38Smrg -avoid-version) 1500518bcf38Smrg avoid_version=yes 1501518bcf38Smrg continue 1502518bcf38Smrg ;; 1503c35d236eSmrg 1504518bcf38Smrg -dlopen) 1505518bcf38Smrg prev=dlfiles 1506518bcf38Smrg continue 1507518bcf38Smrg ;; 1508c35d236eSmrg 1509518bcf38Smrg -dlpreopen) 1510518bcf38Smrg prev=dlprefiles 1511518bcf38Smrg continue 1512518bcf38Smrg ;; 1513c35d236eSmrg 1514518bcf38Smrg -export-dynamic) 1515518bcf38Smrg export_dynamic=yes 1516518bcf38Smrg continue 1517518bcf38Smrg ;; 1518c35d236eSmrg 1519518bcf38Smrg -export-symbols | -export-symbols-regex) 1520518bcf38Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1521518bcf38Smrg $echo "$modename: more than one -exported-symbols argument is not allowed" 1522518bcf38Smrg exit $EXIT_FAILURE 1523518bcf38Smrg fi 1524518bcf38Smrg if test "X$arg" = "X-export-symbols"; then 1525518bcf38Smrg prev=expsyms 1526518bcf38Smrg else 1527518bcf38Smrg prev=expsyms_regex 1528518bcf38Smrg fi 1529518bcf38Smrg continue 1530518bcf38Smrg ;; 1531c35d236eSmrg 1532518bcf38Smrg -framework|-arch|-isysroot) 1533518bcf38Smrg case " $CC " in 1534518bcf38Smrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 1535518bcf38Smrg prev=darwin_framework_skip ;; 1536518bcf38Smrg *) compiler_flags="$compiler_flags $arg" 1537518bcf38Smrg prev=darwin_framework ;; 1538518bcf38Smrg esac 1539518bcf38Smrg compile_command="$compile_command $arg" 1540518bcf38Smrg finalize_command="$finalize_command $arg" 1541518bcf38Smrg continue 1542518bcf38Smrg ;; 1543c35d236eSmrg 1544518bcf38Smrg -inst-prefix-dir) 1545518bcf38Smrg prev=inst_prefix 1546518bcf38Smrg continue 1547518bcf38Smrg ;; 1548c35d236eSmrg 1549518bcf38Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1550518bcf38Smrg # so, if we see these flags be careful not to treat them like -L 1551518bcf38Smrg -L[A-Z][A-Z]*:*) 1552518bcf38Smrg case $with_gcc/$host in 1553518bcf38Smrg no/*-*-irix* | /*-*-irix*) 1554518bcf38Smrg compile_command="$compile_command $arg" 1555518bcf38Smrg finalize_command="$finalize_command $arg" 1556518bcf38Smrg ;; 1557518bcf38Smrg esac 1558518bcf38Smrg continue 1559518bcf38Smrg ;; 1560c35d236eSmrg 1561518bcf38Smrg -L*) 1562518bcf38Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1563518bcf38Smrg # We need an absolute path. 1564518bcf38Smrg case $dir in 1565518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1566518bcf38Smrg *) 1567518bcf38Smrg absdir=`cd "$dir" && pwd` 1568518bcf38Smrg if test -z "$absdir"; then 1569518bcf38Smrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1570518bcf38Smrg absdir="$dir" 1571518bcf38Smrg notinst_path="$notinst_path $dir" 1572518bcf38Smrg fi 1573518bcf38Smrg dir="$absdir" 1574518bcf38Smrg ;; 1575518bcf38Smrg esac 1576518bcf38Smrg case "$deplibs " in 1577518bcf38Smrg *" -L$dir "*) ;; 1578518bcf38Smrg *) 1579518bcf38Smrg deplibs="$deplibs -L$dir" 1580518bcf38Smrg lib_search_path="$lib_search_path $dir" 1581518bcf38Smrg ;; 1582518bcf38Smrg esac 1583518bcf38Smrg case $host in 1584518bcf38Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1585518bcf38Smrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 1586518bcf38Smrg case :$dllsearchpath: in 1587518bcf38Smrg *":$dir:"*) ;; 1588518bcf38Smrg *) dllsearchpath="$dllsearchpath:$dir";; 1589518bcf38Smrg esac 1590518bcf38Smrg case :$dllsearchpath: in 1591518bcf38Smrg *":$testbindir:"*) ;; 1592518bcf38Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 1593518bcf38Smrg esac 1594518bcf38Smrg ;; 1595518bcf38Smrg esac 1596518bcf38Smrg continue 1597518bcf38Smrg ;; 1598c35d236eSmrg 1599518bcf38Smrg -l*) 1600518bcf38Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1601518bcf38Smrg case $host in 1602518bcf38Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 1603518bcf38Smrg # These systems don't actually have a C or math library (as such) 1604518bcf38Smrg continue 1605518bcf38Smrg ;; 1606518bcf38Smrg *-*-os2*) 1607518bcf38Smrg # These systems don't actually have a C library (as such) 1608518bcf38Smrg test "X$arg" = "X-lc" && continue 1609518bcf38Smrg ;; 1610518bcf38Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1611518bcf38Smrg # Do not include libc due to us having libc/libc_r. 1612518bcf38Smrg test "X$arg" = "X-lc" && continue 1613518bcf38Smrg ;; 1614518bcf38Smrg *-*-rhapsody* | *-*-darwin1.[012]) 1615518bcf38Smrg # Rhapsody C and math libraries are in the System framework 1616518bcf38Smrg deplibs="$deplibs -framework System" 1617518bcf38Smrg continue 1618518bcf38Smrg ;; 1619518bcf38Smrg *-*-sco3.2v5* | *-*-sco5v6*) 1620518bcf38Smrg # Causes problems with __ctype 1621518bcf38Smrg test "X$arg" = "X-lc" && continue 1622518bcf38Smrg ;; 1623518bcf38Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 1624518bcf38Smrg # Compiler inserts libc in the correct place for threads to work 1625518bcf38Smrg test "X$arg" = "X-lc" && continue 1626518bcf38Smrg ;; 1627518bcf38Smrg esac 1628518bcf38Smrg elif test "X$arg" = "X-lc_r"; then 1629518bcf38Smrg case $host in 1630518bcf38Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1631518bcf38Smrg # Do not include libc_r directly, use -pthread flag. 1632518bcf38Smrg continue 1633518bcf38Smrg ;; 1634518bcf38Smrg esac 1635f55e6a01Smrg fi 1636518bcf38Smrg deplibs="$deplibs $arg" 1637518bcf38Smrg continue 1638518bcf38Smrg ;; 1639c35d236eSmrg 1640518bcf38Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 1641518bcf38Smrg # classes, name mangling, and exception handling. 1642518bcf38Smrg -model) 1643518bcf38Smrg compile_command="$compile_command $arg" 1644518bcf38Smrg compiler_flags="$compiler_flags $arg" 1645518bcf38Smrg finalize_command="$finalize_command $arg" 1646518bcf38Smrg prev=xcompiler 1647518bcf38Smrg continue 1648c35d236eSmrg ;; 1649c35d236eSmrg 1650518bcf38Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 1651518bcf38Smrg compiler_flags="$compiler_flags $arg" 1652518bcf38Smrg compile_command="$compile_command $arg" 1653518bcf38Smrg finalize_command="$finalize_command $arg" 1654518bcf38Smrg continue 1655c35d236eSmrg ;; 1656c35d236eSmrg 1657518bcf38Smrg -multi_module) 1658518bcf38Smrg single_module="${wl}-multi_module" 1659c35d236eSmrg continue 1660c35d236eSmrg ;; 1661c35d236eSmrg 1662518bcf38Smrg -module) 1663518bcf38Smrg module=yes 1664518bcf38Smrg continue 1665518bcf38Smrg ;; 1666c35d236eSmrg 1667518bcf38Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 1668518bcf38Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 1669518bcf38Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 1670518bcf38Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 1671518bcf38Smrg # -q* pass through compiler args for the IBM compiler 1672518bcf38Smrg # -m* pass through architecture-specific compiler args for GCC 1673518bcf38Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 1674518bcf38Smrg # compiler args for GCC 1675518bcf38Smrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 1676518bcf38Smrg # -F/path gives path to uninstalled frameworks, gcc on darwin 1677518bcf38Smrg # @file GCC response files 1678518bcf38Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 1679518bcf38Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 1680c35d236eSmrg 1681518bcf38Smrg # Unknown arguments in both finalize_command and compile_command need 1682518bcf38Smrg # to be aesthetically quoted because they are evaled later. 1683518bcf38Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1684518bcf38Smrg case $arg in 1685518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1686518bcf38Smrg arg="\"$arg\"" 1687518bcf38Smrg ;; 1688518bcf38Smrg esac 1689518bcf38Smrg compile_command="$compile_command $arg" 1690518bcf38Smrg finalize_command="$finalize_command $arg" 1691518bcf38Smrg compiler_flags="$compiler_flags $arg" 1692518bcf38Smrg continue 1693518bcf38Smrg ;; 1694c35d236eSmrg 1695518bcf38Smrg -shrext) 1696518bcf38Smrg prev=shrext 1697518bcf38Smrg continue 1698c35d236eSmrg ;; 1699c35d236eSmrg 1700518bcf38Smrg -no-fast-install) 1701518bcf38Smrg fast_install=no 1702518bcf38Smrg continue 1703518bcf38Smrg ;; 1704c35d236eSmrg 1705518bcf38Smrg -no-install) 1706518bcf38Smrg case $host in 1707518bcf38Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 1708518bcf38Smrg # The PATH hackery in wrapper scripts is required on Windows 1709518bcf38Smrg # and Darwin in order for the loader to find any dlls it needs. 1710518bcf38Smrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1711518bcf38Smrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1712518bcf38Smrg fast_install=no 1713518bcf38Smrg ;; 1714518bcf38Smrg *) no_install=yes ;; 1715518bcf38Smrg esac 1716518bcf38Smrg continue 1717518bcf38Smrg ;; 1718c35d236eSmrg 1719518bcf38Smrg -no-undefined) 1720518bcf38Smrg allow_undefined=no 1721518bcf38Smrg continue 1722518bcf38Smrg ;; 1723c35d236eSmrg 1724518bcf38Smrg -objectlist) 1725518bcf38Smrg prev=objectlist 1726518bcf38Smrg continue 1727f55e6a01Smrg ;; 1728c35d236eSmrg 1729518bcf38Smrg -o) prev=output ;; 1730c35d236eSmrg 1731518bcf38Smrg -precious-files-regex) 1732518bcf38Smrg prev=precious_regex 1733518bcf38Smrg continue 1734518bcf38Smrg ;; 1735c35d236eSmrg 1736518bcf38Smrg -release) 1737518bcf38Smrg prev=release 1738518bcf38Smrg continue 1739518bcf38Smrg ;; 1740c35d236eSmrg 1741518bcf38Smrg -rpath) 1742518bcf38Smrg prev=rpath 1743518bcf38Smrg continue 1744518bcf38Smrg ;; 1745c35d236eSmrg 1746518bcf38Smrg -R) 1747518bcf38Smrg prev=xrpath 1748c35d236eSmrg continue 1749518bcf38Smrg ;; 1750c35d236eSmrg 1751518bcf38Smrg -R*) 1752518bcf38Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1753518bcf38Smrg # We need an absolute path. 1754518bcf38Smrg case $dir in 1755518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1756518bcf38Smrg *) 1757518bcf38Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 1758518bcf38Smrg exit $EXIT_FAILURE 1759518bcf38Smrg ;; 1760518bcf38Smrg esac 1761518bcf38Smrg case "$xrpath " in 1762518bcf38Smrg *" $dir "*) ;; 1763518bcf38Smrg *) xrpath="$xrpath $dir" ;; 1764f55e6a01Smrg esac 1765518bcf38Smrg continue 1766f55e6a01Smrg ;; 1767518bcf38Smrg 1768518bcf38Smrg -static | -static-libtool-libs) 1769518bcf38Smrg # The effects of -static are defined in a previous loop. 1770518bcf38Smrg # We used to do the same as -all-static on platforms that 1771518bcf38Smrg # didn't have a PIC flag, but the assumption that the effects 1772518bcf38Smrg # would be equivalent was wrong. It would break on at least 1773518bcf38Smrg # Digital Unix and AIX. 1774518bcf38Smrg continue 1775f55e6a01Smrg ;; 1776518bcf38Smrg 1777518bcf38Smrg -thread-safe) 1778518bcf38Smrg thread_safe=yes 1779f55e6a01Smrg continue 1780f55e6a01Smrg ;; 1781518bcf38Smrg 1782518bcf38Smrg -version-info) 1783518bcf38Smrg prev=vinfo 1784518bcf38Smrg continue 1785f55e6a01Smrg ;; 1786518bcf38Smrg -version-number) 1787518bcf38Smrg prev=vinfo 1788518bcf38Smrg vinfo_number=yes 1789518bcf38Smrg continue 1790c35d236eSmrg ;; 1791c35d236eSmrg 1792518bcf38Smrg -Wc,*) 1793518bcf38Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1794518bcf38Smrg arg= 1795518bcf38Smrg save_ifs="$IFS"; IFS=',' 1796518bcf38Smrg for flag in $args; do 1797518bcf38Smrg IFS="$save_ifs" 1798518bcf38Smrg case $flag in 1799518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1800518bcf38Smrg flag="\"$flag\"" 1801518bcf38Smrg ;; 1802518bcf38Smrg esac 1803518bcf38Smrg arg="$arg $wl$flag" 1804518bcf38Smrg compiler_flags="$compiler_flags $flag" 1805518bcf38Smrg done 1806518bcf38Smrg IFS="$save_ifs" 1807518bcf38Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1808518bcf38Smrg ;; 1809c35d236eSmrg 1810518bcf38Smrg -Wl,*) 1811518bcf38Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1812518bcf38Smrg arg= 1813518bcf38Smrg save_ifs="$IFS"; IFS=',' 1814518bcf38Smrg for flag in $args; do 1815518bcf38Smrg IFS="$save_ifs" 1816518bcf38Smrg case $flag in 1817518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1818518bcf38Smrg flag="\"$flag\"" 1819518bcf38Smrg ;; 1820518bcf38Smrg esac 1821518bcf38Smrg arg="$arg $wl$flag" 1822518bcf38Smrg compiler_flags="$compiler_flags $wl$flag" 1823518bcf38Smrg linker_flags="$linker_flags $flag" 1824518bcf38Smrg done 1825518bcf38Smrg IFS="$save_ifs" 1826518bcf38Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1827518bcf38Smrg ;; 1828c35d236eSmrg 1829518bcf38Smrg -Xcompiler) 1830518bcf38Smrg prev=xcompiler 1831518bcf38Smrg continue 1832518bcf38Smrg ;; 1833c35d236eSmrg 1834518bcf38Smrg -Xlinker) 1835518bcf38Smrg prev=xlinker 1836518bcf38Smrg continue 1837518bcf38Smrg ;; 1838c35d236eSmrg 1839518bcf38Smrg -XCClinker) 1840518bcf38Smrg prev=xcclinker 1841518bcf38Smrg continue 1842518bcf38Smrg ;; 1843c35d236eSmrg 1844518bcf38Smrg # Some other compiler flag. 1845518bcf38Smrg -* | +*) 1846518bcf38Smrg # Unknown arguments in both finalize_command and compile_command need 1847518bcf38Smrg # to be aesthetically quoted because they are evaled later. 1848518bcf38Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1849518bcf38Smrg case $arg in 1850518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1851518bcf38Smrg arg="\"$arg\"" 1852f55e6a01Smrg ;; 1853f55e6a01Smrg esac 1854518bcf38Smrg ;; 1855c35d236eSmrg 1856518bcf38Smrg *.$objext) 1857518bcf38Smrg # A standard object. 1858518bcf38Smrg objs="$objs $arg" 1859f55e6a01Smrg ;; 1860f55e6a01Smrg 1861518bcf38Smrg *.lo) 1862518bcf38Smrg # A libtool-controlled object. 1863f55e6a01Smrg 1864518bcf38Smrg # Check to see that this really is a libtool object. 1865518bcf38Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1866518bcf38Smrg pic_object= 1867518bcf38Smrg non_pic_object= 1868f55e6a01Smrg 1869518bcf38Smrg # Read the .lo file 1870518bcf38Smrg # If there is no directory component, then add one. 1871518bcf38Smrg case $arg in 1872518bcf38Smrg */* | *\\*) . $arg ;; 1873518bcf38Smrg *) . ./$arg ;; 1874f55e6a01Smrg esac 1875f55e6a01Smrg 1876518bcf38Smrg if test -z "$pic_object" || \ 1877518bcf38Smrg test -z "$non_pic_object" || 1878518bcf38Smrg test "$pic_object" = none && \ 1879518bcf38Smrg test "$non_pic_object" = none; then 1880518bcf38Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1881518bcf38Smrg exit $EXIT_FAILURE 1882518bcf38Smrg fi 1883f55e6a01Smrg 1884518bcf38Smrg # Extract subdirectory from the argument. 1885518bcf38Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1886518bcf38Smrg if test "X$xdir" = "X$arg"; then 1887518bcf38Smrg xdir= 1888518bcf38Smrg else 1889518bcf38Smrg xdir="$xdir/" 1890f55e6a01Smrg fi 1891f55e6a01Smrg 1892518bcf38Smrg if test "$pic_object" != none; then 1893518bcf38Smrg # Prepend the subdirectory the object is found in. 1894518bcf38Smrg pic_object="$xdir$pic_object" 1895f55e6a01Smrg 1896518bcf38Smrg if test "$prev" = dlfiles; then 1897518bcf38Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1898518bcf38Smrg dlfiles="$dlfiles $pic_object" 1899518bcf38Smrg prev= 1900518bcf38Smrg continue 1901518bcf38Smrg else 1902518bcf38Smrg # If libtool objects are unsupported, then we need to preload. 1903518bcf38Smrg prev=dlprefiles 1904518bcf38Smrg fi 1905518bcf38Smrg fi 1906f55e6a01Smrg 1907518bcf38Smrg # CHECK ME: I think I busted this. -Ossama 1908518bcf38Smrg if test "$prev" = dlprefiles; then 1909518bcf38Smrg # Preload the old-style object. 1910518bcf38Smrg dlprefiles="$dlprefiles $pic_object" 1911518bcf38Smrg prev= 1912518bcf38Smrg fi 1913f55e6a01Smrg 1914518bcf38Smrg # A PIC object. 1915518bcf38Smrg libobjs="$libobjs $pic_object" 1916518bcf38Smrg arg="$pic_object" 1917f55e6a01Smrg fi 1918f55e6a01Smrg 1919518bcf38Smrg # Non-PIC object. 1920518bcf38Smrg if test "$non_pic_object" != none; then 1921518bcf38Smrg # Prepend the subdirectory the object is found in. 1922518bcf38Smrg non_pic_object="$xdir$non_pic_object" 1923518bcf38Smrg 1924518bcf38Smrg # A standard non-PIC object 1925518bcf38Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1926518bcf38Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 1927518bcf38Smrg arg="$non_pic_object" 1928518bcf38Smrg fi 1929518bcf38Smrg else 1930518bcf38Smrg # If the PIC object exists, use it instead. 1931518bcf38Smrg # $xdir was prepended to $pic_object above. 1932518bcf38Smrg non_pic_object="$pic_object" 1933518bcf38Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1934f55e6a01Smrg fi 1935518bcf38Smrg else 1936518bcf38Smrg # Only an error if not doing a dry-run. 1937518bcf38Smrg if test -z "$run"; then 1938518bcf38Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1939518bcf38Smrg exit $EXIT_FAILURE 1940518bcf38Smrg else 1941518bcf38Smrg # Dry-run case. 1942f55e6a01Smrg 1943518bcf38Smrg # Extract subdirectory from the argument. 1944518bcf38Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1945518bcf38Smrg if test "X$xdir" = "X$arg"; then 1946518bcf38Smrg xdir= 1947518bcf38Smrg else 1948518bcf38Smrg xdir="$xdir/" 1949518bcf38Smrg fi 1950f55e6a01Smrg 1951518bcf38Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1952518bcf38Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1953518bcf38Smrg libobjs="$libobjs $pic_object" 1954518bcf38Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1955518bcf38Smrg fi 1956518bcf38Smrg fi 1957518bcf38Smrg ;; 1958f55e6a01Smrg 1959518bcf38Smrg *.$libext) 1960518bcf38Smrg # An archive. 1961518bcf38Smrg deplibs="$deplibs $arg" 1962518bcf38Smrg old_deplibs="$old_deplibs $arg" 1963518bcf38Smrg continue 1964c35d236eSmrg ;; 1965f55e6a01Smrg 1966518bcf38Smrg *.la) 1967518bcf38Smrg # A libtool-controlled library. 1968f55e6a01Smrg 1969518bcf38Smrg if test "$prev" = dlfiles; then 1970518bcf38Smrg # This library was specified with -dlopen. 1971518bcf38Smrg dlfiles="$dlfiles $arg" 1972518bcf38Smrg prev= 1973518bcf38Smrg elif test "$prev" = dlprefiles; then 1974518bcf38Smrg # The library was specified with -dlpreopen. 1975518bcf38Smrg dlprefiles="$dlprefiles $arg" 1976518bcf38Smrg prev= 1977f55e6a01Smrg else 1978518bcf38Smrg deplibs="$deplibs $arg" 1979f55e6a01Smrg fi 1980518bcf38Smrg continue 1981518bcf38Smrg ;; 1982f55e6a01Smrg 1983518bcf38Smrg # Some other compiler argument. 1984518bcf38Smrg *) 1985518bcf38Smrg # Unknown arguments in both finalize_command and compile_command need 1986518bcf38Smrg # to be aesthetically quoted because they are evaled later. 1987518bcf38Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1988518bcf38Smrg case $arg in 1989518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1990518bcf38Smrg arg="\"$arg\"" 1991c35d236eSmrg ;; 1992f55e6a01Smrg esac 1993f55e6a01Smrg ;; 1994518bcf38Smrg esac # arg 1995c35d236eSmrg 1996518bcf38Smrg # Now actually substitute the argument into the commands. 1997518bcf38Smrg if test -n "$arg"; then 1998518bcf38Smrg compile_command="$compile_command $arg" 1999518bcf38Smrg finalize_command="$finalize_command $arg" 2000518bcf38Smrg fi 2001518bcf38Smrg done # argument parsing loop 2002c35d236eSmrg 2003518bcf38Smrg if test -n "$prev"; then 2004518bcf38Smrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 2005518bcf38Smrg $echo "$help" 1>&2 2006518bcf38Smrg exit $EXIT_FAILURE 2007518bcf38Smrg fi 2008c35d236eSmrg 2009518bcf38Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 2010518bcf38Smrg eval arg=\"$export_dynamic_flag_spec\" 2011518bcf38Smrg compile_command="$compile_command $arg" 2012518bcf38Smrg finalize_command="$finalize_command $arg" 2013518bcf38Smrg fi 2014c35d236eSmrg 2015518bcf38Smrg oldlibs= 2016518bcf38Smrg # calculate the name of the file, without its directory 2017518bcf38Smrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 2018518bcf38Smrg libobjs_save="$libobjs" 2019c35d236eSmrg 2020518bcf38Smrg if test -n "$shlibpath_var"; then 2021518bcf38Smrg # get the directories listed in $shlibpath_var 2022518bcf38Smrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 2023518bcf38Smrg else 2024518bcf38Smrg shlib_search_path= 2025518bcf38Smrg fi 2026518bcf38Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 2027518bcf38Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 2028f55e6a01Smrg 2029518bcf38Smrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 2030518bcf38Smrg if test "X$output_objdir" = "X$output"; then 2031518bcf38Smrg output_objdir="$objdir" 2032f55e6a01Smrg else 2033518bcf38Smrg output_objdir="$output_objdir/$objdir" 2034f55e6a01Smrg fi 2035518bcf38Smrg # Create the object directory. 2036518bcf38Smrg if test ! -d "$output_objdir"; then 2037518bcf38Smrg $show "$mkdir $output_objdir" 2038518bcf38Smrg $run $mkdir $output_objdir 2039518bcf38Smrg exit_status=$? 2040518bcf38Smrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 2041518bcf38Smrg exit $exit_status 2042f55e6a01Smrg fi 2043f55e6a01Smrg fi 2044f55e6a01Smrg 2045518bcf38Smrg # Determine the type of output 2046518bcf38Smrg case $output in 2047518bcf38Smrg "") 2048518bcf38Smrg $echo "$modename: you must specify an output file" 1>&2 2049518bcf38Smrg $echo "$help" 1>&2 2050518bcf38Smrg exit $EXIT_FAILURE 2051518bcf38Smrg ;; 2052518bcf38Smrg *.$libext) linkmode=oldlib ;; 2053518bcf38Smrg *.lo | *.$objext) linkmode=obj ;; 2054518bcf38Smrg *.la) linkmode=lib ;; 2055518bcf38Smrg *) linkmode=prog ;; # Anything else should be a program. 2056518bcf38Smrg esac 2057c35d236eSmrg 2058518bcf38Smrg case $host in 2059518bcf38Smrg *cygwin* | *mingw* | *pw32*) 2060518bcf38Smrg # don't eliminate duplications in $postdeps and $predeps 2061518bcf38Smrg duplicate_compiler_generated_deps=yes 2062518bcf38Smrg ;; 2063518bcf38Smrg *) 2064518bcf38Smrg duplicate_compiler_generated_deps=$duplicate_deps 2065518bcf38Smrg ;; 2066518bcf38Smrg esac 2067518bcf38Smrg specialdeplibs= 2068c35d236eSmrg 2069518bcf38Smrg libs= 2070518bcf38Smrg # Find all interdependent deplibs by searching for libraries 2071518bcf38Smrg # that are linked more than once (e.g. -la -lb -la) 2072518bcf38Smrg for deplib in $deplibs; do 2073518bcf38Smrg if test "X$duplicate_deps" = "Xyes" ; then 2074518bcf38Smrg case "$libs " in 2075518bcf38Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2076518bcf38Smrg esac 2077518bcf38Smrg fi 2078518bcf38Smrg libs="$libs $deplib" 2079518bcf38Smrg done 2080c35d236eSmrg 2081518bcf38Smrg if test "$linkmode" = lib; then 2082518bcf38Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 2083c35d236eSmrg 2084518bcf38Smrg # Compute libraries that are listed more than once in $predeps 2085518bcf38Smrg # $postdeps and mark them as special (i.e., whose duplicates are 2086518bcf38Smrg # not to be eliminated). 2087518bcf38Smrg pre_post_deps= 2088518bcf38Smrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 2089518bcf38Smrg for pre_post_dep in $predeps $postdeps; do 2090518bcf38Smrg case "$pre_post_deps " in 2091518bcf38Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 2092f55e6a01Smrg esac 2093518bcf38Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 2094518bcf38Smrg done 2095518bcf38Smrg fi 2096518bcf38Smrg pre_post_deps= 2097518bcf38Smrg fi 2098c35d236eSmrg 2099518bcf38Smrg deplibs= 2100518bcf38Smrg newdependency_libs= 2101518bcf38Smrg newlib_search_path= 2102518bcf38Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 2103518bcf38Smrg notinst_deplibs= # not-installed libtool libraries 2104518bcf38Smrg case $linkmode in 2105518bcf38Smrg lib) 2106518bcf38Smrg passes="conv link" 2107518bcf38Smrg for file in $dlfiles $dlprefiles; do 2108518bcf38Smrg case $file in 2109518bcf38Smrg *.la) ;; 2110f55e6a01Smrg *) 2111518bcf38Smrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 2112518bcf38Smrg exit $EXIT_FAILURE 2113f55e6a01Smrg ;; 2114f55e6a01Smrg esac 2115f55e6a01Smrg done 2116f55e6a01Smrg ;; 2117518bcf38Smrg prog) 2118518bcf38Smrg compile_deplibs= 2119518bcf38Smrg finalize_deplibs= 2120518bcf38Smrg alldeplibs=no 2121518bcf38Smrg newdlfiles= 2122518bcf38Smrg newdlprefiles= 2123518bcf38Smrg passes="conv scan dlopen dlpreopen link" 2124518bcf38Smrg ;; 2125518bcf38Smrg *) passes="conv" 2126f55e6a01Smrg ;; 2127f55e6a01Smrg esac 2128518bcf38Smrg for pass in $passes; do 2129518bcf38Smrg if test "$linkmode,$pass" = "lib,link" || 2130518bcf38Smrg test "$linkmode,$pass" = "prog,scan"; then 2131518bcf38Smrg libs="$deplibs" 2132518bcf38Smrg deplibs= 2133518bcf38Smrg fi 2134518bcf38Smrg if test "$linkmode" = prog; then 2135518bcf38Smrg case $pass in 2136518bcf38Smrg dlopen) libs="$dlfiles" ;; 2137518bcf38Smrg dlpreopen) libs="$dlprefiles" ;; 2138518bcf38Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 2139518bcf38Smrg esac 2140518bcf38Smrg fi 2141518bcf38Smrg if test "$pass" = dlopen; then 2142518bcf38Smrg # Collect dlpreopened libraries 2143518bcf38Smrg save_deplibs="$deplibs" 2144518bcf38Smrg deplibs= 2145518bcf38Smrg fi 2146518bcf38Smrg for deplib in $libs; do 2147518bcf38Smrg lib= 2148518bcf38Smrg found=no 2149518bcf38Smrg case $deplib in 2150518bcf38Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 2151518bcf38Smrg if test "$linkmode,$pass" = "prog,link"; then 2152518bcf38Smrg compile_deplibs="$deplib $compile_deplibs" 2153518bcf38Smrg finalize_deplibs="$deplib $finalize_deplibs" 2154518bcf38Smrg else 2155518bcf38Smrg compiler_flags="$compiler_flags $deplib" 2156518bcf38Smrg fi 2157518bcf38Smrg continue 2158518bcf38Smrg ;; 2159518bcf38Smrg -l*) 2160518bcf38Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 2161518bcf38Smrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2162518bcf38Smrg continue 2163518bcf38Smrg fi 2164518bcf38Smrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 2165518bcf38Smrg if test "$linkmode" = lib; then 2166518bcf38Smrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 2167518bcf38Smrg else 2168518bcf38Smrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 2169518bcf38Smrg fi 2170518bcf38Smrg for searchdir in $searchdirs; do 2171518bcf38Smrg for search_ext in .la $std_shrext .so .a; do 2172518bcf38Smrg # Search the libtool library 2173518bcf38Smrg lib="$searchdir/lib${name}${search_ext}" 2174518bcf38Smrg if test -f "$lib"; then 2175518bcf38Smrg if test "$search_ext" = ".la"; then 2176518bcf38Smrg found=yes 2177518bcf38Smrg else 2178518bcf38Smrg found=no 2179518bcf38Smrg fi 2180518bcf38Smrg break 2 2181518bcf38Smrg fi 2182518bcf38Smrg done 2183518bcf38Smrg done 2184518bcf38Smrg if test "$found" != yes; then 2185518bcf38Smrg # deplib doesn't seem to be a libtool library 2186518bcf38Smrg if test "$linkmode,$pass" = "prog,link"; then 2187518bcf38Smrg compile_deplibs="$deplib $compile_deplibs" 2188518bcf38Smrg finalize_deplibs="$deplib $finalize_deplibs" 2189518bcf38Smrg else 2190518bcf38Smrg deplibs="$deplib $deplibs" 2191518bcf38Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2192518bcf38Smrg fi 2193518bcf38Smrg continue 2194518bcf38Smrg else # deplib is a libtool library 2195518bcf38Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 2196518bcf38Smrg # We need to do some special things here, and not later. 2197518bcf38Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 2198518bcf38Smrg case " $predeps $postdeps " in 2199518bcf38Smrg *" $deplib "*) 2200518bcf38Smrg if (${SED} -e '2q' $lib | 2201518bcf38Smrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 2202518bcf38Smrg library_names= 2203518bcf38Smrg old_library= 2204518bcf38Smrg case $lib in 2205518bcf38Smrg */* | *\\*) . $lib ;; 2206518bcf38Smrg *) . ./$lib ;; 2207518bcf38Smrg esac 2208518bcf38Smrg for l in $old_library $library_names; do 2209518bcf38Smrg ll="$l" 2210518bcf38Smrg done 2211518bcf38Smrg if test "X$ll" = "X$old_library" ; then # only static version available 2212518bcf38Smrg found=no 2213518bcf38Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2214518bcf38Smrg test "X$ladir" = "X$lib" && ladir="." 2215518bcf38Smrg lib=$ladir/$old_library 2216518bcf38Smrg if test "$linkmode,$pass" = "prog,link"; then 2217518bcf38Smrg compile_deplibs="$deplib $compile_deplibs" 2218518bcf38Smrg finalize_deplibs="$deplib $finalize_deplibs" 2219518bcf38Smrg else 2220518bcf38Smrg deplibs="$deplib $deplibs" 2221518bcf38Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2222518bcf38Smrg fi 2223518bcf38Smrg continue 2224518bcf38Smrg fi 2225518bcf38Smrg fi 2226518bcf38Smrg ;; 2227518bcf38Smrg *) ;; 2228518bcf38Smrg esac 2229518bcf38Smrg fi 2230518bcf38Smrg fi 2231518bcf38Smrg ;; # -l 2232518bcf38Smrg -L*) 2233518bcf38Smrg case $linkmode in 2234518bcf38Smrg lib) 2235518bcf38Smrg deplibs="$deplib $deplibs" 2236518bcf38Smrg test "$pass" = conv && continue 2237518bcf38Smrg newdependency_libs="$deplib $newdependency_libs" 2238518bcf38Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2239518bcf38Smrg ;; 2240518bcf38Smrg prog) 2241518bcf38Smrg if test "$pass" = conv; then 2242518bcf38Smrg deplibs="$deplib $deplibs" 2243518bcf38Smrg continue 2244518bcf38Smrg fi 2245518bcf38Smrg if test "$pass" = scan; then 2246518bcf38Smrg deplibs="$deplib $deplibs" 2247518bcf38Smrg else 2248518bcf38Smrg compile_deplibs="$deplib $compile_deplibs" 2249518bcf38Smrg finalize_deplibs="$deplib $finalize_deplibs" 2250518bcf38Smrg fi 2251518bcf38Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2252518bcf38Smrg ;; 2253518bcf38Smrg *) 2254518bcf38Smrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 2255518bcf38Smrg ;; 2256518bcf38Smrg esac # linkmode 2257518bcf38Smrg continue 2258518bcf38Smrg ;; # -L 2259518bcf38Smrg -R*) 2260518bcf38Smrg if test "$pass" = link; then 2261518bcf38Smrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 2262518bcf38Smrg # Make sure the xrpath contains only unique directories. 2263518bcf38Smrg case "$xrpath " in 2264518bcf38Smrg *" $dir "*) ;; 2265518bcf38Smrg *) xrpath="$xrpath $dir" ;; 2266518bcf38Smrg esac 2267518bcf38Smrg fi 2268518bcf38Smrg deplibs="$deplib $deplibs" 2269518bcf38Smrg continue 2270518bcf38Smrg ;; 2271518bcf38Smrg *.la) lib="$deplib" ;; 2272518bcf38Smrg *.$libext) 2273518bcf38Smrg if test "$pass" = conv; then 2274518bcf38Smrg deplibs="$deplib $deplibs" 2275518bcf38Smrg continue 2276518bcf38Smrg fi 2277518bcf38Smrg case $linkmode in 2278518bcf38Smrg lib) 2279518bcf38Smrg valid_a_lib=no 2280518bcf38Smrg case $deplibs_check_method in 2281518bcf38Smrg match_pattern*) 2282518bcf38Smrg set dummy $deplibs_check_method 2283518bcf38Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2284518bcf38Smrg if eval $echo \"$deplib\" 2>/dev/null \ 2285518bcf38Smrg | $SED 10q \ 2286518bcf38Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 2287518bcf38Smrg valid_a_lib=yes 2288518bcf38Smrg fi 2289518bcf38Smrg ;; 2290518bcf38Smrg pass_all) 2291518bcf38Smrg valid_a_lib=yes 2292518bcf38Smrg ;; 2293518bcf38Smrg esac 2294518bcf38Smrg if test "$valid_a_lib" != yes; then 2295518bcf38Smrg $echo 2296518bcf38Smrg $echo "*** Warning: Trying to link with static lib archive $deplib." 2297518bcf38Smrg $echo "*** I have the capability to make that library automatically link in when" 2298518bcf38Smrg $echo "*** you link to this library. But I can only do this if you have a" 2299518bcf38Smrg $echo "*** shared version of the library, which you do not appear to have" 2300518bcf38Smrg $echo "*** because the file extensions .$libext of this argument makes me believe" 2301518bcf38Smrg $echo "*** that it is just a static archive that I should not used here." 2302518bcf38Smrg else 2303518bcf38Smrg $echo 2304518bcf38Smrg $echo "*** Warning: Linking the shared library $output against the" 2305518bcf38Smrg $echo "*** static library $deplib is not portable!" 2306518bcf38Smrg deplibs="$deplib $deplibs" 2307518bcf38Smrg fi 2308518bcf38Smrg continue 2309518bcf38Smrg ;; 2310518bcf38Smrg prog) 2311518bcf38Smrg if test "$pass" != link; then 2312518bcf38Smrg deplibs="$deplib $deplibs" 2313518bcf38Smrg else 2314518bcf38Smrg compile_deplibs="$deplib $compile_deplibs" 2315518bcf38Smrg finalize_deplibs="$deplib $finalize_deplibs" 2316518bcf38Smrg fi 2317518bcf38Smrg continue 2318518bcf38Smrg ;; 2319518bcf38Smrg esac # linkmode 2320518bcf38Smrg ;; # *.$libext 2321518bcf38Smrg *.lo | *.$objext) 2322518bcf38Smrg if test "$pass" = conv; then 2323518bcf38Smrg deplibs="$deplib $deplibs" 2324518bcf38Smrg elif test "$linkmode" = prog; then 2325518bcf38Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 2326518bcf38Smrg # If there is no dlopen support or we're linking statically, 2327518bcf38Smrg # we need to preload. 2328518bcf38Smrg newdlprefiles="$newdlprefiles $deplib" 2329518bcf38Smrg compile_deplibs="$deplib $compile_deplibs" 2330518bcf38Smrg finalize_deplibs="$deplib $finalize_deplibs" 2331518bcf38Smrg else 2332518bcf38Smrg newdlfiles="$newdlfiles $deplib" 2333518bcf38Smrg fi 2334518bcf38Smrg fi 2335518bcf38Smrg continue 2336518bcf38Smrg ;; 2337518bcf38Smrg %DEPLIBS%) 2338518bcf38Smrg alldeplibs=yes 2339518bcf38Smrg continue 2340518bcf38Smrg ;; 2341518bcf38Smrg esac # case $deplib 2342518bcf38Smrg if test "$found" = yes || test -f "$lib"; then : 2343518bcf38Smrg else 2344518bcf38Smrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 2345518bcf38Smrg exit $EXIT_FAILURE 2346518bcf38Smrg fi 2347c35d236eSmrg 2348518bcf38Smrg # Check to see that this really is a libtool archive. 2349518bcf38Smrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2350518bcf38Smrg else 2351518bcf38Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 2352518bcf38Smrg exit $EXIT_FAILURE 2353518bcf38Smrg fi 2354c35d236eSmrg 2355518bcf38Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2356518bcf38Smrg test "X$ladir" = "X$lib" && ladir="." 2357c35d236eSmrg 2358518bcf38Smrg dlname= 2359518bcf38Smrg dlopen= 2360518bcf38Smrg dlpreopen= 2361518bcf38Smrg libdir= 2362518bcf38Smrg library_names= 2363518bcf38Smrg old_library= 2364518bcf38Smrg # If the library was installed with an old release of libtool, 2365518bcf38Smrg # it will not redefine variables installed, or shouldnotlink 2366518bcf38Smrg installed=yes 2367518bcf38Smrg shouldnotlink=no 2368518bcf38Smrg avoidtemprpath= 2369c35d236eSmrg 2370c35d236eSmrg 2371518bcf38Smrg # Read the .la file 2372518bcf38Smrg case $lib in 2373518bcf38Smrg */* | *\\*) . $lib ;; 2374518bcf38Smrg *) . ./$lib ;; 2375f55e6a01Smrg esac 2376c35d236eSmrg 2377518bcf38Smrg if test "$linkmode,$pass" = "lib,link" || 2378518bcf38Smrg test "$linkmode,$pass" = "prog,scan" || 2379518bcf38Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 2380518bcf38Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 2381518bcf38Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 2382518bcf38Smrg fi 2383c35d236eSmrg 2384518bcf38Smrg if test "$pass" = conv; then 2385518bcf38Smrg # Only check for convenience libraries 2386518bcf38Smrg deplibs="$lib $deplibs" 2387518bcf38Smrg if test -z "$libdir"; then 2388518bcf38Smrg if test -z "$old_library"; then 2389518bcf38Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2390518bcf38Smrg exit $EXIT_FAILURE 2391518bcf38Smrg fi 2392518bcf38Smrg # It is a libtool convenience library, so add in its objects. 2393518bcf38Smrg convenience="$convenience $ladir/$objdir/$old_library" 2394518bcf38Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 2395518bcf38Smrg tmp_libs= 2396518bcf38Smrg for deplib in $dependency_libs; do 2397518bcf38Smrg deplibs="$deplib $deplibs" 2398518bcf38Smrg if test "X$duplicate_deps" = "Xyes" ; then 2399518bcf38Smrg case "$tmp_libs " in 2400518bcf38Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2401518bcf38Smrg esac 2402518bcf38Smrg fi 2403518bcf38Smrg tmp_libs="$tmp_libs $deplib" 2404518bcf38Smrg done 2405518bcf38Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 2406518bcf38Smrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 2407518bcf38Smrg exit $EXIT_FAILURE 2408518bcf38Smrg fi 2409518bcf38Smrg continue 2410518bcf38Smrg fi # $pass = conv 2411c35d236eSmrg 2412c35d236eSmrg 2413518bcf38Smrg # Get the name of the library we link against. 2414518bcf38Smrg linklib= 2415518bcf38Smrg for l in $old_library $library_names; do 2416518bcf38Smrg linklib="$l" 2417518bcf38Smrg done 2418518bcf38Smrg if test -z "$linklib"; then 2419518bcf38Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2420518bcf38Smrg exit $EXIT_FAILURE 2421c35d236eSmrg fi 2422c35d236eSmrg 2423518bcf38Smrg # This library was specified with -dlopen. 2424518bcf38Smrg if test "$pass" = dlopen; then 2425518bcf38Smrg if test -z "$libdir"; then 2426518bcf38Smrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 2427518bcf38Smrg exit $EXIT_FAILURE 2428518bcf38Smrg fi 2429518bcf38Smrg if test -z "$dlname" || 2430518bcf38Smrg test "$dlopen_support" != yes || 2431518bcf38Smrg test "$build_libtool_libs" = no; then 2432518bcf38Smrg # If there is no dlname, no dlopen support or we're linking 2433518bcf38Smrg # statically, we need to preload. We also need to preload any 2434518bcf38Smrg # dependent libraries so libltdl's deplib preloader doesn't 2435518bcf38Smrg # bomb out in the load deplibs phase. 2436518bcf38Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 2437518bcf38Smrg else 2438518bcf38Smrg newdlfiles="$newdlfiles $lib" 2439518bcf38Smrg fi 2440518bcf38Smrg continue 2441518bcf38Smrg fi # $pass = dlopen 2442c35d236eSmrg 2443518bcf38Smrg # We need an absolute path. 2444518bcf38Smrg case $ladir in 2445518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 2446518bcf38Smrg *) 2447518bcf38Smrg abs_ladir=`cd "$ladir" && pwd` 2448518bcf38Smrg if test -z "$abs_ladir"; then 2449518bcf38Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 2450518bcf38Smrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 2451518bcf38Smrg abs_ladir="$ladir" 2452518bcf38Smrg fi 2453518bcf38Smrg ;; 2454518bcf38Smrg esac 2455518bcf38Smrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 2456c35d236eSmrg 2457518bcf38Smrg # Find the relevant object directory and library name. 2458518bcf38Smrg if test "X$installed" = Xyes; then 2459518bcf38Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2460518bcf38Smrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 2461518bcf38Smrg dir="$ladir" 2462518bcf38Smrg absdir="$abs_ladir" 2463518bcf38Smrg libdir="$abs_ladir" 2464518bcf38Smrg else 2465518bcf38Smrg dir="$libdir" 2466518bcf38Smrg absdir="$libdir" 2467518bcf38Smrg fi 2468518bcf38Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 2469518bcf38Smrg else 2470518bcf38Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2471518bcf38Smrg dir="$ladir" 2472518bcf38Smrg absdir="$abs_ladir" 2473518bcf38Smrg # Remove this search path later 2474518bcf38Smrg notinst_path="$notinst_path $abs_ladir" 2475518bcf38Smrg else 2476518bcf38Smrg dir="$ladir/$objdir" 2477518bcf38Smrg absdir="$abs_ladir/$objdir" 2478518bcf38Smrg # Remove this search path later 2479518bcf38Smrg notinst_path="$notinst_path $abs_ladir" 2480518bcf38Smrg fi 2481518bcf38Smrg fi # $installed = yes 2482518bcf38Smrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2483c35d236eSmrg 2484518bcf38Smrg # This library was specified with -dlpreopen. 2485518bcf38Smrg if test "$pass" = dlpreopen; then 2486518bcf38Smrg if test -z "$libdir"; then 2487518bcf38Smrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 2488518bcf38Smrg exit $EXIT_FAILURE 2489518bcf38Smrg fi 2490518bcf38Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 2491518bcf38Smrg # are required to link). 2492518bcf38Smrg if test -n "$old_library"; then 2493518bcf38Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 2494518bcf38Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 2495518bcf38Smrg elif test -n "$dlname"; then 2496518bcf38Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 2497518bcf38Smrg else 2498518bcf38Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 2499518bcf38Smrg fi 2500518bcf38Smrg fi # $pass = dlpreopen 2501c35d236eSmrg 2502518bcf38Smrg if test -z "$libdir"; then 2503518bcf38Smrg # Link the convenience library 2504518bcf38Smrg if test "$linkmode" = lib; then 2505518bcf38Smrg deplibs="$dir/$old_library $deplibs" 2506518bcf38Smrg elif test "$linkmode,$pass" = "prog,link"; then 2507518bcf38Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 2508518bcf38Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 2509518bcf38Smrg else 2510518bcf38Smrg deplibs="$lib $deplibs" # used for prog,scan pass 2511518bcf38Smrg fi 2512518bcf38Smrg continue 2513518bcf38Smrg fi 2514c35d236eSmrg 2515c35d236eSmrg 2516518bcf38Smrg if test "$linkmode" = prog && test "$pass" != link; then 2517518bcf38Smrg newlib_search_path="$newlib_search_path $ladir" 2518518bcf38Smrg deplibs="$lib $deplibs" 2519c35d236eSmrg 2520518bcf38Smrg linkalldeplibs=no 2521518bcf38Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 2522518bcf38Smrg test "$build_libtool_libs" = no; then 2523518bcf38Smrg linkalldeplibs=yes 2524518bcf38Smrg fi 2525c35d236eSmrg 2526518bcf38Smrg tmp_libs= 2527518bcf38Smrg for deplib in $dependency_libs; do 2528518bcf38Smrg case $deplib in 2529518bcf38Smrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 2530518bcf38Smrg esac 2531518bcf38Smrg # Need to link against all dependency_libs? 2532518bcf38Smrg if test "$linkalldeplibs" = yes; then 2533518bcf38Smrg deplibs="$deplib $deplibs" 2534518bcf38Smrg else 2535518bcf38Smrg # Need to hardcode shared library paths 2536518bcf38Smrg # or/and link against static libraries 2537518bcf38Smrg newdependency_libs="$deplib $newdependency_libs" 2538518bcf38Smrg fi 2539518bcf38Smrg if test "X$duplicate_deps" = "Xyes" ; then 2540518bcf38Smrg case "$tmp_libs " in 2541518bcf38Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2542518bcf38Smrg esac 2543518bcf38Smrg fi 2544518bcf38Smrg tmp_libs="$tmp_libs $deplib" 2545518bcf38Smrg done # for deplib 2546518bcf38Smrg continue 2547518bcf38Smrg fi # $linkmode = prog... 2548c35d236eSmrg 2549518bcf38Smrg if test "$linkmode,$pass" = "prog,link"; then 2550518bcf38Smrg if test -n "$library_names" && 2551518bcf38Smrg { { test "$prefer_static_libs" = no || 2552518bcf38Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 2553518bcf38Smrg test -z "$old_library"; }; then 2554518bcf38Smrg # We need to hardcode the library path 2555518bcf38Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 2556518bcf38Smrg # Make sure the rpath contains only unique directories. 2557518bcf38Smrg case "$temp_rpath " in 2558518bcf38Smrg *" $dir "*) ;; 2559518bcf38Smrg *" $absdir "*) ;; 2560518bcf38Smrg *) temp_rpath="$temp_rpath $absdir" ;; 2561518bcf38Smrg esac 2562518bcf38Smrg fi 2563c35d236eSmrg 2564518bcf38Smrg # Hardcode the library path. 2565518bcf38Smrg # Skip directories that are in the system default run-time 2566518bcf38Smrg # search path. 2567518bcf38Smrg case " $sys_lib_dlsearch_path " in 2568518bcf38Smrg *" $absdir "*) ;; 2569518bcf38Smrg *) 2570518bcf38Smrg case "$compile_rpath " in 2571518bcf38Smrg *" $absdir "*) ;; 2572518bcf38Smrg *) compile_rpath="$compile_rpath $absdir" 2573518bcf38Smrg esac 2574518bcf38Smrg ;; 2575518bcf38Smrg esac 2576518bcf38Smrg case " $sys_lib_dlsearch_path " in 2577518bcf38Smrg *" $libdir "*) ;; 2578518bcf38Smrg *) 2579518bcf38Smrg case "$finalize_rpath " in 2580518bcf38Smrg *" $libdir "*) ;; 2581518bcf38Smrg *) finalize_rpath="$finalize_rpath $libdir" 2582518bcf38Smrg esac 2583518bcf38Smrg ;; 2584518bcf38Smrg esac 2585518bcf38Smrg fi # $linkmode,$pass = prog,link... 2586c35d236eSmrg 2587518bcf38Smrg if test "$alldeplibs" = yes && 2588518bcf38Smrg { test "$deplibs_check_method" = pass_all || 2589518bcf38Smrg { test "$build_libtool_libs" = yes && 2590518bcf38Smrg test -n "$library_names"; }; }; then 2591518bcf38Smrg # We only need to search for static libraries 2592518bcf38Smrg continue 2593518bcf38Smrg fi 2594f55e6a01Smrg fi 2595c35d236eSmrg 2596518bcf38Smrg link_static=no # Whether the deplib will be linked statically 2597518bcf38Smrg use_static_libs=$prefer_static_libs 2598518bcf38Smrg if test "$use_static_libs" = built && test "$installed" = yes ; then 2599518bcf38Smrg use_static_libs=no 2600518bcf38Smrg fi 2601518bcf38Smrg if test -n "$library_names" && 2602518bcf38Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 2603518bcf38Smrg if test "$installed" = no; then 2604518bcf38Smrg notinst_deplibs="$notinst_deplibs $lib" 2605518bcf38Smrg need_relink=yes 2606518bcf38Smrg fi 2607518bcf38Smrg # This is a shared library 2608c35d236eSmrg 2609518bcf38Smrg # Warn about portability, can't link against -module's on 2610518bcf38Smrg # some systems (darwin) 2611518bcf38Smrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 2612518bcf38Smrg $echo 2613518bcf38Smrg if test "$linkmode" = prog; then 2614518bcf38Smrg $echo "*** Warning: Linking the executable $output against the loadable module" 2615518bcf38Smrg else 2616518bcf38Smrg $echo "*** Warning: Linking the shared library $output against the loadable module" 2617518bcf38Smrg fi 2618518bcf38Smrg $echo "*** $linklib is not portable!" 2619518bcf38Smrg fi 2620518bcf38Smrg if test "$linkmode" = lib && 2621518bcf38Smrg test "$hardcode_into_libs" = yes; then 2622518bcf38Smrg # Hardcode the library path. 2623518bcf38Smrg # Skip directories that are in the system default run-time 2624518bcf38Smrg # search path. 2625518bcf38Smrg case " $sys_lib_dlsearch_path " in 2626518bcf38Smrg *" $absdir "*) ;; 2627518bcf38Smrg *) 2628518bcf38Smrg case "$compile_rpath " in 2629518bcf38Smrg *" $absdir "*) ;; 2630518bcf38Smrg *) compile_rpath="$compile_rpath $absdir" 2631518bcf38Smrg esac 2632518bcf38Smrg ;; 2633518bcf38Smrg esac 2634518bcf38Smrg case " $sys_lib_dlsearch_path " in 2635518bcf38Smrg *" $libdir "*) ;; 2636518bcf38Smrg *) 2637518bcf38Smrg case "$finalize_rpath " in 2638518bcf38Smrg *" $libdir "*) ;; 2639518bcf38Smrg *) finalize_rpath="$finalize_rpath $libdir" 2640518bcf38Smrg esac 2641518bcf38Smrg ;; 2642518bcf38Smrg esac 2643518bcf38Smrg fi 2644c35d236eSmrg 2645518bcf38Smrg if test -n "$old_archive_from_expsyms_cmds"; then 2646518bcf38Smrg # figure out the soname 2647518bcf38Smrg set dummy $library_names 2648518bcf38Smrg realname="$2" 2649518bcf38Smrg shift; shift 2650518bcf38Smrg libname=`eval \\$echo \"$libname_spec\"` 2651518bcf38Smrg # use dlname if we got it. it's perfectly good, no? 2652518bcf38Smrg if test -n "$dlname"; then 2653518bcf38Smrg soname="$dlname" 2654518bcf38Smrg elif test -n "$soname_spec"; then 2655518bcf38Smrg # bleh windows 2656518bcf38Smrg case $host in 2657518bcf38Smrg *cygwin* | mingw*) 2658518bcf38Smrg major=`expr $current - $age` 2659518bcf38Smrg versuffix="-$major" 2660518bcf38Smrg ;; 2661518bcf38Smrg esac 2662518bcf38Smrg eval soname=\"$soname_spec\" 2663518bcf38Smrg else 2664518bcf38Smrg soname="$realname" 2665518bcf38Smrg fi 2666c35d236eSmrg 2667518bcf38Smrg # Make a new name for the extract_expsyms_cmds to use 2668518bcf38Smrg soroot="$soname" 2669518bcf38Smrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 2670518bcf38Smrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 2671c35d236eSmrg 2672518bcf38Smrg # If the library has no export list, then create one now 2673518bcf38Smrg if test -f "$output_objdir/$soname-def"; then : 2674518bcf38Smrg else 2675518bcf38Smrg $show "extracting exported symbol list from \`$soname'" 2676518bcf38Smrg save_ifs="$IFS"; IFS='~' 2677518bcf38Smrg cmds=$extract_expsyms_cmds 2678518bcf38Smrg for cmd in $cmds; do 2679518bcf38Smrg IFS="$save_ifs" 2680518bcf38Smrg eval cmd=\"$cmd\" 2681518bcf38Smrg $show "$cmd" 2682518bcf38Smrg $run eval "$cmd" || exit $? 2683518bcf38Smrg done 2684518bcf38Smrg IFS="$save_ifs" 2685518bcf38Smrg fi 2686c35d236eSmrg 2687518bcf38Smrg # Create $newlib 2688518bcf38Smrg if test -f "$output_objdir/$newlib"; then :; else 2689518bcf38Smrg $show "generating import library for \`$soname'" 2690518bcf38Smrg save_ifs="$IFS"; IFS='~' 2691518bcf38Smrg cmds=$old_archive_from_expsyms_cmds 2692518bcf38Smrg for cmd in $cmds; do 2693518bcf38Smrg IFS="$save_ifs" 2694518bcf38Smrg eval cmd=\"$cmd\" 2695518bcf38Smrg $show "$cmd" 2696518bcf38Smrg $run eval "$cmd" || exit $? 2697518bcf38Smrg done 2698518bcf38Smrg IFS="$save_ifs" 2699518bcf38Smrg fi 2700518bcf38Smrg # make sure the library variables are pointing to the new library 2701518bcf38Smrg dir=$output_objdir 2702518bcf38Smrg linklib=$newlib 2703518bcf38Smrg fi # test -n "$old_archive_from_expsyms_cmds" 2704c35d236eSmrg 2705518bcf38Smrg if test "$linkmode" = prog || test "$mode" != relink; then 2706518bcf38Smrg add_shlibpath= 2707518bcf38Smrg add_dir= 2708518bcf38Smrg add= 2709518bcf38Smrg lib_linked=yes 2710518bcf38Smrg case $hardcode_action in 2711518bcf38Smrg immediate | unsupported) 2712518bcf38Smrg if test "$hardcode_direct" = no; then 2713518bcf38Smrg add="$dir/$linklib" 2714518bcf38Smrg case $host in 2715518bcf38Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 2716518bcf38Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 2717518bcf38Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 2718518bcf38Smrg *-*-unixware7*) add_dir="-L$dir" ;; 2719518bcf38Smrg *-*-darwin* ) 2720518bcf38Smrg # if the lib is a module then we can not link against 2721518bcf38Smrg # it, someone is ignoring the new warnings I added 2722518bcf38Smrg if /usr/bin/file -L $add 2> /dev/null | 2723518bcf38Smrg $EGREP ": [^:]* bundle" >/dev/null ; then 2724518bcf38Smrg $echo "** Warning, lib $linklib is a module, not a shared library" 2725518bcf38Smrg if test -z "$old_library" ; then 2726518bcf38Smrg $echo 2727518bcf38Smrg $echo "** And there doesn't seem to be a static archive available" 2728518bcf38Smrg $echo "** The link will probably fail, sorry" 2729518bcf38Smrg else 2730518bcf38Smrg add="$dir/$old_library" 2731518bcf38Smrg fi 2732518bcf38Smrg fi 2733518bcf38Smrg esac 2734518bcf38Smrg elif test "$hardcode_minus_L" = no; then 2735518bcf38Smrg case $host in 2736518bcf38Smrg *-*-sunos*) add_shlibpath="$dir" ;; 2737518bcf38Smrg esac 2738518bcf38Smrg add_dir="-L$dir" 2739518bcf38Smrg add="-l$name" 2740518bcf38Smrg elif test "$hardcode_shlibpath_var" = no; then 2741518bcf38Smrg add_shlibpath="$dir" 2742518bcf38Smrg add="-l$name" 2743518bcf38Smrg else 2744518bcf38Smrg lib_linked=no 2745518bcf38Smrg fi 2746518bcf38Smrg ;; 2747518bcf38Smrg relink) 2748518bcf38Smrg if test "$hardcode_direct" = yes; then 2749518bcf38Smrg add="$dir/$linklib" 2750518bcf38Smrg elif test "$hardcode_minus_L" = yes; then 2751518bcf38Smrg add_dir="-L$dir" 2752518bcf38Smrg # Try looking first in the location we're being installed to. 2753518bcf38Smrg if test -n "$inst_prefix_dir"; then 2754518bcf38Smrg case $libdir in 2755518bcf38Smrg [\\/]*) 2756518bcf38Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 2757518bcf38Smrg ;; 2758518bcf38Smrg esac 2759518bcf38Smrg fi 2760518bcf38Smrg add="-l$name" 2761518bcf38Smrg elif test "$hardcode_shlibpath_var" = yes; then 2762518bcf38Smrg add_shlibpath="$dir" 2763518bcf38Smrg add="-l$name" 2764518bcf38Smrg else 2765518bcf38Smrg lib_linked=no 2766518bcf38Smrg fi 2767518bcf38Smrg ;; 2768518bcf38Smrg *) lib_linked=no ;; 2769518bcf38Smrg esac 2770c35d236eSmrg 2771518bcf38Smrg if test "$lib_linked" != yes; then 2772518bcf38Smrg $echo "$modename: configuration error: unsupported hardcode properties" 2773518bcf38Smrg exit $EXIT_FAILURE 2774518bcf38Smrg fi 2775c35d236eSmrg 2776518bcf38Smrg if test -n "$add_shlibpath"; then 2777518bcf38Smrg case :$compile_shlibpath: in 2778518bcf38Smrg *":$add_shlibpath:"*) ;; 2779518bcf38Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2780518bcf38Smrg esac 2781518bcf38Smrg fi 2782518bcf38Smrg if test "$linkmode" = prog; then 2783518bcf38Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2784518bcf38Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 2785518bcf38Smrg else 2786518bcf38Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 2787518bcf38Smrg test -n "$add" && deplibs="$add $deplibs" 2788518bcf38Smrg if test "$hardcode_direct" != yes && \ 2789518bcf38Smrg test "$hardcode_minus_L" != yes && \ 2790518bcf38Smrg test "$hardcode_shlibpath_var" = yes; then 2791518bcf38Smrg case :$finalize_shlibpath: in 2792518bcf38Smrg *":$libdir:"*) ;; 2793518bcf38Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2794518bcf38Smrg esac 2795518bcf38Smrg fi 2796518bcf38Smrg fi 2797518bcf38Smrg fi 2798f55e6a01Smrg 2799518bcf38Smrg if test "$linkmode" = prog || test "$mode" = relink; then 2800518bcf38Smrg add_shlibpath= 2801518bcf38Smrg add_dir= 2802518bcf38Smrg add= 2803518bcf38Smrg # Finalize command for both is simple: just hardcode it. 2804518bcf38Smrg if test "$hardcode_direct" = yes; then 2805518bcf38Smrg add="$libdir/$linklib" 2806518bcf38Smrg elif test "$hardcode_minus_L" = yes; then 2807518bcf38Smrg add_dir="-L$libdir" 2808518bcf38Smrg add="-l$name" 2809518bcf38Smrg elif test "$hardcode_shlibpath_var" = yes; then 2810518bcf38Smrg case :$finalize_shlibpath: in 2811518bcf38Smrg *":$libdir:"*) ;; 2812518bcf38Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2813518bcf38Smrg esac 2814518bcf38Smrg add="-l$name" 2815518bcf38Smrg elif test "$hardcode_automatic" = yes; then 2816518bcf38Smrg if test -n "$inst_prefix_dir" && 2817518bcf38Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 2818518bcf38Smrg add="$inst_prefix_dir$libdir/$linklib" 2819518bcf38Smrg else 2820518bcf38Smrg add="$libdir/$linklib" 2821518bcf38Smrg fi 2822518bcf38Smrg else 2823518bcf38Smrg # We cannot seem to hardcode it, guess we'll fake it. 2824518bcf38Smrg add_dir="-L$libdir" 2825518bcf38Smrg # Try looking first in the location we're being installed to. 2826518bcf38Smrg if test -n "$inst_prefix_dir"; then 2827518bcf38Smrg case $libdir in 2828518bcf38Smrg [\\/]*) 2829518bcf38Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 2830518bcf38Smrg ;; 2831518bcf38Smrg esac 2832518bcf38Smrg fi 2833518bcf38Smrg add="-l$name" 2834518bcf38Smrg fi 2835f55e6a01Smrg 2836518bcf38Smrg if test "$linkmode" = prog; then 2837518bcf38Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2838518bcf38Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2839518bcf38Smrg else 2840518bcf38Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 2841518bcf38Smrg test -n "$add" && deplibs="$add $deplibs" 2842518bcf38Smrg fi 2843518bcf38Smrg fi 2844518bcf38Smrg elif test "$linkmode" = prog; then 2845518bcf38Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 2846518bcf38Smrg # is not unsupported. This is valid on all known static and 2847518bcf38Smrg # shared platforms. 2848518bcf38Smrg if test "$hardcode_direct" != unsupported; then 2849518bcf38Smrg test -n "$old_library" && linklib="$old_library" 2850518bcf38Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 2851518bcf38Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 2852518bcf38Smrg else 2853518bcf38Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 2854518bcf38Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2855518bcf38Smrg fi 2856518bcf38Smrg elif test "$build_libtool_libs" = yes; then 2857518bcf38Smrg # Not a shared library 2858518bcf38Smrg if test "$deplibs_check_method" != pass_all; then 2859518bcf38Smrg # We're trying link a shared library against a static one 2860518bcf38Smrg # but the system doesn't support it. 2861f55e6a01Smrg 2862518bcf38Smrg # Just print a warning and add the library to dependency_libs so 2863518bcf38Smrg # that the program can be linked against the static library. 2864518bcf38Smrg $echo 2865518bcf38Smrg $echo "*** Warning: This system can not link to static lib archive $lib." 2866518bcf38Smrg $echo "*** I have the capability to make that library automatically link in when" 2867518bcf38Smrg $echo "*** you link to this library. But I can only do this if you have a" 2868518bcf38Smrg $echo "*** shared version of the library, which you do not appear to have." 2869518bcf38Smrg if test "$module" = yes; then 2870518bcf38Smrg $echo "*** But as you try to build a module library, libtool will still create " 2871518bcf38Smrg $echo "*** a static module, that should work as long as the dlopening application" 2872518bcf38Smrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 2873518bcf38Smrg if test -z "$global_symbol_pipe"; then 2874518bcf38Smrg $echo 2875518bcf38Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 2876518bcf38Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2877518bcf38Smrg $echo "*** not find such a program. So, this module is probably useless." 2878518bcf38Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 2879518bcf38Smrg fi 2880518bcf38Smrg if test "$build_old_libs" = no; then 2881518bcf38Smrg build_libtool_libs=module 2882518bcf38Smrg build_old_libs=yes 2883518bcf38Smrg else 2884518bcf38Smrg build_libtool_libs=no 2885518bcf38Smrg fi 2886518bcf38Smrg fi 2887518bcf38Smrg else 2888518bcf38Smrg deplibs="$dir/$old_library $deplibs" 2889518bcf38Smrg link_static=yes 2890518bcf38Smrg fi 2891518bcf38Smrg fi # link shared/static library? 2892f55e6a01Smrg 2893518bcf38Smrg if test "$linkmode" = lib; then 2894518bcf38Smrg if test -n "$dependency_libs" && 2895518bcf38Smrg { test "$hardcode_into_libs" != yes || 2896518bcf38Smrg test "$build_old_libs" = yes || 2897518bcf38Smrg test "$link_static" = yes; }; then 2898518bcf38Smrg # Extract -R from dependency_libs 2899518bcf38Smrg temp_deplibs= 2900518bcf38Smrg for libdir in $dependency_libs; do 2901518bcf38Smrg case $libdir in 2902518bcf38Smrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2903518bcf38Smrg case " $xrpath " in 2904518bcf38Smrg *" $temp_xrpath "*) ;; 2905518bcf38Smrg *) xrpath="$xrpath $temp_xrpath";; 2906518bcf38Smrg esac;; 2907518bcf38Smrg *) temp_deplibs="$temp_deplibs $libdir";; 2908518bcf38Smrg esac 2909518bcf38Smrg done 2910518bcf38Smrg dependency_libs="$temp_deplibs" 2911518bcf38Smrg fi 2912f55e6a01Smrg 2913518bcf38Smrg newlib_search_path="$newlib_search_path $absdir" 2914518bcf38Smrg # Link against this library 2915518bcf38Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2916518bcf38Smrg # ... and its dependency_libs 2917518bcf38Smrg tmp_libs= 2918518bcf38Smrg for deplib in $dependency_libs; do 2919518bcf38Smrg newdependency_libs="$deplib $newdependency_libs" 2920518bcf38Smrg if test "X$duplicate_deps" = "Xyes" ; then 2921518bcf38Smrg case "$tmp_libs " in 2922518bcf38Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2923518bcf38Smrg esac 2924518bcf38Smrg fi 2925518bcf38Smrg tmp_libs="$tmp_libs $deplib" 2926518bcf38Smrg done 2927c35d236eSmrg 2928518bcf38Smrg if test "$link_all_deplibs" != no; then 2929518bcf38Smrg # Add the search paths of all dependency libraries 2930518bcf38Smrg for deplib in $dependency_libs; do 2931518bcf38Smrg case $deplib in 2932518bcf38Smrg -L*) path="$deplib" ;; 2933518bcf38Smrg *.la) 2934518bcf38Smrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2935518bcf38Smrg test "X$dir" = "X$deplib" && dir="." 2936518bcf38Smrg # We need an absolute path. 2937518bcf38Smrg case $dir in 2938518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2939518bcf38Smrg *) 2940518bcf38Smrg absdir=`cd "$dir" && pwd` 2941518bcf38Smrg if test -z "$absdir"; then 2942518bcf38Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2943518bcf38Smrg absdir="$dir" 2944518bcf38Smrg fi 2945518bcf38Smrg ;; 2946518bcf38Smrg esac 2947518bcf38Smrg if grep "^installed=no" $deplib > /dev/null; then 2948518bcf38Smrg path="$absdir/$objdir" 2949518bcf38Smrg else 2950518bcf38Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2951518bcf38Smrg if test -z "$libdir"; then 2952518bcf38Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2953518bcf38Smrg exit $EXIT_FAILURE 2954518bcf38Smrg fi 2955518bcf38Smrg if test "$absdir" != "$libdir"; then 2956518bcf38Smrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2957518bcf38Smrg fi 2958518bcf38Smrg path="$absdir" 2959518bcf38Smrg fi 2960518bcf38Smrg depdepl= 2961518bcf38Smrg case $host in 2962518bcf38Smrg *-*-darwin*) 2963518bcf38Smrg # we do not want to link against static libs, 2964518bcf38Smrg # but need to link against shared 2965518bcf38Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 2966518bcf38Smrg eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2967518bcf38Smrg if test -n "$deplibrary_names" ; then 2968518bcf38Smrg for tmp in $deplibrary_names ; do 2969518bcf38Smrg depdepl=$tmp 2970518bcf38Smrg done 2971518bcf38Smrg if test -f "$deplibdir/$depdepl" ; then 2972518bcf38Smrg depdepl="$deplibdir/$depdepl" 2973518bcf38Smrg elif test -f "$path/$depdepl" ; then 2974518bcf38Smrg depdepl="$path/$depdepl" 2975518bcf38Smrg else 2976518bcf38Smrg # Can't find it, oh well... 2977518bcf38Smrg depdepl= 2978518bcf38Smrg fi 2979518bcf38Smrg # do not add paths which are already there 2980518bcf38Smrg case " $newlib_search_path " in 2981518bcf38Smrg *" $path "*) ;; 2982518bcf38Smrg *) newlib_search_path="$newlib_search_path $path";; 2983518bcf38Smrg esac 2984518bcf38Smrg fi 2985518bcf38Smrg path="" 2986518bcf38Smrg ;; 2987518bcf38Smrg *) 2988518bcf38Smrg path="-L$path" 2989518bcf38Smrg ;; 2990518bcf38Smrg esac 2991518bcf38Smrg ;; 2992518bcf38Smrg -l*) 2993518bcf38Smrg case $host in 2994518bcf38Smrg *-*-darwin*) 2995518bcf38Smrg # Again, we only want to link against shared libraries 2996518bcf38Smrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 2997518bcf38Smrg for tmp in $newlib_search_path ; do 2998518bcf38Smrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 2999518bcf38Smrg eval depdepl="$tmp/lib$tmp_libs.dylib" 3000518bcf38Smrg break 3001518bcf38Smrg fi 3002518bcf38Smrg done 3003518bcf38Smrg path="" 3004518bcf38Smrg ;; 3005518bcf38Smrg *) continue ;; 3006518bcf38Smrg esac 3007518bcf38Smrg ;; 3008518bcf38Smrg *) continue ;; 3009518bcf38Smrg esac 3010518bcf38Smrg case " $deplibs " in 3011518bcf38Smrg *" $path "*) ;; 3012518bcf38Smrg *) deplibs="$path $deplibs" ;; 3013518bcf38Smrg esac 3014518bcf38Smrg case " $deplibs " in 3015518bcf38Smrg *" $depdepl "*) ;; 3016518bcf38Smrg *) deplibs="$depdepl $deplibs" ;; 3017518bcf38Smrg esac 3018518bcf38Smrg done 3019518bcf38Smrg fi # link_all_deplibs != no 3020518bcf38Smrg fi # linkmode = lib 3021518bcf38Smrg done # for deplib in $libs 3022518bcf38Smrg dependency_libs="$newdependency_libs" 3023518bcf38Smrg if test "$pass" = dlpreopen; then 3024518bcf38Smrg # Link the dlpreopened libraries before other libraries 3025518bcf38Smrg for deplib in $save_deplibs; do 3026518bcf38Smrg deplibs="$deplib $deplibs" 3027518bcf38Smrg done 3028518bcf38Smrg fi 3029518bcf38Smrg if test "$pass" != dlopen; then 3030518bcf38Smrg if test "$pass" != conv; then 3031518bcf38Smrg # Make sure lib_search_path contains only unique directories. 3032518bcf38Smrg lib_search_path= 3033518bcf38Smrg for dir in $newlib_search_path; do 3034518bcf38Smrg case "$lib_search_path " in 3035518bcf38Smrg *" $dir "*) ;; 3036518bcf38Smrg *) lib_search_path="$lib_search_path $dir" ;; 3037518bcf38Smrg esac 3038518bcf38Smrg done 3039518bcf38Smrg newlib_search_path= 3040518bcf38Smrg fi 3041518bcf38Smrg 3042518bcf38Smrg if test "$linkmode,$pass" != "prog,link"; then 3043518bcf38Smrg vars="deplibs" 3044518bcf38Smrg else 3045518bcf38Smrg vars="compile_deplibs finalize_deplibs" 3046518bcf38Smrg fi 3047518bcf38Smrg for var in $vars dependency_libs; do 3048518bcf38Smrg # Add libraries to $var in reverse order 3049518bcf38Smrg eval tmp_libs=\"\$$var\" 3050518bcf38Smrg new_libs= 3051518bcf38Smrg for deplib in $tmp_libs; do 3052518bcf38Smrg # FIXME: Pedantically, this is the right thing to do, so 3053518bcf38Smrg # that some nasty dependency loop isn't accidentally 3054518bcf38Smrg # broken: 3055518bcf38Smrg #new_libs="$deplib $new_libs" 3056518bcf38Smrg # Pragmatically, this seems to cause very few problems in 3057518bcf38Smrg # practice: 3058518bcf38Smrg case $deplib in 3059518bcf38Smrg -L*) new_libs="$deplib $new_libs" ;; 3060518bcf38Smrg -R*) ;; 3061518bcf38Smrg *) 3062518bcf38Smrg # And here is the reason: when a library appears more 3063518bcf38Smrg # than once as an explicit dependence of a library, or 3064518bcf38Smrg # is implicitly linked in more than once by the 3065518bcf38Smrg # compiler, it is considered special, and multiple 3066518bcf38Smrg # occurrences thereof are not removed. Compare this 3067518bcf38Smrg # with having the same library being listed as a 3068518bcf38Smrg # dependency of multiple other libraries: in this case, 3069518bcf38Smrg # we know (pedantically, we assume) the library does not 3070518bcf38Smrg # need to be listed more than once, so we keep only the 3071518bcf38Smrg # last copy. This is not always right, but it is rare 3072518bcf38Smrg # enough that we require users that really mean to play 3073518bcf38Smrg # such unportable linking tricks to link the library 3074518bcf38Smrg # using -Wl,-lname, so that libtool does not consider it 3075518bcf38Smrg # for duplicate removal. 3076518bcf38Smrg case " $specialdeplibs " in 3077518bcf38Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 3078518bcf38Smrg *) 3079518bcf38Smrg case " $new_libs " in 3080518bcf38Smrg *" $deplib "*) ;; 3081518bcf38Smrg *) new_libs="$deplib $new_libs" ;; 3082518bcf38Smrg esac 3083518bcf38Smrg ;; 3084518bcf38Smrg esac 3085518bcf38Smrg ;; 3086518bcf38Smrg esac 3087518bcf38Smrg done 3088518bcf38Smrg tmp_libs= 3089518bcf38Smrg for deplib in $new_libs; do 3090518bcf38Smrg case $deplib in 3091518bcf38Smrg -L*) 3092518bcf38Smrg case " $tmp_libs " in 3093518bcf38Smrg *" $deplib "*) ;; 3094518bcf38Smrg *) tmp_libs="$tmp_libs $deplib" ;; 3095518bcf38Smrg esac 3096518bcf38Smrg ;; 3097518bcf38Smrg *) tmp_libs="$tmp_libs $deplib" ;; 3098518bcf38Smrg esac 3099518bcf38Smrg done 3100518bcf38Smrg eval $var=\"$tmp_libs\" 3101518bcf38Smrg done # for var 3102518bcf38Smrg fi 3103518bcf38Smrg # Last step: remove runtime libs from dependency_libs 3104518bcf38Smrg # (they stay in deplibs) 3105518bcf38Smrg tmp_libs= 3106518bcf38Smrg for i in $dependency_libs ; do 3107518bcf38Smrg case " $predeps $postdeps $compiler_lib_search_path " in 3108518bcf38Smrg *" $i "*) 3109518bcf38Smrg i="" 3110c35d236eSmrg ;; 3111c35d236eSmrg esac 3112518bcf38Smrg if test -n "$i" ; then 3113518bcf38Smrg tmp_libs="$tmp_libs $i" 3114518bcf38Smrg fi 3115518bcf38Smrg done 3116518bcf38Smrg dependency_libs=$tmp_libs 3117518bcf38Smrg done # for pass 3118518bcf38Smrg if test "$linkmode" = prog; then 3119518bcf38Smrg dlfiles="$newdlfiles" 3120518bcf38Smrg dlprefiles="$newdlprefiles" 3121f55e6a01Smrg fi 3122c35d236eSmrg 3123518bcf38Smrg case $linkmode in 3124518bcf38Smrg oldlib) 3125518bcf38Smrg case " $deplibs" in 3126518bcf38Smrg *\ -l* | *\ -L*) 3127518bcf38Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 3128518bcf38Smrg esac 3129c35d236eSmrg 3130518bcf38Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3131518bcf38Smrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 3132518bcf38Smrg fi 3133c35d236eSmrg 3134518bcf38Smrg if test -n "$rpath"; then 3135518bcf38Smrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 3136518bcf38Smrg fi 3137c35d236eSmrg 3138518bcf38Smrg if test -n "$xrpath"; then 3139518bcf38Smrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 3140518bcf38Smrg fi 3141c35d236eSmrg 3142518bcf38Smrg if test -n "$vinfo"; then 3143518bcf38Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 3144518bcf38Smrg fi 3145c35d236eSmrg 3146518bcf38Smrg if test -n "$release"; then 3147518bcf38Smrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 3148518bcf38Smrg fi 3149c35d236eSmrg 3150518bcf38Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3151518bcf38Smrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 3152518bcf38Smrg fi 3153c35d236eSmrg 3154518bcf38Smrg # Now set the variables for building old libraries. 3155518bcf38Smrg build_libtool_libs=no 3156518bcf38Smrg oldlibs="$output" 3157518bcf38Smrg objs="$objs$old_deplibs" 3158518bcf38Smrg ;; 3159c35d236eSmrg 3160518bcf38Smrg lib) 3161518bcf38Smrg # Make sure we only generate libraries of the form `libNAME.la'. 3162518bcf38Smrg case $outputname in 3163518bcf38Smrg lib*) 3164518bcf38Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 3165518bcf38Smrg eval shared_ext=\"$shrext_cmds\" 3166518bcf38Smrg eval libname=\"$libname_spec\" 3167518bcf38Smrg ;; 3168518bcf38Smrg *) 3169518bcf38Smrg if test "$module" = no; then 3170518bcf38Smrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 3171518bcf38Smrg $echo "$help" 1>&2 3172518bcf38Smrg exit $EXIT_FAILURE 3173518bcf38Smrg fi 3174518bcf38Smrg if test "$need_lib_prefix" != no; then 3175518bcf38Smrg # Add the "lib" prefix for modules if required 3176518bcf38Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3177518bcf38Smrg eval shared_ext=\"$shrext_cmds\" 3178518bcf38Smrg eval libname=\"$libname_spec\" 3179518bcf38Smrg else 3180518bcf38Smrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3181518bcf38Smrg fi 3182518bcf38Smrg ;; 3183518bcf38Smrg esac 3184c35d236eSmrg 3185518bcf38Smrg if test -n "$objs"; then 3186518bcf38Smrg if test "$deplibs_check_method" != pass_all; then 3187518bcf38Smrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 3188518bcf38Smrg exit $EXIT_FAILURE 3189518bcf38Smrg else 3190518bcf38Smrg $echo 3191518bcf38Smrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 3192518bcf38Smrg $echo "*** objects $objs is not portable!" 3193518bcf38Smrg libobjs="$libobjs $objs" 3194518bcf38Smrg fi 3195518bcf38Smrg fi 3196f55e6a01Smrg 3197518bcf38Smrg if test "$dlself" != no; then 3198518bcf38Smrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 3199518bcf38Smrg fi 3200f55e6a01Smrg 3201518bcf38Smrg set dummy $rpath 3202518bcf38Smrg if test "$#" -gt 2; then 3203518bcf38Smrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 3204518bcf38Smrg fi 3205518bcf38Smrg install_libdir="$2" 3206f55e6a01Smrg 3207518bcf38Smrg oldlibs= 3208518bcf38Smrg if test -z "$rpath"; then 3209518bcf38Smrg if test "$build_libtool_libs" = yes; then 3210518bcf38Smrg # Building a libtool convenience library. 3211518bcf38Smrg # Some compilers have problems with a `.al' extension so 3212518bcf38Smrg # convenience libraries should have the same extension an 3213518bcf38Smrg # archive normally would. 3214518bcf38Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 3215518bcf38Smrg build_libtool_libs=convenience 3216518bcf38Smrg build_old_libs=yes 3217518bcf38Smrg fi 3218f55e6a01Smrg 3219518bcf38Smrg if test -n "$vinfo"; then 3220518bcf38Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 3221518bcf38Smrg fi 3222f55e6a01Smrg 3223518bcf38Smrg if test -n "$release"; then 3224518bcf38Smrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 3225518bcf38Smrg fi 3226518bcf38Smrg else 3227f55e6a01Smrg 3228518bcf38Smrg # Parse the version information argument. 3229518bcf38Smrg save_ifs="$IFS"; IFS=':' 3230518bcf38Smrg set dummy $vinfo 0 0 0 3231518bcf38Smrg IFS="$save_ifs" 3232f55e6a01Smrg 3233518bcf38Smrg if test -n "$8"; then 3234518bcf38Smrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 3235518bcf38Smrg $echo "$help" 1>&2 3236518bcf38Smrg exit $EXIT_FAILURE 3237518bcf38Smrg fi 3238f55e6a01Smrg 3239518bcf38Smrg # convert absolute version numbers to libtool ages 3240518bcf38Smrg # this retains compatibility with .la files and attempts 3241518bcf38Smrg # to make the code below a bit more comprehensible 3242f55e6a01Smrg 3243518bcf38Smrg case $vinfo_number in 3244518bcf38Smrg yes) 3245518bcf38Smrg number_major="$2" 3246518bcf38Smrg number_minor="$3" 3247518bcf38Smrg number_revision="$4" 3248518bcf38Smrg # 3249518bcf38Smrg # There are really only two kinds -- those that 3250518bcf38Smrg # use the current revision as the major version 3251518bcf38Smrg # and those that subtract age and use age as 3252518bcf38Smrg # a minor version. But, then there is irix 3253518bcf38Smrg # which has an extra 1 added just for fun 3254518bcf38Smrg # 3255518bcf38Smrg case $version_type in 3256518bcf38Smrg darwin|linux|osf|windows|none) 3257518bcf38Smrg current=`expr $number_major + $number_minor` 3258518bcf38Smrg age="$number_minor" 3259518bcf38Smrg revision="$number_revision" 3260518bcf38Smrg ;; 3261518bcf38Smrg freebsd-aout|freebsd-elf|sunos) 3262518bcf38Smrg current="$number_major" 3263518bcf38Smrg revision="$number_minor" 3264518bcf38Smrg age="0" 3265518bcf38Smrg ;; 3266518bcf38Smrg irix|nonstopux) 3267518bcf38Smrg current=`expr $number_major + $number_minor` 3268518bcf38Smrg age="$number_minor" 3269518bcf38Smrg revision="$number_minor" 3270518bcf38Smrg lt_irix_increment=no 3271518bcf38Smrg ;; 3272518bcf38Smrg esac 3273518bcf38Smrg ;; 3274518bcf38Smrg no) 3275518bcf38Smrg current="$2" 3276518bcf38Smrg revision="$3" 3277518bcf38Smrg age="$4" 3278518bcf38Smrg ;; 3279518bcf38Smrg esac 3280f55e6a01Smrg 3281518bcf38Smrg # Check that each of the things are valid numbers. 3282518bcf38Smrg case $current in 3283518bcf38Smrg 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]) ;; 3284518bcf38Smrg *) 3285518bcf38Smrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 3286518bcf38Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3287518bcf38Smrg exit $EXIT_FAILURE 3288518bcf38Smrg ;; 3289518bcf38Smrg esac 3290f55e6a01Smrg 3291518bcf38Smrg case $revision in 3292518bcf38Smrg 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]) ;; 3293518bcf38Smrg *) 3294518bcf38Smrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 3295518bcf38Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3296518bcf38Smrg exit $EXIT_FAILURE 3297518bcf38Smrg ;; 3298518bcf38Smrg esac 3299f55e6a01Smrg 3300518bcf38Smrg case $age in 3301518bcf38Smrg 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]) ;; 3302518bcf38Smrg *) 3303518bcf38Smrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 3304518bcf38Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3305518bcf38Smrg exit $EXIT_FAILURE 3306518bcf38Smrg ;; 3307518bcf38Smrg esac 3308f55e6a01Smrg 3309518bcf38Smrg if test "$age" -gt "$current"; then 3310518bcf38Smrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 3311518bcf38Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3312518bcf38Smrg exit $EXIT_FAILURE 3313518bcf38Smrg fi 3314f55e6a01Smrg 3315518bcf38Smrg # Calculate the version variables. 3316518bcf38Smrg major= 3317518bcf38Smrg versuffix= 3318518bcf38Smrg verstring= 3319518bcf38Smrg case $version_type in 3320518bcf38Smrg none) ;; 3321f55e6a01Smrg 3322518bcf38Smrg darwin) 3323518bcf38Smrg # Like Linux, but with the current version available in 3324518bcf38Smrg # verstring for coding it into the library header 3325518bcf38Smrg major=.`expr $current - $age` 3326518bcf38Smrg versuffix="$major.$age.$revision" 3327518bcf38Smrg # Darwin ld doesn't like 0 for these options... 3328518bcf38Smrg minor_current=`expr $current + 1` 3329518bcf38Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 3330518bcf38Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 3331518bcf38Smrg ;; 3332f55e6a01Smrg 3333518bcf38Smrg freebsd-aout) 3334518bcf38Smrg major=".$current" 3335518bcf38Smrg versuffix=".$current.$revision"; 3336518bcf38Smrg ;; 3337f55e6a01Smrg 3338518bcf38Smrg freebsd-elf) 3339518bcf38Smrg major=".$current" 3340518bcf38Smrg versuffix=".$current"; 3341518bcf38Smrg ;; 3342f55e6a01Smrg 3343518bcf38Smrg irix | nonstopux) 3344518bcf38Smrg if test "X$lt_irix_increment" = "Xno"; then 3345518bcf38Smrg major=`expr $current - $age` 3346518bcf38Smrg else 3347518bcf38Smrg major=`expr $current - $age + 1` 3348518bcf38Smrg fi 3349518bcf38Smrg case $version_type in 3350518bcf38Smrg nonstopux) verstring_prefix=nonstopux ;; 3351518bcf38Smrg *) verstring_prefix=sgi ;; 3352518bcf38Smrg esac 3353518bcf38Smrg verstring="$verstring_prefix$major.$revision" 3354c35d236eSmrg 3355518bcf38Smrg # Add in all the interfaces that we are compatible with. 3356518bcf38Smrg loop=$revision 3357518bcf38Smrg while test "$loop" -ne 0; do 3358518bcf38Smrg iface=`expr $revision - $loop` 3359518bcf38Smrg loop=`expr $loop - 1` 3360518bcf38Smrg verstring="$verstring_prefix$major.$iface:$verstring" 3361518bcf38Smrg done 3362c35d236eSmrg 3363518bcf38Smrg # Before this point, $major must not contain `.'. 3364518bcf38Smrg major=.$major 3365518bcf38Smrg versuffix="$major.$revision" 3366518bcf38Smrg ;; 3367c35d236eSmrg 3368518bcf38Smrg linux) 3369518bcf38Smrg major=.`expr $current - $age` 3370518bcf38Smrg versuffix="$major.$age.$revision" 3371518bcf38Smrg ;; 3372c35d236eSmrg 3373518bcf38Smrg osf) 3374518bcf38Smrg major=.`expr $current - $age` 3375518bcf38Smrg versuffix=".$current.$age.$revision" 3376518bcf38Smrg verstring="$current.$age.$revision" 3377c35d236eSmrg 3378518bcf38Smrg # Add in all the interfaces that we are compatible with. 3379518bcf38Smrg loop=$age 3380518bcf38Smrg while test "$loop" -ne 0; do 3381518bcf38Smrg iface=`expr $current - $loop` 3382518bcf38Smrg loop=`expr $loop - 1` 3383518bcf38Smrg verstring="$verstring:${iface}.0" 3384518bcf38Smrg done 3385c35d236eSmrg 3386518bcf38Smrg # Make executables depend on our current version. 3387518bcf38Smrg verstring="$verstring:${current}.0" 3388518bcf38Smrg ;; 3389c35d236eSmrg 3390518bcf38Smrg sunos) 3391518bcf38Smrg major=".$current" 3392518bcf38Smrg versuffix=".$current.$revision" 3393518bcf38Smrg ;; 3394c35d236eSmrg 3395518bcf38Smrg windows) 3396518bcf38Smrg # Use '-' rather than '.', since we only want one 3397518bcf38Smrg # extension on DOS 8.3 filesystems. 3398518bcf38Smrg major=`expr $current - $age` 3399518bcf38Smrg versuffix="-$major" 3400518bcf38Smrg ;; 3401c35d236eSmrg 3402518bcf38Smrg *) 3403518bcf38Smrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 3404518bcf38Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 3405518bcf38Smrg exit $EXIT_FAILURE 3406518bcf38Smrg ;; 3407518bcf38Smrg esac 3408c35d236eSmrg 3409518bcf38Smrg # Clear the version info if we defaulted, and they specified a release. 3410518bcf38Smrg if test -z "$vinfo" && test -n "$release"; then 3411518bcf38Smrg major= 3412518bcf38Smrg case $version_type in 3413518bcf38Smrg darwin) 3414518bcf38Smrg # we can't check for "0.0" in archive_cmds due to quoting 3415518bcf38Smrg # problems, so we reset it completely 3416518bcf38Smrg verstring= 3417f55e6a01Smrg ;; 3418518bcf38Smrg *) 3419518bcf38Smrg verstring="0.0" 3420518bcf38Smrg ;; 3421518bcf38Smrg esac 3422518bcf38Smrg if test "$need_version" = no; then 3423518bcf38Smrg versuffix= 3424518bcf38Smrg else 3425518bcf38Smrg versuffix=".0.0" 3426518bcf38Smrg fi 3427518bcf38Smrg fi 3428c35d236eSmrg 3429518bcf38Smrg # Remove version info from name if versioning should be avoided 3430518bcf38Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 3431518bcf38Smrg major= 3432518bcf38Smrg versuffix= 3433518bcf38Smrg verstring="" 3434518bcf38Smrg fi 3435c35d236eSmrg 3436518bcf38Smrg # Check to see if the archive will have undefined symbols. 3437518bcf38Smrg if test "$allow_undefined" = yes; then 3438518bcf38Smrg if test "$allow_undefined_flag" = unsupported; then 3439518bcf38Smrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 3440518bcf38Smrg build_libtool_libs=no 3441518bcf38Smrg build_old_libs=yes 3442518bcf38Smrg fi 3443518bcf38Smrg else 3444518bcf38Smrg # Don't allow undefined symbols. 3445518bcf38Smrg allow_undefined_flag="$no_undefined_flag" 3446518bcf38Smrg fi 3447518bcf38Smrg fi 3448c35d236eSmrg 3449518bcf38Smrg if test "$mode" != relink; then 3450518bcf38Smrg # Remove our outputs, but don't remove object files since they 3451518bcf38Smrg # may have been created when compiling PIC objects. 3452518bcf38Smrg removelist= 3453518bcf38Smrg tempremovelist=`$echo "$output_objdir/*"` 3454518bcf38Smrg for p in $tempremovelist; do 3455518bcf38Smrg case $p in 3456518bcf38Smrg *.$objext) 3457518bcf38Smrg ;; 3458518bcf38Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 3459518bcf38Smrg if test "X$precious_files_regex" != "X"; then 3460518bcf38Smrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 3461518bcf38Smrg then 3462518bcf38Smrg continue 3463518bcf38Smrg fi 3464518bcf38Smrg fi 3465518bcf38Smrg removelist="$removelist $p" 3466518bcf38Smrg ;; 3467518bcf38Smrg *) ;; 3468518bcf38Smrg esac 3469518bcf38Smrg done 3470518bcf38Smrg if test -n "$removelist"; then 3471518bcf38Smrg $show "${rm}r $removelist" 3472518bcf38Smrg $run ${rm}r $removelist 3473518bcf38Smrg fi 3474518bcf38Smrg fi 3475c35d236eSmrg 3476518bcf38Smrg # Now set the variables for building old libraries. 3477518bcf38Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 3478518bcf38Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 3479c35d236eSmrg 3480518bcf38Smrg # Transform .lo files to .o files. 3481518bcf38Smrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3482518bcf38Smrg fi 3483c35d236eSmrg 3484518bcf38Smrg # Eliminate all temporary directories. 3485518bcf38Smrg #for path in $notinst_path; do 3486518bcf38Smrg # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 3487518bcf38Smrg # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 3488518bcf38Smrg # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 3489518bcf38Smrg #done 3490c35d236eSmrg 3491518bcf38Smrg if test -n "$xrpath"; then 3492518bcf38Smrg # If the user specified any rpath flags, then add them. 3493518bcf38Smrg temp_xrpath= 3494518bcf38Smrg for libdir in $xrpath; do 3495518bcf38Smrg temp_xrpath="$temp_xrpath -R$libdir" 3496518bcf38Smrg case "$finalize_rpath " in 3497518bcf38Smrg *" $libdir "*) ;; 3498518bcf38Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 3499518bcf38Smrg esac 3500518bcf38Smrg done 3501518bcf38Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 3502518bcf38Smrg dependency_libs="$temp_xrpath $dependency_libs" 3503518bcf38Smrg fi 3504518bcf38Smrg fi 3505c35d236eSmrg 3506518bcf38Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 3507518bcf38Smrg old_dlfiles="$dlfiles" 3508518bcf38Smrg dlfiles= 3509518bcf38Smrg for lib in $old_dlfiles; do 3510518bcf38Smrg case " $dlprefiles $dlfiles " in 3511518bcf38Smrg *" $lib "*) ;; 3512518bcf38Smrg *) dlfiles="$dlfiles $lib" ;; 3513518bcf38Smrg esac 3514518bcf38Smrg done 3515c35d236eSmrg 3516518bcf38Smrg # Make sure dlprefiles contains only unique files 3517518bcf38Smrg old_dlprefiles="$dlprefiles" 3518518bcf38Smrg dlprefiles= 3519518bcf38Smrg for lib in $old_dlprefiles; do 3520518bcf38Smrg case "$dlprefiles " in 3521518bcf38Smrg *" $lib "*) ;; 3522518bcf38Smrg *) dlprefiles="$dlprefiles $lib" ;; 3523518bcf38Smrg esac 3524518bcf38Smrg done 3525c35d236eSmrg 3526518bcf38Smrg if test "$build_libtool_libs" = yes; then 3527518bcf38Smrg if test -n "$rpath"; then 3528518bcf38Smrg case $host in 3529518bcf38Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 3530518bcf38Smrg # these systems don't actually have a c library (as such)! 3531518bcf38Smrg ;; 3532518bcf38Smrg *-*-rhapsody* | *-*-darwin1.[012]) 3533518bcf38Smrg # Rhapsody C library is in the System framework 3534518bcf38Smrg deplibs="$deplibs -framework System" 3535518bcf38Smrg ;; 3536518bcf38Smrg *-*-netbsd*) 3537518bcf38Smrg # Don't link with libc until the a.out ld.so is fixed. 3538518bcf38Smrg ;; 3539518bcf38Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3540518bcf38Smrg # Do not include libc due to us having libc/libc_r. 3541518bcf38Smrg ;; 3542518bcf38Smrg *-*-sco3.2v5* | *-*-sco5v6*) 3543518bcf38Smrg # Causes problems with __ctype 3544518bcf38Smrg ;; 3545518bcf38Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 3546518bcf38Smrg # Compiler inserts libc in the correct place for threads to work 3547518bcf38Smrg ;; 3548518bcf38Smrg *) 3549518bcf38Smrg # Add libc to deplibs on all other systems if necessary. 3550518bcf38Smrg if test "$build_libtool_need_lc" = "yes"; then 3551518bcf38Smrg deplibs="$deplibs -lc" 3552518bcf38Smrg fi 3553518bcf38Smrg ;; 3554518bcf38Smrg esac 3555518bcf38Smrg fi 3556c35d236eSmrg 3557518bcf38Smrg # Transform deplibs into only deplibs that can be linked in shared. 3558518bcf38Smrg name_save=$name 3559518bcf38Smrg libname_save=$libname 3560518bcf38Smrg release_save=$release 3561518bcf38Smrg versuffix_save=$versuffix 3562518bcf38Smrg major_save=$major 3563518bcf38Smrg # I'm not sure if I'm treating the release correctly. I think 3564518bcf38Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 3565518bcf38Smrg # add it in twice. Is that correct? 3566518bcf38Smrg release="" 3567518bcf38Smrg versuffix="" 3568518bcf38Smrg major="" 3569518bcf38Smrg newdeplibs= 3570518bcf38Smrg droppeddeps=no 3571518bcf38Smrg case $deplibs_check_method in 3572518bcf38Smrg pass_all) 3573518bcf38Smrg # Don't check for shared/static. Everything works. 3574518bcf38Smrg # This might be a little naive. We might want to check 3575518bcf38Smrg # whether the library exists or not. But this is on 3576518bcf38Smrg # osf3 & osf4 and I'm not really sure... Just 3577518bcf38Smrg # implementing what was already the behavior. 3578518bcf38Smrg newdeplibs=$deplibs 3579518bcf38Smrg ;; 3580518bcf38Smrg test_compile) 3581518bcf38Smrg # This code stresses the "libraries are programs" paradigm to its 3582518bcf38Smrg # limits. Maybe even breaks it. We compile a program, linking it 3583518bcf38Smrg # against the deplibs as a proxy for the library. Then we can check 3584518bcf38Smrg # whether they linked in statically or dynamically with ldd. 3585518bcf38Smrg $rm conftest.c 3586518bcf38Smrg cat > conftest.c <<EOF 3587518bcf38Smrg int main() { return 0; } 3588518bcf38SmrgEOF 3589518bcf38Smrg $rm conftest 3590518bcf38Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 3591518bcf38Smrg ldd_output=`ldd conftest` 3592518bcf38Smrg for i in $deplibs; do 3593518bcf38Smrg name=`expr $i : '-l\(.*\)'` 3594518bcf38Smrg # If $name is empty we are operating on a -L argument. 3595518bcf38Smrg if test "$name" != "" && test "$name" != "0"; then 3596518bcf38Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3597518bcf38Smrg case " $predeps $postdeps " in 3598518bcf38Smrg *" $i "*) 3599518bcf38Smrg newdeplibs="$newdeplibs $i" 3600518bcf38Smrg i="" 3601518bcf38Smrg ;; 3602518bcf38Smrg esac 3603518bcf38Smrg fi 3604518bcf38Smrg if test -n "$i" ; then 3605518bcf38Smrg libname=`eval \\$echo \"$libname_spec\"` 3606518bcf38Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 3607518bcf38Smrg set dummy $deplib_matches 3608518bcf38Smrg deplib_match=$2 3609518bcf38Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3610518bcf38Smrg newdeplibs="$newdeplibs $i" 3611518bcf38Smrg else 3612518bcf38Smrg droppeddeps=yes 3613518bcf38Smrg $echo 3614518bcf38Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 3615518bcf38Smrg $echo "*** I have the capability to make that library automatically link in when" 3616518bcf38Smrg $echo "*** you link to this library. But I can only do this if you have a" 3617518bcf38Smrg $echo "*** shared version of the library, which I believe you do not have" 3618518bcf38Smrg $echo "*** because a test_compile did reveal that the linker did not use it for" 3619518bcf38Smrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 3620518bcf38Smrg fi 3621518bcf38Smrg fi 3622518bcf38Smrg else 3623518bcf38Smrg newdeplibs="$newdeplibs $i" 3624518bcf38Smrg fi 3625518bcf38Smrg done 3626518bcf38Smrg else 3627518bcf38Smrg # Error occurred in the first compile. Let's try to salvage 3628518bcf38Smrg # the situation: Compile a separate program for each library. 3629518bcf38Smrg for i in $deplibs; do 3630518bcf38Smrg name=`expr $i : '-l\(.*\)'` 3631518bcf38Smrg # If $name is empty we are operating on a -L argument. 3632518bcf38Smrg if test "$name" != "" && test "$name" != "0"; then 3633518bcf38Smrg $rm conftest 3634518bcf38Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 3635518bcf38Smrg ldd_output=`ldd conftest` 3636518bcf38Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3637518bcf38Smrg case " $predeps $postdeps " in 3638518bcf38Smrg *" $i "*) 3639518bcf38Smrg newdeplibs="$newdeplibs $i" 3640518bcf38Smrg i="" 3641518bcf38Smrg ;; 3642518bcf38Smrg esac 3643518bcf38Smrg fi 3644518bcf38Smrg if test -n "$i" ; then 3645518bcf38Smrg libname=`eval \\$echo \"$libname_spec\"` 3646518bcf38Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 3647518bcf38Smrg set dummy $deplib_matches 3648518bcf38Smrg deplib_match=$2 3649518bcf38Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3650518bcf38Smrg newdeplibs="$newdeplibs $i" 3651518bcf38Smrg else 3652518bcf38Smrg droppeddeps=yes 3653518bcf38Smrg $echo 3654518bcf38Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 3655518bcf38Smrg $echo "*** I have the capability to make that library automatically link in when" 3656518bcf38Smrg $echo "*** you link to this library. But I can only do this if you have a" 3657518bcf38Smrg $echo "*** shared version of the library, which you do not appear to have" 3658518bcf38Smrg $echo "*** because a test_compile did reveal that the linker did not use this one" 3659518bcf38Smrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 3660518bcf38Smrg fi 3661518bcf38Smrg fi 3662518bcf38Smrg else 3663518bcf38Smrg droppeddeps=yes 3664518bcf38Smrg $echo 3665518bcf38Smrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 3666518bcf38Smrg $echo "*** make it link in! You will probably need to install it or some" 3667518bcf38Smrg $echo "*** library that it depends on before this library will be fully" 3668518bcf38Smrg $echo "*** functional. Installing it before continuing would be even better." 3669518bcf38Smrg fi 3670518bcf38Smrg else 3671518bcf38Smrg newdeplibs="$newdeplibs $i" 3672518bcf38Smrg fi 3673518bcf38Smrg done 3674518bcf38Smrg fi 3675518bcf38Smrg ;; 3676518bcf38Smrg file_magic*) 3677518bcf38Smrg set dummy $deplibs_check_method 3678518bcf38Smrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3679518bcf38Smrg for a_deplib in $deplibs; do 3680518bcf38Smrg name=`expr $a_deplib : '-l\(.*\)'` 3681518bcf38Smrg # If $name is empty we are operating on a -L argument. 3682518bcf38Smrg if test "$name" != "" && test "$name" != "0"; then 3683518bcf38Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3684518bcf38Smrg case " $predeps $postdeps " in 3685518bcf38Smrg *" $a_deplib "*) 3686518bcf38Smrg newdeplibs="$newdeplibs $a_deplib" 3687518bcf38Smrg a_deplib="" 3688518bcf38Smrg ;; 3689518bcf38Smrg esac 3690518bcf38Smrg fi 3691518bcf38Smrg if test -n "$a_deplib" ; then 3692518bcf38Smrg libname=`eval \\$echo \"$libname_spec\"` 3693518bcf38Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3694518bcf38Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3695518bcf38Smrg for potent_lib in $potential_libs; do 3696518bcf38Smrg # Follow soft links. 3697518bcf38Smrg if ls -lLd "$potent_lib" 2>/dev/null \ 3698518bcf38Smrg | grep " -> " >/dev/null; then 3699518bcf38Smrg continue 3700518bcf38Smrg fi 3701518bcf38Smrg # The statement above tries to avoid entering an 3702518bcf38Smrg # endless loop below, in case of cyclic links. 3703518bcf38Smrg # We might still enter an endless loop, since a link 3704518bcf38Smrg # loop can be closed while we follow links, 3705518bcf38Smrg # but so what? 3706518bcf38Smrg potlib="$potent_lib" 3707518bcf38Smrg while test -h "$potlib" 2>/dev/null; do 3708518bcf38Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 3709518bcf38Smrg case $potliblink in 3710518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 3711518bcf38Smrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 3712518bcf38Smrg esac 3713518bcf38Smrg done 3714518bcf38Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 3715518bcf38Smrg | ${SED} 10q \ 3716518bcf38Smrg | $EGREP "$file_magic_regex" > /dev/null; then 3717518bcf38Smrg newdeplibs="$newdeplibs $a_deplib" 3718518bcf38Smrg a_deplib="" 3719518bcf38Smrg break 2 3720518bcf38Smrg fi 3721518bcf38Smrg done 3722518bcf38Smrg done 3723518bcf38Smrg fi 3724518bcf38Smrg if test -n "$a_deplib" ; then 3725518bcf38Smrg droppeddeps=yes 3726518bcf38Smrg $echo 3727518bcf38Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 3728518bcf38Smrg $echo "*** I have the capability to make that library automatically link in when" 3729518bcf38Smrg $echo "*** you link to this library. But I can only do this if you have a" 3730518bcf38Smrg $echo "*** shared version of the library, which you do not appear to have" 3731518bcf38Smrg $echo "*** because I did check the linker path looking for a file starting" 3732518bcf38Smrg if test -z "$potlib" ; then 3733518bcf38Smrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 3734518bcf38Smrg else 3735518bcf38Smrg $echo "*** with $libname and none of the candidates passed a file format test" 3736518bcf38Smrg $echo "*** using a file magic. Last file checked: $potlib" 3737518bcf38Smrg fi 3738518bcf38Smrg fi 3739518bcf38Smrg else 3740518bcf38Smrg # Add a -L argument. 3741518bcf38Smrg newdeplibs="$newdeplibs $a_deplib" 3742518bcf38Smrg fi 3743518bcf38Smrg done # Gone through all deplibs. 3744518bcf38Smrg ;; 3745518bcf38Smrg match_pattern*) 3746518bcf38Smrg set dummy $deplibs_check_method 3747518bcf38Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3748518bcf38Smrg for a_deplib in $deplibs; do 3749518bcf38Smrg name=`expr $a_deplib : '-l\(.*\)'` 3750518bcf38Smrg # If $name is empty we are operating on a -L argument. 3751518bcf38Smrg if test -n "$name" && test "$name" != "0"; then 3752518bcf38Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3753518bcf38Smrg case " $predeps $postdeps " in 3754518bcf38Smrg *" $a_deplib "*) 3755518bcf38Smrg newdeplibs="$newdeplibs $a_deplib" 3756518bcf38Smrg a_deplib="" 3757518bcf38Smrg ;; 3758518bcf38Smrg esac 3759518bcf38Smrg fi 3760518bcf38Smrg if test -n "$a_deplib" ; then 3761518bcf38Smrg libname=`eval \\$echo \"$libname_spec\"` 3762518bcf38Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3763518bcf38Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3764518bcf38Smrg for potent_lib in $potential_libs; do 3765518bcf38Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 3766518bcf38Smrg if eval $echo \"$potent_lib\" 2>/dev/null \ 3767518bcf38Smrg | ${SED} 10q \ 3768518bcf38Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 3769518bcf38Smrg newdeplibs="$newdeplibs $a_deplib" 3770518bcf38Smrg a_deplib="" 3771518bcf38Smrg break 2 3772518bcf38Smrg fi 3773518bcf38Smrg done 3774518bcf38Smrg done 3775518bcf38Smrg fi 3776518bcf38Smrg if test -n "$a_deplib" ; then 3777518bcf38Smrg droppeddeps=yes 3778518bcf38Smrg $echo 3779518bcf38Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 3780518bcf38Smrg $echo "*** I have the capability to make that library automatically link in when" 3781518bcf38Smrg $echo "*** you link to this library. But I can only do this if you have a" 3782518bcf38Smrg $echo "*** shared version of the library, which you do not appear to have" 3783518bcf38Smrg $echo "*** because I did check the linker path looking for a file starting" 3784518bcf38Smrg if test -z "$potlib" ; then 3785518bcf38Smrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 3786518bcf38Smrg else 3787518bcf38Smrg $echo "*** with $libname and none of the candidates passed a file format test" 3788518bcf38Smrg $echo "*** using a regex pattern. Last file checked: $potlib" 3789518bcf38Smrg fi 3790518bcf38Smrg fi 3791518bcf38Smrg else 3792518bcf38Smrg # Add a -L argument. 3793518bcf38Smrg newdeplibs="$newdeplibs $a_deplib" 3794518bcf38Smrg fi 3795518bcf38Smrg done # Gone through all deplibs. 3796518bcf38Smrg ;; 3797518bcf38Smrg none | unknown | *) 3798518bcf38Smrg newdeplibs="" 3799518bcf38Smrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 3800518bcf38Smrg -e 's/ -[LR][^ ]*//g'` 3801518bcf38Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3802518bcf38Smrg for i in $predeps $postdeps ; do 3803518bcf38Smrg # can't use Xsed below, because $i might contain '/' 3804518bcf38Smrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 3805518bcf38Smrg done 3806518bcf38Smrg fi 3807518bcf38Smrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 3808518bcf38Smrg | grep . >/dev/null; then 3809518bcf38Smrg $echo 3810518bcf38Smrg if test "X$deplibs_check_method" = "Xnone"; then 3811518bcf38Smrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 3812518bcf38Smrg else 3813518bcf38Smrg $echo "*** Warning: inter-library dependencies are not known to be supported." 3814518bcf38Smrg fi 3815518bcf38Smrg $echo "*** All declared inter-library dependencies are being dropped." 3816518bcf38Smrg droppeddeps=yes 3817518bcf38Smrg fi 3818518bcf38Smrg ;; 3819518bcf38Smrg esac 3820518bcf38Smrg versuffix=$versuffix_save 3821518bcf38Smrg major=$major_save 3822518bcf38Smrg release=$release_save 3823518bcf38Smrg libname=$libname_save 3824518bcf38Smrg name=$name_save 3825c35d236eSmrg 3826518bcf38Smrg case $host in 3827518bcf38Smrg *-*-rhapsody* | *-*-darwin1.[012]) 3828518bcf38Smrg # On Rhapsody replace the C library is the System framework 3829518bcf38Smrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 3830518bcf38Smrg ;; 3831518bcf38Smrg esac 3832c35d236eSmrg 3833518bcf38Smrg if test "$droppeddeps" = yes; then 3834518bcf38Smrg if test "$module" = yes; then 3835518bcf38Smrg $echo 3836518bcf38Smrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 3837518bcf38Smrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 3838518bcf38Smrg $echo "*** a static module, that should work as long as the dlopening" 3839518bcf38Smrg $echo "*** application is linked with the -dlopen flag." 3840518bcf38Smrg if test -z "$global_symbol_pipe"; then 3841518bcf38Smrg $echo 3842518bcf38Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 3843518bcf38Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 3844518bcf38Smrg $echo "*** not find such a program. So, this module is probably useless." 3845518bcf38Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 3846518bcf38Smrg fi 3847518bcf38Smrg if test "$build_old_libs" = no; then 3848518bcf38Smrg oldlibs="$output_objdir/$libname.$libext" 3849518bcf38Smrg build_libtool_libs=module 3850518bcf38Smrg build_old_libs=yes 3851518bcf38Smrg else 3852518bcf38Smrg build_libtool_libs=no 3853518bcf38Smrg fi 3854518bcf38Smrg else 3855518bcf38Smrg $echo "*** The inter-library dependencies that have been dropped here will be" 3856518bcf38Smrg $echo "*** automatically added whenever a program is linked with this library" 3857518bcf38Smrg $echo "*** or is declared to -dlopen it." 3858c35d236eSmrg 3859518bcf38Smrg if test "$allow_undefined" = no; then 3860518bcf38Smrg $echo 3861518bcf38Smrg $echo "*** Since this library must not contain undefined symbols," 3862518bcf38Smrg $echo "*** because either the platform does not support them or" 3863518bcf38Smrg $echo "*** it was explicitly requested with -no-undefined," 3864518bcf38Smrg $echo "*** libtool will only create a static version of it." 3865518bcf38Smrg if test "$build_old_libs" = no; then 3866518bcf38Smrg oldlibs="$output_objdir/$libname.$libext" 3867518bcf38Smrg build_libtool_libs=module 3868518bcf38Smrg build_old_libs=yes 3869518bcf38Smrg else 3870518bcf38Smrg build_libtool_libs=no 3871518bcf38Smrg fi 3872518bcf38Smrg fi 3873518bcf38Smrg fi 3874518bcf38Smrg fi 3875518bcf38Smrg # Done checking deplibs! 3876518bcf38Smrg deplibs=$newdeplibs 3877518bcf38Smrg fi 3878c35d236eSmrg 3879c35d236eSmrg 3880518bcf38Smrg # move library search paths that coincide with paths to not yet 3881518bcf38Smrg # installed libraries to the beginning of the library search list 3882518bcf38Smrg new_libs= 3883518bcf38Smrg for path in $notinst_path; do 3884518bcf38Smrg case " $new_libs " in 3885518bcf38Smrg *" -L$path/$objdir "*) ;; 3886518bcf38Smrg *) 3887518bcf38Smrg case " $deplibs " in 3888518bcf38Smrg *" -L$path/$objdir "*) 3889518bcf38Smrg new_libs="$new_libs -L$path/$objdir" ;; 3890518bcf38Smrg esac 3891518bcf38Smrg ;; 3892518bcf38Smrg esac 3893518bcf38Smrg done 3894518bcf38Smrg for deplib in $deplibs; do 3895518bcf38Smrg case $deplib in 3896518bcf38Smrg -L*) 3897518bcf38Smrg case " $new_libs " in 3898518bcf38Smrg *" $deplib "*) ;; 3899518bcf38Smrg *) new_libs="$new_libs $deplib" ;; 3900518bcf38Smrg esac 3901518bcf38Smrg ;; 3902518bcf38Smrg *) new_libs="$new_libs $deplib" ;; 3903518bcf38Smrg esac 3904518bcf38Smrg done 3905518bcf38Smrg deplibs="$new_libs" 3906c35d236eSmrg 3907c35d236eSmrg 3908518bcf38Smrg # All the library-specific variables (install_libdir is set above). 3909518bcf38Smrg library_names= 3910518bcf38Smrg old_library= 3911518bcf38Smrg dlname= 3912c35d236eSmrg 3913518bcf38Smrg # Test again, we may have decided not to build it any more 3914518bcf38Smrg if test "$build_libtool_libs" = yes; then 3915518bcf38Smrg if test "$hardcode_into_libs" = yes; then 3916518bcf38Smrg # Hardcode the library paths 3917518bcf38Smrg hardcode_libdirs= 3918518bcf38Smrg dep_rpath= 3919518bcf38Smrg rpath="$finalize_rpath" 3920518bcf38Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 3921518bcf38Smrg for libdir in $rpath; do 3922518bcf38Smrg if test -n "$hardcode_libdir_flag_spec"; then 3923518bcf38Smrg if test -n "$hardcode_libdir_separator"; then 3924518bcf38Smrg if test -z "$hardcode_libdirs"; then 3925518bcf38Smrg hardcode_libdirs="$libdir" 3926518bcf38Smrg else 3927518bcf38Smrg # Just accumulate the unique libdirs. 3928518bcf38Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3929518bcf38Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3930518bcf38Smrg ;; 3931518bcf38Smrg *) 3932518bcf38Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3933518bcf38Smrg ;; 3934518bcf38Smrg esac 3935518bcf38Smrg fi 3936518bcf38Smrg else 3937518bcf38Smrg eval flag=\"$hardcode_libdir_flag_spec\" 3938518bcf38Smrg dep_rpath="$dep_rpath $flag" 3939518bcf38Smrg fi 3940518bcf38Smrg elif test -n "$runpath_var"; then 3941518bcf38Smrg case "$perm_rpath " in 3942518bcf38Smrg *" $libdir "*) ;; 3943518bcf38Smrg *) perm_rpath="$perm_rpath $libdir" ;; 3944518bcf38Smrg esac 3945518bcf38Smrg fi 3946518bcf38Smrg done 3947518bcf38Smrg # Substitute the hardcoded libdirs into the rpath. 3948518bcf38Smrg if test -n "$hardcode_libdir_separator" && 3949518bcf38Smrg test -n "$hardcode_libdirs"; then 3950518bcf38Smrg libdir="$hardcode_libdirs" 3951518bcf38Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 3952518bcf38Smrg case $archive_cmds in 3953518bcf38Smrg *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 3954518bcf38Smrg *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 3955518bcf38Smrg esac 3956518bcf38Smrg else 3957518bcf38Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3958518bcf38Smrg fi 3959518bcf38Smrg fi 3960518bcf38Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 3961518bcf38Smrg # We should set the runpath_var. 3962518bcf38Smrg rpath= 3963518bcf38Smrg for dir in $perm_rpath; do 3964518bcf38Smrg rpath="$rpath$dir:" 3965518bcf38Smrg done 3966518bcf38Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3967518bcf38Smrg fi 3968518bcf38Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3969518bcf38Smrg fi 3970c35d236eSmrg 3971518bcf38Smrg shlibpath="$finalize_shlibpath" 3972518bcf38Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 3973518bcf38Smrg if test -n "$shlibpath"; then 3974518bcf38Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 3975518bcf38Smrg fi 3976c35d236eSmrg 3977518bcf38Smrg # Get the real and link names of the library. 3978518bcf38Smrg eval shared_ext=\"$shrext_cmds\" 3979518bcf38Smrg eval library_names=\"$library_names_spec\" 3980518bcf38Smrg set dummy $library_names 3981518bcf38Smrg realname="$2" 3982518bcf38Smrg shift; shift 3983c35d236eSmrg 3984518bcf38Smrg if test -n "$soname_spec"; then 3985518bcf38Smrg eval soname=\"$soname_spec\" 3986518bcf38Smrg else 3987518bcf38Smrg soname="$realname" 3988518bcf38Smrg fi 3989518bcf38Smrg if test -z "$dlname"; then 3990518bcf38Smrg dlname=$soname 3991518bcf38Smrg fi 3992c35d236eSmrg 3993518bcf38Smrg lib="$output_objdir/$realname" 3994518bcf38Smrg linknames= 3995518bcf38Smrg for link 3996518bcf38Smrg do 3997518bcf38Smrg linknames="$linknames $link" 3998518bcf38Smrg done 3999c35d236eSmrg 4000518bcf38Smrg # Use standard objects if they are pic 4001518bcf38Smrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4002c35d236eSmrg 4003518bcf38Smrg # Prepare the list of exported symbols 4004518bcf38Smrg if test -z "$export_symbols"; then 4005518bcf38Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 4006518bcf38Smrg $show "generating symbol list for \`$libname.la'" 4007518bcf38Smrg export_symbols="$output_objdir/$libname.exp" 4008518bcf38Smrg $run $rm $export_symbols 4009518bcf38Smrg cmds=$export_symbols_cmds 4010518bcf38Smrg save_ifs="$IFS"; IFS='~' 4011518bcf38Smrg for cmd in $cmds; do 4012518bcf38Smrg IFS="$save_ifs" 4013518bcf38Smrg eval cmd=\"$cmd\" 4014518bcf38Smrg if len=`expr "X$cmd" : ".*"` && 4015518bcf38Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4016518bcf38Smrg $show "$cmd" 4017518bcf38Smrg $run eval "$cmd" || exit $? 4018518bcf38Smrg skipped_export=false 4019518bcf38Smrg else 4020518bcf38Smrg # The command line is too long to execute in one step. 4021518bcf38Smrg $show "using reloadable object file for export list..." 4022518bcf38Smrg skipped_export=: 4023518bcf38Smrg # Break out early, otherwise skipped_export may be 4024518bcf38Smrg # set to false by a later but shorter cmd. 4025518bcf38Smrg break 4026518bcf38Smrg fi 4027518bcf38Smrg done 4028518bcf38Smrg IFS="$save_ifs" 4029518bcf38Smrg if test -n "$export_symbols_regex"; then 4030518bcf38Smrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 4031518bcf38Smrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 4032518bcf38Smrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 4033518bcf38Smrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 4034518bcf38Smrg fi 4035518bcf38Smrg fi 4036518bcf38Smrg fi 4037c35d236eSmrg 4038518bcf38Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 4039518bcf38Smrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 4040518bcf38Smrg fi 4041c35d236eSmrg 4042518bcf38Smrg tmp_deplibs= 4043518bcf38Smrg for test_deplib in $deplibs; do 4044518bcf38Smrg case " $convenience " in 4045518bcf38Smrg *" $test_deplib "*) ;; 4046518bcf38Smrg *) 4047518bcf38Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 4048518bcf38Smrg ;; 4049518bcf38Smrg esac 4050518bcf38Smrg done 4051518bcf38Smrg deplibs="$tmp_deplibs" 4052c35d236eSmrg 4053518bcf38Smrg if test -n "$convenience"; then 4054518bcf38Smrg if test -n "$whole_archive_flag_spec"; then 4055518bcf38Smrg save_libobjs=$libobjs 4056518bcf38Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4057518bcf38Smrg else 4058518bcf38Smrg gentop="$output_objdir/${outputname}x" 4059518bcf38Smrg generated="$generated $gentop" 4060c35d236eSmrg 4061518bcf38Smrg func_extract_archives $gentop $convenience 4062518bcf38Smrg libobjs="$libobjs $func_extract_archives_result" 4063518bcf38Smrg fi 4064518bcf38Smrg fi 4065518bcf38Smrg 4066518bcf38Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 4067518bcf38Smrg eval flag=\"$thread_safe_flag_spec\" 4068518bcf38Smrg linker_flags="$linker_flags $flag" 4069518bcf38Smrg fi 4070c35d236eSmrg 4071518bcf38Smrg # Make a backup of the uninstalled library when relinking 4072518bcf38Smrg if test "$mode" = relink; then 4073518bcf38Smrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 4074518bcf38Smrg fi 4075c35d236eSmrg 4076518bcf38Smrg # Do each of the archive commands. 4077518bcf38Smrg if test "$module" = yes && test -n "$module_cmds" ; then 4078518bcf38Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4079518bcf38Smrg eval test_cmds=\"$module_expsym_cmds\" 4080518bcf38Smrg cmds=$module_expsym_cmds 4081518bcf38Smrg else 4082518bcf38Smrg eval test_cmds=\"$module_cmds\" 4083518bcf38Smrg cmds=$module_cmds 4084518bcf38Smrg fi 4085518bcf38Smrg else 4086518bcf38Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4087518bcf38Smrg eval test_cmds=\"$archive_expsym_cmds\" 4088518bcf38Smrg cmds=$archive_expsym_cmds 4089518bcf38Smrg else 4090518bcf38Smrg eval test_cmds=\"$archive_cmds\" 4091518bcf38Smrg cmds=$archive_cmds 4092518bcf38Smrg fi 4093518bcf38Smrg fi 4094c35d236eSmrg 4095518bcf38Smrg if test "X$skipped_export" != "X:" && 4096518bcf38Smrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4097518bcf38Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4098518bcf38Smrg : 4099518bcf38Smrg else 4100518bcf38Smrg # The command line is too long to link in one step, link piecewise. 4101518bcf38Smrg $echo "creating reloadable object files..." 4102c35d236eSmrg 4103518bcf38Smrg # Save the value of $output and $libobjs because we want to 4104518bcf38Smrg # use them later. If we have whole_archive_flag_spec, we 4105518bcf38Smrg # want to use save_libobjs as it was before 4106518bcf38Smrg # whole_archive_flag_spec was expanded, because we can't 4107518bcf38Smrg # assume the linker understands whole_archive_flag_spec. 4108518bcf38Smrg # This may have to be revisited, in case too many 4109518bcf38Smrg # convenience libraries get linked in and end up exceeding 4110518bcf38Smrg # the spec. 4111518bcf38Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4112518bcf38Smrg save_libobjs=$libobjs 4113518bcf38Smrg fi 4114518bcf38Smrg save_output=$output 4115518bcf38Smrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 4116c35d236eSmrg 4117518bcf38Smrg # Clear the reloadable object creation command queue and 4118518bcf38Smrg # initialize k to one. 4119518bcf38Smrg test_cmds= 4120518bcf38Smrg concat_cmds= 4121518bcf38Smrg objlist= 4122518bcf38Smrg delfiles= 4123518bcf38Smrg last_robj= 4124518bcf38Smrg k=1 4125518bcf38Smrg output=$output_objdir/$output_la-${k}.$objext 4126518bcf38Smrg # Loop over the list of objects to be linked. 4127518bcf38Smrg for obj in $save_libobjs 4128518bcf38Smrg do 4129518bcf38Smrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4130518bcf38Smrg if test "X$objlist" = X || 4131518bcf38Smrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4132518bcf38Smrg test "$len" -le "$max_cmd_len"; }; then 4133518bcf38Smrg objlist="$objlist $obj" 4134518bcf38Smrg else 4135518bcf38Smrg # The command $test_cmds is almost too long, add a 4136518bcf38Smrg # command to the queue. 4137518bcf38Smrg if test "$k" -eq 1 ; then 4138518bcf38Smrg # The first file doesn't have a previous command to add. 4139518bcf38Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 4140518bcf38Smrg else 4141518bcf38Smrg # All subsequent reloadable object files will link in 4142518bcf38Smrg # the last one created. 4143518bcf38Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4144518bcf38Smrg fi 4145518bcf38Smrg last_robj=$output_objdir/$output_la-${k}.$objext 4146518bcf38Smrg k=`expr $k + 1` 4147518bcf38Smrg output=$output_objdir/$output_la-${k}.$objext 4148518bcf38Smrg objlist=$obj 4149518bcf38Smrg len=1 4150518bcf38Smrg fi 4151518bcf38Smrg done 4152518bcf38Smrg # Handle the remaining objects by creating one last 4153518bcf38Smrg # reloadable object file. All subsequent reloadable object 4154518bcf38Smrg # files will link in the last one created. 4155518bcf38Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4156518bcf38Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 4157518bcf38Smrg 4158518bcf38Smrg if ${skipped_export-false}; then 4159518bcf38Smrg $show "generating symbol list for \`$libname.la'" 4160518bcf38Smrg export_symbols="$output_objdir/$libname.exp" 4161518bcf38Smrg $run $rm $export_symbols 4162518bcf38Smrg libobjs=$output 4163518bcf38Smrg # Append the command to create the export file. 4164518bcf38Smrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4165518bcf38Smrg fi 4166518bcf38Smrg 4167518bcf38Smrg # Set up a command to remove the reloadable object files 4168518bcf38Smrg # after they are used. 4169518bcf38Smrg i=0 4170518bcf38Smrg while test "$i" -lt "$k" 4171518bcf38Smrg do 4172518bcf38Smrg i=`expr $i + 1` 4173518bcf38Smrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 4174518bcf38Smrg done 4175c35d236eSmrg 4176518bcf38Smrg $echo "creating a temporary reloadable object file: $output" 4177c35d236eSmrg 4178518bcf38Smrg # Loop through the commands generated above and execute them. 4179518bcf38Smrg save_ifs="$IFS"; IFS='~' 4180518bcf38Smrg for cmd in $concat_cmds; do 4181518bcf38Smrg IFS="$save_ifs" 4182518bcf38Smrg $show "$cmd" 4183518bcf38Smrg $run eval "$cmd" || exit $? 4184518bcf38Smrg done 4185518bcf38Smrg IFS="$save_ifs" 4186c35d236eSmrg 4187518bcf38Smrg libobjs=$output 4188518bcf38Smrg # Restore the value of output. 4189518bcf38Smrg output=$save_output 4190c35d236eSmrg 4191518bcf38Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 4192518bcf38Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4193518bcf38Smrg fi 4194518bcf38Smrg # Expand the library linking commands again to reset the 4195518bcf38Smrg # value of $libobjs for piecewise linking. 4196c35d236eSmrg 4197518bcf38Smrg # Do each of the archive commands. 4198518bcf38Smrg if test "$module" = yes && test -n "$module_cmds" ; then 4199518bcf38Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4200518bcf38Smrg cmds=$module_expsym_cmds 4201518bcf38Smrg else 4202518bcf38Smrg cmds=$module_cmds 4203518bcf38Smrg fi 4204518bcf38Smrg else 4205518bcf38Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4206518bcf38Smrg cmds=$archive_expsym_cmds 4207518bcf38Smrg else 4208518bcf38Smrg cmds=$archive_cmds 4209518bcf38Smrg fi 4210518bcf38Smrg fi 4211c35d236eSmrg 4212518bcf38Smrg # Append the command to remove the reloadable object files 4213518bcf38Smrg # to the just-reset $cmds. 4214518bcf38Smrg eval cmds=\"\$cmds~\$rm $delfiles\" 4215518bcf38Smrg fi 4216518bcf38Smrg save_ifs="$IFS"; IFS='~' 4217518bcf38Smrg for cmd in $cmds; do 4218518bcf38Smrg IFS="$save_ifs" 4219518bcf38Smrg eval cmd=\"$cmd\" 4220518bcf38Smrg $show "$cmd" 4221518bcf38Smrg $run eval "$cmd" || { 4222518bcf38Smrg lt_exit=$? 4223c35d236eSmrg 4224518bcf38Smrg # Restore the uninstalled library and exit 4225518bcf38Smrg if test "$mode" = relink; then 4226518bcf38Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 4227518bcf38Smrg fi 4228c35d236eSmrg 4229518bcf38Smrg exit $lt_exit 4230518bcf38Smrg } 4231518bcf38Smrg done 4232518bcf38Smrg IFS="$save_ifs" 4233518bcf38Smrg 4234518bcf38Smrg # Restore the uninstalled library and exit 4235518bcf38Smrg if test "$mode" = relink; then 4236518bcf38Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4237518bcf38Smrg 4238518bcf38Smrg if test -n "$convenience"; then 4239518bcf38Smrg if test -z "$whole_archive_flag_spec"; then 4240518bcf38Smrg $show "${rm}r $gentop" 4241518bcf38Smrg $run ${rm}r "$gentop" 4242518bcf38Smrg fi 4243518bcf38Smrg fi 4244518bcf38Smrg 4245518bcf38Smrg exit $EXIT_SUCCESS 4246518bcf38Smrg fi 4247518bcf38Smrg 4248518bcf38Smrg # Create links to the real library. 4249518bcf38Smrg for linkname in $linknames; do 4250518bcf38Smrg if test "$realname" != "$linkname"; then 4251518bcf38Smrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 4252518bcf38Smrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 4253518bcf38Smrg fi 4254518bcf38Smrg done 4255518bcf38Smrg 4256518bcf38Smrg # If -module or -export-dynamic was specified, set the dlname. 4257518bcf38Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 4258518bcf38Smrg # On all known operating systems, these are identical. 4259518bcf38Smrg dlname="$soname" 4260518bcf38Smrg fi 4261518bcf38Smrg fi 4262f55e6a01Smrg ;; 4263c35d236eSmrg 4264518bcf38Smrg obj) 4265518bcf38Smrg case " $deplibs" in 4266518bcf38Smrg *\ -l* | *\ -L*) 4267518bcf38Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 4268518bcf38Smrg esac 4269c35d236eSmrg 4270518bcf38Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4271518bcf38Smrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 4272518bcf38Smrg fi 4273c35d236eSmrg 4274518bcf38Smrg if test -n "$rpath"; then 4275518bcf38Smrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 4276518bcf38Smrg fi 4277518bcf38Smrg 4278518bcf38Smrg if test -n "$xrpath"; then 4279518bcf38Smrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 4280518bcf38Smrg fi 4281518bcf38Smrg 4282518bcf38Smrg if test -n "$vinfo"; then 4283518bcf38Smrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 4284518bcf38Smrg fi 4285518bcf38Smrg 4286518bcf38Smrg if test -n "$release"; then 4287518bcf38Smrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 4288518bcf38Smrg fi 4289518bcf38Smrg 4290518bcf38Smrg case $output in 4291518bcf38Smrg *.lo) 4292518bcf38Smrg if test -n "$objs$old_deplibs"; then 4293518bcf38Smrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 4294518bcf38Smrg exit $EXIT_FAILURE 4295518bcf38Smrg fi 4296518bcf38Smrg libobj="$output" 4297518bcf38Smrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 4298f55e6a01Smrg ;; 4299518bcf38Smrg *) 4300518bcf38Smrg libobj= 4301518bcf38Smrg obj="$output" 4302f55e6a01Smrg ;; 4303f55e6a01Smrg esac 4304c35d236eSmrg 4305518bcf38Smrg # Delete the old objects. 4306518bcf38Smrg $run $rm $obj $libobj 4307c35d236eSmrg 4308518bcf38Smrg # Objects from convenience libraries. This assumes 4309518bcf38Smrg # single-version convenience libraries. Whenever we create 4310518bcf38Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 4311518bcf38Smrg # the extraction. 4312518bcf38Smrg reload_conv_objs= 4313518bcf38Smrg gentop= 4314518bcf38Smrg # reload_cmds runs $LD directly, so let us get rid of 4315518bcf38Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 4316518bcf38Smrg # turning comma into space.. 4317518bcf38Smrg wl= 4318c35d236eSmrg 4319518bcf38Smrg if test -n "$convenience"; then 4320518bcf38Smrg if test -n "$whole_archive_flag_spec"; then 4321518bcf38Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 4322518bcf38Smrg reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 4323518bcf38Smrg else 4324518bcf38Smrg gentop="$output_objdir/${obj}x" 4325518bcf38Smrg generated="$generated $gentop" 4326c35d236eSmrg 4327518bcf38Smrg func_extract_archives $gentop $convenience 4328518bcf38Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 4329518bcf38Smrg fi 4330518bcf38Smrg fi 4331c35d236eSmrg 4332518bcf38Smrg # Create the old-style object. 4333518bcf38Smrg 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 4334c35d236eSmrg 4335518bcf38Smrg output="$obj" 4336518bcf38Smrg cmds=$reload_cmds 4337518bcf38Smrg save_ifs="$IFS"; IFS='~' 4338518bcf38Smrg for cmd in $cmds; do 4339518bcf38Smrg IFS="$save_ifs" 4340518bcf38Smrg eval cmd=\"$cmd\" 4341518bcf38Smrg $show "$cmd" 4342518bcf38Smrg $run eval "$cmd" || exit $? 4343518bcf38Smrg done 4344518bcf38Smrg IFS="$save_ifs" 4345c35d236eSmrg 4346518bcf38Smrg # Exit if we aren't doing a library object file. 4347518bcf38Smrg if test -z "$libobj"; then 4348518bcf38Smrg if test -n "$gentop"; then 4349518bcf38Smrg $show "${rm}r $gentop" 4350518bcf38Smrg $run ${rm}r $gentop 4351518bcf38Smrg fi 4352c35d236eSmrg 4353518bcf38Smrg exit $EXIT_SUCCESS 4354518bcf38Smrg fi 4355c35d236eSmrg 4356518bcf38Smrg if test "$build_libtool_libs" != yes; then 4357518bcf38Smrg if test -n "$gentop"; then 4358518bcf38Smrg $show "${rm}r $gentop" 4359518bcf38Smrg $run ${rm}r $gentop 4360518bcf38Smrg fi 4361c35d236eSmrg 4362518bcf38Smrg # Create an invalid libtool object if no PIC, so that we don't 4363518bcf38Smrg # accidentally link it into a program. 4364518bcf38Smrg # $show "echo timestamp > $libobj" 4365518bcf38Smrg # $run eval "echo timestamp > $libobj" || exit $? 4366518bcf38Smrg exit $EXIT_SUCCESS 4367518bcf38Smrg fi 4368c35d236eSmrg 4369518bcf38Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 4370518bcf38Smrg # Only do commands if we really have different PIC objects. 4371518bcf38Smrg reload_objs="$libobjs $reload_conv_objs" 4372518bcf38Smrg output="$libobj" 4373518bcf38Smrg cmds=$reload_cmds 4374518bcf38Smrg save_ifs="$IFS"; IFS='~' 4375518bcf38Smrg for cmd in $cmds; do 4376518bcf38Smrg IFS="$save_ifs" 4377518bcf38Smrg eval cmd=\"$cmd\" 4378518bcf38Smrg $show "$cmd" 4379518bcf38Smrg $run eval "$cmd" || exit $? 4380518bcf38Smrg done 4381518bcf38Smrg IFS="$save_ifs" 4382518bcf38Smrg fi 4383c35d236eSmrg 4384518bcf38Smrg if test -n "$gentop"; then 4385518bcf38Smrg $show "${rm}r $gentop" 4386518bcf38Smrg $run ${rm}r $gentop 4387518bcf38Smrg fi 4388c35d236eSmrg 4389518bcf38Smrg exit $EXIT_SUCCESS 4390518bcf38Smrg ;; 4391c35d236eSmrg 4392518bcf38Smrg prog) 4393518bcf38Smrg case $host in 4394518bcf38Smrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 4395518bcf38Smrg esac 4396518bcf38Smrg if test -n "$vinfo"; then 4397518bcf38Smrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 4398518bcf38Smrg fi 4399c35d236eSmrg 4400518bcf38Smrg if test -n "$release"; then 4401518bcf38Smrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 4402518bcf38Smrg fi 4403c35d236eSmrg 4404518bcf38Smrg if test "$preload" = yes; then 4405518bcf38Smrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 4406518bcf38Smrg test "$dlopen_self_static" = unknown; then 4407518bcf38Smrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 4408f55e6a01Smrg fi 4409518bcf38Smrg fi 4410c35d236eSmrg 4411518bcf38Smrg case $host in 4412518bcf38Smrg *-*-rhapsody* | *-*-darwin1.[012]) 4413518bcf38Smrg # On Rhapsody replace the C library is the System framework 4414518bcf38Smrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4415518bcf38Smrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4416f55e6a01Smrg ;; 4417518bcf38Smrg esac 4418c35d236eSmrg 4419518bcf38Smrg case $host in 4420518bcf38Smrg *darwin*) 4421518bcf38Smrg # Don't allow lazy linking, it breaks C++ global constructors 4422518bcf38Smrg if test "$tagname" = CXX ; then 4423518bcf38Smrg compile_command="$compile_command ${wl}-bind_at_load" 4424518bcf38Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 4425518bcf38Smrg fi 4426518bcf38Smrg ;; 4427518bcf38Smrg esac 4428c35d236eSmrg 4429c35d236eSmrg 4430518bcf38Smrg # move library search paths that coincide with paths to not yet 4431518bcf38Smrg # installed libraries to the beginning of the library search list 4432518bcf38Smrg new_libs= 4433518bcf38Smrg for path in $notinst_path; do 4434518bcf38Smrg case " $new_libs " in 4435518bcf38Smrg *" -L$path/$objdir "*) ;; 4436518bcf38Smrg *) 4437518bcf38Smrg case " $compile_deplibs " in 4438518bcf38Smrg *" -L$path/$objdir "*) 4439518bcf38Smrg new_libs="$new_libs -L$path/$objdir" ;; 4440518bcf38Smrg esac 4441518bcf38Smrg ;; 4442518bcf38Smrg esac 4443518bcf38Smrg done 4444518bcf38Smrg for deplib in $compile_deplibs; do 4445518bcf38Smrg case $deplib in 4446518bcf38Smrg -L*) 4447518bcf38Smrg case " $new_libs " in 4448518bcf38Smrg *" $deplib "*) ;; 4449518bcf38Smrg *) new_libs="$new_libs $deplib" ;; 4450518bcf38Smrg esac 4451518bcf38Smrg ;; 4452518bcf38Smrg *) new_libs="$new_libs $deplib" ;; 4453518bcf38Smrg esac 4454518bcf38Smrg done 4455518bcf38Smrg compile_deplibs="$new_libs" 4456c35d236eSmrg 4457c35d236eSmrg 4458518bcf38Smrg compile_command="$compile_command $compile_deplibs" 4459518bcf38Smrg finalize_command="$finalize_command $finalize_deplibs" 4460c35d236eSmrg 4461518bcf38Smrg if test -n "$rpath$xrpath"; then 4462518bcf38Smrg # If the user specified any rpath flags, then add them. 4463518bcf38Smrg for libdir in $rpath $xrpath; do 4464518bcf38Smrg # This is the magic to use -rpath. 4465518bcf38Smrg case "$finalize_rpath " in 4466518bcf38Smrg *" $libdir "*) ;; 4467518bcf38Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 4468518bcf38Smrg esac 4469518bcf38Smrg done 4470518bcf38Smrg fi 4471c35d236eSmrg 4472518bcf38Smrg # Now hardcode the library paths 4473518bcf38Smrg rpath= 4474518bcf38Smrg hardcode_libdirs= 4475518bcf38Smrg for libdir in $compile_rpath $finalize_rpath; do 4476518bcf38Smrg if test -n "$hardcode_libdir_flag_spec"; then 4477518bcf38Smrg if test -n "$hardcode_libdir_separator"; then 4478518bcf38Smrg if test -z "$hardcode_libdirs"; then 4479518bcf38Smrg hardcode_libdirs="$libdir" 4480518bcf38Smrg else 4481518bcf38Smrg # Just accumulate the unique libdirs. 4482518bcf38Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4483518bcf38Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4484518bcf38Smrg ;; 4485518bcf38Smrg *) 4486518bcf38Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4487518bcf38Smrg ;; 4488518bcf38Smrg esac 4489518bcf38Smrg fi 4490f55e6a01Smrg else 4491518bcf38Smrg eval flag=\"$hardcode_libdir_flag_spec\" 4492518bcf38Smrg rpath="$rpath $flag" 4493f55e6a01Smrg fi 4494518bcf38Smrg elif test -n "$runpath_var"; then 4495518bcf38Smrg case "$perm_rpath " in 4496518bcf38Smrg *" $libdir "*) ;; 4497518bcf38Smrg *) perm_rpath="$perm_rpath $libdir" ;; 4498518bcf38Smrg esac 4499f55e6a01Smrg fi 4500f55e6a01Smrg case $host in 4501518bcf38Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4502518bcf38Smrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 4503f55e6a01Smrg case :$dllsearchpath: in 4504518bcf38Smrg *":$libdir:"*) ;; 4505518bcf38Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 4506f55e6a01Smrg esac 4507f55e6a01Smrg case :$dllsearchpath: in 4508f55e6a01Smrg *":$testbindir:"*) ;; 4509f55e6a01Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 4510f55e6a01Smrg esac 4511f55e6a01Smrg ;; 4512f55e6a01Smrg esac 4513518bcf38Smrg done 4514518bcf38Smrg # Substitute the hardcoded libdirs into the rpath. 4515518bcf38Smrg if test -n "$hardcode_libdir_separator" && 4516518bcf38Smrg test -n "$hardcode_libdirs"; then 4517518bcf38Smrg libdir="$hardcode_libdirs" 4518518bcf38Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 4519518bcf38Smrg fi 4520518bcf38Smrg compile_rpath="$rpath" 4521c35d236eSmrg 4522518bcf38Smrg rpath= 4523518bcf38Smrg hardcode_libdirs= 4524518bcf38Smrg for libdir in $finalize_rpath; do 4525518bcf38Smrg if test -n "$hardcode_libdir_flag_spec"; then 4526518bcf38Smrg if test -n "$hardcode_libdir_separator"; then 4527518bcf38Smrg if test -z "$hardcode_libdirs"; then 4528518bcf38Smrg hardcode_libdirs="$libdir" 4529518bcf38Smrg else 4530518bcf38Smrg # Just accumulate the unique libdirs. 4531518bcf38Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4532518bcf38Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4533518bcf38Smrg ;; 4534518bcf38Smrg *) 4535518bcf38Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4536518bcf38Smrg ;; 4537518bcf38Smrg esac 4538518bcf38Smrg fi 4539518bcf38Smrg else 4540518bcf38Smrg eval flag=\"$hardcode_libdir_flag_spec\" 4541518bcf38Smrg rpath="$rpath $flag" 4542518bcf38Smrg fi 4543518bcf38Smrg elif test -n "$runpath_var"; then 4544518bcf38Smrg case "$finalize_perm_rpath " in 4545518bcf38Smrg *" $libdir "*) ;; 4546518bcf38Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 4547f55e6a01Smrg esac 4548f55e6a01Smrg fi 4549518bcf38Smrg done 4550518bcf38Smrg # Substitute the hardcoded libdirs into the rpath. 4551518bcf38Smrg if test -n "$hardcode_libdir_separator" && 4552518bcf38Smrg test -n "$hardcode_libdirs"; then 4553518bcf38Smrg libdir="$hardcode_libdirs" 4554518bcf38Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 4555518bcf38Smrg fi 4556518bcf38Smrg finalize_rpath="$rpath" 4557c35d236eSmrg 4558518bcf38Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 4559518bcf38Smrg # Transform all the library objects into standard objects. 4560518bcf38Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4561518bcf38Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4562518bcf38Smrg fi 4563c35d236eSmrg 4564518bcf38Smrg dlsyms= 4565518bcf38Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4566518bcf38Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 4567518bcf38Smrg dlsyms="${outputname}S.c" 4568518bcf38Smrg else 4569518bcf38Smrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 4570518bcf38Smrg fi 4571518bcf38Smrg fi 4572c35d236eSmrg 4573518bcf38Smrg if test -n "$dlsyms"; then 4574518bcf38Smrg case $dlsyms in 4575518bcf38Smrg "") ;; 4576518bcf38Smrg *.c) 4577518bcf38Smrg # Discover the nlist of each of the dlfiles. 4578518bcf38Smrg nlist="$output_objdir/${outputname}.nm" 4579c35d236eSmrg 4580518bcf38Smrg $show "$rm $nlist ${nlist}S ${nlist}T" 4581518bcf38Smrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 4582c35d236eSmrg 4583518bcf38Smrg # Parse the name list into a source file. 4584518bcf38Smrg $show "creating $output_objdir/$dlsyms" 4585c35d236eSmrg 4586518bcf38Smrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 4587518bcf38Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 4588518bcf38Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 4589c35d236eSmrg 4590518bcf38Smrg#ifdef __cplusplus 4591518bcf38Smrgextern \"C\" { 4592518bcf38Smrg#endif 4593c35d236eSmrg 4594518bcf38Smrg/* Prevent the only kind of declaration conflicts we can make. */ 4595518bcf38Smrg#define lt_preloaded_symbols some_other_symbol 4596c35d236eSmrg 4597518bcf38Smrg/* External symbol declarations for the compiler. */\ 4598518bcf38Smrg" 4599c35d236eSmrg 4600518bcf38Smrg if test "$dlself" = yes; then 4601518bcf38Smrg $show "generating symbol list for \`$output'" 4602c35d236eSmrg 4603518bcf38Smrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 4604c35d236eSmrg 4605518bcf38Smrg # Add our own program objects to the symbol list. 4606518bcf38Smrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4607518bcf38Smrg for arg in $progfiles; do 4608518bcf38Smrg $show "extracting global C symbols from \`$arg'" 4609518bcf38Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4610518bcf38Smrg done 4611c35d236eSmrg 4612518bcf38Smrg if test -n "$exclude_expsyms"; then 4613518bcf38Smrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4614518bcf38Smrg $run eval '$mv "$nlist"T "$nlist"' 4615518bcf38Smrg fi 4616c35d236eSmrg 4617518bcf38Smrg if test -n "$export_symbols_regex"; then 4618518bcf38Smrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4619518bcf38Smrg $run eval '$mv "$nlist"T "$nlist"' 4620518bcf38Smrg fi 4621c35d236eSmrg 4622518bcf38Smrg # Prepare the list of exported symbols 4623518bcf38Smrg if test -z "$export_symbols"; then 4624518bcf38Smrg export_symbols="$output_objdir/$outputname.exp" 4625518bcf38Smrg $run $rm $export_symbols 4626518bcf38Smrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4627518bcf38Smrg case $host in 4628518bcf38Smrg *cygwin* | *mingw* ) 4629518bcf38Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4630518bcf38Smrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4631518bcf38Smrg ;; 4632518bcf38Smrg esac 4633518bcf38Smrg else 4634518bcf38Smrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4635518bcf38Smrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4636518bcf38Smrg $run eval 'mv "$nlist"T "$nlist"' 4637518bcf38Smrg case $host in 4638518bcf38Smrg *cygwin* | *mingw* ) 4639518bcf38Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4640518bcf38Smrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4641518bcf38Smrg ;; 4642518bcf38Smrg esac 4643518bcf38Smrg fi 4644518bcf38Smrg fi 4645c35d236eSmrg 4646518bcf38Smrg for arg in $dlprefiles; do 4647518bcf38Smrg $show "extracting global C symbols from \`$arg'" 4648518bcf38Smrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 4649518bcf38Smrg $run eval '$echo ": $name " >> "$nlist"' 4650518bcf38Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4651518bcf38Smrg done 4652c35d236eSmrg 4653518bcf38Smrg if test -z "$run"; then 4654518bcf38Smrg # Make sure we have at least an empty file. 4655518bcf38Smrg test -f "$nlist" || : > "$nlist" 4656c35d236eSmrg 4657518bcf38Smrg if test -n "$exclude_expsyms"; then 4658518bcf38Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4659518bcf38Smrg $mv "$nlist"T "$nlist" 4660518bcf38Smrg fi 4661c35d236eSmrg 4662518bcf38Smrg # Try sorting and uniquifying the output. 4663518bcf38Smrg if grep -v "^: " < "$nlist" | 4664518bcf38Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 4665518bcf38Smrg sort -k 3 4666518bcf38Smrg else 4667518bcf38Smrg sort +2 4668518bcf38Smrg fi | 4669518bcf38Smrg uniq > "$nlist"S; then 4670518bcf38Smrg : 4671518bcf38Smrg else 4672518bcf38Smrg grep -v "^: " < "$nlist" > "$nlist"S 4673518bcf38Smrg fi 4674c35d236eSmrg 4675518bcf38Smrg if test -f "$nlist"S; then 4676518bcf38Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 4677518bcf38Smrg else 4678518bcf38Smrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 4679518bcf38Smrg fi 4680c35d236eSmrg 4681518bcf38Smrg $echo >> "$output_objdir/$dlsyms" "\ 4682c35d236eSmrg 4683518bcf38Smrg#undef lt_preloaded_symbols 46844f6cd06fSmrg 4685518bcf38Smrg#if defined (__STDC__) && __STDC__ 4686518bcf38Smrg# define lt_ptr void * 4687518bcf38Smrg#else 4688518bcf38Smrg# define lt_ptr char * 4689518bcf38Smrg# define const 4690518bcf38Smrg#endif 4691c35d236eSmrg 4692518bcf38Smrg/* The mapping between symbol names and symbols. */ 4693518bcf38Smrg" 4694c35d236eSmrg 4695518bcf38Smrg case $host in 4696518bcf38Smrg *cygwin* | *mingw* ) 4697518bcf38Smrg $echo >> "$output_objdir/$dlsyms" "\ 4698518bcf38Smrg/* DATA imports from DLLs on WIN32 can't be const, because 4699518bcf38Smrg runtime relocations are performed -- see ld's documentation 4700518bcf38Smrg on pseudo-relocs */ 4701518bcf38Smrgstruct { 4702518bcf38Smrg" 4703518bcf38Smrg ;; 4704518bcf38Smrg * ) 4705518bcf38Smrg $echo >> "$output_objdir/$dlsyms" "\ 4706518bcf38Smrgconst struct { 4707518bcf38Smrg" 4708518bcf38Smrg ;; 4709518bcf38Smrg esac 4710c35d236eSmrg 4711c35d236eSmrg 4712518bcf38Smrg $echo >> "$output_objdir/$dlsyms" "\ 4713518bcf38Smrg const char *name; 4714518bcf38Smrg lt_ptr address; 4715518bcf38Smrg} 4716518bcf38Smrglt_preloaded_symbols[] = 4717518bcf38Smrg{\ 4718518bcf38Smrg" 4719c35d236eSmrg 4720518bcf38Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 4721c35d236eSmrg 4722518bcf38Smrg $echo >> "$output_objdir/$dlsyms" "\ 4723518bcf38Smrg {0, (lt_ptr) 0} 4724518bcf38Smrg}; 4725c35d236eSmrg 4726518bcf38Smrg/* This works around a problem in FreeBSD linker */ 4727518bcf38Smrg#ifdef FREEBSD_WORKAROUND 4728518bcf38Smrgstatic const void *lt_preloaded_setup() { 4729518bcf38Smrg return lt_preloaded_symbols; 4730518bcf38Smrg} 4731518bcf38Smrg#endif 4732c35d236eSmrg 4733518bcf38Smrg#ifdef __cplusplus 4734518bcf38Smrg} 4735518bcf38Smrg#endif\ 4736518bcf38Smrg" 4737f55e6a01Smrg fi 4738c35d236eSmrg 4739518bcf38Smrg pic_flag_for_symtable= 4740518bcf38Smrg case $host in 4741518bcf38Smrg # compiling the symbol table file with pic_flag works around 4742518bcf38Smrg # a FreeBSD bug that causes programs to crash when -lm is 4743518bcf38Smrg # linked before any other PIC object. But we must not use 4744518bcf38Smrg # pic_flag when linking with -static. The problem exists in 4745518bcf38Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 4746518bcf38Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 4747518bcf38Smrg case "$compile_command " in 4748518bcf38Smrg *" -static "*) ;; 4749518bcf38Smrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 4750518bcf38Smrg esac;; 4751518bcf38Smrg *-*-hpux*) 4752518bcf38Smrg case "$compile_command " in 4753518bcf38Smrg *" -static "*) ;; 4754518bcf38Smrg *) pic_flag_for_symtable=" $pic_flag";; 4755518bcf38Smrg esac 4756518bcf38Smrg esac 4757f55e6a01Smrg 4758518bcf38Smrg # Now compile the dynamic symbol file. 4759518bcf38Smrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4760518bcf38Smrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 4761c35d236eSmrg 4762518bcf38Smrg # Clean up the generated files. 4763518bcf38Smrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4764518bcf38Smrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4765c35d236eSmrg 4766518bcf38Smrg # Transform the symbol file into the correct name. 4767518bcf38Smrg case $host in 4768518bcf38Smrg *cygwin* | *mingw* ) 4769518bcf38Smrg if test -f "$output_objdir/${outputname}.def" ; then 4770518bcf38Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4771518bcf38Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4772518bcf38Smrg else 4773518bcf38Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4774518bcf38Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4775518bcf38Smrg fi 4776518bcf38Smrg ;; 4777518bcf38Smrg * ) 4778518bcf38Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4779518bcf38Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4780518bcf38Smrg ;; 4781518bcf38Smrg esac 4782518bcf38Smrg ;; 4783518bcf38Smrg *) 4784518bcf38Smrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4785518bcf38Smrg exit $EXIT_FAILURE 4786518bcf38Smrg ;; 4787518bcf38Smrg esac 4788518bcf38Smrg else 4789518bcf38Smrg # We keep going just in case the user didn't refer to 4790518bcf38Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 4791518bcf38Smrg # really was required. 4792c35d236eSmrg 4793518bcf38Smrg # Nullify the symbol file. 4794518bcf38Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4795518bcf38Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4796518bcf38Smrg fi 4797c35d236eSmrg 4798518bcf38Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 4799518bcf38Smrg # Replace the output file specification. 4800518bcf38Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 4801518bcf38Smrg link_command="$compile_command$compile_rpath" 4802c35d236eSmrg 4803518bcf38Smrg # We have no uninstalled library dependencies, so finalize right now. 4804518bcf38Smrg $show "$link_command" 4805518bcf38Smrg $run eval "$link_command" 4806518bcf38Smrg exit_status=$? 4807c35d236eSmrg 4808518bcf38Smrg # Delete the generated files. 4809518bcf38Smrg if test -n "$dlsyms"; then 4810518bcf38Smrg $show "$rm $output_objdir/${outputname}S.${objext}" 4811518bcf38Smrg $run $rm "$output_objdir/${outputname}S.${objext}" 4812f55e6a01Smrg fi 4813c35d236eSmrg 4814518bcf38Smrg exit $exit_status 4815518bcf38Smrg fi 4816c35d236eSmrg 4817518bcf38Smrg if test -n "$shlibpath_var"; then 4818518bcf38Smrg # We should set the shlibpath_var 4819518bcf38Smrg rpath= 4820518bcf38Smrg for dir in $temp_rpath; do 4821518bcf38Smrg case $dir in 4822518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) 4823518bcf38Smrg # Absolute path. 4824518bcf38Smrg rpath="$rpath$dir:" 4825518bcf38Smrg ;; 4826518bcf38Smrg *) 4827518bcf38Smrg # Relative path: add a thisdir entry. 4828518bcf38Smrg rpath="$rpath\$thisdir/$dir:" 4829518bcf38Smrg ;; 4830518bcf38Smrg esac 4831518bcf38Smrg done 4832518bcf38Smrg temp_rpath="$rpath" 4833f55e6a01Smrg fi 4834c35d236eSmrg 4835518bcf38Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 4836518bcf38Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 4837518bcf38Smrg fi 4838518bcf38Smrg if test -n "$finalize_shlibpath"; then 4839518bcf38Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 4840518bcf38Smrg fi 4841f55e6a01Smrg 4842518bcf38Smrg compile_var= 4843518bcf38Smrg finalize_var= 4844518bcf38Smrg if test -n "$runpath_var"; then 4845518bcf38Smrg if test -n "$perm_rpath"; then 4846518bcf38Smrg # We should set the runpath_var. 4847518bcf38Smrg rpath= 4848518bcf38Smrg for dir in $perm_rpath; do 4849518bcf38Smrg rpath="$rpath$dir:" 4850518bcf38Smrg done 4851518bcf38Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 4852518bcf38Smrg fi 4853518bcf38Smrg if test -n "$finalize_perm_rpath"; then 4854518bcf38Smrg # We should set the runpath_var. 4855518bcf38Smrg rpath= 4856518bcf38Smrg for dir in $finalize_perm_rpath; do 4857518bcf38Smrg rpath="$rpath$dir:" 4858518bcf38Smrg done 4859518bcf38Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 4860518bcf38Smrg fi 4861518bcf38Smrg fi 4862f55e6a01Smrg 4863518bcf38Smrg if test "$no_install" = yes; then 4864518bcf38Smrg # We don't need to create a wrapper script. 4865518bcf38Smrg link_command="$compile_var$compile_command$compile_rpath" 4866518bcf38Smrg # Replace the output file specification. 4867518bcf38Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4868518bcf38Smrg # Delete the old output file. 4869518bcf38Smrg $run $rm $output 4870518bcf38Smrg # Link the executable and exit 4871518bcf38Smrg $show "$link_command" 4872518bcf38Smrg $run eval "$link_command" || exit $? 4873518bcf38Smrg exit $EXIT_SUCCESS 4874518bcf38Smrg fi 4875f55e6a01Smrg 4876518bcf38Smrg if test "$hardcode_action" = relink; then 4877518bcf38Smrg # Fast installation is not supported 4878518bcf38Smrg link_command="$compile_var$compile_command$compile_rpath" 4879518bcf38Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 4880f55e6a01Smrg 4881518bcf38Smrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 4882518bcf38Smrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 4883518bcf38Smrg else 4884518bcf38Smrg if test "$fast_install" != no; then 4885518bcf38Smrg link_command="$finalize_var$compile_command$finalize_rpath" 4886518bcf38Smrg if test "$fast_install" = yes; then 4887518bcf38Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 4888518bcf38Smrg else 4889518bcf38Smrg # fast_install is set to needless 4890518bcf38Smrg relink_command= 4891518bcf38Smrg fi 4892518bcf38Smrg else 4893518bcf38Smrg link_command="$compile_var$compile_command$compile_rpath" 4894518bcf38Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 4895518bcf38Smrg fi 4896f55e6a01Smrg fi 4897f55e6a01Smrg 4898518bcf38Smrg # Replace the output file specification. 4899518bcf38Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 4900f55e6a01Smrg 4901518bcf38Smrg # Delete the old output files. 4902518bcf38Smrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 4903f55e6a01Smrg 4904518bcf38Smrg $show "$link_command" 4905518bcf38Smrg $run eval "$link_command" || exit $? 4906f55e6a01Smrg 4907518bcf38Smrg # Now create the wrapper script. 4908518bcf38Smrg $show "creating $output" 4909f55e6a01Smrg 4910518bcf38Smrg # Quote the relink command for shipping. 4911518bcf38Smrg if test -n "$relink_command"; then 4912518bcf38Smrg # Preserve any variables that may affect compiler behavior 4913518bcf38Smrg for var in $variables_saved_for_relink; do 4914518bcf38Smrg if eval test -z \"\${$var+set}\"; then 4915518bcf38Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4916518bcf38Smrg elif eval var_value=\$$var; test -z "$var_value"; then 4917518bcf38Smrg relink_command="$var=; export $var; $relink_command" 4918518bcf38Smrg else 4919518bcf38Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4920518bcf38Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 4921518bcf38Smrg fi 4922f55e6a01Smrg done 4923518bcf38Smrg relink_command="(cd `pwd`; $relink_command)" 4924518bcf38Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 4925f55e6a01Smrg fi 4926f55e6a01Smrg 4927518bcf38Smrg # Quote $echo for shipping. 4928518bcf38Smrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 4929518bcf38Smrg case $progpath in 4930518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 4931518bcf38Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 4932f55e6a01Smrg esac 4933518bcf38Smrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 4934518bcf38Smrg else 4935518bcf38Smrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 4936f55e6a01Smrg fi 4937f55e6a01Smrg 4938518bcf38Smrg # Only actually do things if our run command is non-null. 4939518bcf38Smrg if test -z "$run"; then 4940518bcf38Smrg # win32 will think the script is a binary if it has 4941518bcf38Smrg # a .exe suffix, so we strip it off here. 4942518bcf38Smrg case $output in 4943518bcf38Smrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 4944518bcf38Smrg esac 4945518bcf38Smrg # test for cygwin because mv fails w/o .exe extensions 4946518bcf38Smrg case $host in 4947518bcf38Smrg *cygwin*) 4948518bcf38Smrg exeext=.exe 4949518bcf38Smrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4950518bcf38Smrg *) exeext= ;; 4951518bcf38Smrg esac 4952518bcf38Smrg case $host in 4953518bcf38Smrg *cygwin* | *mingw* ) 4954518bcf38Smrg output_name=`basename $output` 4955518bcf38Smrg output_path=`dirname $output` 4956518bcf38Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 4957518bcf38Smrg cwrapper="$output_path/$output_name.exe" 4958518bcf38Smrg $rm $cwrappersource $cwrapper 4959518bcf38Smrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4960f55e6a01Smrg 4961518bcf38Smrg cat > $cwrappersource <<EOF 4962f55e6a01Smrg 4963518bcf38Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4964518bcf38Smrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4965f55e6a01Smrg 4966518bcf38Smrg The $output program cannot be directly executed until all the libtool 4967518bcf38Smrg libraries that it depends on are installed. 4968f55e6a01Smrg 4969518bcf38Smrg This wrapper executable should never be moved out of the build directory. 4970518bcf38Smrg If it is, it will not operate correctly. 4971f55e6a01Smrg 4972518bcf38Smrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 4973518bcf38Smrg but could eventually absorb all of the scripts functionality and 4974518bcf38Smrg exec $objdir/$outputname directly. 4975518bcf38Smrg*/ 4976518bcf38SmrgEOF 4977518bcf38Smrg cat >> $cwrappersource<<"EOF" 4978518bcf38Smrg#include <stdio.h> 4979518bcf38Smrg#include <stdlib.h> 4980518bcf38Smrg#include <unistd.h> 4981518bcf38Smrg#include <malloc.h> 4982518bcf38Smrg#include <stdarg.h> 4983518bcf38Smrg#include <assert.h> 4984518bcf38Smrg#include <string.h> 4985518bcf38Smrg#include <ctype.h> 4986518bcf38Smrg#include <sys/stat.h> 4987f55e6a01Smrg 4988518bcf38Smrg#if defined(PATH_MAX) 4989518bcf38Smrg# define LT_PATHMAX PATH_MAX 4990518bcf38Smrg#elif defined(MAXPATHLEN) 4991518bcf38Smrg# define LT_PATHMAX MAXPATHLEN 4992518bcf38Smrg#else 4993518bcf38Smrg# define LT_PATHMAX 1024 4994518bcf38Smrg#endif 4995f55e6a01Smrg 4996518bcf38Smrg#ifndef DIR_SEPARATOR 4997518bcf38Smrg# define DIR_SEPARATOR '/' 4998518bcf38Smrg# define PATH_SEPARATOR ':' 4999518bcf38Smrg#endif 5000f55e6a01Smrg 5001518bcf38Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 5002518bcf38Smrg defined (__OS2__) 5003518bcf38Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 5004518bcf38Smrg# ifndef DIR_SEPARATOR_2 5005518bcf38Smrg# define DIR_SEPARATOR_2 '\\' 5006518bcf38Smrg# endif 5007518bcf38Smrg# ifndef PATH_SEPARATOR_2 5008518bcf38Smrg# define PATH_SEPARATOR_2 ';' 5009518bcf38Smrg# endif 5010518bcf38Smrg#endif 5011f55e6a01Smrg 5012518bcf38Smrg#ifndef DIR_SEPARATOR_2 5013518bcf38Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 5014518bcf38Smrg#else /* DIR_SEPARATOR_2 */ 5015518bcf38Smrg# define IS_DIR_SEPARATOR(ch) \ 5016518bcf38Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 5017518bcf38Smrg#endif /* DIR_SEPARATOR_2 */ 5018f55e6a01Smrg 5019518bcf38Smrg#ifndef PATH_SEPARATOR_2 5020518bcf38Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 5021518bcf38Smrg#else /* PATH_SEPARATOR_2 */ 5022518bcf38Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 5023518bcf38Smrg#endif /* PATH_SEPARATOR_2 */ 5024f55e6a01Smrg 5025518bcf38Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 5026518bcf38Smrg#define XFREE(stale) do { \ 5027518bcf38Smrg if (stale) { free ((void *) stale); stale = 0; } \ 5028518bcf38Smrg} while (0) 5029f55e6a01Smrg 5030518bcf38Smrg/* -DDEBUG is fairly common in CFLAGS. */ 5031518bcf38Smrg#undef DEBUG 5032518bcf38Smrg#if defined DEBUGWRAPPER 5033518bcf38Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 5034518bcf38Smrg#else 5035518bcf38Smrg# define DEBUG(format, ...) 5036518bcf38Smrg#endif 5037f55e6a01Smrg 5038518bcf38Smrgconst char *program_name = NULL; 5039f55e6a01Smrg 5040518bcf38Smrgvoid * xmalloc (size_t num); 5041518bcf38Smrgchar * xstrdup (const char *string); 5042518bcf38Smrgconst char * base_name (const char *name); 5043518bcf38Smrgchar * find_executable(const char *wrapper); 5044518bcf38Smrgint check_executable(const char *path); 5045518bcf38Smrgchar * strendzap(char *str, const char *pat); 5046518bcf38Smrgvoid lt_fatal (const char *message, ...); 5047f55e6a01Smrg 5048518bcf38Smrgint 5049518bcf38Smrgmain (int argc, char *argv[]) 5050518bcf38Smrg{ 5051518bcf38Smrg char **newargz; 5052518bcf38Smrg int i; 5053f55e6a01Smrg 5054518bcf38Smrg program_name = (char *) xstrdup (base_name (argv[0])); 5055518bcf38Smrg DEBUG("(main) argv[0] : %s\n",argv[0]); 5056518bcf38Smrg DEBUG("(main) program_name : %s\n",program_name); 5057518bcf38Smrg newargz = XMALLOC(char *, argc+2); 5058518bcf38SmrgEOF 5059f55e6a01Smrg 5060518bcf38Smrg cat >> $cwrappersource <<EOF 5061518bcf38Smrg newargz[0] = (char *) xstrdup("$SHELL"); 5062518bcf38SmrgEOF 5063f55e6a01Smrg 5064518bcf38Smrg cat >> $cwrappersource <<"EOF" 5065518bcf38Smrg newargz[1] = find_executable(argv[0]); 5066518bcf38Smrg if (newargz[1] == NULL) 5067518bcf38Smrg lt_fatal("Couldn't find %s", argv[0]); 5068518bcf38Smrg DEBUG("(main) found exe at : %s\n",newargz[1]); 5069518bcf38Smrg /* we know the script has the same name, without the .exe */ 5070518bcf38Smrg /* so make sure newargz[1] doesn't end in .exe */ 5071518bcf38Smrg strendzap(newargz[1],".exe"); 5072518bcf38Smrg for (i = 1; i < argc; i++) 5073518bcf38Smrg newargz[i+1] = xstrdup(argv[i]); 5074518bcf38Smrg newargz[argc+1] = NULL; 5075f55e6a01Smrg 5076518bcf38Smrg for (i=0; i<argc+1; i++) 5077518bcf38Smrg { 5078518bcf38Smrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 5079518bcf38Smrg ; 5080518bcf38Smrg } 5081f55e6a01Smrg 5082518bcf38SmrgEOF 5083f55e6a01Smrg 5084518bcf38Smrg case $host_os in 5085518bcf38Smrg mingw*) 5086518bcf38Smrg cat >> $cwrappersource <<EOF 5087518bcf38Smrg execv("$SHELL",(char const **)newargz); 5088518bcf38SmrgEOF 5089518bcf38Smrg ;; 5090518bcf38Smrg *) 5091518bcf38Smrg cat >> $cwrappersource <<EOF 5092518bcf38Smrg execv("$SHELL",newargz); 5093518bcf38SmrgEOF 5094518bcf38Smrg ;; 5095518bcf38Smrg esac 5096f55e6a01Smrg 5097518bcf38Smrg cat >> $cwrappersource <<"EOF" 5098518bcf38Smrg return 127; 5099518bcf38Smrg} 5100f55e6a01Smrg 5101518bcf38Smrgvoid * 5102518bcf38Smrgxmalloc (size_t num) 5103518bcf38Smrg{ 5104518bcf38Smrg void * p = (void *) malloc (num); 5105518bcf38Smrg if (!p) 5106518bcf38Smrg lt_fatal ("Memory exhausted"); 5107f55e6a01Smrg 5108518bcf38Smrg return p; 5109518bcf38Smrg} 5110f55e6a01Smrg 5111518bcf38Smrgchar * 5112518bcf38Smrgxstrdup (const char *string) 5113518bcf38Smrg{ 5114518bcf38Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5115518bcf38Smrg; 5116518bcf38Smrg} 5117f55e6a01Smrg 5118518bcf38Smrgconst char * 5119518bcf38Smrgbase_name (const char *name) 5120518bcf38Smrg{ 5121518bcf38Smrg const char *base; 5122f55e6a01Smrg 5123518bcf38Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5124518bcf38Smrg /* Skip over the disk name in MSDOS pathnames. */ 5125518bcf38Smrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 5126518bcf38Smrg name += 2; 5127518bcf38Smrg#endif 5128f55e6a01Smrg 5129518bcf38Smrg for (base = name; *name; name++) 5130518bcf38Smrg if (IS_DIR_SEPARATOR (*name)) 5131518bcf38Smrg base = name + 1; 5132518bcf38Smrg return base; 5133518bcf38Smrg} 5134f55e6a01Smrg 5135518bcf38Smrgint 5136518bcf38Smrgcheck_executable(const char * path) 5137518bcf38Smrg{ 5138518bcf38Smrg struct stat st; 5139f55e6a01Smrg 5140518bcf38Smrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 5141518bcf38Smrg if ((!path) || (!*path)) 5142518bcf38Smrg return 0; 5143f55e6a01Smrg 5144518bcf38Smrg if ((stat (path, &st) >= 0) && 5145518bcf38Smrg ( 5146518bcf38Smrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 5147518bcf38Smrg#if defined (S_IXOTH) 5148518bcf38Smrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 5149518bcf38Smrg#endif 5150518bcf38Smrg#if defined (S_IXGRP) 5151518bcf38Smrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 5152518bcf38Smrg#endif 5153518bcf38Smrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 5154518bcf38Smrg ) 5155518bcf38Smrg return 1; 5156518bcf38Smrg else 5157518bcf38Smrg return 0; 5158518bcf38Smrg} 5159c35d236eSmrg 5160518bcf38Smrg/* Searches for the full path of the wrapper. Returns 5161518bcf38Smrg newly allocated full path name if found, NULL otherwise */ 5162518bcf38Smrgchar * 5163518bcf38Smrgfind_executable (const char* wrapper) 5164518bcf38Smrg{ 5165518bcf38Smrg int has_slash = 0; 5166518bcf38Smrg const char* p; 5167518bcf38Smrg const char* p_next; 5168518bcf38Smrg /* static buffer for getcwd */ 5169518bcf38Smrg char tmp[LT_PATHMAX + 1]; 5170518bcf38Smrg int tmp_len; 5171518bcf38Smrg char* concat_name; 5172c35d236eSmrg 5173518bcf38Smrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 5174c35d236eSmrg 5175518bcf38Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 5176518bcf38Smrg return NULL; 5177c35d236eSmrg 5178518bcf38Smrg /* Absolute path? */ 5179518bcf38Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5180518bcf38Smrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 5181518bcf38Smrg { 5182518bcf38Smrg concat_name = xstrdup (wrapper); 5183518bcf38Smrg if (check_executable(concat_name)) 5184518bcf38Smrg return concat_name; 5185518bcf38Smrg XFREE(concat_name); 5186518bcf38Smrg } 5187518bcf38Smrg else 5188518bcf38Smrg { 5189518bcf38Smrg#endif 5190518bcf38Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 5191518bcf38Smrg { 5192518bcf38Smrg concat_name = xstrdup (wrapper); 5193518bcf38Smrg if (check_executable(concat_name)) 5194518bcf38Smrg return concat_name; 5195518bcf38Smrg XFREE(concat_name); 5196518bcf38Smrg } 5197518bcf38Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5198518bcf38Smrg } 5199518bcf38Smrg#endif 5200518bcf38Smrg 5201518bcf38Smrg for (p = wrapper; *p; p++) 5202518bcf38Smrg if (*p == '/') 5203518bcf38Smrg { 5204518bcf38Smrg has_slash = 1; 5205518bcf38Smrg break; 5206518bcf38Smrg } 5207518bcf38Smrg if (!has_slash) 5208518bcf38Smrg { 5209518bcf38Smrg /* no slashes; search PATH */ 5210518bcf38Smrg const char* path = getenv ("PATH"); 5211518bcf38Smrg if (path != NULL) 5212518bcf38Smrg { 5213518bcf38Smrg for (p = path; *p; p = p_next) 5214518bcf38Smrg { 5215518bcf38Smrg const char* q; 5216518bcf38Smrg size_t p_len; 5217518bcf38Smrg for (q = p; *q; q++) 5218518bcf38Smrg if (IS_PATH_SEPARATOR(*q)) 5219518bcf38Smrg break; 5220518bcf38Smrg p_len = q - p; 5221518bcf38Smrg p_next = (*q == '\0' ? q : q + 1); 5222518bcf38Smrg if (p_len == 0) 5223518bcf38Smrg { 5224518bcf38Smrg /* empty path: current directory */ 5225518bcf38Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 5226518bcf38Smrg lt_fatal ("getcwd failed"); 5227518bcf38Smrg tmp_len = strlen(tmp); 5228518bcf38Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5229518bcf38Smrg memcpy (concat_name, tmp, tmp_len); 5230518bcf38Smrg concat_name[tmp_len] = '/'; 5231518bcf38Smrg strcpy (concat_name + tmp_len + 1, wrapper); 5232518bcf38Smrg } 5233518bcf38Smrg else 5234518bcf38Smrg { 5235518bcf38Smrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 5236518bcf38Smrg memcpy (concat_name, p, p_len); 5237518bcf38Smrg concat_name[p_len] = '/'; 5238518bcf38Smrg strcpy (concat_name + p_len + 1, wrapper); 5239518bcf38Smrg } 5240518bcf38Smrg if (check_executable(concat_name)) 5241518bcf38Smrg return concat_name; 5242518bcf38Smrg XFREE(concat_name); 5243518bcf38Smrg } 5244518bcf38Smrg } 5245518bcf38Smrg /* not found in PATH; assume curdir */ 5246518bcf38Smrg } 5247518bcf38Smrg /* Relative path | not found in path: prepend cwd */ 5248518bcf38Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 5249518bcf38Smrg lt_fatal ("getcwd failed"); 5250518bcf38Smrg tmp_len = strlen(tmp); 5251518bcf38Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5252518bcf38Smrg memcpy (concat_name, tmp, tmp_len); 5253518bcf38Smrg concat_name[tmp_len] = '/'; 5254518bcf38Smrg strcpy (concat_name + tmp_len + 1, wrapper); 5255518bcf38Smrg 5256518bcf38Smrg if (check_executable(concat_name)) 5257518bcf38Smrg return concat_name; 5258518bcf38Smrg XFREE(concat_name); 5259518bcf38Smrg return NULL; 5260518bcf38Smrg} 5261518bcf38Smrg 5262518bcf38Smrgchar * 5263518bcf38Smrgstrendzap(char *str, const char *pat) 5264518bcf38Smrg{ 5265518bcf38Smrg size_t len, patlen; 5266518bcf38Smrg 5267518bcf38Smrg assert(str != NULL); 5268518bcf38Smrg assert(pat != NULL); 5269518bcf38Smrg 5270518bcf38Smrg len = strlen(str); 5271518bcf38Smrg patlen = strlen(pat); 5272518bcf38Smrg 5273518bcf38Smrg if (patlen <= len) 5274518bcf38Smrg { 5275518bcf38Smrg str += len - patlen; 5276518bcf38Smrg if (strcmp(str, pat) == 0) 5277518bcf38Smrg *str = '\0'; 5278518bcf38Smrg } 5279518bcf38Smrg return str; 5280518bcf38Smrg} 5281518bcf38Smrg 5282518bcf38Smrgstatic void 5283518bcf38Smrglt_error_core (int exit_status, const char * mode, 5284518bcf38Smrg const char * message, va_list ap) 5285518bcf38Smrg{ 5286518bcf38Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 5287518bcf38Smrg vfprintf (stderr, message, ap); 5288518bcf38Smrg fprintf (stderr, ".\n"); 5289518bcf38Smrg 5290518bcf38Smrg if (exit_status >= 0) 5291518bcf38Smrg exit (exit_status); 5292518bcf38Smrg} 5293518bcf38Smrg 5294518bcf38Smrgvoid 5295518bcf38Smrglt_fatal (const char *message, ...) 5296518bcf38Smrg{ 5297518bcf38Smrg va_list ap; 5298518bcf38Smrg va_start (ap, message); 5299518bcf38Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5300518bcf38Smrg va_end (ap); 5301518bcf38Smrg} 5302518bcf38SmrgEOF 5303518bcf38Smrg # we should really use a build-platform specific compiler 5304518bcf38Smrg # here, but OTOH, the wrappers (shell script and this C one) 5305518bcf38Smrg # are only useful if you want to execute the "real" binary. 5306518bcf38Smrg # Since the "real" binary is built for $host, then this 5307518bcf38Smrg # wrapper might as well be built for $host, too. 5308518bcf38Smrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 5309518bcf38Smrg ;; 5310518bcf38Smrg esac 5311518bcf38Smrg $rm $output 5312518bcf38Smrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5313518bcf38Smrg 5314518bcf38Smrg $echo > $output "\ 5315518bcf38Smrg#! $SHELL 5316518bcf38Smrg 5317518bcf38Smrg# $output - temporary wrapper script for $objdir/$outputname 5318518bcf38Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5319518bcf38Smrg# 5320518bcf38Smrg# The $output program cannot be directly executed until all the libtool 5321518bcf38Smrg# libraries that it depends on are installed. 5322518bcf38Smrg# 5323518bcf38Smrg# This wrapper script should never be moved out of the build directory. 5324518bcf38Smrg# If it is, it will not operate correctly. 5325518bcf38Smrg 5326518bcf38Smrg# Sed substitution that helps us do robust quoting. It backslashifies 5327518bcf38Smrg# metacharacters that are still active within double-quoted strings. 5328518bcf38SmrgXsed='${SED} -e 1s/^X//' 5329518bcf38Smrgsed_quote_subst='$sed_quote_subst' 5330518bcf38Smrg 5331518bcf38Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 5332518bcf38Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 5333518bcf38Smrg emulate sh 5334518bcf38Smrg NULLCMD=: 5335518bcf38Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 5336518bcf38Smrg # is contrary to our usage. Disable this feature. 5337518bcf38Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 5338518bcf38Smrg setopt NO_GLOB_SUBST 5339518bcf38Smrgelse 5340518bcf38Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 5341518bcf38Smrgfi 5342518bcf38SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 5343518bcf38SmrgDUALCASE=1; export DUALCASE # for MKS sh 5344518bcf38Smrg 5345518bcf38Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 5346518bcf38Smrg# if CDPATH is set. 5347518bcf38Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5348518bcf38Smrg 5349518bcf38Smrgrelink_command=\"$relink_command\" 5350518bcf38Smrg 5351518bcf38Smrg# This environment variable determines our operation mode. 5352518bcf38Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 5353518bcf38Smrg # install mode needs the following variable: 5354518bcf38Smrg notinst_deplibs='$notinst_deplibs' 5355518bcf38Smrgelse 5356518bcf38Smrg # When we are sourced in execute mode, \$file and \$echo are already set. 5357518bcf38Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 5358518bcf38Smrg echo=\"$qecho\" 5359518bcf38Smrg file=\"\$0\" 5360518bcf38Smrg # Make sure echo works. 5361518bcf38Smrg if test \"X\$1\" = X--no-reexec; then 5362518bcf38Smrg # Discard the --no-reexec flag, and continue. 5363518bcf38Smrg shift 5364518bcf38Smrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 5365518bcf38Smrg # Yippee, \$echo works! 5366518bcf38Smrg : 5367518bcf38Smrg else 5368518bcf38Smrg # Restart under the correct shell, and then maybe \$echo will work. 5369518bcf38Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 5370518bcf38Smrg fi 5371518bcf38Smrg fi\ 5372518bcf38Smrg" 5373518bcf38Smrg $echo >> $output "\ 5374c35d236eSmrg 5375518bcf38Smrg # Find the directory that this script lives in. 5376518bcf38Smrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 5377518bcf38Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 5378c35d236eSmrg 5379518bcf38Smrg # Follow symbolic links until we get to the real thisdir. 5380518bcf38Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 5381518bcf38Smrg while test -n \"\$file\"; do 5382518bcf38Smrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 5383c35d236eSmrg 5384518bcf38Smrg # If there was a directory component, then change thisdir. 5385518bcf38Smrg if test \"x\$destdir\" != \"x\$file\"; then 5386518bcf38Smrg case \"\$destdir\" in 5387518bcf38Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5388518bcf38Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 5389518bcf38Smrg esac 5390518bcf38Smrg fi 5391f55e6a01Smrg 5392518bcf38Smrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 5393518bcf38Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 5394518bcf38Smrg done 5395f55e6a01Smrg 5396518bcf38Smrg # Try to get the absolute directory name. 5397518bcf38Smrg absdir=\`cd \"\$thisdir\" && pwd\` 5398518bcf38Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 5399518bcf38Smrg" 5400c35d236eSmrg 5401518bcf38Smrg if test "$fast_install" = yes; then 5402518bcf38Smrg $echo >> $output "\ 5403518bcf38Smrg program=lt-'$outputname'$exeext 5404518bcf38Smrg progdir=\"\$thisdir/$objdir\" 5405c35d236eSmrg 5406518bcf38Smrg if test ! -f \"\$progdir/\$program\" || \\ 5407518bcf38Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 5408518bcf38Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 5409c35d236eSmrg 5410518bcf38Smrg file=\"\$\$-\$program\" 5411c35d236eSmrg 5412518bcf38Smrg if test ! -d \"\$progdir\"; then 5413518bcf38Smrg $mkdir \"\$progdir\" 5414518bcf38Smrg else 5415518bcf38Smrg $rm \"\$progdir/\$file\" 5416518bcf38Smrg fi" 5417c35d236eSmrg 5418518bcf38Smrg $echo >> $output "\ 5419f55e6a01Smrg 5420518bcf38Smrg # relink executable if necessary 5421518bcf38Smrg if test -n \"\$relink_command\"; then 5422518bcf38Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5423518bcf38Smrg else 5424518bcf38Smrg $echo \"\$relink_command_output\" >&2 5425518bcf38Smrg $rm \"\$progdir/\$file\" 5426518bcf38Smrg exit $EXIT_FAILURE 5427518bcf38Smrg fi 5428518bcf38Smrg fi 5429f55e6a01Smrg 5430518bcf38Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5431518bcf38Smrg { $rm \"\$progdir/\$program\"; 5432518bcf38Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5433518bcf38Smrg $rm \"\$progdir/\$file\" 5434518bcf38Smrg fi" 5435518bcf38Smrg else 5436518bcf38Smrg $echo >> $output "\ 5437518bcf38Smrg program='$outputname' 5438518bcf38Smrg progdir=\"\$thisdir/$objdir\" 5439518bcf38Smrg" 5440c35d236eSmrg fi 5441c35d236eSmrg 5442518bcf38Smrg $echo >> $output "\ 5443c35d236eSmrg 5444518bcf38Smrg if test -f \"\$progdir/\$program\"; then" 5445c35d236eSmrg 5446518bcf38Smrg # Export our shlibpath_var if we have one. 5447518bcf38Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5448518bcf38Smrg $echo >> $output "\ 5449518bcf38Smrg # Add our own library path to $shlibpath_var 5450518bcf38Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 5451c35d236eSmrg 5452518bcf38Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 5453518bcf38Smrg # The second colon is a workaround for a bug in BeOS R4 sed 5454518bcf38Smrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 5455c35d236eSmrg 5456518bcf38Smrg export $shlibpath_var 5457518bcf38Smrg" 5458518bcf38Smrg fi 5459f55e6a01Smrg 5460518bcf38Smrg # fixup the dll searchpath if we need to. 5461518bcf38Smrg if test -n "$dllsearchpath"; then 5462518bcf38Smrg $echo >> $output "\ 5463518bcf38Smrg # Add the dll search path components to the executable PATH 5464518bcf38Smrg PATH=$dllsearchpath:\$PATH 5465518bcf38Smrg" 5466518bcf38Smrg fi 5467f55e6a01Smrg 5468518bcf38Smrg $echo >> $output "\ 5469518bcf38Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 5470518bcf38Smrg # Run the actual program with our arguments. 5471518bcf38Smrg" 5472518bcf38Smrg case $host in 5473518bcf38Smrg # Backslashes separate directories on plain windows 5474518bcf38Smrg *-*-mingw | *-*-os2*) 5475518bcf38Smrg $echo >> $output "\ 5476518bcf38Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5477518bcf38Smrg" 5478518bcf38Smrg ;; 5479f55e6a01Smrg 5480518bcf38Smrg *) 5481518bcf38Smrg $echo >> $output "\ 5482518bcf38Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 5483518bcf38Smrg" 5484518bcf38Smrg ;; 5485518bcf38Smrg esac 5486518bcf38Smrg $echo >> $output "\ 5487518bcf38Smrg \$echo \"\$0: cannot exec \$program \$*\" 5488518bcf38Smrg exit $EXIT_FAILURE 5489518bcf38Smrg fi 5490518bcf38Smrg else 5491518bcf38Smrg # The program doesn't exist. 5492518bcf38Smrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 5493518bcf38Smrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 5494518bcf38Smrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5495518bcf38Smrg exit $EXIT_FAILURE 5496518bcf38Smrg fi 5497518bcf38Smrgfi\ 5498518bcf38Smrg" 5499518bcf38Smrg chmod +x $output 5500518bcf38Smrg fi 5501518bcf38Smrg exit $EXIT_SUCCESS 5502518bcf38Smrg ;; 5503518bcf38Smrg esac 5504f55e6a01Smrg 5505518bcf38Smrg # See if we need to build an old-fashioned archive. 5506518bcf38Smrg for oldlib in $oldlibs; do 5507f55e6a01Smrg 5508518bcf38Smrg if test "$build_libtool_libs" = convenience; then 5509518bcf38Smrg oldobjs="$libobjs_save" 5510518bcf38Smrg addlibs="$convenience" 5511518bcf38Smrg build_libtool_libs=no 5512518bcf38Smrg else 5513518bcf38Smrg if test "$build_libtool_libs" = module; then 5514518bcf38Smrg oldobjs="$libobjs_save" 5515518bcf38Smrg build_libtool_libs=no 5516518bcf38Smrg else 5517518bcf38Smrg oldobjs="$old_deplibs $non_pic_objects" 5518518bcf38Smrg fi 5519518bcf38Smrg addlibs="$old_convenience" 5520518bcf38Smrg fi 5521f55e6a01Smrg 5522518bcf38Smrg if test -n "$addlibs"; then 5523518bcf38Smrg gentop="$output_objdir/${outputname}x" 5524518bcf38Smrg generated="$generated $gentop" 5525f55e6a01Smrg 5526518bcf38Smrg func_extract_archives $gentop $addlibs 5527518bcf38Smrg oldobjs="$oldobjs $func_extract_archives_result" 5528518bcf38Smrg fi 5529f55e6a01Smrg 5530518bcf38Smrg # Do each command in the archive commands. 5531518bcf38Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5532518bcf38Smrg cmds=$old_archive_from_new_cmds 5533518bcf38Smrg else 5534518bcf38Smrg # POSIX demands no paths to be encoded in archives. We have 5535518bcf38Smrg # to avoid creating archives with duplicate basenames if we 5536518bcf38Smrg # might have to extract them afterwards, e.g., when creating a 5537518bcf38Smrg # static archive out of a convenience library, or when linking 5538518bcf38Smrg # the entirety of a libtool archive into another (currently 5539518bcf38Smrg # not supported by libtool). 5540518bcf38Smrg if (for obj in $oldobjs 5541518bcf38Smrg do 5542518bcf38Smrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 5543518bcf38Smrg done | sort | sort -uc >/dev/null 2>&1); then 5544518bcf38Smrg : 5545518bcf38Smrg else 5546518bcf38Smrg $echo "copying selected object files to avoid basename conflicts..." 5547c35d236eSmrg 5548518bcf38Smrg if test -z "$gentop"; then 5549518bcf38Smrg gentop="$output_objdir/${outputname}x" 5550518bcf38Smrg generated="$generated $gentop" 5551c35d236eSmrg 5552518bcf38Smrg $show "${rm}r $gentop" 5553518bcf38Smrg $run ${rm}r "$gentop" 5554518bcf38Smrg $show "$mkdir $gentop" 5555518bcf38Smrg $run $mkdir "$gentop" 5556518bcf38Smrg exit_status=$? 5557518bcf38Smrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 5558518bcf38Smrg exit $exit_status 5559f55e6a01Smrg fi 5560f55e6a01Smrg fi 5561c35d236eSmrg 5562518bcf38Smrg save_oldobjs=$oldobjs 5563518bcf38Smrg oldobjs= 5564518bcf38Smrg counter=1 5565518bcf38Smrg for obj in $save_oldobjs 5566518bcf38Smrg do 5567518bcf38Smrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 5568518bcf38Smrg case " $oldobjs " in 5569518bcf38Smrg " ") oldobjs=$obj ;; 5570518bcf38Smrg *[\ /]"$objbase "*) 5571518bcf38Smrg while :; do 5572518bcf38Smrg # Make sure we don't pick an alternate name that also 5573518bcf38Smrg # overlaps. 5574518bcf38Smrg newobj=lt$counter-$objbase 5575518bcf38Smrg counter=`expr $counter + 1` 5576518bcf38Smrg case " $oldobjs " in 5577518bcf38Smrg *[\ /]"$newobj "*) ;; 5578518bcf38Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 5579518bcf38Smrg esac 5580518bcf38Smrg done 5581518bcf38Smrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 5582518bcf38Smrg $run ln "$obj" "$gentop/$newobj" || 5583518bcf38Smrg $run cp "$obj" "$gentop/$newobj" 5584518bcf38Smrg oldobjs="$oldobjs $gentop/$newobj" 5585518bcf38Smrg ;; 5586518bcf38Smrg *) oldobjs="$oldobjs $obj" ;; 5587518bcf38Smrg esac 5588518bcf38Smrg done 5589518bcf38Smrg fi 5590c35d236eSmrg 5591518bcf38Smrg eval cmds=\"$old_archive_cmds\" 5592c35d236eSmrg 5593518bcf38Smrg if len=`expr "X$cmds" : ".*"` && 5594518bcf38Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5595518bcf38Smrg cmds=$old_archive_cmds 5596518bcf38Smrg else 5597518bcf38Smrg # the command line is too long to link in one step, link in parts 5598518bcf38Smrg $echo "using piecewise archive linking..." 5599518bcf38Smrg save_RANLIB=$RANLIB 5600518bcf38Smrg RANLIB=: 5601518bcf38Smrg objlist= 5602518bcf38Smrg concat_cmds= 5603518bcf38Smrg save_oldobjs=$oldobjs 5604518bcf38Smrg 5605518bcf38Smrg # Is there a better way of finding the last object in the list? 5606518bcf38Smrg for obj in $save_oldobjs 5607518bcf38Smrg do 5608518bcf38Smrg last_oldobj=$obj 5609518bcf38Smrg done 5610518bcf38Smrg for obj in $save_oldobjs 5611518bcf38Smrg do 5612518bcf38Smrg oldobjs="$objlist $obj" 5613518bcf38Smrg objlist="$objlist $obj" 5614518bcf38Smrg eval test_cmds=\"$old_archive_cmds\" 5615518bcf38Smrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5616518bcf38Smrg test "$len" -le "$max_cmd_len"; then 5617518bcf38Smrg : 5618f55e6a01Smrg else 5619518bcf38Smrg # the above command should be used before it gets too long 5620518bcf38Smrg oldobjs=$objlist 5621518bcf38Smrg if test "$obj" = "$last_oldobj" ; then 5622518bcf38Smrg RANLIB=$save_RANLIB 5623518bcf38Smrg fi 5624518bcf38Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5625518bcf38Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 5626518bcf38Smrg objlist= 5627f55e6a01Smrg fi 5628518bcf38Smrg done 5629518bcf38Smrg RANLIB=$save_RANLIB 5630518bcf38Smrg oldobjs=$objlist 5631518bcf38Smrg if test "X$oldobjs" = "X" ; then 5632518bcf38Smrg eval cmds=\"\$concat_cmds\" 5633f55e6a01Smrg else 5634518bcf38Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 5635f55e6a01Smrg fi 5636f55e6a01Smrg fi 5637518bcf38Smrg fi 5638518bcf38Smrg save_ifs="$IFS"; IFS='~' 5639518bcf38Smrg for cmd in $cmds; do 5640518bcf38Smrg eval cmd=\"$cmd\" 5641f55e6a01Smrg IFS="$save_ifs" 5642518bcf38Smrg $show "$cmd" 5643518bcf38Smrg $run eval "$cmd" || exit $? 5644518bcf38Smrg done 5645518bcf38Smrg IFS="$save_ifs" 5646518bcf38Smrg done 5647c35d236eSmrg 5648518bcf38Smrg if test -n "$generated"; then 5649518bcf38Smrg $show "${rm}r$generated" 5650518bcf38Smrg $run ${rm}r$generated 5651518bcf38Smrg fi 5652c35d236eSmrg 5653518bcf38Smrg # Now create the libtool archive. 5654518bcf38Smrg case $output in 5655518bcf38Smrg *.la) 5656518bcf38Smrg old_library= 5657518bcf38Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 5658518bcf38Smrg $show "creating $output" 5659f55e6a01Smrg 5660518bcf38Smrg # Preserve any variables that may affect compiler behavior 5661518bcf38Smrg for var in $variables_saved_for_relink; do 5662518bcf38Smrg if eval test -z \"\${$var+set}\"; then 5663518bcf38Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 5664518bcf38Smrg elif eval var_value=\$$var; test -z "$var_value"; then 5665518bcf38Smrg relink_command="$var=; export $var; $relink_command" 5666518bcf38Smrg else 5667518bcf38Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 5668518bcf38Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 5669f55e6a01Smrg fi 5670518bcf38Smrg done 5671518bcf38Smrg # Quote the link command for shipping. 5672518bcf38Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 5673518bcf38Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 5674518bcf38Smrg if test "$hardcode_automatic" = yes ; then 5675518bcf38Smrg relink_command= 5676f55e6a01Smrg fi 5677c35d236eSmrg 5678c35d236eSmrg 5679518bcf38Smrg # Only create the output if not a dry run. 5680518bcf38Smrg if test -z "$run"; then 5681518bcf38Smrg for installed in no yes; do 5682518bcf38Smrg if test "$installed" = yes; then 5683518bcf38Smrg if test -z "$install_libdir"; then 5684518bcf38Smrg break 5685518bcf38Smrg fi 5686518bcf38Smrg output="$output_objdir/$outputname"i 5687518bcf38Smrg # Replace all uninstalled libtool libraries with the installed ones 5688518bcf38Smrg newdependency_libs= 5689518bcf38Smrg for deplib in $dependency_libs; do 5690518bcf38Smrg case $deplib in 5691518bcf38Smrg *.la) 5692518bcf38Smrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 5693518bcf38Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5694518bcf38Smrg if test -z "$libdir"; then 5695518bcf38Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 5696518bcf38Smrg exit $EXIT_FAILURE 5697518bcf38Smrg fi 5698518bcf38Smrg newdependency_libs="$newdependency_libs $libdir/$name" 5699518bcf38Smrg ;; 5700518bcf38Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 5701518bcf38Smrg esac 5702518bcf38Smrg done 5703518bcf38Smrg dependency_libs="$newdependency_libs" 5704518bcf38Smrg newdlfiles= 5705518bcf38Smrg for lib in $dlfiles; do 5706518bcf38Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5707518bcf38Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5708518bcf38Smrg if test -z "$libdir"; then 5709518bcf38Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5710518bcf38Smrg exit $EXIT_FAILURE 5711518bcf38Smrg fi 5712518bcf38Smrg newdlfiles="$newdlfiles $libdir/$name" 5713518bcf38Smrg done 5714518bcf38Smrg dlfiles="$newdlfiles" 5715518bcf38Smrg newdlprefiles= 5716518bcf38Smrg for lib in $dlprefiles; do 5717518bcf38Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5718518bcf38Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5719518bcf38Smrg if test -z "$libdir"; then 5720518bcf38Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5721518bcf38Smrg exit $EXIT_FAILURE 5722518bcf38Smrg fi 5723518bcf38Smrg newdlprefiles="$newdlprefiles $libdir/$name" 5724518bcf38Smrg done 5725518bcf38Smrg dlprefiles="$newdlprefiles" 5726518bcf38Smrg else 5727518bcf38Smrg newdlfiles= 5728518bcf38Smrg for lib in $dlfiles; do 5729518bcf38Smrg case $lib in 5730518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5731518bcf38Smrg *) abs=`pwd`"/$lib" ;; 5732518bcf38Smrg esac 5733518bcf38Smrg newdlfiles="$newdlfiles $abs" 5734518bcf38Smrg done 5735518bcf38Smrg dlfiles="$newdlfiles" 5736518bcf38Smrg newdlprefiles= 5737518bcf38Smrg for lib in $dlprefiles; do 5738518bcf38Smrg case $lib in 5739518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5740518bcf38Smrg *) abs=`pwd`"/$lib" ;; 5741518bcf38Smrg esac 5742518bcf38Smrg newdlprefiles="$newdlprefiles $abs" 5743518bcf38Smrg done 5744518bcf38Smrg dlprefiles="$newdlprefiles" 5745518bcf38Smrg fi 5746518bcf38Smrg $rm $output 5747518bcf38Smrg # place dlname in correct position for cygwin 5748518bcf38Smrg tdlname=$dlname 5749518bcf38Smrg case $host,$output,$installed,$module,$dlname in 5750518bcf38Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 5751518bcf38Smrg esac 5752518bcf38Smrg $echo > $output "\ 5753518bcf38Smrg# $outputname - a libtool library file 5754518bcf38Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5755518bcf38Smrg# 5756518bcf38Smrg# Please DO NOT delete this file! 5757518bcf38Smrg# It is necessary for linking the library. 5758c35d236eSmrg 5759518bcf38Smrg# The name that we can dlopen(3). 5760518bcf38Smrgdlname='$tdlname' 5761c35d236eSmrg 5762518bcf38Smrg# Names of this library. 5763518bcf38Smrglibrary_names='$library_names' 5764c35d236eSmrg 5765518bcf38Smrg# The name of the static archive. 5766518bcf38Smrgold_library='$old_library' 5767c35d236eSmrg 5768518bcf38Smrg# Libraries that this one depends upon. 5769518bcf38Smrgdependency_libs='$dependency_libs' 5770f55e6a01Smrg 5771518bcf38Smrg# Version information for $libname. 5772518bcf38Smrgcurrent=$current 5773518bcf38Smrgage=$age 5774518bcf38Smrgrevision=$revision 5775f55e6a01Smrg 5776518bcf38Smrg# Is this an already installed library? 5777518bcf38Smrginstalled=$installed 5778f55e6a01Smrg 5779518bcf38Smrg# Should we warn about portability when linking against -modules? 5780518bcf38Smrgshouldnotlink=$module 5781f55e6a01Smrg 5782518bcf38Smrg# Files to dlopen/dlpreopen 5783518bcf38Smrgdlopen='$dlfiles' 5784518bcf38Smrgdlpreopen='$dlprefiles' 5785f55e6a01Smrg 5786518bcf38Smrg# Directory that this library needs to be installed in: 5787518bcf38Smrglibdir='$install_libdir'" 5788518bcf38Smrg if test "$installed" = no && test "$need_relink" = yes; then 5789518bcf38Smrg $echo >> $output "\ 5790518bcf38Smrgrelink_command=\"$relink_command\"" 5791518bcf38Smrg fi 5792518bcf38Smrg done 5793f55e6a01Smrg fi 5794f55e6a01Smrg 5795518bcf38Smrg # Do a symbolic link so that the libtool archive can be found in 5796518bcf38Smrg # LD_LIBRARY_PATH before the program is installed. 5797518bcf38Smrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 5798518bcf38Smrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 5799c35d236eSmrg ;; 5800518bcf38Smrg esac 5801518bcf38Smrg exit $EXIT_SUCCESS 5802518bcf38Smrg ;; 5803c35d236eSmrg 5804518bcf38Smrg # libtool install mode 5805518bcf38Smrg install) 5806518bcf38Smrg modename="$modename: install" 5807518bcf38Smrg 5808518bcf38Smrg # There may be an optional sh(1) argument at the beginning of 5809518bcf38Smrg # install_prog (especially on Windows NT). 5810518bcf38Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5811518bcf38Smrg # Allow the use of GNU shtool's install command. 5812518bcf38Smrg $echo "X$nonopt" | grep shtool > /dev/null; then 5813518bcf38Smrg # Aesthetically quote it. 5814518bcf38Smrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5815518bcf38Smrg case $arg in 5816518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5817518bcf38Smrg arg="\"$arg\"" 5818518bcf38Smrg ;; 5819f55e6a01Smrg esac 5820518bcf38Smrg install_prog="$arg " 5821518bcf38Smrg arg="$1" 5822518bcf38Smrg shift 5823518bcf38Smrg else 5824518bcf38Smrg install_prog= 5825518bcf38Smrg arg=$nonopt 5826518bcf38Smrg fi 5827c35d236eSmrg 5828518bcf38Smrg # The real first argument should be the name of the installation program. 5829518bcf38Smrg # Aesthetically quote it. 5830518bcf38Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5831518bcf38Smrg case $arg in 5832518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5833518bcf38Smrg arg="\"$arg\"" 5834518bcf38Smrg ;; 5835518bcf38Smrg esac 5836518bcf38Smrg install_prog="$install_prog$arg" 5837c35d236eSmrg 5838518bcf38Smrg # We need to accept at least all the BSD install flags. 5839518bcf38Smrg dest= 5840518bcf38Smrg files= 5841518bcf38Smrg opts= 5842518bcf38Smrg prev= 5843518bcf38Smrg install_type= 5844518bcf38Smrg isdir=no 5845518bcf38Smrg stripme= 5846518bcf38Smrg for arg 5847518bcf38Smrg do 5848518bcf38Smrg if test -n "$dest"; then 5849518bcf38Smrg files="$files $dest" 5850518bcf38Smrg dest=$arg 5851518bcf38Smrg continue 5852518bcf38Smrg fi 5853f55e6a01Smrg 5854518bcf38Smrg case $arg in 5855518bcf38Smrg -d) isdir=yes ;; 5856518bcf38Smrg -f) 5857518bcf38Smrg case " $install_prog " in 5858518bcf38Smrg *[\\\ /]cp\ *) ;; 5859518bcf38Smrg *) prev=$arg ;; 5860518bcf38Smrg esac 5861518bcf38Smrg ;; 5862518bcf38Smrg -g | -m | -o) prev=$arg ;; 5863518bcf38Smrg -s) 5864518bcf38Smrg stripme=" -s" 5865518bcf38Smrg continue 5866518bcf38Smrg ;; 5867518bcf38Smrg -*) 5868518bcf38Smrg ;; 5869518bcf38Smrg *) 5870518bcf38Smrg # If the previous option needed an argument, then skip it. 5871518bcf38Smrg if test -n "$prev"; then 5872518bcf38Smrg prev= 5873518bcf38Smrg else 5874518bcf38Smrg dest=$arg 5875518bcf38Smrg continue 5876518bcf38Smrg fi 5877c35d236eSmrg ;; 5878f55e6a01Smrg esac 5879c35d236eSmrg 5880518bcf38Smrg # Aesthetically quote the argument. 5881518bcf38Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5882518bcf38Smrg case $arg in 5883518bcf38Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5884518bcf38Smrg arg="\"$arg\"" 5885f55e6a01Smrg ;; 5886f55e6a01Smrg esac 5887518bcf38Smrg install_prog="$install_prog $arg" 5888518bcf38Smrg done 5889c35d236eSmrg 5890518bcf38Smrg if test -z "$install_prog"; then 5891518bcf38Smrg $echo "$modename: you must specify an install program" 1>&2 5892518bcf38Smrg $echo "$help" 1>&2 5893518bcf38Smrg exit $EXIT_FAILURE 5894518bcf38Smrg fi 5895c35d236eSmrg 5896518bcf38Smrg if test -n "$prev"; then 5897518bcf38Smrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 5898518bcf38Smrg $echo "$help" 1>&2 5899518bcf38Smrg exit $EXIT_FAILURE 5900518bcf38Smrg fi 5901518bcf38Smrg 5902518bcf38Smrg if test -z "$files"; then 5903518bcf38Smrg if test -z "$dest"; then 5904518bcf38Smrg $echo "$modename: no file or destination specified" 1>&2 5905518bcf38Smrg else 5906518bcf38Smrg $echo "$modename: you must specify a destination" 1>&2 5907518bcf38Smrg fi 5908518bcf38Smrg $echo "$help" 1>&2 5909518bcf38Smrg exit $EXIT_FAILURE 5910518bcf38Smrg fi 5911518bcf38Smrg 5912518bcf38Smrg # Strip any trailing slash from the destination. 5913518bcf38Smrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 5914518bcf38Smrg 5915518bcf38Smrg # Check to see that the destination is a directory. 5916518bcf38Smrg test -d "$dest" && isdir=yes 5917518bcf38Smrg if test "$isdir" = yes; then 5918518bcf38Smrg destdir="$dest" 5919518bcf38Smrg destname= 5920518bcf38Smrg else 5921518bcf38Smrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 5922518bcf38Smrg test "X$destdir" = "X$dest" && destdir=. 5923518bcf38Smrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 5924518bcf38Smrg 5925518bcf38Smrg # Not a directory, so check to see that there is only one file specified. 5926518bcf38Smrg set dummy $files 5927518bcf38Smrg if test "$#" -gt 2; then 5928518bcf38Smrg $echo "$modename: \`$dest' is not a directory" 1>&2 5929518bcf38Smrg $echo "$help" 1>&2 5930518bcf38Smrg exit $EXIT_FAILURE 5931518bcf38Smrg fi 5932518bcf38Smrg fi 5933518bcf38Smrg case $destdir in 5934518bcf38Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 5935518bcf38Smrg *) 5936518bcf38Smrg for file in $files; do 5937518bcf38Smrg case $file in 5938518bcf38Smrg *.lo) ;; 5939f55e6a01Smrg *) 5940518bcf38Smrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 5941518bcf38Smrg $echo "$help" 1>&2 5942518bcf38Smrg exit $EXIT_FAILURE 5943f55e6a01Smrg ;; 5944f55e6a01Smrg esac 5945f55e6a01Smrg done 5946518bcf38Smrg ;; 5947518bcf38Smrg esac 5948c35d236eSmrg 5949518bcf38Smrg # This variable tells wrapper scripts just to set variables rather 5950518bcf38Smrg # than running their programs. 5951518bcf38Smrg libtool_install_magic="$magic" 5952c35d236eSmrg 5953518bcf38Smrg staticlibs= 5954518bcf38Smrg future_libdirs= 5955518bcf38Smrg current_libdirs= 5956518bcf38Smrg for file in $files; do 5957c35d236eSmrg 5958518bcf38Smrg # Do each installation. 5959518bcf38Smrg case $file in 5960518bcf38Smrg *.$libext) 5961518bcf38Smrg # Do the static libraries later. 5962518bcf38Smrg staticlibs="$staticlibs $file" 5963518bcf38Smrg ;; 5964518bcf38Smrg 5965518bcf38Smrg *.la) 5966518bcf38Smrg # Check to see that this really is a libtool archive. 5967518bcf38Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 5968518bcf38Smrg else 5969518bcf38Smrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 5970518bcf38Smrg $echo "$help" 1>&2 5971518bcf38Smrg exit $EXIT_FAILURE 5972518bcf38Smrg fi 5973518bcf38Smrg 5974518bcf38Smrg library_names= 5975518bcf38Smrg old_library= 5976518bcf38Smrg relink_command= 5977518bcf38Smrg # If there is no directory component, then add one. 5978518bcf38Smrg case $file in 5979518bcf38Smrg */* | *\\*) . $file ;; 5980518bcf38Smrg *) . ./$file ;; 5981518bcf38Smrg esac 5982518bcf38Smrg 5983518bcf38Smrg # Add the libdir to current_libdirs if it is the destination. 5984518bcf38Smrg if test "X$destdir" = "X$libdir"; then 5985518bcf38Smrg case "$current_libdirs " in 5986f55e6a01Smrg *" $libdir "*) ;; 5987518bcf38Smrg *) current_libdirs="$current_libdirs $libdir" ;; 5988f55e6a01Smrg esac 5989518bcf38Smrg else 5990518bcf38Smrg # Note the libdir as a future libdir. 5991518bcf38Smrg case "$future_libdirs " in 5992f55e6a01Smrg *" $libdir "*) ;; 5993518bcf38Smrg *) future_libdirs="$future_libdirs $libdir" ;; 5994f55e6a01Smrg esac 5995f55e6a01Smrg fi 5996c35d236eSmrg 5997518bcf38Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 5998518bcf38Smrg test "X$dir" = "X$file/" && dir= 5999518bcf38Smrg dir="$dir$objdir" 6000518bcf38Smrg 6001518bcf38Smrg if test -n "$relink_command"; then 6002518bcf38Smrg # Determine the prefix the user has applied to our future dir. 6003518bcf38Smrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 6004518bcf38Smrg 6005518bcf38Smrg # Don't allow the user to place us outside of our expected 6006518bcf38Smrg # location b/c this prevents finding dependent libraries that 6007518bcf38Smrg # are installed to the same prefix. 6008518bcf38Smrg # At present, this check doesn't affect windows .dll's that 6009518bcf38Smrg # are installed into $libdir/../bin (currently, that works fine) 6010518bcf38Smrg # but it's something to keep an eye on. 6011518bcf38Smrg if test "$inst_prefix_dir" = "$destdir"; then 6012518bcf38Smrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 6013518bcf38Smrg exit $EXIT_FAILURE 6014518bcf38Smrg fi 6015518bcf38Smrg 6016518bcf38Smrg if test -n "$inst_prefix_dir"; then 6017518bcf38Smrg # Stick the inst_prefix_dir data into the link command. 6018518bcf38Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 6019518bcf38Smrg else 6020518bcf38Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 6021518bcf38Smrg fi 6022518bcf38Smrg 6023518bcf38Smrg $echo "$modename: warning: relinking \`$file'" 1>&2 6024518bcf38Smrg $show "$relink_command" 6025518bcf38Smrg if $run eval "$relink_command"; then : 6026c35d236eSmrg else 6027518bcf38Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6028518bcf38Smrg exit $EXIT_FAILURE 6029c35d236eSmrg fi 6030c35d236eSmrg fi 6031c35d236eSmrg 6032518bcf38Smrg # See the names of the shared library. 6033518bcf38Smrg set dummy $library_names 6034518bcf38Smrg if test -n "$2"; then 6035518bcf38Smrg realname="$2" 6036518bcf38Smrg shift 6037518bcf38Smrg shift 6038c35d236eSmrg 6039518bcf38Smrg srcname="$realname" 6040518bcf38Smrg test -n "$relink_command" && srcname="$realname"T 6041c35d236eSmrg 6042518bcf38Smrg # Install the shared library and build the symlinks. 6043518bcf38Smrg $show "$install_prog $dir/$srcname $destdir/$realname" 6044518bcf38Smrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 6045518bcf38Smrg if test -n "$stripme" && test -n "$striplib"; then 6046518bcf38Smrg $show "$striplib $destdir/$realname" 6047518bcf38Smrg $run eval "$striplib $destdir/$realname" || exit $? 6048518bcf38Smrg fi 6049c35d236eSmrg 6050518bcf38Smrg if test "$#" -gt 0; then 6051518bcf38Smrg # Delete the old symlinks, and create new ones. 6052518bcf38Smrg # Try `ln -sf' first, because the `ln' binary might depend on 6053518bcf38Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 6054518bcf38Smrg # so we also need to try rm && ln -s. 6055518bcf38Smrg for linkname 6056518bcf38Smrg do 6057518bcf38Smrg if test "$linkname" != "$realname"; then 6058518bcf38Smrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6059518bcf38Smrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6060518bcf38Smrg fi 6061518bcf38Smrg done 6062518bcf38Smrg fi 6063c35d236eSmrg 6064518bcf38Smrg # Do each command in the postinstall commands. 6065518bcf38Smrg lib="$destdir/$realname" 6066518bcf38Smrg cmds=$postinstall_cmds 6067518bcf38Smrg save_ifs="$IFS"; IFS='~' 6068518bcf38Smrg for cmd in $cmds; do 6069518bcf38Smrg IFS="$save_ifs" 6070518bcf38Smrg eval cmd=\"$cmd\" 6071518bcf38Smrg $show "$cmd" 6072518bcf38Smrg $run eval "$cmd" || { 6073518bcf38Smrg lt_exit=$? 6074518bcf38Smrg 6075518bcf38Smrg # Restore the uninstalled library and exit 6076518bcf38Smrg if test "$mode" = relink; then 6077518bcf38Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 6078518bcf38Smrg fi 6079c35d236eSmrg 6080518bcf38Smrg exit $lt_exit 6081518bcf38Smrg } 6082518bcf38Smrg done 6083518bcf38Smrg IFS="$save_ifs" 6084c35d236eSmrg fi 6085c35d236eSmrg 6086518bcf38Smrg # Install the pseudo-library for information purposes. 6087518bcf38Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6088518bcf38Smrg instname="$dir/$name"i 6089518bcf38Smrg $show "$install_prog $instname $destdir/$name" 6090518bcf38Smrg $run eval "$install_prog $instname $destdir/$name" || exit $? 6091c35d236eSmrg 6092518bcf38Smrg # Maybe install the static library, too. 6093518bcf38Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 6094518bcf38Smrg ;; 6095c35d236eSmrg 6096518bcf38Smrg *.lo) 6097518bcf38Smrg # Install (i.e. copy) a libtool object. 6098518bcf38Smrg 6099518bcf38Smrg # Figure out destination file name, if it wasn't already specified. 6100518bcf38Smrg if test -n "$destname"; then 6101518bcf38Smrg destfile="$destdir/$destname" 6102518bcf38Smrg else 6103518bcf38Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6104518bcf38Smrg destfile="$destdir/$destfile" 6105c35d236eSmrg fi 6106518bcf38Smrg 6107518bcf38Smrg # Deduce the name of the destination old-style object file. 6108518bcf38Smrg case $destfile in 6109518bcf38Smrg *.lo) 6110518bcf38Smrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 6111518bcf38Smrg ;; 6112518bcf38Smrg *.$objext) 6113518bcf38Smrg staticdest="$destfile" 6114518bcf38Smrg destfile= 6115518bcf38Smrg ;; 6116518bcf38Smrg *) 6117518bcf38Smrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 6118518bcf38Smrg $echo "$help" 1>&2 6119518bcf38Smrg exit $EXIT_FAILURE 6120518bcf38Smrg ;; 6121518bcf38Smrg esac 6122518bcf38Smrg 6123518bcf38Smrg # Install the libtool object if requested. 6124518bcf38Smrg if test -n "$destfile"; then 6125518bcf38Smrg $show "$install_prog $file $destfile" 6126518bcf38Smrg $run eval "$install_prog $file $destfile" || exit $? 6127c35d236eSmrg fi 6128c35d236eSmrg 6129518bcf38Smrg # Install the old object if enabled. 6130518bcf38Smrg if test "$build_old_libs" = yes; then 6131518bcf38Smrg # Deduce the name of the old-style object file. 6132518bcf38Smrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 6133c35d236eSmrg 6134518bcf38Smrg $show "$install_prog $staticobj $staticdest" 6135518bcf38Smrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 6136518bcf38Smrg fi 6137518bcf38Smrg exit $EXIT_SUCCESS 6138518bcf38Smrg ;; 6139f55e6a01Smrg 6140518bcf38Smrg *) 6141518bcf38Smrg # Figure out destination file name, if it wasn't already specified. 6142518bcf38Smrg if test -n "$destname"; then 6143518bcf38Smrg destfile="$destdir/$destname" 6144c35d236eSmrg else 6145518bcf38Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6146518bcf38Smrg destfile="$destdir/$destfile" 6147c35d236eSmrg fi 6148c35d236eSmrg 6149518bcf38Smrg # If the file is missing, and there is a .exe on the end, strip it 6150518bcf38Smrg # because it is most likely a libtool script we actually want to 6151518bcf38Smrg # install 6152518bcf38Smrg stripped_ext="" 6153518bcf38Smrg case $file in 6154518bcf38Smrg *.exe) 6155518bcf38Smrg if test ! -f "$file"; then 6156518bcf38Smrg file=`$echo $file|${SED} 's,.exe$,,'` 6157518bcf38Smrg stripped_ext=".exe" 6158518bcf38Smrg fi 6159518bcf38Smrg ;; 6160518bcf38Smrg esac 6161c35d236eSmrg 6162518bcf38Smrg # Do a test to see if this is really a libtool program. 6163518bcf38Smrg case $host in 6164518bcf38Smrg *cygwin*|*mingw*) 6165518bcf38Smrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 6166518bcf38Smrg ;; 6167518bcf38Smrg *) 6168518bcf38Smrg wrapper=$file 6169518bcf38Smrg ;; 6170518bcf38Smrg esac 6171518bcf38Smrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6172518bcf38Smrg notinst_deplibs= 6173518bcf38Smrg relink_command= 6174c35d236eSmrg 6175518bcf38Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 6176518bcf38Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 6177518bcf38Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 6178518bcf38Smrg # `FILE.' does not work on cygwin managed mounts. 6179518bcf38Smrg # 6180518bcf38Smrg # If there is no directory component, then add one. 6181518bcf38Smrg case $wrapper in 6182518bcf38Smrg */* | *\\*) . ${wrapper} ;; 6183518bcf38Smrg *) . ./${wrapper} ;; 6184518bcf38Smrg esac 6185c35d236eSmrg 6186518bcf38Smrg # Check the variables that should have been set. 6187518bcf38Smrg if test -z "$notinst_deplibs"; then 6188518bcf38Smrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6189518bcf38Smrg exit $EXIT_FAILURE 6190518bcf38Smrg fi 6191c35d236eSmrg 6192518bcf38Smrg finalize=yes 6193518bcf38Smrg for lib in $notinst_deplibs; do 6194518bcf38Smrg # Check to see that each library is installed. 6195518bcf38Smrg libdir= 6196518bcf38Smrg if test -f "$lib"; then 6197518bcf38Smrg # If there is no directory component, then add one. 6198518bcf38Smrg case $lib in 6199518bcf38Smrg */* | *\\*) . $lib ;; 6200518bcf38Smrg *) . ./$lib ;; 6201518bcf38Smrg esac 6202518bcf38Smrg fi 6203518bcf38Smrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 6204518bcf38Smrg if test -n "$libdir" && test ! -f "$libfile"; then 6205518bcf38Smrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 6206518bcf38Smrg finalize=no 6207518bcf38Smrg fi 6208518bcf38Smrg done 6209518bcf38Smrg 6210518bcf38Smrg relink_command= 6211518bcf38Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 6212518bcf38Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 6213518bcf38Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 6214518bcf38Smrg # `FILE.' does not work on cygwin managed mounts. 6215518bcf38Smrg # 6216518bcf38Smrg # If there is no directory component, then add one. 6217518bcf38Smrg case $wrapper in 6218518bcf38Smrg */* | *\\*) . ${wrapper} ;; 6219518bcf38Smrg *) . ./${wrapper} ;; 6220518bcf38Smrg esac 6221518bcf38Smrg 6222518bcf38Smrg outputname= 6223518bcf38Smrg if test "$fast_install" = no && test -n "$relink_command"; then 6224518bcf38Smrg if test "$finalize" = yes && test -z "$run"; then 6225518bcf38Smrg tmpdir=`func_mktempdir` 6226518bcf38Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6227518bcf38Smrg outputname="$tmpdir/$file" 6228518bcf38Smrg # Replace the output file specification. 6229518bcf38Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 6230518bcf38Smrg 6231518bcf38Smrg $show "$relink_command" 6232518bcf38Smrg if $run eval "$relink_command"; then : 6233518bcf38Smrg else 6234518bcf38Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6235518bcf38Smrg ${rm}r "$tmpdir" 6236518bcf38Smrg continue 6237518bcf38Smrg fi 6238518bcf38Smrg file="$outputname" 6239518bcf38Smrg else 6240518bcf38Smrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 6241518bcf38Smrg fi 6242c35d236eSmrg else 6243518bcf38Smrg # Install the binary that we compiled earlier. 6244518bcf38Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 6245c35d236eSmrg fi 6246518bcf38Smrg fi 6247f55e6a01Smrg 6248518bcf38Smrg # remove .exe since cygwin /usr/bin/install will append another 6249518bcf38Smrg # one anyway 6250518bcf38Smrg case $install_prog,$host in 6251518bcf38Smrg */usr/bin/install*,*cygwin*) 6252518bcf38Smrg case $file:$destfile in 6253518bcf38Smrg *.exe:*.exe) 6254518bcf38Smrg # this is ok 6255518bcf38Smrg ;; 6256518bcf38Smrg *.exe:*) 6257518bcf38Smrg destfile=$destfile.exe 6258518bcf38Smrg ;; 6259518bcf38Smrg *:*.exe) 6260518bcf38Smrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 6261518bcf38Smrg ;; 6262518bcf38Smrg esac 6263518bcf38Smrg ;; 6264f55e6a01Smrg esac 6265518bcf38Smrg $show "$install_prog$stripme $file $destfile" 6266518bcf38Smrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 6267518bcf38Smrg test -n "$outputname" && ${rm}r "$tmpdir" 6268518bcf38Smrg ;; 6269518bcf38Smrg esac 6270518bcf38Smrg done 6271c35d236eSmrg 6272518bcf38Smrg for file in $staticlibs; do 6273518bcf38Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6274c35d236eSmrg 6275518bcf38Smrg # Set up the ranlib parameters. 6276518bcf38Smrg oldlib="$destdir/$name" 6277c35d236eSmrg 6278518bcf38Smrg $show "$install_prog $file $oldlib" 6279518bcf38Smrg $run eval "$install_prog \$file \$oldlib" || exit $? 6280c35d236eSmrg 6281518bcf38Smrg if test -n "$stripme" && test -n "$old_striplib"; then 6282518bcf38Smrg $show "$old_striplib $oldlib" 6283518bcf38Smrg $run eval "$old_striplib $oldlib" || exit $? 6284c35d236eSmrg fi 6285c35d236eSmrg 6286518bcf38Smrg # Do each command in the postinstall commands. 6287518bcf38Smrg cmds=$old_postinstall_cmds 6288518bcf38Smrg save_ifs="$IFS"; IFS='~' 6289518bcf38Smrg for cmd in $cmds; do 6290518bcf38Smrg IFS="$save_ifs" 6291518bcf38Smrg eval cmd=\"$cmd\" 6292518bcf38Smrg $show "$cmd" 6293518bcf38Smrg $run eval "$cmd" || exit $? 6294518bcf38Smrg done 6295518bcf38Smrg IFS="$save_ifs" 6296518bcf38Smrg done 6297c35d236eSmrg 6298518bcf38Smrg if test -n "$future_libdirs"; then 6299518bcf38Smrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 6300518bcf38Smrg fi 6301c35d236eSmrg 6302518bcf38Smrg if test -n "$current_libdirs"; then 6303518bcf38Smrg # Maybe just do a dry run. 6304518bcf38Smrg test -n "$run" && current_libdirs=" -n$current_libdirs" 6305518bcf38Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 6306518bcf38Smrg else 6307518bcf38Smrg exit $EXIT_SUCCESS 6308518bcf38Smrg fi 6309518bcf38Smrg ;; 6310c35d236eSmrg 6311518bcf38Smrg # libtool finish mode 6312518bcf38Smrg finish) 6313518bcf38Smrg modename="$modename: finish" 6314518bcf38Smrg libdirs="$nonopt" 6315518bcf38Smrg admincmds= 6316c35d236eSmrg 6317518bcf38Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 6318518bcf38Smrg for dir 6319518bcf38Smrg do 6320518bcf38Smrg libdirs="$libdirs $dir" 6321518bcf38Smrg done 6322c35d236eSmrg 6323518bcf38Smrg for libdir in $libdirs; do 6324518bcf38Smrg if test -n "$finish_cmds"; then 6325518bcf38Smrg # Do each command in the finish commands. 6326518bcf38Smrg cmds=$finish_cmds 6327518bcf38Smrg save_ifs="$IFS"; IFS='~' 6328518bcf38Smrg for cmd in $cmds; do 6329518bcf38Smrg IFS="$save_ifs" 6330518bcf38Smrg eval cmd=\"$cmd\" 6331518bcf38Smrg $show "$cmd" 6332518bcf38Smrg $run eval "$cmd" || admincmds="$admincmds 6333518bcf38Smrg $cmd" 6334c35d236eSmrg done 6335518bcf38Smrg IFS="$save_ifs" 6336c35d236eSmrg fi 6337518bcf38Smrg if test -n "$finish_eval"; then 6338518bcf38Smrg # Do the single finish_eval. 6339518bcf38Smrg eval cmds=\"$finish_eval\" 6340518bcf38Smrg $run eval "$cmds" || admincmds="$admincmds 6341518bcf38Smrg $cmds" 6342f55e6a01Smrg fi 6343518bcf38Smrg done 6344518bcf38Smrg fi 6345518bcf38Smrg 6346518bcf38Smrg # Exit here if they wanted silent mode. 6347518bcf38Smrg test "$show" = : && exit $EXIT_SUCCESS 6348518bcf38Smrg 6349518bcf38Smrg $echo "X----------------------------------------------------------------------" | $Xsed 6350518bcf38Smrg $echo "Libraries have been installed in:" 6351518bcf38Smrg for libdir in $libdirs; do 6352518bcf38Smrg $echo " $libdir" 6353c35d236eSmrg done 6354518bcf38Smrg $echo 6355518bcf38Smrg $echo "If you ever happen to want to link against installed libraries" 6356518bcf38Smrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 6357518bcf38Smrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 6358518bcf38Smrg $echo "flag during linking and do at least one of the following:" 6359518bcf38Smrg if test -n "$shlibpath_var"; then 6360518bcf38Smrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 6361518bcf38Smrg $echo " during execution" 6362518bcf38Smrg fi 6363518bcf38Smrg if test -n "$runpath_var"; then 6364518bcf38Smrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 6365518bcf38Smrg $echo " during linking" 6366518bcf38Smrg fi 6367518bcf38Smrg if test -n "$hardcode_libdir_flag_spec"; then 6368518bcf38Smrg libdir=LIBDIR 6369518bcf38Smrg eval flag=\"$hardcode_libdir_flag_spec\" 6370c35d236eSmrg 6371518bcf38Smrg $echo " - use the \`$flag' linker flag" 6372518bcf38Smrg fi 6373518bcf38Smrg if test -n "$admincmds"; then 6374518bcf38Smrg $echo " - have your system administrator run these commands:$admincmds" 6375518bcf38Smrg fi 6376518bcf38Smrg if test -f /etc/ld.so.conf; then 6377518bcf38Smrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6378518bcf38Smrg fi 6379518bcf38Smrg $echo 6380518bcf38Smrg $echo "See any operating system documentation about shared libraries for" 6381518bcf38Smrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6382518bcf38Smrg $echo "X----------------------------------------------------------------------" | $Xsed 6383518bcf38Smrg exit $EXIT_SUCCESS 6384518bcf38Smrg ;; 6385c35d236eSmrg 6386518bcf38Smrg # libtool execute mode 6387518bcf38Smrg execute) 6388518bcf38Smrg modename="$modename: execute" 6389c35d236eSmrg 6390518bcf38Smrg # The first argument is the command name. 6391518bcf38Smrg cmd="$nonopt" 6392518bcf38Smrg if test -z "$cmd"; then 6393518bcf38Smrg $echo "$modename: you must specify a COMMAND" 1>&2 6394518bcf38Smrg $echo "$help" 6395518bcf38Smrg exit $EXIT_FAILURE 6396518bcf38Smrg fi 6397c35d236eSmrg 6398518bcf38Smrg # Handle -dlopen flags immediately. 6399518bcf38Smrg for file in $execute_dlfiles; do 6400518bcf38Smrg if test ! -f "$file"; then 6401518bcf38Smrg $echo "$modename: \`$file' is not a file" 1>&2 6402518bcf38Smrg $echo "$help" 1>&2 6403518bcf38Smrg exit $EXIT_FAILURE 6404518bcf38Smrg fi 6405c35d236eSmrg 6406518bcf38Smrg dir= 6407518bcf38Smrg case $file in 6408518bcf38Smrg *.la) 6409518bcf38Smrg # Check to see that this really is a libtool archive. 6410518bcf38Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 6411518bcf38Smrg else 6412518bcf38Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 6413518bcf38Smrg $echo "$help" 1>&2 6414518bcf38Smrg exit $EXIT_FAILURE 6415518bcf38Smrg fi 6416c35d236eSmrg 6417518bcf38Smrg # Read the libtool library. 6418518bcf38Smrg dlname= 6419518bcf38Smrg library_names= 6420c35d236eSmrg 6421518bcf38Smrg # If there is no directory component, then add one. 6422518bcf38Smrg case $file in 6423518bcf38Smrg */* | *\\*) . $file ;; 6424518bcf38Smrg *) . ./$file ;; 6425518bcf38Smrg esac 6426c35d236eSmrg 6427518bcf38Smrg # Skip this library if it cannot be dlopened. 6428518bcf38Smrg if test -z "$dlname"; then 6429518bcf38Smrg # Warn if it was a shared library. 6430518bcf38Smrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 6431518bcf38Smrg continue 6432518bcf38Smrg fi 6433c35d236eSmrg 6434518bcf38Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6435518bcf38Smrg test "X$dir" = "X$file" && dir=. 6436c35d236eSmrg 6437518bcf38Smrg if test -f "$dir/$objdir/$dlname"; then 6438518bcf38Smrg dir="$dir/$objdir" 6439518bcf38Smrg else 6440518bcf38Smrg if test ! -f "$dir/$dlname"; then 6441518bcf38Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 6442518bcf38Smrg exit $EXIT_FAILURE 6443518bcf38Smrg fi 6444518bcf38Smrg fi 6445518bcf38Smrg ;; 6446c35d236eSmrg 6447518bcf38Smrg *.lo) 6448518bcf38Smrg # Just add the directory containing the .lo file. 6449518bcf38Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6450518bcf38Smrg test "X$dir" = "X$file" && dir=. 6451518bcf38Smrg ;; 6452c35d236eSmrg 6453518bcf38Smrg *) 6454518bcf38Smrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 6455518bcf38Smrg continue 6456518bcf38Smrg ;; 6457518bcf38Smrg esac 6458c35d236eSmrg 6459518bcf38Smrg # Get the absolute pathname. 6460518bcf38Smrg absdir=`cd "$dir" && pwd` 6461518bcf38Smrg test -n "$absdir" && dir="$absdir" 6462c35d236eSmrg 6463518bcf38Smrg # Now add the directory to shlibpath_var. 6464518bcf38Smrg if eval "test -z \"\$$shlibpath_var\""; then 6465518bcf38Smrg eval "$shlibpath_var=\"\$dir\"" 6466518bcf38Smrg else 6467518bcf38Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 6468518bcf38Smrg fi 6469518bcf38Smrg done 6470c35d236eSmrg 6471518bcf38Smrg # This variable tells wrapper scripts just to set shlibpath_var 6472518bcf38Smrg # rather than running their programs. 6473518bcf38Smrg libtool_execute_magic="$magic" 6474c35d236eSmrg 6475518bcf38Smrg # Check if any of the arguments is a wrapper script. 6476518bcf38Smrg args= 6477518bcf38Smrg for file 6478518bcf38Smrg do 6479518bcf38Smrg case $file in 6480518bcf38Smrg -*) ;; 6481518bcf38Smrg *) 6482518bcf38Smrg # Do a test to see if this is really a libtool program. 6483518bcf38Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6484518bcf38Smrg # If there is no directory component, then add one. 6485518bcf38Smrg case $file in 6486518bcf38Smrg */* | *\\*) . $file ;; 6487518bcf38Smrg *) . ./$file ;; 6488518bcf38Smrg esac 6489c35d236eSmrg 6490518bcf38Smrg # Transform arg to wrapped name. 6491518bcf38Smrg file="$progdir/$program" 6492518bcf38Smrg fi 6493518bcf38Smrg ;; 6494518bcf38Smrg esac 6495518bcf38Smrg # Quote arguments (to preserve shell metacharacters). 6496518bcf38Smrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 6497518bcf38Smrg args="$args \"$file\"" 6498518bcf38Smrg done 64994f6cd06fSmrg 6500518bcf38Smrg if test -z "$run"; then 6501518bcf38Smrg if test -n "$shlibpath_var"; then 6502518bcf38Smrg # Export the shlibpath_var. 6503518bcf38Smrg eval "export $shlibpath_var" 6504518bcf38Smrg fi 6505518bcf38Smrg 6506518bcf38Smrg # Restore saved environment variables 6507518bcf38Smrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 6508518bcf38Smrg do 6509518bcf38Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 6510518bcf38Smrg $lt_var=\$save_$lt_var; export $lt_var 6511518bcf38Smrg fi" 6512518bcf38Smrg done 6513c35d236eSmrg 6514518bcf38Smrg # Now prepare to actually exec the command. 6515518bcf38Smrg exec_cmd="\$cmd$args" 6516518bcf38Smrg else 6517518bcf38Smrg # Display what would be done. 6518518bcf38Smrg if test -n "$shlibpath_var"; then 6519518bcf38Smrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 6520518bcf38Smrg $echo "export $shlibpath_var" 6521518bcf38Smrg fi 6522518bcf38Smrg $echo "$cmd$args" 6523518bcf38Smrg exit $EXIT_SUCCESS 6524518bcf38Smrg fi 6525518bcf38Smrg ;; 6526c35d236eSmrg 6527518bcf38Smrg # libtool clean and uninstall mode 6528518bcf38Smrg clean | uninstall) 6529518bcf38Smrg modename="$modename: $mode" 6530518bcf38Smrg rm="$nonopt" 6531c35d236eSmrg files= 6532c35d236eSmrg rmforce= 6533c35d236eSmrg exit_status=0 6534c35d236eSmrg 6535c35d236eSmrg # This variable tells wrapper scripts just to set variables rather 6536c35d236eSmrg # than running their programs. 6537c35d236eSmrg libtool_install_magic="$magic" 6538c35d236eSmrg 6539c35d236eSmrg for arg 6540c35d236eSmrg do 6541c35d236eSmrg case $arg in 6542518bcf38Smrg -f) rm="$rm $arg"; rmforce=yes ;; 6543518bcf38Smrg -*) rm="$rm $arg" ;; 6544c35d236eSmrg *) files="$files $arg" ;; 6545c35d236eSmrg esac 6546c35d236eSmrg done 6547c35d236eSmrg 6548518bcf38Smrg if test -z "$rm"; then 6549518bcf38Smrg $echo "$modename: you must specify an RM program" 1>&2 6550518bcf38Smrg $echo "$help" 1>&2 6551518bcf38Smrg exit $EXIT_FAILURE 6552518bcf38Smrg fi 6553c35d236eSmrg 6554c35d236eSmrg rmdirs= 6555c35d236eSmrg 6556c35d236eSmrg origobjdir="$objdir" 6557c35d236eSmrg for file in $files; do 6558518bcf38Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6559518bcf38Smrg if test "X$dir" = "X$file"; then 6560518bcf38Smrg dir=. 6561c35d236eSmrg objdir="$origobjdir" 6562c35d236eSmrg else 6563c35d236eSmrg objdir="$dir/$origobjdir" 6564c35d236eSmrg fi 6565518bcf38Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6566c35d236eSmrg test "$mode" = uninstall && objdir="$dir" 6567c35d236eSmrg 6568c35d236eSmrg # Remember objdir for removal later, being careful to avoid duplicates 6569c35d236eSmrg if test "$mode" = clean; then 6570c35d236eSmrg case " $rmdirs " in 6571c35d236eSmrg *" $objdir "*) ;; 6572c35d236eSmrg *) rmdirs="$rmdirs $objdir" ;; 6573c35d236eSmrg esac 6574c35d236eSmrg fi 6575c35d236eSmrg 6576c35d236eSmrg # Don't error if the file doesn't exist and rm -f was used. 6577518bcf38Smrg if (test -L "$file") >/dev/null 2>&1 \ 6578518bcf38Smrg || (test -h "$file") >/dev/null 2>&1 \ 6579518bcf38Smrg || test -f "$file"; then 6580c35d236eSmrg : 6581c35d236eSmrg elif test -d "$file"; then 6582c35d236eSmrg exit_status=1 6583c35d236eSmrg continue 6584c35d236eSmrg elif test "$rmforce" = yes; then 6585c35d236eSmrg continue 6586c35d236eSmrg fi 6587c35d236eSmrg 6588c35d236eSmrg rmfiles="$file" 6589c35d236eSmrg 6590c35d236eSmrg case $name in 6591c35d236eSmrg *.la) 6592c35d236eSmrg # Possibly a libtool archive, so verify it. 6593518bcf38Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6594518bcf38Smrg . $dir/$name 6595c35d236eSmrg 6596c35d236eSmrg # Delete the libtool libraries and symlinks. 6597c35d236eSmrg for n in $library_names; do 6598c35d236eSmrg rmfiles="$rmfiles $objdir/$n" 6599c35d236eSmrg done 6600c35d236eSmrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6601c35d236eSmrg 6602c35d236eSmrg case "$mode" in 6603c35d236eSmrg clean) 6604c35d236eSmrg case " $library_names " in 6605c35d236eSmrg # " " in the beginning catches empty $dlname 6606c35d236eSmrg *" $dlname "*) ;; 6607c35d236eSmrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 6608c35d236eSmrg esac 6609518bcf38Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 6610c35d236eSmrg ;; 6611c35d236eSmrg uninstall) 6612c35d236eSmrg if test -n "$library_names"; then 6613c35d236eSmrg # Do each command in the postuninstall commands. 6614518bcf38Smrg cmds=$postuninstall_cmds 6615518bcf38Smrg save_ifs="$IFS"; IFS='~' 6616518bcf38Smrg for cmd in $cmds; do 6617518bcf38Smrg IFS="$save_ifs" 6618518bcf38Smrg eval cmd=\"$cmd\" 6619518bcf38Smrg $show "$cmd" 6620518bcf38Smrg $run eval "$cmd" 6621518bcf38Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 6622518bcf38Smrg exit_status=1 6623518bcf38Smrg fi 6624518bcf38Smrg done 6625518bcf38Smrg IFS="$save_ifs" 6626c35d236eSmrg fi 6627c35d236eSmrg 6628c35d236eSmrg if test -n "$old_library"; then 6629c35d236eSmrg # Do each command in the old_postuninstall commands. 6630518bcf38Smrg cmds=$old_postuninstall_cmds 6631518bcf38Smrg save_ifs="$IFS"; IFS='~' 6632518bcf38Smrg for cmd in $cmds; do 6633518bcf38Smrg IFS="$save_ifs" 6634518bcf38Smrg eval cmd=\"$cmd\" 6635518bcf38Smrg $show "$cmd" 6636518bcf38Smrg $run eval "$cmd" 6637518bcf38Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 6638518bcf38Smrg exit_status=1 6639518bcf38Smrg fi 6640518bcf38Smrg done 6641518bcf38Smrg IFS="$save_ifs" 6642c35d236eSmrg fi 6643c35d236eSmrg # FIXME: should reinstall the best remaining shared library. 6644c35d236eSmrg ;; 6645c35d236eSmrg esac 6646c35d236eSmrg fi 6647c35d236eSmrg ;; 6648c35d236eSmrg 6649c35d236eSmrg *.lo) 6650c35d236eSmrg # Possibly a libtool object, so verify it. 6651518bcf38Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6652c35d236eSmrg 6653c35d236eSmrg # Read the .lo file 6654518bcf38Smrg . $dir/$name 6655c35d236eSmrg 6656c35d236eSmrg # Add PIC object to the list of files to remove. 6657518bcf38Smrg if test -n "$pic_object" \ 6658518bcf38Smrg && test "$pic_object" != none; then 6659c35d236eSmrg rmfiles="$rmfiles $dir/$pic_object" 6660c35d236eSmrg fi 6661c35d236eSmrg 6662c35d236eSmrg # Add non-PIC object to the list of files to remove. 6663518bcf38Smrg if test -n "$non_pic_object" \ 6664518bcf38Smrg && test "$non_pic_object" != none; then 6665c35d236eSmrg rmfiles="$rmfiles $dir/$non_pic_object" 6666c35d236eSmrg fi 6667c35d236eSmrg fi 6668c35d236eSmrg ;; 6669c35d236eSmrg 6670c35d236eSmrg *) 6671c35d236eSmrg if test "$mode" = clean ; then 6672c35d236eSmrg noexename=$name 6673c35d236eSmrg case $file in 6674c35d236eSmrg *.exe) 6675518bcf38Smrg file=`$echo $file|${SED} 's,.exe$,,'` 6676518bcf38Smrg noexename=`$echo $name|${SED} 's,.exe$,,'` 6677c35d236eSmrg # $file with .exe has already been added to rmfiles, 6678c35d236eSmrg # add $file without .exe 6679c35d236eSmrg rmfiles="$rmfiles $file" 6680c35d236eSmrg ;; 6681c35d236eSmrg esac 6682c35d236eSmrg # Do a test to see if this is a libtool program. 6683518bcf38Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6684518bcf38Smrg relink_command= 6685518bcf38Smrg . $dir/$noexename 6686c35d236eSmrg 6687c35d236eSmrg # note $name still contains .exe if it was in $file originally 6688c35d236eSmrg # as does the version of $file that was added into $rmfiles 6689c35d236eSmrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 6690c35d236eSmrg if test "$fast_install" = yes && test -n "$relink_command"; then 6691c35d236eSmrg rmfiles="$rmfiles $objdir/lt-$name" 6692c35d236eSmrg fi 6693c35d236eSmrg if test "X$noexename" != "X$name" ; then 6694c35d236eSmrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 6695c35d236eSmrg fi 6696c35d236eSmrg fi 6697c35d236eSmrg fi 6698c35d236eSmrg ;; 6699c35d236eSmrg esac 6700518bcf38Smrg $show "$rm $rmfiles" 6701518bcf38Smrg $run $rm $rmfiles || exit_status=1 6702c35d236eSmrg done 6703c35d236eSmrg objdir="$origobjdir" 6704c35d236eSmrg 6705c35d236eSmrg # Try to remove the ${objdir}s in the directories where we deleted files 6706c35d236eSmrg for dir in $rmdirs; do 6707c35d236eSmrg if test -d "$dir"; then 6708518bcf38Smrg $show "rmdir $dir" 6709518bcf38Smrg $run rmdir $dir >/dev/null 2>&1 6710c35d236eSmrg fi 6711c35d236eSmrg done 6712c35d236eSmrg 6713c35d236eSmrg exit $exit_status 6714518bcf38Smrg ;; 6715c35d236eSmrg 6716518bcf38Smrg "") 6717518bcf38Smrg $echo "$modename: you must specify a MODE" 1>&2 6718518bcf38Smrg $echo "$generic_help" 1>&2 6719518bcf38Smrg exit $EXIT_FAILURE 6720518bcf38Smrg ;; 6721518bcf38Smrg esac 6722f55e6a01Smrg 6723518bcf38Smrg if test -z "$exec_cmd"; then 6724518bcf38Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 6725518bcf38Smrg $echo "$generic_help" 1>&2 6726518bcf38Smrg exit $EXIT_FAILURE 6727518bcf38Smrg fi 6728518bcf38Smrgfi # test -z "$show_help" 6729c35d236eSmrg 6730c35d236eSmrgif test -n "$exec_cmd"; then 6731518bcf38Smrg eval exec $exec_cmd 6732c35d236eSmrg exit $EXIT_FAILURE 6733c35d236eSmrgfi 6734c35d236eSmrg 6735518bcf38Smrg# We need to display help for each of the modes. 6736518bcf38Smrgcase $mode in 6737518bcf38Smrg"") $echo \ 6738518bcf38Smrg"Usage: $modename [OPTION]... [MODE-ARG]... 6739518bcf38Smrg 6740518bcf38SmrgProvide generalized library-building support services. 6741518bcf38Smrg 6742518bcf38Smrg --config show all configuration variables 6743518bcf38Smrg --debug enable verbose shell tracing 6744518bcf38Smrg-n, --dry-run display commands without modifying any files 6745518bcf38Smrg --features display basic configuration information and exit 6746518bcf38Smrg --finish same as \`--mode=finish' 6747518bcf38Smrg --help display this help message and exit 6748518bcf38Smrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 6749518bcf38Smrg --quiet same as \`--silent' 6750518bcf38Smrg --silent don't print informational messages 6751518bcf38Smrg --tag=TAG use configuration variables from tag TAG 6752518bcf38Smrg --version print version information 6753518bcf38Smrg 6754518bcf38SmrgMODE must be one of the following: 6755518bcf38Smrg 6756518bcf38Smrg clean remove files from the build directory 6757518bcf38Smrg compile compile a source file into a libtool object 6758518bcf38Smrg execute automatically set library path, then run a program 6759518bcf38Smrg finish complete the installation of libtool libraries 6760518bcf38Smrg install install libraries or executables 6761518bcf38Smrg link create a library or an executable 6762518bcf38Smrg uninstall remove libraries from an installed directory 6763518bcf38Smrg 6764518bcf38SmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 6765518bcf38Smrga more detailed description of MODE. 6766518bcf38Smrg 6767518bcf38SmrgReport bugs to <bug-libtool@gnu.org>." 6768518bcf38Smrg exit $EXIT_SUCCESS 6769518bcf38Smrg ;; 6770518bcf38Smrg 6771518bcf38Smrgclean) 6772518bcf38Smrg $echo \ 6773518bcf38Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 6774518bcf38Smrg 6775518bcf38SmrgRemove files from the build directory. 6776518bcf38Smrg 6777518bcf38SmrgRM is the name of the program to use to delete files associated with each FILE 6778518bcf38Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6779518bcf38Smrgto RM. 6780518bcf38Smrg 6781518bcf38SmrgIf FILE is a libtool library, object or program, all the files associated 6782518bcf38Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 6783518bcf38Smrg ;; 6784518bcf38Smrg 6785518bcf38Smrgcompile) 6786518bcf38Smrg $echo \ 6787518bcf38Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 6788518bcf38Smrg 6789518bcf38SmrgCompile a source file into a libtool library object. 6790518bcf38Smrg 6791518bcf38SmrgThis mode accepts the following additional options: 6792518bcf38Smrg 6793518bcf38Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 6794518bcf38Smrg -prefer-pic try to building PIC objects only 6795518bcf38Smrg -prefer-non-pic try to building non-PIC objects only 6796518bcf38Smrg -static always build a \`.o' file suitable for static linking 6797518bcf38Smrg 6798518bcf38SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 6799518bcf38Smrgfrom the given SOURCEFILE. 6800518bcf38Smrg 6801518bcf38SmrgThe output file name is determined by removing the directory component from 6802518bcf38SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 6803518bcf38Smrglibrary object suffix, \`.lo'." 6804518bcf38Smrg ;; 6805518bcf38Smrg 6806518bcf38Smrgexecute) 6807518bcf38Smrg $echo \ 6808518bcf38Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 6809518bcf38Smrg 6810518bcf38SmrgAutomatically set library path, then run a program. 6811518bcf38Smrg 6812518bcf38SmrgThis mode accepts the following additional options: 6813518bcf38Smrg 6814518bcf38Smrg -dlopen FILE add the directory containing FILE to the library path 6815518bcf38Smrg 6816518bcf38SmrgThis mode sets the library path environment variable according to \`-dlopen' 6817518bcf38Smrgflags. 6818518bcf38Smrg 6819518bcf38SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 6820518bcf38Smrginto their corresponding uninstalled binary, and any of their required library 6821518bcf38Smrgdirectories are added to the library path. 6822518bcf38Smrg 6823518bcf38SmrgThen, COMMAND is executed, with ARGS as arguments." 6824518bcf38Smrg ;; 6825518bcf38Smrg 6826518bcf38Smrgfinish) 6827518bcf38Smrg $echo \ 6828518bcf38Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 6829518bcf38Smrg 6830518bcf38SmrgComplete the installation of libtool libraries. 6831518bcf38Smrg 6832518bcf38SmrgEach LIBDIR is a directory that contains libtool libraries. 6833518bcf38Smrg 6834518bcf38SmrgThe commands that this mode executes may require superuser privileges. Use 6835518bcf38Smrgthe \`--dry-run' option if you just want to see what would be executed." 6836518bcf38Smrg ;; 6837518bcf38Smrg 6838518bcf38Smrginstall) 6839518bcf38Smrg $echo \ 6840518bcf38Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 6841518bcf38Smrg 6842518bcf38SmrgInstall executables or libraries. 6843518bcf38Smrg 6844518bcf38SmrgINSTALL-COMMAND is the installation command. The first component should be 6845518bcf38Smrgeither the \`install' or \`cp' program. 6846518bcf38Smrg 6847518bcf38SmrgThe rest of the components are interpreted as arguments to that command (only 6848518bcf38SmrgBSD-compatible install options are recognized)." 6849518bcf38Smrg ;; 6850518bcf38Smrg 6851518bcf38Smrglink) 6852518bcf38Smrg $echo \ 6853518bcf38Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 6854518bcf38Smrg 6855518bcf38SmrgLink object files or libraries together to form another library, or to 6856518bcf38Smrgcreate an executable program. 6857c35d236eSmrg 6858518bcf38SmrgLINK-COMMAND is a command using the C compiler that you would use to create 6859518bcf38Smrga program from several object files. 6860518bcf38Smrg 6861518bcf38SmrgThe following components of LINK-COMMAND are treated specially: 6862518bcf38Smrg 6863518bcf38Smrg -all-static do not do any dynamic linking at all 6864518bcf38Smrg -avoid-version do not add a version suffix if possible 6865518bcf38Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 6866518bcf38Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 6867518bcf38Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 6868518bcf38Smrg -export-symbols SYMFILE 6869518bcf38Smrg try to export only the symbols listed in SYMFILE 6870518bcf38Smrg -export-symbols-regex REGEX 6871518bcf38Smrg try to export only the symbols matching REGEX 6872518bcf38Smrg -LLIBDIR search LIBDIR for required installed libraries 6873518bcf38Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 6874518bcf38Smrg -module build a library that can dlopened 6875518bcf38Smrg -no-fast-install disable the fast-install mode 6876518bcf38Smrg -no-install link a not-installable executable 6877518bcf38Smrg -no-undefined declare that a library does not refer to external symbols 6878518bcf38Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 6879518bcf38Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 6880518bcf38Smrg -precious-files-regex REGEX 6881518bcf38Smrg don't remove output files matching REGEX 6882518bcf38Smrg -release RELEASE specify package release information 6883518bcf38Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 6884518bcf38Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 6885518bcf38Smrg -static do not do any dynamic linking of uninstalled libtool libraries 6886518bcf38Smrg -static-libtool-libs 6887518bcf38Smrg do not do any dynamic linking of libtool libraries 6888518bcf38Smrg -version-info CURRENT[:REVISION[:AGE]] 6889518bcf38Smrg specify library version info [each variable defaults to 0] 6890518bcf38Smrg 6891518bcf38SmrgAll other options (arguments beginning with \`-') are ignored. 6892518bcf38Smrg 6893518bcf38SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 6894518bcf38Smrgtreated as uninstalled libtool libraries, other files are standard or library 6895518bcf38Smrgobject files. 6896518bcf38Smrg 6897518bcf38SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 6898518bcf38Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 6899518bcf38Smrgrequired, except when creating a convenience library. 6900518bcf38Smrg 6901518bcf38SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 6902518bcf38Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 6903518bcf38Smrg 6904518bcf38SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 6905518bcf38Smrgis created, otherwise an executable program is created." 6906518bcf38Smrg ;; 6907518bcf38Smrg 6908518bcf38Smrguninstall) 6909518bcf38Smrg $echo \ 6910518bcf38Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 6911518bcf38Smrg 6912518bcf38SmrgRemove libraries from an installation directory. 6913518bcf38Smrg 6914518bcf38SmrgRM is the name of the program to use to delete files associated with each FILE 6915518bcf38Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6916518bcf38Smrgto RM. 6917518bcf38Smrg 6918518bcf38SmrgIf FILE is a libtool library, all the files associated with it are deleted. 6919518bcf38SmrgOtherwise, only FILE itself is deleted using RM." 6920518bcf38Smrg ;; 6921518bcf38Smrg 6922518bcf38Smrg*) 6923518bcf38Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 6924518bcf38Smrg $echo "$help" 1>&2 6925518bcf38Smrg exit $EXIT_FAILURE 6926518bcf38Smrg ;; 6927518bcf38Smrgesac 6928518bcf38Smrg 6929518bcf38Smrg$echo 6930518bcf38Smrg$echo "Try \`$modename --help' for more information about other modes." 6931518bcf38Smrg 6932518bcf38Smrgexit $? 6933c35d236eSmrg 6934c35d236eSmrg# The TAGs below are defined such that we never get into a situation 6935c35d236eSmrg# in which we disable both kinds of libraries. Given conflicting 6936c35d236eSmrg# choices, we go for a static library, that is the most portable, 6937c35d236eSmrg# since we can't tell whether shared libraries were disabled because 6938c35d236eSmrg# the user asked for that or because the platform doesn't support 6939c35d236eSmrg# them. This is particularly important on AIX, because we don't 6940c35d236eSmrg# support having both static and shared libraries enabled at the same 6941c35d236eSmrg# time on that platform, so we default to a shared-only configuration. 6942c35d236eSmrg# If a disable-shared tag is given, we'll fallback to a static-only 6943c35d236eSmrg# configuration. But we'll never go from static-only to shared-only. 6944c35d236eSmrg 6945c35d236eSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6946518bcf38Smrgdisable_libs=shared 6947c35d236eSmrg# ### END LIBTOOL TAG CONFIG: disable-shared 6948c35d236eSmrg 6949c35d236eSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6950518bcf38Smrgdisable_libs=static 6951c35d236eSmrg# ### END LIBTOOL TAG CONFIG: disable-static 6952c35d236eSmrg 6953c35d236eSmrg# Local Variables: 6954c35d236eSmrg# mode:shell-script 6955c35d236eSmrg# sh-indentation:2 6956c35d236eSmrg# End: 6957