ltmain.sh revision 692f60a7
1692f60a7Smrg# ltmain.sh - Provide generalized library-building support services. 2692f60a7Smrg# NOTE: Changing this file will not affect anything until you rerun configure. 3692f60a7Smrg# 4692f60a7Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 5692f60a7Smrg# Free Software Foundation, Inc. 6692f60a7Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7692f60a7Smrg# 8692f60a7Smrg# This program is free software; you can redistribute it and/or modify 9692f60a7Smrg# it under the terms of the GNU General Public License as published by 10692f60a7Smrg# the Free Software Foundation; either version 2 of the License, or 11692f60a7Smrg# (at your option) any later version. 12692f60a7Smrg# 13692f60a7Smrg# This program is distributed in the hope that it will be useful, but 14692f60a7Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 15692f60a7Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16692f60a7Smrg# General Public License for more details. 17692f60a7Smrg# 18692f60a7Smrg# You should have received a copy of the GNU General Public License 19692f60a7Smrg# along with this program; if not, write to the Free Software 20692f60a7Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21692f60a7Smrg# 22692f60a7Smrg# As a special exception to the GNU General Public License, if you 23692f60a7Smrg# distribute this file as part of a program that contains a 24692f60a7Smrg# configuration script generated by Autoconf, you may include it under 25692f60a7Smrg# the same distribution terms that you use for the rest of that program. 26692f60a7Smrg 27692f60a7Smrgbasename="s,^.*/,,g" 28692f60a7Smrg 29692f60a7Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 30692f60a7Smrg# is ksh but when the shell is invoked as "sh" and the current value of 31692f60a7Smrg# the _XPG environment variable is not equal to 1 (one), the special 32692f60a7Smrg# positional parameter $0, within a function call, is the name of the 33692f60a7Smrg# function. 34692f60a7Smrgprogpath="$0" 35692f60a7Smrg 36692f60a7Smrg# The name of this program: 37692f60a7Smrgprogname=`echo "$progpath" | $SED $basename` 38692f60a7Smrgmodename="$progname" 39692f60a7Smrg 40692f60a7Smrg# Global variables: 41692f60a7SmrgEXIT_SUCCESS=0 42692f60a7SmrgEXIT_FAILURE=1 43692f60a7Smrg 44692f60a7SmrgPROGRAM=ltmain.sh 45692f60a7SmrgPACKAGE=libtool 46692f60a7SmrgVERSION=1.5.22 47692f60a7SmrgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" 48692f60a7Smrg 49692f60a7Smrg# See if we are running on zsh, and set the options which allow our 50692f60a7Smrg# commands through without removal of \ escapes. 51692f60a7Smrgif test -n "${ZSH_VERSION+set}" ; then 52692f60a7Smrg setopt NO_GLOB_SUBST 53692f60a7Smrgfi 54692f60a7Smrg 55692f60a7Smrg# Check that we have a working $echo. 56692f60a7Smrgif test "X$1" = X--no-reexec; then 57692f60a7Smrg # Discard the --no-reexec flag, and continue. 58692f60a7Smrg shift 59692f60a7Smrgelif test "X$1" = X--fallback-echo; then 60692f60a7Smrg # Avoid inline document here, it may be left over 61692f60a7Smrg : 62692f60a7Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 63692f60a7Smrg # Yippee, $echo works! 64692f60a7Smrg : 65692f60a7Smrgelse 66692f60a7Smrg # Restart under the correct shell, and then maybe $echo will work. 67692f60a7Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 68692f60a7Smrgfi 69692f60a7Smrg 70692f60a7Smrgif test "X$1" = X--fallback-echo; then 71692f60a7Smrg # used as fallback echo 72692f60a7Smrg shift 73692f60a7Smrg cat <<EOF 74692f60a7Smrg$* 75692f60a7SmrgEOF 76692f60a7Smrg exit $EXIT_SUCCESS 77692f60a7Smrgfi 78692f60a7Smrg 79692f60a7Smrgdefault_mode= 80692f60a7Smrghelp="Try \`$progname --help' for more information." 81692f60a7Smrgmagic="%%%MAGIC variable%%%" 82692f60a7Smrgmkdir="mkdir" 83692f60a7Smrgmv="mv -f" 84692f60a7Smrgrm="rm -f" 85692f60a7Smrg 86692f60a7Smrg# Sed substitution that helps us do robust quoting. It backslashifies 87692f60a7Smrg# metacharacters that are still active within double-quoted strings. 88692f60a7SmrgXsed="${SED}"' -e 1s/^X//' 89692f60a7Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 90692f60a7Smrg# test EBCDIC or ASCII 91692f60a7Smrgcase `echo X|tr X '\101'` in 92692f60a7Smrg A) # ASCII based system 93692f60a7Smrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 94692f60a7Smrg SP2NL='tr \040 \012' 95692f60a7Smrg NL2SP='tr \015\012 \040\040' 96692f60a7Smrg ;; 97692f60a7Smrg *) # EBCDIC based system 98692f60a7Smrg SP2NL='tr \100 \n' 99692f60a7Smrg NL2SP='tr \r\n \100\100' 100692f60a7Smrg ;; 101692f60a7Smrgesac 102692f60a7Smrg 103692f60a7Smrg# NLS nuisances. 104692f60a7Smrg# Only set LANG and LC_ALL to C if already set. 105692f60a7Smrg# These must not be set unconditionally because not all systems understand 106692f60a7Smrg# e.g. LANG=C (notably SCO). 107692f60a7Smrg# We save the old values to restore during execute mode. 108692f60a7Smrgif test "${LC_ALL+set}" = set; then 109692f60a7Smrg save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL 110692f60a7Smrgfi 111692f60a7Smrgif test "${LANG+set}" = set; then 112692f60a7Smrg save_LANG="$LANG"; LANG=C; export LANG 113692f60a7Smrgfi 114692f60a7Smrg 115692f60a7Smrg# Make sure IFS has a sensible default 116692f60a7Smrglt_nl=' 117692f60a7Smrg' 118692f60a7SmrgIFS=" $lt_nl" 119692f60a7Smrg 120692f60a7Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 121692f60a7Smrg $echo "$modename: not configured to build any kind of library" 1>&2 122692f60a7Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 123692f60a7Smrg exit $EXIT_FAILURE 124692f60a7Smrgfi 125692f60a7Smrg 126692f60a7Smrg# Global variables. 127692f60a7Smrgmode=$default_mode 128692f60a7Smrgnonopt= 129692f60a7Smrgprev= 130692f60a7Smrgprevopt= 131692f60a7Smrgrun= 132692f60a7Smrgshow="$echo" 133692f60a7Smrgshow_help= 134692f60a7Smrgexecute_dlfiles= 135692f60a7Smrgduplicate_deps=no 136692f60a7Smrgpreserve_args= 137692f60a7Smrglo2o="s/\\.lo\$/.${objext}/" 138692f60a7Smrgo2lo="s/\\.${objext}\$/.lo/" 139692f60a7Smrg 140692f60a7Smrg##################################### 141692f60a7Smrg# Shell function definitions: 142692f60a7Smrg# This seems to be the best place for them 143692f60a7Smrg 144692f60a7Smrg# func_mktempdir [string] 145692f60a7Smrg# Make a temporary directory that won't clash with other running 146692f60a7Smrg# libtool processes, and avoids race conditions if possible. If 147692f60a7Smrg# given, STRING is the basename for that directory. 148692f60a7Smrgfunc_mktempdir () 149692f60a7Smrg{ 150692f60a7Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 151692f60a7Smrg 152692f60a7Smrg if test "$run" = ":"; then 153692f60a7Smrg # Return a directory name, but don't create it in dry-run mode 154692f60a7Smrg my_tmpdir="${my_template}-$$" 155692f60a7Smrg else 156692f60a7Smrg 157692f60a7Smrg # If mktemp works, use that first and foremost 158692f60a7Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 159692f60a7Smrg 160692f60a7Smrg if test ! -d "$my_tmpdir"; then 161692f60a7Smrg # Failing that, at least try and use $RANDOM to avoid a race 162692f60a7Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 163692f60a7Smrg 164692f60a7Smrg save_mktempdir_umask=`umask` 165692f60a7Smrg umask 0077 166692f60a7Smrg $mkdir "$my_tmpdir" 167692f60a7Smrg umask $save_mktempdir_umask 168692f60a7Smrg fi 169692f60a7Smrg 170692f60a7Smrg # If we're not in dry-run mode, bomb out on failure 171692f60a7Smrg test -d "$my_tmpdir" || { 172692f60a7Smrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 173692f60a7Smrg exit $EXIT_FAILURE 174692f60a7Smrg } 175692f60a7Smrg fi 176692f60a7Smrg 177692f60a7Smrg $echo "X$my_tmpdir" | $Xsed 178692f60a7Smrg} 179692f60a7Smrg 180692f60a7Smrg 181692f60a7Smrg# func_win32_libid arg 182692f60a7Smrg# return the library type of file 'arg' 183692f60a7Smrg# 184692f60a7Smrg# Need a lot of goo to handle *both* DLLs and import libs 185692f60a7Smrg# Has to be a shell function in order to 'eat' the argument 186692f60a7Smrg# that is supplied when $file_magic_command is called. 187692f60a7Smrgfunc_win32_libid () 188692f60a7Smrg{ 189692f60a7Smrg win32_libid_type="unknown" 190692f60a7Smrg win32_fileres=`file -L $1 2>/dev/null` 191692f60a7Smrg case $win32_fileres in 192692f60a7Smrg *ar\ archive\ import\ library*) # definitely import 193692f60a7Smrg win32_libid_type="x86 archive import" 194692f60a7Smrg ;; 195692f60a7Smrg *ar\ archive*) # could be an import, or static 196692f60a7Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 197692f60a7Smrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 198692f60a7Smrg win32_nmres=`eval $NM -f posix -A $1 | \ 199692f60a7Smrg $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` 200692f60a7Smrg case $win32_nmres in 201692f60a7Smrg import*) win32_libid_type="x86 archive import";; 202692f60a7Smrg *) win32_libid_type="x86 archive static";; 203692f60a7Smrg esac 204692f60a7Smrg fi 205692f60a7Smrg ;; 206692f60a7Smrg *DLL*) 207692f60a7Smrg win32_libid_type="x86 DLL" 208692f60a7Smrg ;; 209692f60a7Smrg *executable*) # but shell scripts are "executable" too... 210692f60a7Smrg case $win32_fileres in 211692f60a7Smrg *MS\ Windows\ PE\ Intel*) 212692f60a7Smrg win32_libid_type="x86 DLL" 213692f60a7Smrg ;; 214692f60a7Smrg esac 215692f60a7Smrg ;; 216692f60a7Smrg esac 217692f60a7Smrg $echo $win32_libid_type 218692f60a7Smrg} 219692f60a7Smrg 220692f60a7Smrg 221692f60a7Smrg# func_infer_tag arg 222692f60a7Smrg# Infer tagged configuration to use if any are available and 223692f60a7Smrg# if one wasn't chosen via the "--tag" command line option. 224692f60a7Smrg# Only attempt this if the compiler in the base compile 225692f60a7Smrg# command doesn't match the default compiler. 226692f60a7Smrg# arg is usually of the form 'gcc ...' 227692f60a7Smrgfunc_infer_tag () 228692f60a7Smrg{ 229692f60a7Smrg if test -n "$available_tags" && test -z "$tagname"; then 230692f60a7Smrg CC_quoted= 231692f60a7Smrg for arg in $CC; do 232692f60a7Smrg case $arg in 233692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 234692f60a7Smrg arg="\"$arg\"" 235692f60a7Smrg ;; 236692f60a7Smrg esac 237692f60a7Smrg CC_quoted="$CC_quoted $arg" 238692f60a7Smrg done 239692f60a7Smrg case $@ in 240692f60a7Smrg # Blanks in the command may have been stripped by the calling shell, 241692f60a7Smrg # but not from the CC environment variable when configure was run. 242692f60a7Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 243692f60a7Smrg # Blanks at the start of $base_compile will cause this to fail 244692f60a7Smrg # if we don't check for them as well. 245692f60a7Smrg *) 246692f60a7Smrg for z in $available_tags; do 247692f60a7Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 248692f60a7Smrg # Evaluate the configuration. 249692f60a7Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 250692f60a7Smrg CC_quoted= 251692f60a7Smrg for arg in $CC; do 252692f60a7Smrg # Double-quote args containing other shell metacharacters. 253692f60a7Smrg case $arg in 254692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 255692f60a7Smrg arg="\"$arg\"" 256692f60a7Smrg ;; 257692f60a7Smrg esac 258692f60a7Smrg CC_quoted="$CC_quoted $arg" 259692f60a7Smrg done 260692f60a7Smrg case "$@ " in 261692f60a7Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 262692f60a7Smrg # The compiler in the base compile command matches 263692f60a7Smrg # the one in the tagged configuration. 264692f60a7Smrg # Assume this is the tagged configuration we want. 265692f60a7Smrg tagname=$z 266692f60a7Smrg break 267692f60a7Smrg ;; 268692f60a7Smrg esac 269692f60a7Smrg fi 270692f60a7Smrg done 271692f60a7Smrg # If $tagname still isn't set, then no tagged configuration 272692f60a7Smrg # was found and let the user know that the "--tag" command 273692f60a7Smrg # line option must be used. 274692f60a7Smrg if test -z "$tagname"; then 275692f60a7Smrg $echo "$modename: unable to infer tagged configuration" 276692f60a7Smrg $echo "$modename: specify a tag with \`--tag'" 1>&2 277692f60a7Smrg exit $EXIT_FAILURE 278692f60a7Smrg# else 279692f60a7Smrg# $echo "$modename: using $tagname tagged configuration" 280692f60a7Smrg fi 281692f60a7Smrg ;; 282692f60a7Smrg esac 283692f60a7Smrg fi 284692f60a7Smrg} 285692f60a7Smrg 286692f60a7Smrg 287692f60a7Smrg# func_extract_an_archive dir oldlib 288692f60a7Smrgfunc_extract_an_archive () 289692f60a7Smrg{ 290692f60a7Smrg f_ex_an_ar_dir="$1"; shift 291692f60a7Smrg f_ex_an_ar_oldlib="$1" 292692f60a7Smrg 293692f60a7Smrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 294692f60a7Smrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 295692f60a7Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 296692f60a7Smrg : 297692f60a7Smrg else 298692f60a7Smrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 299692f60a7Smrg exit $EXIT_FAILURE 300692f60a7Smrg fi 301692f60a7Smrg} 302692f60a7Smrg 303692f60a7Smrg# func_extract_archives gentop oldlib ... 304692f60a7Smrgfunc_extract_archives () 305692f60a7Smrg{ 306692f60a7Smrg my_gentop="$1"; shift 307692f60a7Smrg my_oldlibs=${1+"$@"} 308692f60a7Smrg my_oldobjs="" 309692f60a7Smrg my_xlib="" 310692f60a7Smrg my_xabs="" 311692f60a7Smrg my_xdir="" 312692f60a7Smrg my_status="" 313692f60a7Smrg 314692f60a7Smrg $show "${rm}r $my_gentop" 315692f60a7Smrg $run ${rm}r "$my_gentop" 316692f60a7Smrg $show "$mkdir $my_gentop" 317692f60a7Smrg $run $mkdir "$my_gentop" 318692f60a7Smrg my_status=$? 319692f60a7Smrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 320692f60a7Smrg exit $my_status 321692f60a7Smrg fi 322692f60a7Smrg 323692f60a7Smrg for my_xlib in $my_oldlibs; do 324692f60a7Smrg # Extract the objects. 325692f60a7Smrg case $my_xlib in 326692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 327692f60a7Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 328692f60a7Smrg esac 329692f60a7Smrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 330692f60a7Smrg my_xdir="$my_gentop/$my_xlib" 331692f60a7Smrg 332692f60a7Smrg $show "${rm}r $my_xdir" 333692f60a7Smrg $run ${rm}r "$my_xdir" 334692f60a7Smrg $show "$mkdir $my_xdir" 335692f60a7Smrg $run $mkdir "$my_xdir" 336692f60a7Smrg exit_status=$? 337692f60a7Smrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 338692f60a7Smrg exit $exit_status 339692f60a7Smrg fi 340692f60a7Smrg case $host in 341692f60a7Smrg *-darwin*) 342692f60a7Smrg $show "Extracting $my_xabs" 343692f60a7Smrg # Do not bother doing anything if just a dry run 344692f60a7Smrg if test -z "$run"; then 345692f60a7Smrg darwin_orig_dir=`pwd` 346692f60a7Smrg cd $my_xdir || exit $? 347692f60a7Smrg darwin_archive=$my_xabs 348692f60a7Smrg darwin_curdir=`pwd` 349692f60a7Smrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 350692f60a7Smrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 351692f60a7Smrg if test -n "$darwin_arches"; then 352692f60a7Smrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 353692f60a7Smrg darwin_arch= 354692f60a7Smrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 355692f60a7Smrg for darwin_arch in $darwin_arches ; do 356692f60a7Smrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 357692f60a7Smrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 358692f60a7Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 359692f60a7Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 360692f60a7Smrg cd "$darwin_curdir" 361692f60a7Smrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 362692f60a7Smrg done # $darwin_arches 363692f60a7Smrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 364692f60a7Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 365692f60a7Smrg darwin_file= 366692f60a7Smrg darwin_files= 367692f60a7Smrg for darwin_file in $darwin_filelist; do 368692f60a7Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 369692f60a7Smrg lipo -create -output "$darwin_file" $darwin_files 370692f60a7Smrg done # $darwin_filelist 371692f60a7Smrg ${rm}r unfat-$$ 372692f60a7Smrg cd "$darwin_orig_dir" 373692f60a7Smrg else 374692f60a7Smrg cd "$darwin_orig_dir" 375692f60a7Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 376692f60a7Smrg fi # $darwin_arches 377692f60a7Smrg fi # $run 378692f60a7Smrg ;; 379692f60a7Smrg *) 380692f60a7Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 381692f60a7Smrg ;; 382692f60a7Smrg esac 383692f60a7Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 384692f60a7Smrg done 385692f60a7Smrg func_extract_archives_result="$my_oldobjs" 386692f60a7Smrg} 387692f60a7Smrg# End of Shell function definitions 388692f60a7Smrg##################################### 389692f60a7Smrg 390692f60a7Smrg# Darwin sucks 391692f60a7Smrgeval std_shrext=\"$shrext_cmds\" 392692f60a7Smrg 393692f60a7Smrgdisable_libs=no 394692f60a7Smrg 395692f60a7Smrg# Parse our command line options once, thoroughly. 396692f60a7Smrgwhile test "$#" -gt 0 397692f60a7Smrgdo 398692f60a7Smrg arg="$1" 399692f60a7Smrg shift 400692f60a7Smrg 401692f60a7Smrg case $arg in 402692f60a7Smrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 403692f60a7Smrg *) optarg= ;; 404692f60a7Smrg esac 405692f60a7Smrg 406692f60a7Smrg # If the previous option needs an argument, assign it. 407692f60a7Smrg if test -n "$prev"; then 408692f60a7Smrg case $prev in 409692f60a7Smrg execute_dlfiles) 410692f60a7Smrg execute_dlfiles="$execute_dlfiles $arg" 411692f60a7Smrg ;; 412692f60a7Smrg tag) 413692f60a7Smrg tagname="$arg" 414692f60a7Smrg preserve_args="${preserve_args}=$arg" 415692f60a7Smrg 416692f60a7Smrg # Check whether tagname contains only valid characters 417692f60a7Smrg case $tagname in 418692f60a7Smrg *[!-_A-Za-z0-9,/]*) 419692f60a7Smrg $echo "$progname: invalid tag name: $tagname" 1>&2 420692f60a7Smrg exit $EXIT_FAILURE 421692f60a7Smrg ;; 422692f60a7Smrg esac 423692f60a7Smrg 424692f60a7Smrg case $tagname in 425692f60a7Smrg CC) 426692f60a7Smrg # Don't test for the "default" C tag, as we know, it's there, but 427692f60a7Smrg # not specially marked. 428692f60a7Smrg ;; 429692f60a7Smrg *) 430692f60a7Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 431692f60a7Smrg taglist="$taglist $tagname" 432692f60a7Smrg # Evaluate the configuration. 433692f60a7Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 434692f60a7Smrg else 435692f60a7Smrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 436692f60a7Smrg fi 437692f60a7Smrg ;; 438692f60a7Smrg esac 439692f60a7Smrg ;; 440692f60a7Smrg *) 441692f60a7Smrg eval "$prev=\$arg" 442692f60a7Smrg ;; 443692f60a7Smrg esac 444692f60a7Smrg 445692f60a7Smrg prev= 446692f60a7Smrg prevopt= 447692f60a7Smrg continue 448692f60a7Smrg fi 449692f60a7Smrg 450692f60a7Smrg # Have we seen a non-optional argument yet? 451692f60a7Smrg case $arg in 452692f60a7Smrg --help) 453692f60a7Smrg show_help=yes 454692f60a7Smrg ;; 455692f60a7Smrg 456692f60a7Smrg --version) 457692f60a7Smrg $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 458692f60a7Smrg $echo 459692f60a7Smrg $echo "Copyright (C) 2005 Free Software Foundation, Inc." 460692f60a7Smrg $echo "This is free software; see the source for copying conditions. There is NO" 461692f60a7Smrg $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 462692f60a7Smrg exit $? 463692f60a7Smrg ;; 464692f60a7Smrg 465692f60a7Smrg --config) 466692f60a7Smrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 467692f60a7Smrg # Now print the configurations for the tags. 468692f60a7Smrg for tagname in $taglist; do 469692f60a7Smrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 470692f60a7Smrg done 471692f60a7Smrg exit $? 472692f60a7Smrg ;; 473692f60a7Smrg 474692f60a7Smrg --debug) 475692f60a7Smrg $echo "$progname: enabling shell trace mode" 476692f60a7Smrg set -x 477692f60a7Smrg preserve_args="$preserve_args $arg" 478692f60a7Smrg ;; 479692f60a7Smrg 480692f60a7Smrg --dry-run | -n) 481692f60a7Smrg run=: 482692f60a7Smrg ;; 483692f60a7Smrg 484692f60a7Smrg --features) 485692f60a7Smrg $echo "host: $host" 486692f60a7Smrg if test "$build_libtool_libs" = yes; then 487692f60a7Smrg $echo "enable shared libraries" 488692f60a7Smrg else 489692f60a7Smrg $echo "disable shared libraries" 490692f60a7Smrg fi 491692f60a7Smrg if test "$build_old_libs" = yes; then 492692f60a7Smrg $echo "enable static libraries" 493692f60a7Smrg else 494692f60a7Smrg $echo "disable static libraries" 495692f60a7Smrg fi 496692f60a7Smrg exit $? 497692f60a7Smrg ;; 498692f60a7Smrg 499692f60a7Smrg --finish) mode="finish" ;; 500692f60a7Smrg 501692f60a7Smrg --mode) prevopt="--mode" prev=mode ;; 502692f60a7Smrg --mode=*) mode="$optarg" ;; 503692f60a7Smrg 504692f60a7Smrg --preserve-dup-deps) duplicate_deps="yes" ;; 505692f60a7Smrg 506692f60a7Smrg --quiet | --silent) 507692f60a7Smrg show=: 508692f60a7Smrg preserve_args="$preserve_args $arg" 509692f60a7Smrg ;; 510692f60a7Smrg 511692f60a7Smrg --tag) 512692f60a7Smrg prevopt="--tag" 513692f60a7Smrg prev=tag 514692f60a7Smrg preserve_args="$preserve_args --tag" 515692f60a7Smrg ;; 516692f60a7Smrg --tag=*) 517692f60a7Smrg set tag "$optarg" ${1+"$@"} 518692f60a7Smrg shift 519692f60a7Smrg prev=tag 520692f60a7Smrg preserve_args="$preserve_args --tag" 521692f60a7Smrg ;; 522692f60a7Smrg 523692f60a7Smrg -dlopen) 524692f60a7Smrg prevopt="-dlopen" 525692f60a7Smrg prev=execute_dlfiles 526692f60a7Smrg ;; 527692f60a7Smrg 528692f60a7Smrg -*) 529692f60a7Smrg $echo "$modename: unrecognized option \`$arg'" 1>&2 530692f60a7Smrg $echo "$help" 1>&2 531692f60a7Smrg exit $EXIT_FAILURE 532692f60a7Smrg ;; 533692f60a7Smrg 534692f60a7Smrg *) 535692f60a7Smrg nonopt="$arg" 536692f60a7Smrg break 537692f60a7Smrg ;; 538692f60a7Smrg esac 539692f60a7Smrgdone 540692f60a7Smrg 541692f60a7Smrgif test -n "$prevopt"; then 542692f60a7Smrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 543692f60a7Smrg $echo "$help" 1>&2 544692f60a7Smrg exit $EXIT_FAILURE 545692f60a7Smrgfi 546692f60a7Smrg 547692f60a7Smrgcase $disable_libs in 548692f60a7Smrgno) 549692f60a7Smrg ;; 550692f60a7Smrgshared) 551692f60a7Smrg build_libtool_libs=no 552692f60a7Smrg build_old_libs=yes 553692f60a7Smrg ;; 554692f60a7Smrgstatic) 555692f60a7Smrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 556692f60a7Smrg ;; 557692f60a7Smrgesac 558692f60a7Smrg 559692f60a7Smrg# If this variable is set in any of the actions, the command in it 560692f60a7Smrg# will be execed at the end. This prevents here-documents from being 561692f60a7Smrg# left over by shells. 562692f60a7Smrgexec_cmd= 563692f60a7Smrg 564692f60a7Smrgif test -z "$show_help"; then 565692f60a7Smrg 566692f60a7Smrg # Infer the operation mode. 567692f60a7Smrg if test -z "$mode"; then 568692f60a7Smrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 569692f60a7Smrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 570692f60a7Smrg case $nonopt in 571692f60a7Smrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 572692f60a7Smrg mode=link 573692f60a7Smrg for arg 574692f60a7Smrg do 575692f60a7Smrg case $arg in 576692f60a7Smrg -c) 577692f60a7Smrg mode=compile 578692f60a7Smrg break 579692f60a7Smrg ;; 580692f60a7Smrg esac 581692f60a7Smrg done 582692f60a7Smrg ;; 583692f60a7Smrg *db | *dbx | *strace | *truss) 584692f60a7Smrg mode=execute 585692f60a7Smrg ;; 586692f60a7Smrg *install*|cp|mv) 587692f60a7Smrg mode=install 588692f60a7Smrg ;; 589692f60a7Smrg *rm) 590692f60a7Smrg mode=uninstall 591692f60a7Smrg ;; 592692f60a7Smrg *) 593692f60a7Smrg # If we have no mode, but dlfiles were specified, then do execute mode. 594692f60a7Smrg test -n "$execute_dlfiles" && mode=execute 595692f60a7Smrg 596692f60a7Smrg # Just use the default operation mode. 597692f60a7Smrg if test -z "$mode"; then 598692f60a7Smrg if test -n "$nonopt"; then 599692f60a7Smrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 600692f60a7Smrg else 601692f60a7Smrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 602692f60a7Smrg fi 603692f60a7Smrg fi 604692f60a7Smrg ;; 605692f60a7Smrg esac 606692f60a7Smrg fi 607692f60a7Smrg 608692f60a7Smrg # Only execute mode is allowed to have -dlopen flags. 609692f60a7Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 610692f60a7Smrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 611692f60a7Smrg $echo "$help" 1>&2 612692f60a7Smrg exit $EXIT_FAILURE 613692f60a7Smrg fi 614692f60a7Smrg 615692f60a7Smrg # Change the help message to a mode-specific one. 616692f60a7Smrg generic_help="$help" 617692f60a7Smrg help="Try \`$modename --help --mode=$mode' for more information." 618692f60a7Smrg 619692f60a7Smrg # These modes are in order of execution frequency so that they run quickly. 620692f60a7Smrg case $mode in 621692f60a7Smrg # libtool compile mode 622692f60a7Smrg compile) 623692f60a7Smrg modename="$modename: compile" 624692f60a7Smrg # Get the compilation command and the source file. 625692f60a7Smrg base_compile= 626692f60a7Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 627692f60a7Smrg suppress_opt=yes 628692f60a7Smrg suppress_output= 629692f60a7Smrg arg_mode=normal 630692f60a7Smrg libobj= 631692f60a7Smrg later= 632692f60a7Smrg 633692f60a7Smrg for arg 634692f60a7Smrg do 635692f60a7Smrg case $arg_mode in 636692f60a7Smrg arg ) 637692f60a7Smrg # do not "continue". Instead, add this to base_compile 638692f60a7Smrg lastarg="$arg" 639692f60a7Smrg arg_mode=normal 640692f60a7Smrg ;; 641692f60a7Smrg 642692f60a7Smrg target ) 643692f60a7Smrg libobj="$arg" 644692f60a7Smrg arg_mode=normal 645692f60a7Smrg continue 646692f60a7Smrg ;; 647692f60a7Smrg 648692f60a7Smrg normal ) 649692f60a7Smrg # Accept any command-line options. 650692f60a7Smrg case $arg in 651692f60a7Smrg -o) 652692f60a7Smrg if test -n "$libobj" ; then 653692f60a7Smrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 654692f60a7Smrg exit $EXIT_FAILURE 655692f60a7Smrg fi 656692f60a7Smrg arg_mode=target 657692f60a7Smrg continue 658692f60a7Smrg ;; 659692f60a7Smrg 660692f60a7Smrg -static | -prefer-pic | -prefer-non-pic) 661692f60a7Smrg later="$later $arg" 662692f60a7Smrg continue 663692f60a7Smrg ;; 664692f60a7Smrg 665692f60a7Smrg -no-suppress) 666692f60a7Smrg suppress_opt=no 667692f60a7Smrg continue 668692f60a7Smrg ;; 669692f60a7Smrg 670692f60a7Smrg -Xcompiler) 671692f60a7Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 672692f60a7Smrg continue # The current "srcfile" will either be retained or 673692f60a7Smrg ;; # replaced later. I would guess that would be a bug. 674692f60a7Smrg 675692f60a7Smrg -Wc,*) 676692f60a7Smrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 677692f60a7Smrg lastarg= 678692f60a7Smrg save_ifs="$IFS"; IFS=',' 679692f60a7Smrg for arg in $args; do 680692f60a7Smrg IFS="$save_ifs" 681692f60a7Smrg 682692f60a7Smrg # Double-quote args containing other shell metacharacters. 683692f60a7Smrg # Many Bourne shells cannot handle close brackets correctly 684692f60a7Smrg # in scan sets, so we specify it separately. 685692f60a7Smrg case $arg in 686692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 687692f60a7Smrg arg="\"$arg\"" 688692f60a7Smrg ;; 689692f60a7Smrg esac 690692f60a7Smrg lastarg="$lastarg $arg" 691692f60a7Smrg done 692692f60a7Smrg IFS="$save_ifs" 693692f60a7Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 694692f60a7Smrg 695692f60a7Smrg # Add the arguments to base_compile. 696692f60a7Smrg base_compile="$base_compile $lastarg" 697692f60a7Smrg continue 698692f60a7Smrg ;; 699692f60a7Smrg 700692f60a7Smrg * ) 701692f60a7Smrg # Accept the current argument as the source file. 702692f60a7Smrg # The previous "srcfile" becomes the current argument. 703692f60a7Smrg # 704692f60a7Smrg lastarg="$srcfile" 705692f60a7Smrg srcfile="$arg" 706692f60a7Smrg ;; 707692f60a7Smrg esac # case $arg 708692f60a7Smrg ;; 709692f60a7Smrg esac # case $arg_mode 710692f60a7Smrg 711692f60a7Smrg # Aesthetically quote the previous argument. 712692f60a7Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 713692f60a7Smrg 714692f60a7Smrg case $lastarg in 715692f60a7Smrg # Double-quote args containing other shell metacharacters. 716692f60a7Smrg # Many Bourne shells cannot handle close brackets correctly 717692f60a7Smrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 718692f60a7Smrg # in scan sets (worked around with variable expansion), 719692f60a7Smrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 720692f60a7Smrg # at all, so we specify them separately. 721692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 722692f60a7Smrg lastarg="\"$lastarg\"" 723692f60a7Smrg ;; 724692f60a7Smrg esac 725692f60a7Smrg 726692f60a7Smrg base_compile="$base_compile $lastarg" 727692f60a7Smrg done # for arg 728692f60a7Smrg 729692f60a7Smrg case $arg_mode in 730692f60a7Smrg arg) 731692f60a7Smrg $echo "$modename: you must specify an argument for -Xcompile" 732692f60a7Smrg exit $EXIT_FAILURE 733692f60a7Smrg ;; 734692f60a7Smrg target) 735692f60a7Smrg $echo "$modename: you must specify a target with \`-o'" 1>&2 736692f60a7Smrg exit $EXIT_FAILURE 737692f60a7Smrg ;; 738692f60a7Smrg *) 739692f60a7Smrg # Get the name of the library object. 740692f60a7Smrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 741692f60a7Smrg ;; 742692f60a7Smrg esac 743692f60a7Smrg 744692f60a7Smrg # Recognize several different file suffixes. 745692f60a7Smrg # If the user specifies -o file.o, it is replaced with file.lo 746692f60a7Smrg xform='[cCFSifmso]' 747692f60a7Smrg case $libobj in 748692f60a7Smrg *.ada) xform=ada ;; 749692f60a7Smrg *.adb) xform=adb ;; 750692f60a7Smrg *.ads) xform=ads ;; 751692f60a7Smrg *.asm) xform=asm ;; 752692f60a7Smrg *.c++) xform=c++ ;; 753692f60a7Smrg *.cc) xform=cc ;; 754692f60a7Smrg *.ii) xform=ii ;; 755692f60a7Smrg *.class) xform=class ;; 756692f60a7Smrg *.cpp) xform=cpp ;; 757692f60a7Smrg *.cxx) xform=cxx ;; 758692f60a7Smrg *.f90) xform=f90 ;; 759692f60a7Smrg *.for) xform=for ;; 760692f60a7Smrg *.java) xform=java ;; 761692f60a7Smrg esac 762692f60a7Smrg 763692f60a7Smrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 764692f60a7Smrg 765692f60a7Smrg case $libobj in 766692f60a7Smrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 767692f60a7Smrg *) 768692f60a7Smrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 769692f60a7Smrg exit $EXIT_FAILURE 770692f60a7Smrg ;; 771692f60a7Smrg esac 772692f60a7Smrg 773692f60a7Smrg func_infer_tag $base_compile 774692f60a7Smrg 775692f60a7Smrg for arg in $later; do 776692f60a7Smrg case $arg in 777692f60a7Smrg -static) 778692f60a7Smrg build_old_libs=yes 779692f60a7Smrg continue 780692f60a7Smrg ;; 781692f60a7Smrg 782692f60a7Smrg -prefer-pic) 783692f60a7Smrg pic_mode=yes 784692f60a7Smrg continue 785692f60a7Smrg ;; 786692f60a7Smrg 787692f60a7Smrg -prefer-non-pic) 788692f60a7Smrg pic_mode=no 789692f60a7Smrg continue 790692f60a7Smrg ;; 791692f60a7Smrg esac 792692f60a7Smrg done 793692f60a7Smrg 794692f60a7Smrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 795692f60a7Smrg case $qlibobj in 796692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 797692f60a7Smrg qlibobj="\"$qlibobj\"" ;; 798692f60a7Smrg esac 799692f60a7Smrg test "X$libobj" != "X$qlibobj" \ 800692f60a7Smrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 801692f60a7Smrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 802692f60a7Smrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 803692f60a7Smrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 804692f60a7Smrg if test "X$xdir" = "X$obj"; then 805692f60a7Smrg xdir= 806692f60a7Smrg else 807692f60a7Smrg xdir=$xdir/ 808692f60a7Smrg fi 809692f60a7Smrg lobj=${xdir}$objdir/$objname 810692f60a7Smrg 811692f60a7Smrg if test -z "$base_compile"; then 812692f60a7Smrg $echo "$modename: you must specify a compilation command" 1>&2 813692f60a7Smrg $echo "$help" 1>&2 814692f60a7Smrg exit $EXIT_FAILURE 815692f60a7Smrg fi 816692f60a7Smrg 817692f60a7Smrg # Delete any leftover library objects. 818692f60a7Smrg if test "$build_old_libs" = yes; then 819692f60a7Smrg removelist="$obj $lobj $libobj ${libobj}T" 820692f60a7Smrg else 821692f60a7Smrg removelist="$lobj $libobj ${libobj}T" 822692f60a7Smrg fi 823692f60a7Smrg 824692f60a7Smrg $run $rm $removelist 825692f60a7Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 826692f60a7Smrg 827692f60a7Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 828692f60a7Smrg case $host_os in 829692f60a7Smrg cygwin* | mingw* | pw32* | os2*) 830692f60a7Smrg pic_mode=default 831692f60a7Smrg ;; 832692f60a7Smrg esac 833692f60a7Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 834692f60a7Smrg # non-PIC code in shared libraries is not supported 835692f60a7Smrg pic_mode=default 836692f60a7Smrg fi 837692f60a7Smrg 838692f60a7Smrg # Calculate the filename of the output object if compiler does 839692f60a7Smrg # not support -o with -c 840692f60a7Smrg if test "$compiler_c_o" = no; then 841692f60a7Smrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 842692f60a7Smrg lockfile="$output_obj.lock" 843692f60a7Smrg removelist="$removelist $output_obj $lockfile" 844692f60a7Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 845692f60a7Smrg else 846692f60a7Smrg output_obj= 847692f60a7Smrg need_locks=no 848692f60a7Smrg lockfile= 849692f60a7Smrg fi 850692f60a7Smrg 851692f60a7Smrg # Lock this critical section if it is needed 852692f60a7Smrg # We use this script file to make the link, it avoids creating a new file 853692f60a7Smrg if test "$need_locks" = yes; then 854692f60a7Smrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 855692f60a7Smrg $show "Waiting for $lockfile to be removed" 856692f60a7Smrg sleep 2 857692f60a7Smrg done 858692f60a7Smrg elif test "$need_locks" = warn; then 859692f60a7Smrg if test -f "$lockfile"; then 860692f60a7Smrg $echo "\ 861692f60a7Smrg*** ERROR, $lockfile exists and contains: 862692f60a7Smrg`cat $lockfile 2>/dev/null` 863692f60a7Smrg 864692f60a7SmrgThis indicates that another process is trying to use the same 865692f60a7Smrgtemporary object file, and libtool could not work around it because 866692f60a7Smrgyour compiler does not support \`-c' and \`-o' together. If you 867692f60a7Smrgrepeat this compilation, it may succeed, by chance, but you had better 868692f60a7Smrgavoid parallel builds (make -j) in this platform, or get a better 869692f60a7Smrgcompiler." 870692f60a7Smrg 871692f60a7Smrg $run $rm $removelist 872692f60a7Smrg exit $EXIT_FAILURE 873692f60a7Smrg fi 874692f60a7Smrg $echo "$srcfile" > "$lockfile" 875692f60a7Smrg fi 876692f60a7Smrg 877692f60a7Smrg if test -n "$fix_srcfile_path"; then 878692f60a7Smrg eval srcfile=\"$fix_srcfile_path\" 879692f60a7Smrg fi 880692f60a7Smrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 881692f60a7Smrg case $qsrcfile in 882692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 883692f60a7Smrg qsrcfile="\"$qsrcfile\"" ;; 884692f60a7Smrg esac 885692f60a7Smrg 886692f60a7Smrg $run $rm "$libobj" "${libobj}T" 887692f60a7Smrg 888692f60a7Smrg # Create a libtool object file (analogous to a ".la" file), 889692f60a7Smrg # but don't create it if we're doing a dry run. 890692f60a7Smrg test -z "$run" && cat > ${libobj}T <<EOF 891692f60a7Smrg# $libobj - a libtool object file 892692f60a7Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 893692f60a7Smrg# 894692f60a7Smrg# Please DO NOT delete this file! 895692f60a7Smrg# It is necessary for linking the library. 896692f60a7Smrg 897692f60a7Smrg# Name of the PIC object. 898692f60a7SmrgEOF 899692f60a7Smrg 900692f60a7Smrg # Only build a PIC object if we are building libtool libraries. 901692f60a7Smrg if test "$build_libtool_libs" = yes; then 902692f60a7Smrg # Without this assignment, base_compile gets emptied. 903692f60a7Smrg fbsd_hideous_sh_bug=$base_compile 904692f60a7Smrg 905692f60a7Smrg if test "$pic_mode" != no; then 906692f60a7Smrg command="$base_compile $qsrcfile $pic_flag" 907692f60a7Smrg else 908692f60a7Smrg # Don't build PIC code 909692f60a7Smrg command="$base_compile $qsrcfile" 910692f60a7Smrg fi 911692f60a7Smrg 912692f60a7Smrg if test ! -d "${xdir}$objdir"; then 913692f60a7Smrg $show "$mkdir ${xdir}$objdir" 914692f60a7Smrg $run $mkdir ${xdir}$objdir 915692f60a7Smrg exit_status=$? 916692f60a7Smrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 917692f60a7Smrg exit $exit_status 918692f60a7Smrg fi 919692f60a7Smrg fi 920692f60a7Smrg 921692f60a7Smrg if test -z "$output_obj"; then 922692f60a7Smrg # Place PIC objects in $objdir 923692f60a7Smrg command="$command -o $lobj" 924692f60a7Smrg fi 925692f60a7Smrg 926692f60a7Smrg $run $rm "$lobj" "$output_obj" 927692f60a7Smrg 928692f60a7Smrg $show "$command" 929692f60a7Smrg if $run eval "$command"; then : 930692f60a7Smrg else 931692f60a7Smrg test -n "$output_obj" && $run $rm $removelist 932692f60a7Smrg exit $EXIT_FAILURE 933692f60a7Smrg fi 934692f60a7Smrg 935692f60a7Smrg if test "$need_locks" = warn && 936692f60a7Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 937692f60a7Smrg $echo "\ 938692f60a7Smrg*** ERROR, $lockfile contains: 939692f60a7Smrg`cat $lockfile 2>/dev/null` 940692f60a7Smrg 941692f60a7Smrgbut it should contain: 942692f60a7Smrg$srcfile 943692f60a7Smrg 944692f60a7SmrgThis indicates that another process is trying to use the same 945692f60a7Smrgtemporary object file, and libtool could not work around it because 946692f60a7Smrgyour compiler does not support \`-c' and \`-o' together. If you 947692f60a7Smrgrepeat this compilation, it may succeed, by chance, but you had better 948692f60a7Smrgavoid parallel builds (make -j) in this platform, or get a better 949692f60a7Smrgcompiler." 950692f60a7Smrg 951692f60a7Smrg $run $rm $removelist 952692f60a7Smrg exit $EXIT_FAILURE 953692f60a7Smrg fi 954692f60a7Smrg 955692f60a7Smrg # Just move the object if needed, then go on to compile the next one 956692f60a7Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 957692f60a7Smrg $show "$mv $output_obj $lobj" 958692f60a7Smrg if $run $mv $output_obj $lobj; then : 959692f60a7Smrg else 960692f60a7Smrg error=$? 961692f60a7Smrg $run $rm $removelist 962692f60a7Smrg exit $error 963692f60a7Smrg fi 964692f60a7Smrg fi 965692f60a7Smrg 966692f60a7Smrg # Append the name of the PIC object to the libtool object file. 967692f60a7Smrg test -z "$run" && cat >> ${libobj}T <<EOF 968692f60a7Smrgpic_object='$objdir/$objname' 969692f60a7Smrg 970692f60a7SmrgEOF 971692f60a7Smrg 972692f60a7Smrg # Allow error messages only from the first compilation. 973692f60a7Smrg if test "$suppress_opt" = yes; then 974692f60a7Smrg suppress_output=' >/dev/null 2>&1' 975692f60a7Smrg fi 976692f60a7Smrg else 977692f60a7Smrg # No PIC object so indicate it doesn't exist in the libtool 978692f60a7Smrg # object file. 979692f60a7Smrg test -z "$run" && cat >> ${libobj}T <<EOF 980692f60a7Smrgpic_object=none 981692f60a7Smrg 982692f60a7SmrgEOF 983692f60a7Smrg fi 984692f60a7Smrg 985692f60a7Smrg # Only build a position-dependent object if we build old libraries. 986692f60a7Smrg if test "$build_old_libs" = yes; then 987692f60a7Smrg if test "$pic_mode" != yes; then 988692f60a7Smrg # Don't build PIC code 989692f60a7Smrg command="$base_compile $qsrcfile" 990692f60a7Smrg else 991692f60a7Smrg command="$base_compile $qsrcfile $pic_flag" 992692f60a7Smrg fi 993692f60a7Smrg if test "$compiler_c_o" = yes; then 994692f60a7Smrg command="$command -o $obj" 995692f60a7Smrg fi 996692f60a7Smrg 997692f60a7Smrg # Suppress compiler output if we already did a PIC compilation. 998692f60a7Smrg command="$command$suppress_output" 999692f60a7Smrg $run $rm "$obj" "$output_obj" 1000692f60a7Smrg $show "$command" 1001692f60a7Smrg if $run eval "$command"; then : 1002692f60a7Smrg else 1003692f60a7Smrg $run $rm $removelist 1004692f60a7Smrg exit $EXIT_FAILURE 1005692f60a7Smrg fi 1006692f60a7Smrg 1007692f60a7Smrg if test "$need_locks" = warn && 1008692f60a7Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1009692f60a7Smrg $echo "\ 1010692f60a7Smrg*** ERROR, $lockfile contains: 1011692f60a7Smrg`cat $lockfile 2>/dev/null` 1012692f60a7Smrg 1013692f60a7Smrgbut it should contain: 1014692f60a7Smrg$srcfile 1015692f60a7Smrg 1016692f60a7SmrgThis indicates that another process is trying to use the same 1017692f60a7Smrgtemporary object file, and libtool could not work around it because 1018692f60a7Smrgyour compiler does not support \`-c' and \`-o' together. If you 1019692f60a7Smrgrepeat this compilation, it may succeed, by chance, but you had better 1020692f60a7Smrgavoid parallel builds (make -j) in this platform, or get a better 1021692f60a7Smrgcompiler." 1022692f60a7Smrg 1023692f60a7Smrg $run $rm $removelist 1024692f60a7Smrg exit $EXIT_FAILURE 1025692f60a7Smrg fi 1026692f60a7Smrg 1027692f60a7Smrg # Just move the object if needed 1028692f60a7Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1029692f60a7Smrg $show "$mv $output_obj $obj" 1030692f60a7Smrg if $run $mv $output_obj $obj; then : 1031692f60a7Smrg else 1032692f60a7Smrg error=$? 1033692f60a7Smrg $run $rm $removelist 1034692f60a7Smrg exit $error 1035692f60a7Smrg fi 1036692f60a7Smrg fi 1037692f60a7Smrg 1038692f60a7Smrg # Append the name of the non-PIC object the libtool object file. 1039692f60a7Smrg # Only append if the libtool object file exists. 1040692f60a7Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1041692f60a7Smrg# Name of the non-PIC object. 1042692f60a7Smrgnon_pic_object='$objname' 1043692f60a7Smrg 1044692f60a7SmrgEOF 1045692f60a7Smrg else 1046692f60a7Smrg # Append the name of the non-PIC object the libtool object file. 1047692f60a7Smrg # Only append if the libtool object file exists. 1048692f60a7Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1049692f60a7Smrg# Name of the non-PIC object. 1050692f60a7Smrgnon_pic_object=none 1051692f60a7Smrg 1052692f60a7SmrgEOF 1053692f60a7Smrg fi 1054692f60a7Smrg 1055692f60a7Smrg $run $mv "${libobj}T" "${libobj}" 1056692f60a7Smrg 1057692f60a7Smrg # Unlock the critical section if it was locked 1058692f60a7Smrg if test "$need_locks" != no; then 1059692f60a7Smrg $run $rm "$lockfile" 1060692f60a7Smrg fi 1061692f60a7Smrg 1062692f60a7Smrg exit $EXIT_SUCCESS 1063692f60a7Smrg ;; 1064692f60a7Smrg 1065692f60a7Smrg # libtool link mode 1066692f60a7Smrg link | relink) 1067692f60a7Smrg modename="$modename: link" 1068692f60a7Smrg case $host in 1069692f60a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1070692f60a7Smrg # It is impossible to link a dll without this setting, and 1071692f60a7Smrg # we shouldn't force the makefile maintainer to figure out 1072692f60a7Smrg # which system we are compiling for in order to pass an extra 1073692f60a7Smrg # flag for every libtool invocation. 1074692f60a7Smrg # allow_undefined=no 1075692f60a7Smrg 1076692f60a7Smrg # FIXME: Unfortunately, there are problems with the above when trying 1077692f60a7Smrg # to make a dll which has undefined symbols, in which case not 1078692f60a7Smrg # even a static library is built. For now, we need to specify 1079692f60a7Smrg # -no-undefined on the libtool link line when we can be certain 1080692f60a7Smrg # that all symbols are satisfied, otherwise we get a static library. 1081692f60a7Smrg allow_undefined=yes 1082692f60a7Smrg ;; 1083692f60a7Smrg *) 1084692f60a7Smrg allow_undefined=yes 1085692f60a7Smrg ;; 1086692f60a7Smrg esac 1087692f60a7Smrg libtool_args="$nonopt" 1088692f60a7Smrg base_compile="$nonopt $@" 1089692f60a7Smrg compile_command="$nonopt" 1090692f60a7Smrg finalize_command="$nonopt" 1091692f60a7Smrg 1092692f60a7Smrg compile_rpath= 1093692f60a7Smrg finalize_rpath= 1094692f60a7Smrg compile_shlibpath= 1095692f60a7Smrg finalize_shlibpath= 1096692f60a7Smrg convenience= 1097692f60a7Smrg old_convenience= 1098692f60a7Smrg deplibs= 1099692f60a7Smrg old_deplibs= 1100692f60a7Smrg compiler_flags= 1101692f60a7Smrg linker_flags= 1102692f60a7Smrg dllsearchpath= 1103692f60a7Smrg lib_search_path=`pwd` 1104692f60a7Smrg inst_prefix_dir= 1105692f60a7Smrg 1106692f60a7Smrg avoid_version=no 1107692f60a7Smrg dlfiles= 1108692f60a7Smrg dlprefiles= 1109692f60a7Smrg dlself=no 1110692f60a7Smrg export_dynamic=no 1111692f60a7Smrg export_symbols= 1112692f60a7Smrg export_symbols_regex= 1113692f60a7Smrg generated= 1114692f60a7Smrg libobjs= 1115692f60a7Smrg ltlibs= 1116692f60a7Smrg module=no 1117692f60a7Smrg no_install=no 1118692f60a7Smrg objs= 1119692f60a7Smrg non_pic_objects= 1120692f60a7Smrg notinst_path= # paths that contain not-installed libtool libraries 1121692f60a7Smrg precious_files_regex= 1122692f60a7Smrg prefer_static_libs=no 1123692f60a7Smrg preload=no 1124692f60a7Smrg prev= 1125692f60a7Smrg prevarg= 1126692f60a7Smrg release= 1127692f60a7Smrg rpath= 1128692f60a7Smrg xrpath= 1129692f60a7Smrg perm_rpath= 1130692f60a7Smrg temp_rpath= 1131692f60a7Smrg thread_safe=no 1132692f60a7Smrg vinfo= 1133692f60a7Smrg vinfo_number=no 1134692f60a7Smrg 1135692f60a7Smrg func_infer_tag $base_compile 1136692f60a7Smrg 1137692f60a7Smrg # We need to know -static, to get the right output filenames. 1138692f60a7Smrg for arg 1139692f60a7Smrg do 1140692f60a7Smrg case $arg in 1141692f60a7Smrg -all-static | -static) 1142692f60a7Smrg if test "X$arg" = "X-all-static"; then 1143692f60a7Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 1144692f60a7Smrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1145692f60a7Smrg fi 1146692f60a7Smrg if test -n "$link_static_flag"; then 1147692f60a7Smrg dlopen_self=$dlopen_self_static 1148692f60a7Smrg fi 1149692f60a7Smrg prefer_static_libs=yes 1150692f60a7Smrg else 1151692f60a7Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 1152692f60a7Smrg dlopen_self=$dlopen_self_static 1153692f60a7Smrg fi 1154692f60a7Smrg prefer_static_libs=built 1155692f60a7Smrg fi 1156692f60a7Smrg build_libtool_libs=no 1157692f60a7Smrg build_old_libs=yes 1158692f60a7Smrg break 1159692f60a7Smrg ;; 1160692f60a7Smrg esac 1161692f60a7Smrg done 1162692f60a7Smrg 1163692f60a7Smrg # See if our shared archives depend on static archives. 1164692f60a7Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 1165692f60a7Smrg 1166692f60a7Smrg # Go through the arguments, transforming them on the way. 1167692f60a7Smrg while test "$#" -gt 0; do 1168692f60a7Smrg arg="$1" 1169692f60a7Smrg shift 1170692f60a7Smrg case $arg in 1171692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1172692f60a7Smrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 1173692f60a7Smrg ;; 1174692f60a7Smrg *) qarg=$arg ;; 1175692f60a7Smrg esac 1176692f60a7Smrg libtool_args="$libtool_args $qarg" 1177692f60a7Smrg 1178692f60a7Smrg # If the previous option needs an argument, assign it. 1179692f60a7Smrg if test -n "$prev"; then 1180692f60a7Smrg case $prev in 1181692f60a7Smrg output) 1182692f60a7Smrg compile_command="$compile_command @OUTPUT@" 1183692f60a7Smrg finalize_command="$finalize_command @OUTPUT@" 1184692f60a7Smrg ;; 1185692f60a7Smrg esac 1186692f60a7Smrg 1187692f60a7Smrg case $prev in 1188692f60a7Smrg dlfiles|dlprefiles) 1189692f60a7Smrg if test "$preload" = no; then 1190692f60a7Smrg # Add the symbol object into the linking commands. 1191692f60a7Smrg compile_command="$compile_command @SYMFILE@" 1192692f60a7Smrg finalize_command="$finalize_command @SYMFILE@" 1193692f60a7Smrg preload=yes 1194692f60a7Smrg fi 1195692f60a7Smrg case $arg in 1196692f60a7Smrg *.la | *.lo) ;; # We handle these cases below. 1197692f60a7Smrg force) 1198692f60a7Smrg if test "$dlself" = no; then 1199692f60a7Smrg dlself=needless 1200692f60a7Smrg export_dynamic=yes 1201692f60a7Smrg fi 1202692f60a7Smrg prev= 1203692f60a7Smrg continue 1204692f60a7Smrg ;; 1205692f60a7Smrg self) 1206692f60a7Smrg if test "$prev" = dlprefiles; then 1207692f60a7Smrg dlself=yes 1208692f60a7Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 1209692f60a7Smrg dlself=yes 1210692f60a7Smrg else 1211692f60a7Smrg dlself=needless 1212692f60a7Smrg export_dynamic=yes 1213692f60a7Smrg fi 1214692f60a7Smrg prev= 1215692f60a7Smrg continue 1216692f60a7Smrg ;; 1217692f60a7Smrg *) 1218692f60a7Smrg if test "$prev" = dlfiles; then 1219692f60a7Smrg dlfiles="$dlfiles $arg" 1220692f60a7Smrg else 1221692f60a7Smrg dlprefiles="$dlprefiles $arg" 1222692f60a7Smrg fi 1223692f60a7Smrg prev= 1224692f60a7Smrg continue 1225692f60a7Smrg ;; 1226692f60a7Smrg esac 1227692f60a7Smrg ;; 1228692f60a7Smrg expsyms) 1229692f60a7Smrg export_symbols="$arg" 1230692f60a7Smrg if test ! -f "$arg"; then 1231692f60a7Smrg $echo "$modename: symbol file \`$arg' does not exist" 1232692f60a7Smrg exit $EXIT_FAILURE 1233692f60a7Smrg fi 1234692f60a7Smrg prev= 1235692f60a7Smrg continue 1236692f60a7Smrg ;; 1237692f60a7Smrg expsyms_regex) 1238692f60a7Smrg export_symbols_regex="$arg" 1239692f60a7Smrg prev= 1240692f60a7Smrg continue 1241692f60a7Smrg ;; 1242692f60a7Smrg inst_prefix) 1243692f60a7Smrg inst_prefix_dir="$arg" 1244692f60a7Smrg prev= 1245692f60a7Smrg continue 1246692f60a7Smrg ;; 1247692f60a7Smrg precious_regex) 1248692f60a7Smrg precious_files_regex="$arg" 1249692f60a7Smrg prev= 1250692f60a7Smrg continue 1251692f60a7Smrg ;; 1252692f60a7Smrg release) 1253692f60a7Smrg release="-$arg" 1254692f60a7Smrg prev= 1255692f60a7Smrg continue 1256692f60a7Smrg ;; 1257692f60a7Smrg objectlist) 1258692f60a7Smrg if test -f "$arg"; then 1259692f60a7Smrg save_arg=$arg 1260692f60a7Smrg moreargs= 1261692f60a7Smrg for fil in `cat $save_arg` 1262692f60a7Smrg do 1263692f60a7Smrg# moreargs="$moreargs $fil" 1264692f60a7Smrg arg=$fil 1265692f60a7Smrg # A libtool-controlled object. 1266692f60a7Smrg 1267692f60a7Smrg # Check to see that this really is a libtool object. 1268692f60a7Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1269692f60a7Smrg pic_object= 1270692f60a7Smrg non_pic_object= 1271692f60a7Smrg 1272692f60a7Smrg # Read the .lo file 1273692f60a7Smrg # If there is no directory component, then add one. 1274692f60a7Smrg case $arg in 1275692f60a7Smrg */* | *\\*) . $arg ;; 1276692f60a7Smrg *) . ./$arg ;; 1277692f60a7Smrg esac 1278692f60a7Smrg 1279692f60a7Smrg if test -z "$pic_object" || \ 1280692f60a7Smrg test -z "$non_pic_object" || 1281692f60a7Smrg test "$pic_object" = none && \ 1282692f60a7Smrg test "$non_pic_object" = none; then 1283692f60a7Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1284692f60a7Smrg exit $EXIT_FAILURE 1285692f60a7Smrg fi 1286692f60a7Smrg 1287692f60a7Smrg # Extract subdirectory from the argument. 1288692f60a7Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1289692f60a7Smrg if test "X$xdir" = "X$arg"; then 1290692f60a7Smrg xdir= 1291692f60a7Smrg else 1292692f60a7Smrg xdir="$xdir/" 1293692f60a7Smrg fi 1294692f60a7Smrg 1295692f60a7Smrg if test "$pic_object" != none; then 1296692f60a7Smrg # Prepend the subdirectory the object is found in. 1297692f60a7Smrg pic_object="$xdir$pic_object" 1298692f60a7Smrg 1299692f60a7Smrg if test "$prev" = dlfiles; then 1300692f60a7Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1301692f60a7Smrg dlfiles="$dlfiles $pic_object" 1302692f60a7Smrg prev= 1303692f60a7Smrg continue 1304692f60a7Smrg else 1305692f60a7Smrg # If libtool objects are unsupported, then we need to preload. 1306692f60a7Smrg prev=dlprefiles 1307692f60a7Smrg fi 1308692f60a7Smrg fi 1309692f60a7Smrg 1310692f60a7Smrg # CHECK ME: I think I busted this. -Ossama 1311692f60a7Smrg if test "$prev" = dlprefiles; then 1312692f60a7Smrg # Preload the old-style object. 1313692f60a7Smrg dlprefiles="$dlprefiles $pic_object" 1314692f60a7Smrg prev= 1315692f60a7Smrg fi 1316692f60a7Smrg 1317692f60a7Smrg # A PIC object. 1318692f60a7Smrg libobjs="$libobjs $pic_object" 1319692f60a7Smrg arg="$pic_object" 1320692f60a7Smrg fi 1321692f60a7Smrg 1322692f60a7Smrg # Non-PIC object. 1323692f60a7Smrg if test "$non_pic_object" != none; then 1324692f60a7Smrg # Prepend the subdirectory the object is found in. 1325692f60a7Smrg non_pic_object="$xdir$non_pic_object" 1326692f60a7Smrg 1327692f60a7Smrg # A standard non-PIC object 1328692f60a7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1329692f60a7Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 1330692f60a7Smrg arg="$non_pic_object" 1331692f60a7Smrg fi 1332692f60a7Smrg else 1333692f60a7Smrg # If the PIC object exists, use it instead. 1334692f60a7Smrg # $xdir was prepended to $pic_object above. 1335692f60a7Smrg non_pic_object="$pic_object" 1336692f60a7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1337692f60a7Smrg fi 1338692f60a7Smrg else 1339692f60a7Smrg # Only an error if not doing a dry-run. 1340692f60a7Smrg if test -z "$run"; then 1341692f60a7Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1342692f60a7Smrg exit $EXIT_FAILURE 1343692f60a7Smrg else 1344692f60a7Smrg # Dry-run case. 1345692f60a7Smrg 1346692f60a7Smrg # Extract subdirectory from the argument. 1347692f60a7Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1348692f60a7Smrg if test "X$xdir" = "X$arg"; then 1349692f60a7Smrg xdir= 1350692f60a7Smrg else 1351692f60a7Smrg xdir="$xdir/" 1352692f60a7Smrg fi 1353692f60a7Smrg 1354692f60a7Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1355692f60a7Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1356692f60a7Smrg libobjs="$libobjs $pic_object" 1357692f60a7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1358692f60a7Smrg fi 1359692f60a7Smrg fi 1360692f60a7Smrg done 1361692f60a7Smrg else 1362692f60a7Smrg $echo "$modename: link input file \`$save_arg' does not exist" 1363692f60a7Smrg exit $EXIT_FAILURE 1364692f60a7Smrg fi 1365692f60a7Smrg arg=$save_arg 1366692f60a7Smrg prev= 1367692f60a7Smrg continue 1368692f60a7Smrg ;; 1369692f60a7Smrg rpath | xrpath) 1370692f60a7Smrg # We need an absolute path. 1371692f60a7Smrg case $arg in 1372692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1373692f60a7Smrg *) 1374692f60a7Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 1375692f60a7Smrg exit $EXIT_FAILURE 1376692f60a7Smrg ;; 1377692f60a7Smrg esac 1378692f60a7Smrg if test "$prev" = rpath; then 1379692f60a7Smrg case "$rpath " in 1380692f60a7Smrg *" $arg "*) ;; 1381692f60a7Smrg *) rpath="$rpath $arg" ;; 1382692f60a7Smrg esac 1383692f60a7Smrg else 1384692f60a7Smrg case "$xrpath " in 1385692f60a7Smrg *" $arg "*) ;; 1386692f60a7Smrg *) xrpath="$xrpath $arg" ;; 1387692f60a7Smrg esac 1388692f60a7Smrg fi 1389692f60a7Smrg prev= 1390692f60a7Smrg continue 1391692f60a7Smrg ;; 1392692f60a7Smrg xcompiler) 1393692f60a7Smrg compiler_flags="$compiler_flags $qarg" 1394692f60a7Smrg prev= 1395692f60a7Smrg compile_command="$compile_command $qarg" 1396692f60a7Smrg finalize_command="$finalize_command $qarg" 1397692f60a7Smrg continue 1398692f60a7Smrg ;; 1399692f60a7Smrg xlinker) 1400692f60a7Smrg linker_flags="$linker_flags $qarg" 1401692f60a7Smrg compiler_flags="$compiler_flags $wl$qarg" 1402692f60a7Smrg prev= 1403692f60a7Smrg compile_command="$compile_command $wl$qarg" 1404692f60a7Smrg finalize_command="$finalize_command $wl$qarg" 1405692f60a7Smrg continue 1406692f60a7Smrg ;; 1407692f60a7Smrg xcclinker) 1408692f60a7Smrg linker_flags="$linker_flags $qarg" 1409692f60a7Smrg compiler_flags="$compiler_flags $qarg" 1410692f60a7Smrg prev= 1411692f60a7Smrg compile_command="$compile_command $qarg" 1412692f60a7Smrg finalize_command="$finalize_command $qarg" 1413692f60a7Smrg continue 1414692f60a7Smrg ;; 1415692f60a7Smrg shrext) 1416692f60a7Smrg shrext_cmds="$arg" 1417692f60a7Smrg prev= 1418692f60a7Smrg continue 1419692f60a7Smrg ;; 1420692f60a7Smrg darwin_framework|darwin_framework_skip) 1421692f60a7Smrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 1422692f60a7Smrg compile_command="$compile_command $arg" 1423692f60a7Smrg finalize_command="$finalize_command $arg" 1424692f60a7Smrg prev= 1425692f60a7Smrg continue 1426692f60a7Smrg ;; 1427692f60a7Smrg *) 1428692f60a7Smrg eval "$prev=\"\$arg\"" 1429692f60a7Smrg prev= 1430692f60a7Smrg continue 1431692f60a7Smrg ;; 1432692f60a7Smrg esac 1433692f60a7Smrg fi # test -n "$prev" 1434692f60a7Smrg 1435692f60a7Smrg prevarg="$arg" 1436692f60a7Smrg 1437692f60a7Smrg case $arg in 1438692f60a7Smrg -all-static) 1439692f60a7Smrg if test -n "$link_static_flag"; then 1440692f60a7Smrg compile_command="$compile_command $link_static_flag" 1441692f60a7Smrg finalize_command="$finalize_command $link_static_flag" 1442692f60a7Smrg fi 1443692f60a7Smrg continue 1444692f60a7Smrg ;; 1445692f60a7Smrg 1446692f60a7Smrg -allow-undefined) 1447692f60a7Smrg # FIXME: remove this flag sometime in the future. 1448692f60a7Smrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1449692f60a7Smrg continue 1450692f60a7Smrg ;; 1451692f60a7Smrg 1452692f60a7Smrg -avoid-version) 1453692f60a7Smrg avoid_version=yes 1454692f60a7Smrg continue 1455692f60a7Smrg ;; 1456692f60a7Smrg 1457692f60a7Smrg -dlopen) 1458692f60a7Smrg prev=dlfiles 1459692f60a7Smrg continue 1460692f60a7Smrg ;; 1461692f60a7Smrg 1462692f60a7Smrg -dlpreopen) 1463692f60a7Smrg prev=dlprefiles 1464692f60a7Smrg continue 1465692f60a7Smrg ;; 1466692f60a7Smrg 1467692f60a7Smrg -export-dynamic) 1468692f60a7Smrg export_dynamic=yes 1469692f60a7Smrg continue 1470692f60a7Smrg ;; 1471692f60a7Smrg 1472692f60a7Smrg -export-symbols | -export-symbols-regex) 1473692f60a7Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1474692f60a7Smrg $echo "$modename: more than one -exported-symbols argument is not allowed" 1475692f60a7Smrg exit $EXIT_FAILURE 1476692f60a7Smrg fi 1477692f60a7Smrg if test "X$arg" = "X-export-symbols"; then 1478692f60a7Smrg prev=expsyms 1479692f60a7Smrg else 1480692f60a7Smrg prev=expsyms_regex 1481692f60a7Smrg fi 1482692f60a7Smrg continue 1483692f60a7Smrg ;; 1484692f60a7Smrg 1485692f60a7Smrg -framework|-arch|-isysroot) 1486692f60a7Smrg case " $CC " in 1487692f60a7Smrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 1488692f60a7Smrg prev=darwin_framework_skip ;; 1489692f60a7Smrg *) compiler_flags="$compiler_flags $arg" 1490692f60a7Smrg prev=darwin_framework ;; 1491692f60a7Smrg esac 1492692f60a7Smrg compile_command="$compile_command $arg" 1493692f60a7Smrg finalize_command="$finalize_command $arg" 1494692f60a7Smrg continue 1495692f60a7Smrg ;; 1496692f60a7Smrg 1497692f60a7Smrg -inst-prefix-dir) 1498692f60a7Smrg prev=inst_prefix 1499692f60a7Smrg continue 1500692f60a7Smrg ;; 1501692f60a7Smrg 1502692f60a7Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1503692f60a7Smrg # so, if we see these flags be careful not to treat them like -L 1504692f60a7Smrg -L[A-Z][A-Z]*:*) 1505692f60a7Smrg case $with_gcc/$host in 1506692f60a7Smrg no/*-*-irix* | /*-*-irix*) 1507692f60a7Smrg compile_command="$compile_command $arg" 1508692f60a7Smrg finalize_command="$finalize_command $arg" 1509692f60a7Smrg ;; 1510692f60a7Smrg esac 1511692f60a7Smrg continue 1512692f60a7Smrg ;; 1513692f60a7Smrg 1514692f60a7Smrg -L*) 1515692f60a7Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1516692f60a7Smrg # We need an absolute path. 1517692f60a7Smrg case $dir in 1518692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1519692f60a7Smrg *) 1520692f60a7Smrg absdir=`cd "$dir" && pwd` 1521692f60a7Smrg if test -z "$absdir"; then 1522692f60a7Smrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1523692f60a7Smrg absdir="$dir" 1524692f60a7Smrg notinst_path="$notinst_path $dir" 1525692f60a7Smrg fi 1526692f60a7Smrg dir="$absdir" 1527692f60a7Smrg ;; 1528692f60a7Smrg esac 1529692f60a7Smrg case "$deplibs " in 1530692f60a7Smrg *" -L$dir "*) ;; 1531692f60a7Smrg *) 1532692f60a7Smrg deplibs="$deplibs -L$dir" 1533692f60a7Smrg lib_search_path="$lib_search_path $dir" 1534692f60a7Smrg ;; 1535692f60a7Smrg esac 1536692f60a7Smrg case $host in 1537692f60a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1538692f60a7Smrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 1539692f60a7Smrg case :$dllsearchpath: in 1540692f60a7Smrg *":$dir:"*) ;; 1541692f60a7Smrg *) dllsearchpath="$dllsearchpath:$dir";; 1542692f60a7Smrg esac 1543692f60a7Smrg case :$dllsearchpath: in 1544692f60a7Smrg *":$testbindir:"*) ;; 1545692f60a7Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 1546692f60a7Smrg esac 1547692f60a7Smrg ;; 1548692f60a7Smrg esac 1549692f60a7Smrg continue 1550692f60a7Smrg ;; 1551692f60a7Smrg 1552692f60a7Smrg -l*) 1553692f60a7Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1554692f60a7Smrg case $host in 1555692f60a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 1556692f60a7Smrg # These systems don't actually have a C or math library (as such) 1557692f60a7Smrg continue 1558692f60a7Smrg ;; 1559692f60a7Smrg *-*-os2*) 1560692f60a7Smrg # These systems don't actually have a C library (as such) 1561692f60a7Smrg test "X$arg" = "X-lc" && continue 1562692f60a7Smrg ;; 1563692f60a7Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1564692f60a7Smrg # Do not include libc due to us having libc/libc_r. 1565692f60a7Smrg test "X$arg" = "X-lc" && continue 1566692f60a7Smrg ;; 1567692f60a7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 1568692f60a7Smrg # Rhapsody C and math libraries are in the System framework 1569692f60a7Smrg deplibs="$deplibs -framework System" 1570692f60a7Smrg continue 1571692f60a7Smrg ;; 1572692f60a7Smrg *-*-sco3.2v5* | *-*-sco5v6*) 1573692f60a7Smrg # Causes problems with __ctype 1574692f60a7Smrg test "X$arg" = "X-lc" && continue 1575692f60a7Smrg ;; 1576692f60a7Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 1577692f60a7Smrg # Compiler inserts libc in the correct place for threads to work 1578692f60a7Smrg test "X$arg" = "X-lc" && continue 1579692f60a7Smrg ;; 1580692f60a7Smrg esac 1581692f60a7Smrg elif test "X$arg" = "X-lc_r"; then 1582692f60a7Smrg case $host in 1583692f60a7Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1584692f60a7Smrg # Do not include libc_r directly, use -pthread flag. 1585692f60a7Smrg continue 1586692f60a7Smrg ;; 1587692f60a7Smrg esac 1588692f60a7Smrg fi 1589692f60a7Smrg deplibs="$deplibs $arg" 1590692f60a7Smrg continue 1591692f60a7Smrg ;; 1592692f60a7Smrg 1593692f60a7Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 1594692f60a7Smrg # classes, name mangling, and exception handling. 1595692f60a7Smrg -model) 1596692f60a7Smrg compile_command="$compile_command $arg" 1597692f60a7Smrg compiler_flags="$compiler_flags $arg" 1598692f60a7Smrg finalize_command="$finalize_command $arg" 1599692f60a7Smrg prev=xcompiler 1600692f60a7Smrg continue 1601692f60a7Smrg ;; 1602692f60a7Smrg 1603692f60a7Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 1604692f60a7Smrg compiler_flags="$compiler_flags $arg" 1605692f60a7Smrg compile_command="$compile_command $arg" 1606692f60a7Smrg finalize_command="$finalize_command $arg" 1607692f60a7Smrg continue 1608692f60a7Smrg ;; 1609692f60a7Smrg 1610692f60a7Smrg -module) 1611692f60a7Smrg module=yes 1612692f60a7Smrg continue 1613692f60a7Smrg ;; 1614692f60a7Smrg 1615692f60a7Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 1616692f60a7Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 1617692f60a7Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 1618692f60a7Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 1619692f60a7Smrg # -q* pass through compiler args for the IBM compiler 1620692f60a7Smrg # -m* pass through architecture-specific compiler args for GCC 1621692f60a7Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 1622692f60a7Smrg # compiler args for GCC 1623692f60a7Smrg # -pg pass through profiling flag for GCC 1624692f60a7Smrg # @file GCC response files 1625692f60a7Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ 1626692f60a7Smrg -t[45]*|-txscale*|@*) 1627692f60a7Smrg 1628692f60a7Smrg # Unknown arguments in both finalize_command and compile_command need 1629692f60a7Smrg # to be aesthetically quoted because they are evaled later. 1630692f60a7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1631692f60a7Smrg case $arg in 1632692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1633692f60a7Smrg arg="\"$arg\"" 1634692f60a7Smrg ;; 1635692f60a7Smrg esac 1636692f60a7Smrg compile_command="$compile_command $arg" 1637692f60a7Smrg finalize_command="$finalize_command $arg" 1638692f60a7Smrg compiler_flags="$compiler_flags $arg" 1639692f60a7Smrg continue 1640692f60a7Smrg ;; 1641692f60a7Smrg 1642692f60a7Smrg -shrext) 1643692f60a7Smrg prev=shrext 1644692f60a7Smrg continue 1645692f60a7Smrg ;; 1646692f60a7Smrg 1647692f60a7Smrg -no-fast-install) 1648692f60a7Smrg fast_install=no 1649692f60a7Smrg continue 1650692f60a7Smrg ;; 1651692f60a7Smrg 1652692f60a7Smrg -no-install) 1653692f60a7Smrg case $host in 1654692f60a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1655692f60a7Smrg # The PATH hackery in wrapper scripts is required on Windows 1656692f60a7Smrg # in order for the loader to find any dlls it needs. 1657692f60a7Smrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1658692f60a7Smrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1659692f60a7Smrg fast_install=no 1660692f60a7Smrg ;; 1661692f60a7Smrg *) no_install=yes ;; 1662692f60a7Smrg esac 1663692f60a7Smrg continue 1664692f60a7Smrg ;; 1665692f60a7Smrg 1666692f60a7Smrg -no-undefined) 1667692f60a7Smrg allow_undefined=no 1668692f60a7Smrg continue 1669692f60a7Smrg ;; 1670692f60a7Smrg 1671692f60a7Smrg -objectlist) 1672692f60a7Smrg prev=objectlist 1673692f60a7Smrg continue 1674692f60a7Smrg ;; 1675692f60a7Smrg 1676692f60a7Smrg -o) prev=output ;; 1677692f60a7Smrg 1678692f60a7Smrg -precious-files-regex) 1679692f60a7Smrg prev=precious_regex 1680692f60a7Smrg continue 1681692f60a7Smrg ;; 1682692f60a7Smrg 1683692f60a7Smrg -release) 1684692f60a7Smrg prev=release 1685692f60a7Smrg continue 1686692f60a7Smrg ;; 1687692f60a7Smrg 1688692f60a7Smrg -rpath) 1689692f60a7Smrg prev=rpath 1690692f60a7Smrg continue 1691692f60a7Smrg ;; 1692692f60a7Smrg 1693692f60a7Smrg -R) 1694692f60a7Smrg prev=xrpath 1695692f60a7Smrg continue 1696692f60a7Smrg ;; 1697692f60a7Smrg 1698692f60a7Smrg -R*) 1699692f60a7Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1700692f60a7Smrg # We need an absolute path. 1701692f60a7Smrg case $dir in 1702692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1703692f60a7Smrg *) 1704692f60a7Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 1705692f60a7Smrg exit $EXIT_FAILURE 1706692f60a7Smrg ;; 1707692f60a7Smrg esac 1708692f60a7Smrg case "$xrpath " in 1709692f60a7Smrg *" $dir "*) ;; 1710692f60a7Smrg *) xrpath="$xrpath $dir" ;; 1711692f60a7Smrg esac 1712692f60a7Smrg continue 1713692f60a7Smrg ;; 1714692f60a7Smrg 1715692f60a7Smrg -static) 1716692f60a7Smrg # The effects of -static are defined in a previous loop. 1717692f60a7Smrg # We used to do the same as -all-static on platforms that 1718692f60a7Smrg # didn't have a PIC flag, but the assumption that the effects 1719692f60a7Smrg # would be equivalent was wrong. It would break on at least 1720692f60a7Smrg # Digital Unix and AIX. 1721692f60a7Smrg continue 1722692f60a7Smrg ;; 1723692f60a7Smrg 1724692f60a7Smrg -thread-safe) 1725692f60a7Smrg thread_safe=yes 1726692f60a7Smrg continue 1727692f60a7Smrg ;; 1728692f60a7Smrg 1729692f60a7Smrg -version-info) 1730692f60a7Smrg prev=vinfo 1731692f60a7Smrg continue 1732692f60a7Smrg ;; 1733692f60a7Smrg -version-number) 1734692f60a7Smrg prev=vinfo 1735692f60a7Smrg vinfo_number=yes 1736692f60a7Smrg continue 1737692f60a7Smrg ;; 1738692f60a7Smrg 1739692f60a7Smrg -Wc,*) 1740692f60a7Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1741692f60a7Smrg arg= 1742692f60a7Smrg save_ifs="$IFS"; IFS=',' 1743692f60a7Smrg for flag in $args; do 1744692f60a7Smrg IFS="$save_ifs" 1745692f60a7Smrg case $flag in 1746692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1747692f60a7Smrg flag="\"$flag\"" 1748692f60a7Smrg ;; 1749692f60a7Smrg esac 1750692f60a7Smrg arg="$arg $wl$flag" 1751692f60a7Smrg compiler_flags="$compiler_flags $flag" 1752692f60a7Smrg done 1753692f60a7Smrg IFS="$save_ifs" 1754692f60a7Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1755692f60a7Smrg ;; 1756692f60a7Smrg 1757692f60a7Smrg -Wl,*) 1758692f60a7Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1759692f60a7Smrg arg= 1760692f60a7Smrg save_ifs="$IFS"; IFS=',' 1761692f60a7Smrg for flag in $args; do 1762692f60a7Smrg IFS="$save_ifs" 1763692f60a7Smrg case $flag in 1764692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1765692f60a7Smrg flag="\"$flag\"" 1766692f60a7Smrg ;; 1767692f60a7Smrg esac 1768692f60a7Smrg arg="$arg $wl$flag" 1769692f60a7Smrg compiler_flags="$compiler_flags $wl$flag" 1770692f60a7Smrg linker_flags="$linker_flags $flag" 1771692f60a7Smrg done 1772692f60a7Smrg IFS="$save_ifs" 1773692f60a7Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1774692f60a7Smrg ;; 1775692f60a7Smrg 1776692f60a7Smrg -Xcompiler) 1777692f60a7Smrg prev=xcompiler 1778692f60a7Smrg continue 1779692f60a7Smrg ;; 1780692f60a7Smrg 1781692f60a7Smrg -Xlinker) 1782692f60a7Smrg prev=xlinker 1783692f60a7Smrg continue 1784692f60a7Smrg ;; 1785692f60a7Smrg 1786692f60a7Smrg -XCClinker) 1787692f60a7Smrg prev=xcclinker 1788692f60a7Smrg continue 1789692f60a7Smrg ;; 1790692f60a7Smrg 1791692f60a7Smrg # Some other compiler flag. 1792692f60a7Smrg -* | +*) 1793692f60a7Smrg # Unknown arguments in both finalize_command and compile_command need 1794692f60a7Smrg # to be aesthetically quoted because they are evaled later. 1795692f60a7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1796692f60a7Smrg case $arg in 1797692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1798692f60a7Smrg arg="\"$arg\"" 1799692f60a7Smrg ;; 1800692f60a7Smrg esac 1801692f60a7Smrg ;; 1802692f60a7Smrg 1803692f60a7Smrg *.$objext) 1804692f60a7Smrg # A standard object. 1805692f60a7Smrg objs="$objs $arg" 1806692f60a7Smrg ;; 1807692f60a7Smrg 1808692f60a7Smrg *.lo) 1809692f60a7Smrg # A libtool-controlled object. 1810692f60a7Smrg 1811692f60a7Smrg # Check to see that this really is a libtool object. 1812692f60a7Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1813692f60a7Smrg pic_object= 1814692f60a7Smrg non_pic_object= 1815692f60a7Smrg 1816692f60a7Smrg # Read the .lo file 1817692f60a7Smrg # If there is no directory component, then add one. 1818692f60a7Smrg case $arg in 1819692f60a7Smrg */* | *\\*) . $arg ;; 1820692f60a7Smrg *) . ./$arg ;; 1821692f60a7Smrg esac 1822692f60a7Smrg 1823692f60a7Smrg if test -z "$pic_object" || \ 1824692f60a7Smrg test -z "$non_pic_object" || 1825692f60a7Smrg test "$pic_object" = none && \ 1826692f60a7Smrg test "$non_pic_object" = none; then 1827692f60a7Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1828692f60a7Smrg exit $EXIT_FAILURE 1829692f60a7Smrg fi 1830692f60a7Smrg 1831692f60a7Smrg # Extract subdirectory from the argument. 1832692f60a7Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1833692f60a7Smrg if test "X$xdir" = "X$arg"; then 1834692f60a7Smrg xdir= 1835692f60a7Smrg else 1836692f60a7Smrg xdir="$xdir/" 1837692f60a7Smrg fi 1838692f60a7Smrg 1839692f60a7Smrg if test "$pic_object" != none; then 1840692f60a7Smrg # Prepend the subdirectory the object is found in. 1841692f60a7Smrg pic_object="$xdir$pic_object" 1842692f60a7Smrg 1843692f60a7Smrg if test "$prev" = dlfiles; then 1844692f60a7Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1845692f60a7Smrg dlfiles="$dlfiles $pic_object" 1846692f60a7Smrg prev= 1847692f60a7Smrg continue 1848692f60a7Smrg else 1849692f60a7Smrg # If libtool objects are unsupported, then we need to preload. 1850692f60a7Smrg prev=dlprefiles 1851692f60a7Smrg fi 1852692f60a7Smrg fi 1853692f60a7Smrg 1854692f60a7Smrg # CHECK ME: I think I busted this. -Ossama 1855692f60a7Smrg if test "$prev" = dlprefiles; then 1856692f60a7Smrg # Preload the old-style object. 1857692f60a7Smrg dlprefiles="$dlprefiles $pic_object" 1858692f60a7Smrg prev= 1859692f60a7Smrg fi 1860692f60a7Smrg 1861692f60a7Smrg # A PIC object. 1862692f60a7Smrg libobjs="$libobjs $pic_object" 1863692f60a7Smrg arg="$pic_object" 1864692f60a7Smrg fi 1865692f60a7Smrg 1866692f60a7Smrg # Non-PIC object. 1867692f60a7Smrg if test "$non_pic_object" != none; then 1868692f60a7Smrg # Prepend the subdirectory the object is found in. 1869692f60a7Smrg non_pic_object="$xdir$non_pic_object" 1870692f60a7Smrg 1871692f60a7Smrg # A standard non-PIC object 1872692f60a7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1873692f60a7Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 1874692f60a7Smrg arg="$non_pic_object" 1875692f60a7Smrg fi 1876692f60a7Smrg else 1877692f60a7Smrg # If the PIC object exists, use it instead. 1878692f60a7Smrg # $xdir was prepended to $pic_object above. 1879692f60a7Smrg non_pic_object="$pic_object" 1880692f60a7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1881692f60a7Smrg fi 1882692f60a7Smrg else 1883692f60a7Smrg # Only an error if not doing a dry-run. 1884692f60a7Smrg if test -z "$run"; then 1885692f60a7Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1886692f60a7Smrg exit $EXIT_FAILURE 1887692f60a7Smrg else 1888692f60a7Smrg # Dry-run case. 1889692f60a7Smrg 1890692f60a7Smrg # Extract subdirectory from the argument. 1891692f60a7Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1892692f60a7Smrg if test "X$xdir" = "X$arg"; then 1893692f60a7Smrg xdir= 1894692f60a7Smrg else 1895692f60a7Smrg xdir="$xdir/" 1896692f60a7Smrg fi 1897692f60a7Smrg 1898692f60a7Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1899692f60a7Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1900692f60a7Smrg libobjs="$libobjs $pic_object" 1901692f60a7Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1902692f60a7Smrg fi 1903692f60a7Smrg fi 1904692f60a7Smrg ;; 1905692f60a7Smrg 1906692f60a7Smrg *.$libext) 1907692f60a7Smrg # An archive. 1908692f60a7Smrg deplibs="$deplibs $arg" 1909692f60a7Smrg old_deplibs="$old_deplibs $arg" 1910692f60a7Smrg continue 1911692f60a7Smrg ;; 1912692f60a7Smrg 1913692f60a7Smrg *.la) 1914692f60a7Smrg # A libtool-controlled library. 1915692f60a7Smrg 1916692f60a7Smrg if test "$prev" = dlfiles; then 1917692f60a7Smrg # This library was specified with -dlopen. 1918692f60a7Smrg dlfiles="$dlfiles $arg" 1919692f60a7Smrg prev= 1920692f60a7Smrg elif test "$prev" = dlprefiles; then 1921692f60a7Smrg # The library was specified with -dlpreopen. 1922692f60a7Smrg dlprefiles="$dlprefiles $arg" 1923692f60a7Smrg prev= 1924692f60a7Smrg else 1925692f60a7Smrg deplibs="$deplibs $arg" 1926692f60a7Smrg fi 1927692f60a7Smrg continue 1928692f60a7Smrg ;; 1929692f60a7Smrg 1930692f60a7Smrg # Some other compiler argument. 1931692f60a7Smrg *) 1932692f60a7Smrg # Unknown arguments in both finalize_command and compile_command need 1933692f60a7Smrg # to be aesthetically quoted because they are evaled later. 1934692f60a7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1935692f60a7Smrg case $arg in 1936692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1937692f60a7Smrg arg="\"$arg\"" 1938692f60a7Smrg ;; 1939692f60a7Smrg esac 1940692f60a7Smrg ;; 1941692f60a7Smrg esac # arg 1942692f60a7Smrg 1943692f60a7Smrg # Now actually substitute the argument into the commands. 1944692f60a7Smrg if test -n "$arg"; then 1945692f60a7Smrg compile_command="$compile_command $arg" 1946692f60a7Smrg finalize_command="$finalize_command $arg" 1947692f60a7Smrg fi 1948692f60a7Smrg done # argument parsing loop 1949692f60a7Smrg 1950692f60a7Smrg if test -n "$prev"; then 1951692f60a7Smrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 1952692f60a7Smrg $echo "$help" 1>&2 1953692f60a7Smrg exit $EXIT_FAILURE 1954692f60a7Smrg fi 1955692f60a7Smrg 1956692f60a7Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 1957692f60a7Smrg eval arg=\"$export_dynamic_flag_spec\" 1958692f60a7Smrg compile_command="$compile_command $arg" 1959692f60a7Smrg finalize_command="$finalize_command $arg" 1960692f60a7Smrg fi 1961692f60a7Smrg 1962692f60a7Smrg oldlibs= 1963692f60a7Smrg # calculate the name of the file, without its directory 1964692f60a7Smrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 1965692f60a7Smrg libobjs_save="$libobjs" 1966692f60a7Smrg 1967692f60a7Smrg if test -n "$shlibpath_var"; then 1968692f60a7Smrg # get the directories listed in $shlibpath_var 1969692f60a7Smrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 1970692f60a7Smrg else 1971692f60a7Smrg shlib_search_path= 1972692f60a7Smrg fi 1973692f60a7Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 1974692f60a7Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 1975692f60a7Smrg 1976692f60a7Smrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 1977692f60a7Smrg if test "X$output_objdir" = "X$output"; then 1978692f60a7Smrg output_objdir="$objdir" 1979692f60a7Smrg else 1980692f60a7Smrg output_objdir="$output_objdir/$objdir" 1981692f60a7Smrg fi 1982692f60a7Smrg # Create the object directory. 1983692f60a7Smrg if test ! -d "$output_objdir"; then 1984692f60a7Smrg $show "$mkdir $output_objdir" 1985692f60a7Smrg $run $mkdir $output_objdir 1986692f60a7Smrg exit_status=$? 1987692f60a7Smrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 1988692f60a7Smrg exit $exit_status 1989692f60a7Smrg fi 1990692f60a7Smrg fi 1991692f60a7Smrg 1992692f60a7Smrg # Determine the type of output 1993692f60a7Smrg case $output in 1994692f60a7Smrg "") 1995692f60a7Smrg $echo "$modename: you must specify an output file" 1>&2 1996692f60a7Smrg $echo "$help" 1>&2 1997692f60a7Smrg exit $EXIT_FAILURE 1998692f60a7Smrg ;; 1999692f60a7Smrg *.$libext) linkmode=oldlib ;; 2000692f60a7Smrg *.lo | *.$objext) linkmode=obj ;; 2001692f60a7Smrg *.la) linkmode=lib ;; 2002692f60a7Smrg *) linkmode=prog ;; # Anything else should be a program. 2003692f60a7Smrg esac 2004692f60a7Smrg 2005692f60a7Smrg case $host in 2006692f60a7Smrg *cygwin* | *mingw* | *pw32*) 2007692f60a7Smrg # don't eliminate duplications in $postdeps and $predeps 2008692f60a7Smrg duplicate_compiler_generated_deps=yes 2009692f60a7Smrg ;; 2010692f60a7Smrg *) 2011692f60a7Smrg duplicate_compiler_generated_deps=$duplicate_deps 2012692f60a7Smrg ;; 2013692f60a7Smrg esac 2014692f60a7Smrg specialdeplibs= 2015692f60a7Smrg 2016692f60a7Smrg libs= 2017692f60a7Smrg # Find all interdependent deplibs by searching for libraries 2018692f60a7Smrg # that are linked more than once (e.g. -la -lb -la) 2019692f60a7Smrg for deplib in $deplibs; do 2020692f60a7Smrg if test "X$duplicate_deps" = "Xyes" ; then 2021692f60a7Smrg case "$libs " in 2022692f60a7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2023692f60a7Smrg esac 2024692f60a7Smrg fi 2025692f60a7Smrg libs="$libs $deplib" 2026692f60a7Smrg done 2027692f60a7Smrg 2028692f60a7Smrg if test "$linkmode" = lib; then 2029692f60a7Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 2030692f60a7Smrg 2031692f60a7Smrg # Compute libraries that are listed more than once in $predeps 2032692f60a7Smrg # $postdeps and mark them as special (i.e., whose duplicates are 2033692f60a7Smrg # not to be eliminated). 2034692f60a7Smrg pre_post_deps= 2035692f60a7Smrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 2036692f60a7Smrg for pre_post_dep in $predeps $postdeps; do 2037692f60a7Smrg case "$pre_post_deps " in 2038692f60a7Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 2039692f60a7Smrg esac 2040692f60a7Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 2041692f60a7Smrg done 2042692f60a7Smrg fi 2043692f60a7Smrg pre_post_deps= 2044692f60a7Smrg fi 2045692f60a7Smrg 2046692f60a7Smrg deplibs= 2047692f60a7Smrg newdependency_libs= 2048692f60a7Smrg newlib_search_path= 2049692f60a7Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 2050692f60a7Smrg notinst_deplibs= # not-installed libtool libraries 2051692f60a7Smrg case $linkmode in 2052692f60a7Smrg lib) 2053692f60a7Smrg passes="conv link" 2054692f60a7Smrg for file in $dlfiles $dlprefiles; do 2055692f60a7Smrg case $file in 2056692f60a7Smrg *.la) ;; 2057692f60a7Smrg *) 2058692f60a7Smrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 2059692f60a7Smrg exit $EXIT_FAILURE 2060692f60a7Smrg ;; 2061692f60a7Smrg esac 2062692f60a7Smrg done 2063692f60a7Smrg ;; 2064692f60a7Smrg prog) 2065692f60a7Smrg compile_deplibs= 2066692f60a7Smrg finalize_deplibs= 2067692f60a7Smrg alldeplibs=no 2068692f60a7Smrg newdlfiles= 2069692f60a7Smrg newdlprefiles= 2070692f60a7Smrg passes="conv scan dlopen dlpreopen link" 2071692f60a7Smrg ;; 2072692f60a7Smrg *) passes="conv" 2073692f60a7Smrg ;; 2074692f60a7Smrg esac 2075692f60a7Smrg for pass in $passes; do 2076692f60a7Smrg if test "$linkmode,$pass" = "lib,link" || 2077692f60a7Smrg test "$linkmode,$pass" = "prog,scan"; then 2078692f60a7Smrg libs="$deplibs" 2079692f60a7Smrg deplibs= 2080692f60a7Smrg fi 2081692f60a7Smrg if test "$linkmode" = prog; then 2082692f60a7Smrg case $pass in 2083692f60a7Smrg dlopen) libs="$dlfiles" ;; 2084692f60a7Smrg dlpreopen) libs="$dlprefiles" ;; 2085692f60a7Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 2086692f60a7Smrg esac 2087692f60a7Smrg fi 2088692f60a7Smrg if test "$pass" = dlopen; then 2089692f60a7Smrg # Collect dlpreopened libraries 2090692f60a7Smrg save_deplibs="$deplibs" 2091692f60a7Smrg deplibs= 2092692f60a7Smrg fi 2093692f60a7Smrg for deplib in $libs; do 2094692f60a7Smrg lib= 2095692f60a7Smrg found=no 2096692f60a7Smrg case $deplib in 2097692f60a7Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 2098692f60a7Smrg if test "$linkmode,$pass" = "prog,link"; then 2099692f60a7Smrg compile_deplibs="$deplib $compile_deplibs" 2100692f60a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 2101692f60a7Smrg else 2102692f60a7Smrg compiler_flags="$compiler_flags $deplib" 2103692f60a7Smrg fi 2104692f60a7Smrg continue 2105692f60a7Smrg ;; 2106692f60a7Smrg -l*) 2107692f60a7Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 2108692f60a7Smrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2109692f60a7Smrg continue 2110692f60a7Smrg fi 2111692f60a7Smrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 2112692f60a7Smrg for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 2113692f60a7Smrg for search_ext in .la $std_shrext .so .a; do 2114692f60a7Smrg # Search the libtool library 2115692f60a7Smrg lib="$searchdir/lib${name}${search_ext}" 2116692f60a7Smrg if test -f "$lib"; then 2117692f60a7Smrg if test "$search_ext" = ".la"; then 2118692f60a7Smrg found=yes 2119692f60a7Smrg else 2120692f60a7Smrg found=no 2121692f60a7Smrg fi 2122692f60a7Smrg break 2 2123692f60a7Smrg fi 2124692f60a7Smrg done 2125692f60a7Smrg done 2126692f60a7Smrg if test "$found" != yes; then 2127692f60a7Smrg # deplib doesn't seem to be a libtool library 2128692f60a7Smrg if test "$linkmode,$pass" = "prog,link"; then 2129692f60a7Smrg compile_deplibs="$deplib $compile_deplibs" 2130692f60a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 2131692f60a7Smrg else 2132692f60a7Smrg deplibs="$deplib $deplibs" 2133692f60a7Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2134692f60a7Smrg fi 2135692f60a7Smrg continue 2136692f60a7Smrg else # deplib is a libtool library 2137692f60a7Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 2138692f60a7Smrg # We need to do some special things here, and not later. 2139692f60a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 2140692f60a7Smrg case " $predeps $postdeps " in 2141692f60a7Smrg *" $deplib "*) 2142692f60a7Smrg if (${SED} -e '2q' $lib | 2143692f60a7Smrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 2144692f60a7Smrg library_names= 2145692f60a7Smrg old_library= 2146692f60a7Smrg case $lib in 2147692f60a7Smrg */* | *\\*) . $lib ;; 2148692f60a7Smrg *) . ./$lib ;; 2149692f60a7Smrg esac 2150692f60a7Smrg for l in $old_library $library_names; do 2151692f60a7Smrg ll="$l" 2152692f60a7Smrg done 2153692f60a7Smrg if test "X$ll" = "X$old_library" ; then # only static version available 2154692f60a7Smrg found=no 2155692f60a7Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2156692f60a7Smrg test "X$ladir" = "X$lib" && ladir="." 2157692f60a7Smrg lib=$ladir/$old_library 2158692f60a7Smrg if test "$linkmode,$pass" = "prog,link"; then 2159692f60a7Smrg compile_deplibs="$deplib $compile_deplibs" 2160692f60a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 2161692f60a7Smrg else 2162692f60a7Smrg deplibs="$deplib $deplibs" 2163692f60a7Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2164692f60a7Smrg fi 2165692f60a7Smrg continue 2166692f60a7Smrg fi 2167692f60a7Smrg fi 2168692f60a7Smrg ;; 2169692f60a7Smrg *) ;; 2170692f60a7Smrg esac 2171692f60a7Smrg fi 2172692f60a7Smrg fi 2173692f60a7Smrg ;; # -l 2174692f60a7Smrg -L*) 2175692f60a7Smrg case $linkmode in 2176692f60a7Smrg lib) 2177692f60a7Smrg deplibs="$deplib $deplibs" 2178692f60a7Smrg test "$pass" = conv && continue 2179692f60a7Smrg newdependency_libs="$deplib $newdependency_libs" 2180692f60a7Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2181692f60a7Smrg ;; 2182692f60a7Smrg prog) 2183692f60a7Smrg if test "$pass" = conv; then 2184692f60a7Smrg deplibs="$deplib $deplibs" 2185692f60a7Smrg continue 2186692f60a7Smrg fi 2187692f60a7Smrg if test "$pass" = scan; then 2188692f60a7Smrg deplibs="$deplib $deplibs" 2189692f60a7Smrg else 2190692f60a7Smrg compile_deplibs="$deplib $compile_deplibs" 2191692f60a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 2192692f60a7Smrg fi 2193692f60a7Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2194692f60a7Smrg ;; 2195692f60a7Smrg *) 2196692f60a7Smrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 2197692f60a7Smrg ;; 2198692f60a7Smrg esac # linkmode 2199692f60a7Smrg continue 2200692f60a7Smrg ;; # -L 2201692f60a7Smrg -R*) 2202692f60a7Smrg if test "$pass" = link; then 2203692f60a7Smrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 2204692f60a7Smrg # Make sure the xrpath contains only unique directories. 2205692f60a7Smrg case "$xrpath " in 2206692f60a7Smrg *" $dir "*) ;; 2207692f60a7Smrg *) xrpath="$xrpath $dir" ;; 2208692f60a7Smrg esac 2209692f60a7Smrg fi 2210692f60a7Smrg deplibs="$deplib $deplibs" 2211692f60a7Smrg continue 2212692f60a7Smrg ;; 2213692f60a7Smrg *.la) lib="$deplib" ;; 2214692f60a7Smrg *.$libext) 2215692f60a7Smrg if test "$pass" = conv; then 2216692f60a7Smrg deplibs="$deplib $deplibs" 2217692f60a7Smrg continue 2218692f60a7Smrg fi 2219692f60a7Smrg case $linkmode in 2220692f60a7Smrg lib) 2221692f60a7Smrg valid_a_lib=no 2222692f60a7Smrg case $deplibs_check_method in 2223692f60a7Smrg match_pattern*) 2224692f60a7Smrg set dummy $deplibs_check_method 2225692f60a7Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2226692f60a7Smrg if eval $echo \"$deplib\" 2>/dev/null \ 2227692f60a7Smrg | $SED 10q \ 2228692f60a7Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 2229692f60a7Smrg valid_a_lib=yes 2230692f60a7Smrg fi 2231692f60a7Smrg ;; 2232692f60a7Smrg pass_all) 2233692f60a7Smrg valid_a_lib=yes 2234692f60a7Smrg ;; 2235692f60a7Smrg esac 2236692f60a7Smrg if test "$valid_a_lib" != yes; then 2237692f60a7Smrg $echo 2238692f60a7Smrg $echo "*** Warning: Trying to link with static lib archive $deplib." 2239692f60a7Smrg $echo "*** I have the capability to make that library automatically link in when" 2240692f60a7Smrg $echo "*** you link to this library. But I can only do this if you have a" 2241692f60a7Smrg $echo "*** shared version of the library, which you do not appear to have" 2242692f60a7Smrg $echo "*** because the file extensions .$libext of this argument makes me believe" 2243692f60a7Smrg $echo "*** that it is just a static archive that I should not used here." 2244692f60a7Smrg else 2245692f60a7Smrg $echo 2246692f60a7Smrg $echo "*** Warning: Linking the shared library $output against the" 2247692f60a7Smrg $echo "*** static library $deplib is not portable!" 2248692f60a7Smrg deplibs="$deplib $deplibs" 2249692f60a7Smrg fi 2250692f60a7Smrg continue 2251692f60a7Smrg ;; 2252692f60a7Smrg prog) 2253692f60a7Smrg if test "$pass" != link; then 2254692f60a7Smrg deplibs="$deplib $deplibs" 2255692f60a7Smrg else 2256692f60a7Smrg compile_deplibs="$deplib $compile_deplibs" 2257692f60a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 2258692f60a7Smrg fi 2259692f60a7Smrg continue 2260692f60a7Smrg ;; 2261692f60a7Smrg esac # linkmode 2262692f60a7Smrg ;; # *.$libext 2263692f60a7Smrg *.lo | *.$objext) 2264692f60a7Smrg if test "$pass" = conv; then 2265692f60a7Smrg deplibs="$deplib $deplibs" 2266692f60a7Smrg elif test "$linkmode" = prog; then 2267692f60a7Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 2268692f60a7Smrg # If there is no dlopen support or we're linking statically, 2269692f60a7Smrg # we need to preload. 2270692f60a7Smrg newdlprefiles="$newdlprefiles $deplib" 2271692f60a7Smrg compile_deplibs="$deplib $compile_deplibs" 2272692f60a7Smrg finalize_deplibs="$deplib $finalize_deplibs" 2273692f60a7Smrg else 2274692f60a7Smrg newdlfiles="$newdlfiles $deplib" 2275692f60a7Smrg fi 2276692f60a7Smrg fi 2277692f60a7Smrg continue 2278692f60a7Smrg ;; 2279692f60a7Smrg %DEPLIBS%) 2280692f60a7Smrg alldeplibs=yes 2281692f60a7Smrg continue 2282692f60a7Smrg ;; 2283692f60a7Smrg esac # case $deplib 2284692f60a7Smrg if test "$found" = yes || test -f "$lib"; then : 2285692f60a7Smrg else 2286692f60a7Smrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 2287692f60a7Smrg exit $EXIT_FAILURE 2288692f60a7Smrg fi 2289692f60a7Smrg 2290692f60a7Smrg # Check to see that this really is a libtool archive. 2291692f60a7Smrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2292692f60a7Smrg else 2293692f60a7Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 2294692f60a7Smrg exit $EXIT_FAILURE 2295692f60a7Smrg fi 2296692f60a7Smrg 2297692f60a7Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2298692f60a7Smrg test "X$ladir" = "X$lib" && ladir="." 2299692f60a7Smrg 2300692f60a7Smrg dlname= 2301692f60a7Smrg dlopen= 2302692f60a7Smrg dlpreopen= 2303692f60a7Smrg libdir= 2304692f60a7Smrg library_names= 2305692f60a7Smrg old_library= 2306692f60a7Smrg # If the library was installed with an old release of libtool, 2307692f60a7Smrg # it will not redefine variables installed, or shouldnotlink 2308692f60a7Smrg installed=yes 2309692f60a7Smrg shouldnotlink=no 2310692f60a7Smrg avoidtemprpath= 2311692f60a7Smrg 2312692f60a7Smrg 2313692f60a7Smrg # Read the .la file 2314692f60a7Smrg case $lib in 2315692f60a7Smrg */* | *\\*) . $lib ;; 2316692f60a7Smrg *) . ./$lib ;; 2317692f60a7Smrg esac 2318692f60a7Smrg 2319692f60a7Smrg if test "$linkmode,$pass" = "lib,link" || 2320692f60a7Smrg test "$linkmode,$pass" = "prog,scan" || 2321692f60a7Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 2322692f60a7Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 2323692f60a7Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 2324692f60a7Smrg fi 2325692f60a7Smrg 2326692f60a7Smrg if test "$pass" = conv; then 2327692f60a7Smrg # Only check for convenience libraries 2328692f60a7Smrg deplibs="$lib $deplibs" 2329692f60a7Smrg if test -z "$libdir"; then 2330692f60a7Smrg if test -z "$old_library"; then 2331692f60a7Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2332692f60a7Smrg exit $EXIT_FAILURE 2333692f60a7Smrg fi 2334692f60a7Smrg # It is a libtool convenience library, so add in its objects. 2335692f60a7Smrg convenience="$convenience $ladir/$objdir/$old_library" 2336692f60a7Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 2337692f60a7Smrg tmp_libs= 2338692f60a7Smrg for deplib in $dependency_libs; do 2339692f60a7Smrg deplibs="$deplib $deplibs" 2340692f60a7Smrg if test "X$duplicate_deps" = "Xyes" ; then 2341692f60a7Smrg case "$tmp_libs " in 2342692f60a7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2343692f60a7Smrg esac 2344692f60a7Smrg fi 2345692f60a7Smrg tmp_libs="$tmp_libs $deplib" 2346692f60a7Smrg done 2347692f60a7Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 2348692f60a7Smrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 2349692f60a7Smrg exit $EXIT_FAILURE 2350692f60a7Smrg fi 2351692f60a7Smrg continue 2352692f60a7Smrg fi # $pass = conv 2353692f60a7Smrg 2354692f60a7Smrg 2355692f60a7Smrg # Get the name of the library we link against. 2356692f60a7Smrg linklib= 2357692f60a7Smrg for l in $old_library $library_names; do 2358692f60a7Smrg linklib="$l" 2359692f60a7Smrg done 2360692f60a7Smrg if test -z "$linklib"; then 2361692f60a7Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2362692f60a7Smrg exit $EXIT_FAILURE 2363692f60a7Smrg fi 2364692f60a7Smrg 2365692f60a7Smrg # This library was specified with -dlopen. 2366692f60a7Smrg if test "$pass" = dlopen; then 2367692f60a7Smrg if test -z "$libdir"; then 2368692f60a7Smrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 2369692f60a7Smrg exit $EXIT_FAILURE 2370692f60a7Smrg fi 2371692f60a7Smrg if test -z "$dlname" || 2372692f60a7Smrg test "$dlopen_support" != yes || 2373692f60a7Smrg test "$build_libtool_libs" = no; then 2374692f60a7Smrg # If there is no dlname, no dlopen support or we're linking 2375692f60a7Smrg # statically, we need to preload. We also need to preload any 2376692f60a7Smrg # dependent libraries so libltdl's deplib preloader doesn't 2377692f60a7Smrg # bomb out in the load deplibs phase. 2378692f60a7Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 2379692f60a7Smrg else 2380692f60a7Smrg newdlfiles="$newdlfiles $lib" 2381692f60a7Smrg fi 2382692f60a7Smrg continue 2383692f60a7Smrg fi # $pass = dlopen 2384692f60a7Smrg 2385692f60a7Smrg # We need an absolute path. 2386692f60a7Smrg case $ladir in 2387692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 2388692f60a7Smrg *) 2389692f60a7Smrg abs_ladir=`cd "$ladir" && pwd` 2390692f60a7Smrg if test -z "$abs_ladir"; then 2391692f60a7Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 2392692f60a7Smrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 2393692f60a7Smrg abs_ladir="$ladir" 2394692f60a7Smrg fi 2395692f60a7Smrg ;; 2396692f60a7Smrg esac 2397692f60a7Smrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 2398692f60a7Smrg 2399692f60a7Smrg # Find the relevant object directory and library name. 2400692f60a7Smrg if test "X$installed" = Xyes; then 2401692f60a7Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2402692f60a7Smrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 2403692f60a7Smrg dir="$ladir" 2404692f60a7Smrg absdir="$abs_ladir" 2405692f60a7Smrg libdir="$abs_ladir" 2406692f60a7Smrg else 2407692f60a7Smrg dir="$libdir" 2408692f60a7Smrg absdir="$libdir" 2409692f60a7Smrg fi 2410692f60a7Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 2411692f60a7Smrg else 2412692f60a7Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2413692f60a7Smrg dir="$ladir" 2414692f60a7Smrg absdir="$abs_ladir" 2415692f60a7Smrg # Remove this search path later 2416692f60a7Smrg notinst_path="$notinst_path $abs_ladir" 2417692f60a7Smrg else 2418692f60a7Smrg dir="$ladir/$objdir" 2419692f60a7Smrg absdir="$abs_ladir/$objdir" 2420692f60a7Smrg # Remove this search path later 2421692f60a7Smrg notinst_path="$notinst_path $abs_ladir" 2422692f60a7Smrg fi 2423692f60a7Smrg fi # $installed = yes 2424692f60a7Smrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2425692f60a7Smrg 2426692f60a7Smrg # This library was specified with -dlpreopen. 2427692f60a7Smrg if test "$pass" = dlpreopen; then 2428692f60a7Smrg if test -z "$libdir"; then 2429692f60a7Smrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 2430692f60a7Smrg exit $EXIT_FAILURE 2431692f60a7Smrg fi 2432692f60a7Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 2433692f60a7Smrg # are required to link). 2434692f60a7Smrg if test -n "$old_library"; then 2435692f60a7Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 2436692f60a7Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 2437692f60a7Smrg elif test -n "$dlname"; then 2438692f60a7Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 2439692f60a7Smrg else 2440692f60a7Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 2441692f60a7Smrg fi 2442692f60a7Smrg fi # $pass = dlpreopen 2443692f60a7Smrg 2444692f60a7Smrg if test -z "$libdir"; then 2445692f60a7Smrg # Link the convenience library 2446692f60a7Smrg if test "$linkmode" = lib; then 2447692f60a7Smrg deplibs="$dir/$old_library $deplibs" 2448692f60a7Smrg elif test "$linkmode,$pass" = "prog,link"; then 2449692f60a7Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 2450692f60a7Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 2451692f60a7Smrg else 2452692f60a7Smrg deplibs="$lib $deplibs" # used for prog,scan pass 2453692f60a7Smrg fi 2454692f60a7Smrg continue 2455692f60a7Smrg fi 2456692f60a7Smrg 2457692f60a7Smrg 2458692f60a7Smrg if test "$linkmode" = prog && test "$pass" != link; then 2459692f60a7Smrg newlib_search_path="$newlib_search_path $ladir" 2460692f60a7Smrg deplibs="$lib $deplibs" 2461692f60a7Smrg 2462692f60a7Smrg linkalldeplibs=no 2463692f60a7Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 2464692f60a7Smrg test "$build_libtool_libs" = no; then 2465692f60a7Smrg linkalldeplibs=yes 2466692f60a7Smrg fi 2467692f60a7Smrg 2468692f60a7Smrg tmp_libs= 2469692f60a7Smrg for deplib in $dependency_libs; do 2470692f60a7Smrg case $deplib in 2471692f60a7Smrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 2472692f60a7Smrg esac 2473692f60a7Smrg # Need to link against all dependency_libs? 2474692f60a7Smrg if test "$linkalldeplibs" = yes; then 2475692f60a7Smrg deplibs="$deplib $deplibs" 2476692f60a7Smrg else 2477692f60a7Smrg # Need to hardcode shared library paths 2478692f60a7Smrg # or/and link against static libraries 2479692f60a7Smrg newdependency_libs="$deplib $newdependency_libs" 2480692f60a7Smrg fi 2481692f60a7Smrg if test "X$duplicate_deps" = "Xyes" ; then 2482692f60a7Smrg case "$tmp_libs " in 2483692f60a7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2484692f60a7Smrg esac 2485692f60a7Smrg fi 2486692f60a7Smrg tmp_libs="$tmp_libs $deplib" 2487692f60a7Smrg done # for deplib 2488692f60a7Smrg continue 2489692f60a7Smrg fi # $linkmode = prog... 2490692f60a7Smrg 2491692f60a7Smrg if test "$linkmode,$pass" = "prog,link"; then 2492692f60a7Smrg if test -n "$library_names" && 2493692f60a7Smrg { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2494692f60a7Smrg # We need to hardcode the library path 2495692f60a7Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 2496692f60a7Smrg # Make sure the rpath contains only unique directories. 2497692f60a7Smrg case "$temp_rpath " in 2498692f60a7Smrg *" $dir "*) ;; 2499692f60a7Smrg *" $absdir "*) ;; 2500692f60a7Smrg *) temp_rpath="$temp_rpath $absdir" ;; 2501692f60a7Smrg esac 2502692f60a7Smrg fi 2503692f60a7Smrg 2504692f60a7Smrg # Hardcode the library path. 2505692f60a7Smrg # Skip directories that are in the system default run-time 2506692f60a7Smrg # search path. 2507692f60a7Smrg case " $sys_lib_dlsearch_path " in 2508692f60a7Smrg *" $absdir "*) ;; 2509692f60a7Smrg *) 2510692f60a7Smrg case "$compile_rpath " in 2511692f60a7Smrg *" $absdir "*) ;; 2512692f60a7Smrg *) compile_rpath="$compile_rpath $absdir" 2513692f60a7Smrg esac 2514692f60a7Smrg ;; 2515692f60a7Smrg esac 2516692f60a7Smrg case " $sys_lib_dlsearch_path " in 2517692f60a7Smrg *" $libdir "*) ;; 2518692f60a7Smrg *) 2519692f60a7Smrg case "$finalize_rpath " in 2520692f60a7Smrg *" $libdir "*) ;; 2521692f60a7Smrg *) finalize_rpath="$finalize_rpath $libdir" 2522692f60a7Smrg esac 2523692f60a7Smrg ;; 2524692f60a7Smrg esac 2525692f60a7Smrg fi # $linkmode,$pass = prog,link... 2526692f60a7Smrg 2527692f60a7Smrg if test "$alldeplibs" = yes && 2528692f60a7Smrg { test "$deplibs_check_method" = pass_all || 2529692f60a7Smrg { test "$build_libtool_libs" = yes && 2530692f60a7Smrg test -n "$library_names"; }; }; then 2531692f60a7Smrg # We only need to search for static libraries 2532692f60a7Smrg continue 2533692f60a7Smrg fi 2534692f60a7Smrg fi 2535692f60a7Smrg 2536692f60a7Smrg link_static=no # Whether the deplib will be linked statically 2537692f60a7Smrg use_static_libs=$prefer_static_libs 2538692f60a7Smrg if test "$use_static_libs" = built && test "$installed" = yes ; then 2539692f60a7Smrg use_static_libs=no 2540692f60a7Smrg fi 2541692f60a7Smrg if test -n "$library_names" && 2542692f60a7Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 2543692f60a7Smrg if test "$installed" = no; then 2544692f60a7Smrg notinst_deplibs="$notinst_deplibs $lib" 2545692f60a7Smrg need_relink=yes 2546692f60a7Smrg fi 2547692f60a7Smrg # This is a shared library 2548692f60a7Smrg 2549692f60a7Smrg # Warn about portability, can't link against -module's on 2550692f60a7Smrg # some systems (darwin) 2551692f60a7Smrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 2552692f60a7Smrg $echo 2553692f60a7Smrg if test "$linkmode" = prog; then 2554692f60a7Smrg $echo "*** Warning: Linking the executable $output against the loadable module" 2555692f60a7Smrg else 2556692f60a7Smrg $echo "*** Warning: Linking the shared library $output against the loadable module" 2557692f60a7Smrg fi 2558692f60a7Smrg $echo "*** $linklib is not portable!" 2559692f60a7Smrg fi 2560692f60a7Smrg if test "$linkmode" = lib && 2561692f60a7Smrg test "$hardcode_into_libs" = yes; then 2562692f60a7Smrg # Hardcode the library path. 2563692f60a7Smrg # Skip directories that are in the system default run-time 2564692f60a7Smrg # search path. 2565692f60a7Smrg case " $sys_lib_dlsearch_path " in 2566692f60a7Smrg *" $absdir "*) ;; 2567692f60a7Smrg *) 2568692f60a7Smrg case "$compile_rpath " in 2569692f60a7Smrg *" $absdir "*) ;; 2570692f60a7Smrg *) compile_rpath="$compile_rpath $absdir" 2571692f60a7Smrg esac 2572692f60a7Smrg ;; 2573692f60a7Smrg esac 2574692f60a7Smrg case " $sys_lib_dlsearch_path " in 2575692f60a7Smrg *" $libdir "*) ;; 2576692f60a7Smrg *) 2577692f60a7Smrg case "$finalize_rpath " in 2578692f60a7Smrg *" $libdir "*) ;; 2579692f60a7Smrg *) finalize_rpath="$finalize_rpath $libdir" 2580692f60a7Smrg esac 2581692f60a7Smrg ;; 2582692f60a7Smrg esac 2583692f60a7Smrg fi 2584692f60a7Smrg 2585692f60a7Smrg if test -n "$old_archive_from_expsyms_cmds"; then 2586692f60a7Smrg # figure out the soname 2587692f60a7Smrg set dummy $library_names 2588692f60a7Smrg realname="$2" 2589692f60a7Smrg shift; shift 2590692f60a7Smrg libname=`eval \\$echo \"$libname_spec\"` 2591692f60a7Smrg # use dlname if we got it. it's perfectly good, no? 2592692f60a7Smrg if test -n "$dlname"; then 2593692f60a7Smrg soname="$dlname" 2594692f60a7Smrg elif test -n "$soname_spec"; then 2595692f60a7Smrg # bleh windows 2596692f60a7Smrg case $host in 2597692f60a7Smrg *cygwin* | mingw*) 2598692f60a7Smrg major=`expr $current - $age` 2599692f60a7Smrg versuffix="-$major" 2600692f60a7Smrg ;; 2601692f60a7Smrg esac 2602692f60a7Smrg eval soname=\"$soname_spec\" 2603692f60a7Smrg else 2604692f60a7Smrg soname="$realname" 2605692f60a7Smrg fi 2606692f60a7Smrg 2607692f60a7Smrg # Make a new name for the extract_expsyms_cmds to use 2608692f60a7Smrg soroot="$soname" 2609692f60a7Smrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 2610692f60a7Smrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 2611692f60a7Smrg 2612692f60a7Smrg # If the library has no export list, then create one now 2613692f60a7Smrg if test -f "$output_objdir/$soname-def"; then : 2614692f60a7Smrg else 2615692f60a7Smrg $show "extracting exported symbol list from \`$soname'" 2616692f60a7Smrg save_ifs="$IFS"; IFS='~' 2617692f60a7Smrg cmds=$extract_expsyms_cmds 2618692f60a7Smrg for cmd in $cmds; do 2619692f60a7Smrg IFS="$save_ifs" 2620692f60a7Smrg eval cmd=\"$cmd\" 2621692f60a7Smrg $show "$cmd" 2622692f60a7Smrg $run eval "$cmd" || exit $? 2623692f60a7Smrg done 2624692f60a7Smrg IFS="$save_ifs" 2625692f60a7Smrg fi 2626692f60a7Smrg 2627692f60a7Smrg # Create $newlib 2628692f60a7Smrg if test -f "$output_objdir/$newlib"; then :; else 2629692f60a7Smrg $show "generating import library for \`$soname'" 2630692f60a7Smrg save_ifs="$IFS"; IFS='~' 2631692f60a7Smrg cmds=$old_archive_from_expsyms_cmds 2632692f60a7Smrg for cmd in $cmds; do 2633692f60a7Smrg IFS="$save_ifs" 2634692f60a7Smrg eval cmd=\"$cmd\" 2635692f60a7Smrg $show "$cmd" 2636692f60a7Smrg $run eval "$cmd" || exit $? 2637692f60a7Smrg done 2638692f60a7Smrg IFS="$save_ifs" 2639692f60a7Smrg fi 2640692f60a7Smrg # make sure the library variables are pointing to the new library 2641692f60a7Smrg dir=$output_objdir 2642692f60a7Smrg linklib=$newlib 2643692f60a7Smrg fi # test -n "$old_archive_from_expsyms_cmds" 2644692f60a7Smrg 2645692f60a7Smrg if test "$linkmode" = prog || test "$mode" != relink; then 2646692f60a7Smrg add_shlibpath= 2647692f60a7Smrg add_dir= 2648692f60a7Smrg add= 2649692f60a7Smrg lib_linked=yes 2650692f60a7Smrg case $hardcode_action in 2651692f60a7Smrg immediate | unsupported) 2652692f60a7Smrg if test "$hardcode_direct" = no; then 2653692f60a7Smrg add="$dir/$linklib" 2654692f60a7Smrg case $host in 2655692f60a7Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 2656692f60a7Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 2657692f60a7Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 2658692f60a7Smrg *-*-unixware7*) add_dir="-L$dir" ;; 2659692f60a7Smrg *-*-darwin* ) 2660692f60a7Smrg # if the lib is a module then we can not link against 2661692f60a7Smrg # it, someone is ignoring the new warnings I added 2662692f60a7Smrg if /usr/bin/file -L $add 2> /dev/null | 2663692f60a7Smrg $EGREP ": [^:]* bundle" >/dev/null ; then 2664692f60a7Smrg $echo "** Warning, lib $linklib is a module, not a shared library" 2665692f60a7Smrg if test -z "$old_library" ; then 2666692f60a7Smrg $echo 2667692f60a7Smrg $echo "** And there doesn't seem to be a static archive available" 2668692f60a7Smrg $echo "** The link will probably fail, sorry" 2669692f60a7Smrg else 2670692f60a7Smrg add="$dir/$old_library" 2671692f60a7Smrg fi 2672692f60a7Smrg fi 2673692f60a7Smrg esac 2674692f60a7Smrg elif test "$hardcode_minus_L" = no; then 2675692f60a7Smrg case $host in 2676692f60a7Smrg *-*-sunos*) add_shlibpath="$dir" ;; 2677692f60a7Smrg esac 2678692f60a7Smrg add_dir="-L$dir" 2679692f60a7Smrg add="-l$name" 2680692f60a7Smrg elif test "$hardcode_shlibpath_var" = no; then 2681692f60a7Smrg add_shlibpath="$dir" 2682692f60a7Smrg add="-l$name" 2683692f60a7Smrg else 2684692f60a7Smrg lib_linked=no 2685692f60a7Smrg fi 2686692f60a7Smrg ;; 2687692f60a7Smrg relink) 2688692f60a7Smrg if test "$hardcode_direct" = yes; then 2689692f60a7Smrg add="$dir/$linklib" 2690692f60a7Smrg elif test "$hardcode_minus_L" = yes; then 2691692f60a7Smrg add_dir="-L$dir" 2692692f60a7Smrg # Try looking first in the location we're being installed to. 2693692f60a7Smrg if test -n "$inst_prefix_dir"; then 2694692f60a7Smrg case $libdir in 2695692f60a7Smrg [\\/]*) 2696692f60a7Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 2697692f60a7Smrg ;; 2698692f60a7Smrg esac 2699692f60a7Smrg fi 2700692f60a7Smrg add="-l$name" 2701692f60a7Smrg elif test "$hardcode_shlibpath_var" = yes; then 2702692f60a7Smrg add_shlibpath="$dir" 2703692f60a7Smrg add="-l$name" 2704692f60a7Smrg else 2705692f60a7Smrg lib_linked=no 2706692f60a7Smrg fi 2707692f60a7Smrg ;; 2708692f60a7Smrg *) lib_linked=no ;; 2709692f60a7Smrg esac 2710692f60a7Smrg 2711692f60a7Smrg if test "$lib_linked" != yes; then 2712692f60a7Smrg $echo "$modename: configuration error: unsupported hardcode properties" 2713692f60a7Smrg exit $EXIT_FAILURE 2714692f60a7Smrg fi 2715692f60a7Smrg 2716692f60a7Smrg if test -n "$add_shlibpath"; then 2717692f60a7Smrg case :$compile_shlibpath: in 2718692f60a7Smrg *":$add_shlibpath:"*) ;; 2719692f60a7Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2720692f60a7Smrg esac 2721692f60a7Smrg fi 2722692f60a7Smrg if test "$linkmode" = prog; then 2723692f60a7Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2724692f60a7Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 2725692f60a7Smrg else 2726692f60a7Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 2727692f60a7Smrg test -n "$add" && deplibs="$add $deplibs" 2728692f60a7Smrg if test "$hardcode_direct" != yes && \ 2729692f60a7Smrg test "$hardcode_minus_L" != yes && \ 2730692f60a7Smrg test "$hardcode_shlibpath_var" = yes; then 2731692f60a7Smrg case :$finalize_shlibpath: in 2732692f60a7Smrg *":$libdir:"*) ;; 2733692f60a7Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2734692f60a7Smrg esac 2735692f60a7Smrg fi 2736692f60a7Smrg fi 2737692f60a7Smrg fi 2738692f60a7Smrg 2739692f60a7Smrg if test "$linkmode" = prog || test "$mode" = relink; then 2740692f60a7Smrg add_shlibpath= 2741692f60a7Smrg add_dir= 2742692f60a7Smrg add= 2743692f60a7Smrg # Finalize command for both is simple: just hardcode it. 2744692f60a7Smrg if test "$hardcode_direct" = yes; then 2745692f60a7Smrg add="$libdir/$linklib" 2746692f60a7Smrg elif test "$hardcode_minus_L" = yes; then 2747692f60a7Smrg add_dir="-L$libdir" 2748692f60a7Smrg add="-l$name" 2749692f60a7Smrg elif test "$hardcode_shlibpath_var" = yes; then 2750692f60a7Smrg case :$finalize_shlibpath: in 2751692f60a7Smrg *":$libdir:"*) ;; 2752692f60a7Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2753692f60a7Smrg esac 2754692f60a7Smrg add="-l$name" 2755692f60a7Smrg elif test "$hardcode_automatic" = yes; then 2756692f60a7Smrg if test -n "$inst_prefix_dir" && 2757692f60a7Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 2758692f60a7Smrg add="$inst_prefix_dir$libdir/$linklib" 2759692f60a7Smrg else 2760692f60a7Smrg add="$libdir/$linklib" 2761692f60a7Smrg fi 2762692f60a7Smrg else 2763692f60a7Smrg # We cannot seem to hardcode it, guess we'll fake it. 2764692f60a7Smrg add_dir="-L$libdir" 2765692f60a7Smrg # Try looking first in the location we're being installed to. 2766692f60a7Smrg if test -n "$inst_prefix_dir"; then 2767692f60a7Smrg case $libdir in 2768692f60a7Smrg [\\/]*) 2769692f60a7Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 2770692f60a7Smrg ;; 2771692f60a7Smrg esac 2772692f60a7Smrg fi 2773692f60a7Smrg add="-l$name" 2774692f60a7Smrg fi 2775692f60a7Smrg 2776692f60a7Smrg if test "$linkmode" = prog; then 2777692f60a7Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2778692f60a7Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2779692f60a7Smrg else 2780692f60a7Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 2781692f60a7Smrg test -n "$add" && deplibs="$add $deplibs" 2782692f60a7Smrg fi 2783692f60a7Smrg fi 2784692f60a7Smrg elif test "$linkmode" = prog; then 2785692f60a7Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 2786692f60a7Smrg # is not unsupported. This is valid on all known static and 2787692f60a7Smrg # shared platforms. 2788692f60a7Smrg if test "$hardcode_direct" != unsupported; then 2789692f60a7Smrg test -n "$old_library" && linklib="$old_library" 2790692f60a7Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 2791692f60a7Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 2792692f60a7Smrg else 2793692f60a7Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 2794692f60a7Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2795692f60a7Smrg fi 2796692f60a7Smrg elif test "$build_libtool_libs" = yes; then 2797692f60a7Smrg # Not a shared library 2798692f60a7Smrg if test "$deplibs_check_method" != pass_all; then 2799692f60a7Smrg # We're trying link a shared library against a static one 2800692f60a7Smrg # but the system doesn't support it. 2801692f60a7Smrg 2802692f60a7Smrg # Just print a warning and add the library to dependency_libs so 2803692f60a7Smrg # that the program can be linked against the static library. 2804692f60a7Smrg $echo 2805692f60a7Smrg $echo "*** Warning: This system can not link to static lib archive $lib." 2806692f60a7Smrg $echo "*** I have the capability to make that library automatically link in when" 2807692f60a7Smrg $echo "*** you link to this library. But I can only do this if you have a" 2808692f60a7Smrg $echo "*** shared version of the library, which you do not appear to have." 2809692f60a7Smrg if test "$module" = yes; then 2810692f60a7Smrg $echo "*** But as you try to build a module library, libtool will still create " 2811692f60a7Smrg $echo "*** a static module, that should work as long as the dlopening application" 2812692f60a7Smrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 2813692f60a7Smrg if test -z "$global_symbol_pipe"; then 2814692f60a7Smrg $echo 2815692f60a7Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 2816692f60a7Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2817692f60a7Smrg $echo "*** not find such a program. So, this module is probably useless." 2818692f60a7Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 2819692f60a7Smrg fi 2820692f60a7Smrg if test "$build_old_libs" = no; then 2821692f60a7Smrg build_libtool_libs=module 2822692f60a7Smrg build_old_libs=yes 2823692f60a7Smrg else 2824692f60a7Smrg build_libtool_libs=no 2825692f60a7Smrg fi 2826692f60a7Smrg fi 2827692f60a7Smrg else 2828692f60a7Smrg deplibs="$dir/$old_library $deplibs" 2829692f60a7Smrg link_static=yes 2830692f60a7Smrg fi 2831692f60a7Smrg fi # link shared/static library? 2832692f60a7Smrg 2833692f60a7Smrg if test "$linkmode" = lib; then 2834692f60a7Smrg if test -n "$dependency_libs" && 2835692f60a7Smrg { test "$hardcode_into_libs" != yes || 2836692f60a7Smrg test "$build_old_libs" = yes || 2837692f60a7Smrg test "$link_static" = yes; }; then 2838692f60a7Smrg # Extract -R from dependency_libs 2839692f60a7Smrg temp_deplibs= 2840692f60a7Smrg for libdir in $dependency_libs; do 2841692f60a7Smrg case $libdir in 2842692f60a7Smrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2843692f60a7Smrg case " $xrpath " in 2844692f60a7Smrg *" $temp_xrpath "*) ;; 2845692f60a7Smrg *) xrpath="$xrpath $temp_xrpath";; 2846692f60a7Smrg esac;; 2847692f60a7Smrg *) temp_deplibs="$temp_deplibs $libdir";; 2848692f60a7Smrg esac 2849692f60a7Smrg done 2850692f60a7Smrg dependency_libs="$temp_deplibs" 2851692f60a7Smrg fi 2852692f60a7Smrg 2853692f60a7Smrg newlib_search_path="$newlib_search_path $absdir" 2854692f60a7Smrg # Link against this library 2855692f60a7Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2856692f60a7Smrg # ... and its dependency_libs 2857692f60a7Smrg tmp_libs= 2858692f60a7Smrg for deplib in $dependency_libs; do 2859692f60a7Smrg newdependency_libs="$deplib $newdependency_libs" 2860692f60a7Smrg if test "X$duplicate_deps" = "Xyes" ; then 2861692f60a7Smrg case "$tmp_libs " in 2862692f60a7Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2863692f60a7Smrg esac 2864692f60a7Smrg fi 2865692f60a7Smrg tmp_libs="$tmp_libs $deplib" 2866692f60a7Smrg done 2867692f60a7Smrg 2868692f60a7Smrg if test "$link_all_deplibs" != no; then 2869692f60a7Smrg # Add the search paths of all dependency libraries 2870692f60a7Smrg for deplib in $dependency_libs; do 2871692f60a7Smrg case $deplib in 2872692f60a7Smrg -L*) path="$deplib" ;; 2873692f60a7Smrg *.la) 2874692f60a7Smrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2875692f60a7Smrg test "X$dir" = "X$deplib" && dir="." 2876692f60a7Smrg # We need an absolute path. 2877692f60a7Smrg case $dir in 2878692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2879692f60a7Smrg *) 2880692f60a7Smrg absdir=`cd "$dir" && pwd` 2881692f60a7Smrg if test -z "$absdir"; then 2882692f60a7Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2883692f60a7Smrg absdir="$dir" 2884692f60a7Smrg fi 2885692f60a7Smrg ;; 2886692f60a7Smrg esac 2887692f60a7Smrg if grep "^installed=no" $deplib > /dev/null; then 2888692f60a7Smrg path="$absdir/$objdir" 2889692f60a7Smrg else 2890692f60a7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2891692f60a7Smrg if test -z "$libdir"; then 2892692f60a7Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2893692f60a7Smrg exit $EXIT_FAILURE 2894692f60a7Smrg fi 2895692f60a7Smrg if test "$absdir" != "$libdir"; then 2896692f60a7Smrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2897692f60a7Smrg fi 2898692f60a7Smrg path="$absdir" 2899692f60a7Smrg fi 2900692f60a7Smrg depdepl= 2901692f60a7Smrg case $host in 2902692f60a7Smrg *-*-darwin*) 2903692f60a7Smrg # we do not want to link against static libs, 2904692f60a7Smrg # but need to link against shared 2905692f60a7Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 2906692f60a7Smrg if test -n "$deplibrary_names" ; then 2907692f60a7Smrg for tmp in $deplibrary_names ; do 2908692f60a7Smrg depdepl=$tmp 2909692f60a7Smrg done 2910692f60a7Smrg if test -f "$path/$depdepl" ; then 2911692f60a7Smrg depdepl="$path/$depdepl" 2912692f60a7Smrg fi 2913692f60a7Smrg # do not add paths which are already there 2914692f60a7Smrg case " $newlib_search_path " in 2915692f60a7Smrg *" $path "*) ;; 2916692f60a7Smrg *) newlib_search_path="$newlib_search_path $path";; 2917692f60a7Smrg esac 2918692f60a7Smrg fi 2919692f60a7Smrg path="" 2920692f60a7Smrg ;; 2921692f60a7Smrg *) 2922692f60a7Smrg path="-L$path" 2923692f60a7Smrg ;; 2924692f60a7Smrg esac 2925692f60a7Smrg ;; 2926692f60a7Smrg -l*) 2927692f60a7Smrg case $host in 2928692f60a7Smrg *-*-darwin*) 2929692f60a7Smrg # Again, we only want to link against shared libraries 2930692f60a7Smrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 2931692f60a7Smrg for tmp in $newlib_search_path ; do 2932692f60a7Smrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 2933692f60a7Smrg eval depdepl="$tmp/lib$tmp_libs.dylib" 2934692f60a7Smrg break 2935692f60a7Smrg fi 2936692f60a7Smrg done 2937692f60a7Smrg path="" 2938692f60a7Smrg ;; 2939692f60a7Smrg *) continue ;; 2940692f60a7Smrg esac 2941692f60a7Smrg ;; 2942692f60a7Smrg *) continue ;; 2943692f60a7Smrg esac 2944692f60a7Smrg case " $deplibs " in 2945692f60a7Smrg *" $path "*) ;; 2946692f60a7Smrg *) deplibs="$path $deplibs" ;; 2947692f60a7Smrg esac 2948692f60a7Smrg case " $deplibs " in 2949692f60a7Smrg *" $depdepl "*) ;; 2950692f60a7Smrg *) deplibs="$depdepl $deplibs" ;; 2951692f60a7Smrg esac 2952692f60a7Smrg done 2953692f60a7Smrg fi # link_all_deplibs != no 2954692f60a7Smrg fi # linkmode = lib 2955692f60a7Smrg done # for deplib in $libs 2956692f60a7Smrg dependency_libs="$newdependency_libs" 2957692f60a7Smrg if test "$pass" = dlpreopen; then 2958692f60a7Smrg # Link the dlpreopened libraries before other libraries 2959692f60a7Smrg for deplib in $save_deplibs; do 2960692f60a7Smrg deplibs="$deplib $deplibs" 2961692f60a7Smrg done 2962692f60a7Smrg fi 2963692f60a7Smrg if test "$pass" != dlopen; then 2964692f60a7Smrg if test "$pass" != conv; then 2965692f60a7Smrg # Make sure lib_search_path contains only unique directories. 2966692f60a7Smrg lib_search_path= 2967692f60a7Smrg for dir in $newlib_search_path; do 2968692f60a7Smrg case "$lib_search_path " in 2969692f60a7Smrg *" $dir "*) ;; 2970692f60a7Smrg *) lib_search_path="$lib_search_path $dir" ;; 2971692f60a7Smrg esac 2972692f60a7Smrg done 2973692f60a7Smrg newlib_search_path= 2974692f60a7Smrg fi 2975692f60a7Smrg 2976692f60a7Smrg if test "$linkmode,$pass" != "prog,link"; then 2977692f60a7Smrg vars="deplibs" 2978692f60a7Smrg else 2979692f60a7Smrg vars="compile_deplibs finalize_deplibs" 2980692f60a7Smrg fi 2981692f60a7Smrg for var in $vars dependency_libs; do 2982692f60a7Smrg # Add libraries to $var in reverse order 2983692f60a7Smrg eval tmp_libs=\"\$$var\" 2984692f60a7Smrg new_libs= 2985692f60a7Smrg for deplib in $tmp_libs; do 2986692f60a7Smrg # FIXME: Pedantically, this is the right thing to do, so 2987692f60a7Smrg # that some nasty dependency loop isn't accidentally 2988692f60a7Smrg # broken: 2989692f60a7Smrg #new_libs="$deplib $new_libs" 2990692f60a7Smrg # Pragmatically, this seems to cause very few problems in 2991692f60a7Smrg # practice: 2992692f60a7Smrg case $deplib in 2993692f60a7Smrg -L*) new_libs="$deplib $new_libs" ;; 2994692f60a7Smrg -R*) ;; 2995692f60a7Smrg *) 2996692f60a7Smrg # And here is the reason: when a library appears more 2997692f60a7Smrg # than once as an explicit dependence of a library, or 2998692f60a7Smrg # is implicitly linked in more than once by the 2999692f60a7Smrg # compiler, it is considered special, and multiple 3000692f60a7Smrg # occurrences thereof are not removed. Compare this 3001692f60a7Smrg # with having the same library being listed as a 3002692f60a7Smrg # dependency of multiple other libraries: in this case, 3003692f60a7Smrg # we know (pedantically, we assume) the library does not 3004692f60a7Smrg # need to be listed more than once, so we keep only the 3005692f60a7Smrg # last copy. This is not always right, but it is rare 3006692f60a7Smrg # enough that we require users that really mean to play 3007692f60a7Smrg # such unportable linking tricks to link the library 3008692f60a7Smrg # using -Wl,-lname, so that libtool does not consider it 3009692f60a7Smrg # for duplicate removal. 3010692f60a7Smrg case " $specialdeplibs " in 3011692f60a7Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 3012692f60a7Smrg *) 3013692f60a7Smrg case " $new_libs " in 3014692f60a7Smrg *" $deplib "*) ;; 3015692f60a7Smrg *) new_libs="$deplib $new_libs" ;; 3016692f60a7Smrg esac 3017692f60a7Smrg ;; 3018692f60a7Smrg esac 3019692f60a7Smrg ;; 3020692f60a7Smrg esac 3021692f60a7Smrg done 3022692f60a7Smrg tmp_libs= 3023692f60a7Smrg for deplib in $new_libs; do 3024692f60a7Smrg case $deplib in 3025692f60a7Smrg -L*) 3026692f60a7Smrg case " $tmp_libs " in 3027692f60a7Smrg *" $deplib "*) ;; 3028692f60a7Smrg *) tmp_libs="$tmp_libs $deplib" ;; 3029692f60a7Smrg esac 3030692f60a7Smrg ;; 3031692f60a7Smrg *) tmp_libs="$tmp_libs $deplib" ;; 3032692f60a7Smrg esac 3033692f60a7Smrg done 3034692f60a7Smrg eval $var=\"$tmp_libs\" 3035692f60a7Smrg done # for var 3036692f60a7Smrg fi 3037692f60a7Smrg # Last step: remove runtime libs from dependency_libs 3038692f60a7Smrg # (they stay in deplibs) 3039692f60a7Smrg tmp_libs= 3040692f60a7Smrg for i in $dependency_libs ; do 3041692f60a7Smrg case " $predeps $postdeps $compiler_lib_search_path " in 3042692f60a7Smrg *" $i "*) 3043692f60a7Smrg i="" 3044692f60a7Smrg ;; 3045692f60a7Smrg esac 3046692f60a7Smrg if test -n "$i" ; then 3047692f60a7Smrg tmp_libs="$tmp_libs $i" 3048692f60a7Smrg fi 3049692f60a7Smrg done 3050692f60a7Smrg dependency_libs=$tmp_libs 3051692f60a7Smrg done # for pass 3052692f60a7Smrg if test "$linkmode" = prog; then 3053692f60a7Smrg dlfiles="$newdlfiles" 3054692f60a7Smrg dlprefiles="$newdlprefiles" 3055692f60a7Smrg fi 3056692f60a7Smrg 3057692f60a7Smrg case $linkmode in 3058692f60a7Smrg oldlib) 3059692f60a7Smrg if test -n "$deplibs"; then 3060692f60a7Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 3061692f60a7Smrg fi 3062692f60a7Smrg 3063692f60a7Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3064692f60a7Smrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 3065692f60a7Smrg fi 3066692f60a7Smrg 3067692f60a7Smrg if test -n "$rpath"; then 3068692f60a7Smrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 3069692f60a7Smrg fi 3070692f60a7Smrg 3071692f60a7Smrg if test -n "$xrpath"; then 3072692f60a7Smrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 3073692f60a7Smrg fi 3074692f60a7Smrg 3075692f60a7Smrg if test -n "$vinfo"; then 3076692f60a7Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 3077692f60a7Smrg fi 3078692f60a7Smrg 3079692f60a7Smrg if test -n "$release"; then 3080692f60a7Smrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 3081692f60a7Smrg fi 3082692f60a7Smrg 3083692f60a7Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3084692f60a7Smrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 3085692f60a7Smrg fi 3086692f60a7Smrg 3087692f60a7Smrg # Now set the variables for building old libraries. 3088692f60a7Smrg build_libtool_libs=no 3089692f60a7Smrg oldlibs="$output" 3090692f60a7Smrg objs="$objs$old_deplibs" 3091692f60a7Smrg ;; 3092692f60a7Smrg 3093692f60a7Smrg lib) 3094692f60a7Smrg # Make sure we only generate libraries of the form `libNAME.la'. 3095692f60a7Smrg case $outputname in 3096692f60a7Smrg lib*) 3097692f60a7Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 3098692f60a7Smrg eval shared_ext=\"$shrext_cmds\" 3099692f60a7Smrg eval libname=\"$libname_spec\" 3100692f60a7Smrg ;; 3101692f60a7Smrg *) 3102692f60a7Smrg if test "$module" = no; then 3103692f60a7Smrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 3104692f60a7Smrg $echo "$help" 1>&2 3105692f60a7Smrg exit $EXIT_FAILURE 3106692f60a7Smrg fi 3107692f60a7Smrg if test "$need_lib_prefix" != no; then 3108692f60a7Smrg # Add the "lib" prefix for modules if required 3109692f60a7Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3110692f60a7Smrg eval shared_ext=\"$shrext_cmds\" 3111692f60a7Smrg eval libname=\"$libname_spec\" 3112692f60a7Smrg else 3113692f60a7Smrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3114692f60a7Smrg fi 3115692f60a7Smrg ;; 3116692f60a7Smrg esac 3117692f60a7Smrg 3118692f60a7Smrg if test -n "$objs"; then 3119692f60a7Smrg if test "$deplibs_check_method" != pass_all; then 3120692f60a7Smrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 3121692f60a7Smrg exit $EXIT_FAILURE 3122692f60a7Smrg else 3123692f60a7Smrg $echo 3124692f60a7Smrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 3125692f60a7Smrg $echo "*** objects $objs is not portable!" 3126692f60a7Smrg libobjs="$libobjs $objs" 3127692f60a7Smrg fi 3128692f60a7Smrg fi 3129692f60a7Smrg 3130692f60a7Smrg if test "$dlself" != no; then 3131692f60a7Smrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 3132692f60a7Smrg fi 3133692f60a7Smrg 3134692f60a7Smrg set dummy $rpath 3135692f60a7Smrg if test "$#" -gt 2; then 3136692f60a7Smrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 3137692f60a7Smrg fi 3138692f60a7Smrg install_libdir="$2" 3139692f60a7Smrg 3140692f60a7Smrg oldlibs= 3141692f60a7Smrg if test -z "$rpath"; then 3142692f60a7Smrg if test "$build_libtool_libs" = yes; then 3143692f60a7Smrg # Building a libtool convenience library. 3144692f60a7Smrg # Some compilers have problems with a `.al' extension so 3145692f60a7Smrg # convenience libraries should have the same extension an 3146692f60a7Smrg # archive normally would. 3147692f60a7Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 3148692f60a7Smrg build_libtool_libs=convenience 3149692f60a7Smrg build_old_libs=yes 3150692f60a7Smrg fi 3151692f60a7Smrg 3152692f60a7Smrg if test -n "$vinfo"; then 3153692f60a7Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 3154692f60a7Smrg fi 3155692f60a7Smrg 3156692f60a7Smrg if test -n "$release"; then 3157692f60a7Smrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 3158692f60a7Smrg fi 3159692f60a7Smrg else 3160692f60a7Smrg 3161692f60a7Smrg # Parse the version information argument. 3162692f60a7Smrg save_ifs="$IFS"; IFS=':' 3163692f60a7Smrg set dummy $vinfo 0 0 0 3164692f60a7Smrg IFS="$save_ifs" 3165692f60a7Smrg 3166692f60a7Smrg if test -n "$8"; then 3167692f60a7Smrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 3168692f60a7Smrg $echo "$help" 1>&2 3169692f60a7Smrg exit $EXIT_FAILURE 3170692f60a7Smrg fi 3171692f60a7Smrg 3172692f60a7Smrg # convert absolute version numbers to libtool ages 3173692f60a7Smrg # this retains compatibility with .la files and attempts 3174692f60a7Smrg # to make the code below a bit more comprehensible 3175692f60a7Smrg 3176692f60a7Smrg case $vinfo_number in 3177692f60a7Smrg yes) 3178692f60a7Smrg number_major="$2" 3179692f60a7Smrg number_minor="$3" 3180692f60a7Smrg number_revision="$4" 3181692f60a7Smrg # 3182692f60a7Smrg # There are really only two kinds -- those that 3183692f60a7Smrg # use the current revision as the major version 3184692f60a7Smrg # and those that subtract age and use age as 3185692f60a7Smrg # a minor version. But, then there is irix 3186692f60a7Smrg # which has an extra 1 added just for fun 3187692f60a7Smrg # 3188692f60a7Smrg case $version_type in 3189692f60a7Smrg darwin|linux|osf|windows) 3190692f60a7Smrg current=`expr $number_major + $number_minor` 3191692f60a7Smrg age="$number_minor" 3192692f60a7Smrg revision="$number_revision" 3193692f60a7Smrg ;; 3194692f60a7Smrg freebsd-aout|freebsd-elf|sunos) 3195692f60a7Smrg current="$number_major" 3196692f60a7Smrg revision="$number_minor" 3197692f60a7Smrg age="0" 3198692f60a7Smrg ;; 3199692f60a7Smrg irix|nonstopux) 3200692f60a7Smrg current=`expr $number_major + $number_minor - 1` 3201692f60a7Smrg age="$number_minor" 3202692f60a7Smrg revision="$number_minor" 3203692f60a7Smrg ;; 3204692f60a7Smrg esac 3205692f60a7Smrg ;; 3206692f60a7Smrg no) 3207692f60a7Smrg current="$2" 3208692f60a7Smrg revision="$3" 3209692f60a7Smrg age="$4" 3210692f60a7Smrg ;; 3211692f60a7Smrg esac 3212692f60a7Smrg 3213692f60a7Smrg # Check that each of the things are valid numbers. 3214692f60a7Smrg case $current in 3215692f60a7Smrg 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]) ;; 3216692f60a7Smrg *) 3217692f60a7Smrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 3218692f60a7Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3219692f60a7Smrg exit $EXIT_FAILURE 3220692f60a7Smrg ;; 3221692f60a7Smrg esac 3222692f60a7Smrg 3223692f60a7Smrg case $revision in 3224692f60a7Smrg 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]) ;; 3225692f60a7Smrg *) 3226692f60a7Smrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 3227692f60a7Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3228692f60a7Smrg exit $EXIT_FAILURE 3229692f60a7Smrg ;; 3230692f60a7Smrg esac 3231692f60a7Smrg 3232692f60a7Smrg case $age in 3233692f60a7Smrg 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]) ;; 3234692f60a7Smrg *) 3235692f60a7Smrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 3236692f60a7Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3237692f60a7Smrg exit $EXIT_FAILURE 3238692f60a7Smrg ;; 3239692f60a7Smrg esac 3240692f60a7Smrg 3241692f60a7Smrg if test "$age" -gt "$current"; then 3242692f60a7Smrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 3243692f60a7Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3244692f60a7Smrg exit $EXIT_FAILURE 3245692f60a7Smrg fi 3246692f60a7Smrg 3247692f60a7Smrg # Calculate the version variables. 3248692f60a7Smrg major= 3249692f60a7Smrg versuffix= 3250692f60a7Smrg verstring= 3251692f60a7Smrg case $version_type in 3252692f60a7Smrg none) ;; 3253692f60a7Smrg 3254692f60a7Smrg darwin) 3255692f60a7Smrg # Like Linux, but with the current version available in 3256692f60a7Smrg # verstring for coding it into the library header 3257692f60a7Smrg major=.`expr $current - $age` 3258692f60a7Smrg versuffix="$major.$age.$revision" 3259692f60a7Smrg # Darwin ld doesn't like 0 for these options... 3260692f60a7Smrg minor_current=`expr $current + 1` 3261692f60a7Smrg verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 3262692f60a7Smrg ;; 3263692f60a7Smrg 3264692f60a7Smrg freebsd-aout) 3265692f60a7Smrg major=".$current" 3266692f60a7Smrg versuffix=".$current.$revision"; 3267692f60a7Smrg ;; 3268692f60a7Smrg 3269692f60a7Smrg freebsd-elf) 3270692f60a7Smrg major=".$current" 3271692f60a7Smrg versuffix=".$current"; 3272692f60a7Smrg ;; 3273692f60a7Smrg 3274692f60a7Smrg irix | nonstopux) 3275692f60a7Smrg major=`expr $current - $age + 1` 3276692f60a7Smrg 3277692f60a7Smrg case $version_type in 3278692f60a7Smrg nonstopux) verstring_prefix=nonstopux ;; 3279692f60a7Smrg *) verstring_prefix=sgi ;; 3280692f60a7Smrg esac 3281692f60a7Smrg verstring="$verstring_prefix$major.$revision" 3282692f60a7Smrg 3283692f60a7Smrg # Add in all the interfaces that we are compatible with. 3284692f60a7Smrg loop=$revision 3285692f60a7Smrg while test "$loop" -ne 0; do 3286692f60a7Smrg iface=`expr $revision - $loop` 3287692f60a7Smrg loop=`expr $loop - 1` 3288692f60a7Smrg verstring="$verstring_prefix$major.$iface:$verstring" 3289692f60a7Smrg done 3290692f60a7Smrg 3291692f60a7Smrg # Before this point, $major must not contain `.'. 3292692f60a7Smrg major=.$major 3293692f60a7Smrg versuffix="$major.$revision" 3294692f60a7Smrg ;; 3295692f60a7Smrg 3296692f60a7Smrg linux) 3297692f60a7Smrg major=.`expr $current - $age` 3298692f60a7Smrg versuffix="$major.$age.$revision" 3299692f60a7Smrg ;; 3300692f60a7Smrg 3301692f60a7Smrg osf) 3302692f60a7Smrg major=.`expr $current - $age` 3303692f60a7Smrg versuffix=".$current.$age.$revision" 3304692f60a7Smrg verstring="$current.$age.$revision" 3305692f60a7Smrg 3306692f60a7Smrg # Add in all the interfaces that we are compatible with. 3307692f60a7Smrg loop=$age 3308692f60a7Smrg while test "$loop" -ne 0; do 3309692f60a7Smrg iface=`expr $current - $loop` 3310692f60a7Smrg loop=`expr $loop - 1` 3311692f60a7Smrg verstring="$verstring:${iface}.0" 3312692f60a7Smrg done 3313692f60a7Smrg 3314692f60a7Smrg # Make executables depend on our current version. 3315692f60a7Smrg verstring="$verstring:${current}.0" 3316692f60a7Smrg ;; 3317692f60a7Smrg 3318692f60a7Smrg sunos) 3319692f60a7Smrg major=".$current" 3320692f60a7Smrg versuffix=".$current.$revision" 3321692f60a7Smrg ;; 3322692f60a7Smrg 3323692f60a7Smrg windows) 3324692f60a7Smrg # Use '-' rather than '.', since we only want one 3325692f60a7Smrg # extension on DOS 8.3 filesystems. 3326692f60a7Smrg major=`expr $current - $age` 3327692f60a7Smrg versuffix="-$major" 3328692f60a7Smrg ;; 3329692f60a7Smrg 3330692f60a7Smrg *) 3331692f60a7Smrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 3332692f60a7Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 3333692f60a7Smrg exit $EXIT_FAILURE 3334692f60a7Smrg ;; 3335692f60a7Smrg esac 3336692f60a7Smrg 3337692f60a7Smrg # Clear the version info if we defaulted, and they specified a release. 3338692f60a7Smrg if test -z "$vinfo" && test -n "$release"; then 3339692f60a7Smrg major= 3340692f60a7Smrg case $version_type in 3341692f60a7Smrg darwin) 3342692f60a7Smrg # we can't check for "0.0" in archive_cmds due to quoting 3343692f60a7Smrg # problems, so we reset it completely 3344692f60a7Smrg verstring= 3345692f60a7Smrg ;; 3346692f60a7Smrg *) 3347692f60a7Smrg verstring="0.0" 3348692f60a7Smrg ;; 3349692f60a7Smrg esac 3350692f60a7Smrg if test "$need_version" = no; then 3351692f60a7Smrg versuffix= 3352692f60a7Smrg else 3353692f60a7Smrg versuffix=".0.0" 3354692f60a7Smrg fi 3355692f60a7Smrg fi 3356692f60a7Smrg 3357692f60a7Smrg # Remove version info from name if versioning should be avoided 3358692f60a7Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 3359692f60a7Smrg major= 3360692f60a7Smrg versuffix= 3361692f60a7Smrg verstring="" 3362692f60a7Smrg fi 3363692f60a7Smrg 3364692f60a7Smrg # Check to see if the archive will have undefined symbols. 3365692f60a7Smrg if test "$allow_undefined" = yes; then 3366692f60a7Smrg if test "$allow_undefined_flag" = unsupported; then 3367692f60a7Smrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 3368692f60a7Smrg build_libtool_libs=no 3369692f60a7Smrg build_old_libs=yes 3370692f60a7Smrg fi 3371692f60a7Smrg else 3372692f60a7Smrg # Don't allow undefined symbols. 3373692f60a7Smrg allow_undefined_flag="$no_undefined_flag" 3374692f60a7Smrg fi 3375692f60a7Smrg fi 3376692f60a7Smrg 3377692f60a7Smrg if test "$mode" != relink; then 3378692f60a7Smrg # Remove our outputs, but don't remove object files since they 3379692f60a7Smrg # may have been created when compiling PIC objects. 3380692f60a7Smrg removelist= 3381692f60a7Smrg tempremovelist=`$echo "$output_objdir/*"` 3382692f60a7Smrg for p in $tempremovelist; do 3383692f60a7Smrg case $p in 3384692f60a7Smrg *.$objext) 3385692f60a7Smrg ;; 3386692f60a7Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 3387692f60a7Smrg if test "X$precious_files_regex" != "X"; then 3388692f60a7Smrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 3389692f60a7Smrg then 3390692f60a7Smrg continue 3391692f60a7Smrg fi 3392692f60a7Smrg fi 3393692f60a7Smrg removelist="$removelist $p" 3394692f60a7Smrg ;; 3395692f60a7Smrg *) ;; 3396692f60a7Smrg esac 3397692f60a7Smrg done 3398692f60a7Smrg if test -n "$removelist"; then 3399692f60a7Smrg $show "${rm}r $removelist" 3400692f60a7Smrg $run ${rm}r $removelist 3401692f60a7Smrg fi 3402692f60a7Smrg fi 3403692f60a7Smrg 3404692f60a7Smrg # Now set the variables for building old libraries. 3405692f60a7Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 3406692f60a7Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 3407692f60a7Smrg 3408692f60a7Smrg # Transform .lo files to .o files. 3409692f60a7Smrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3410692f60a7Smrg fi 3411692f60a7Smrg 3412692f60a7Smrg # Eliminate all temporary directories. 3413692f60a7Smrg for path in $notinst_path; do 3414692f60a7Smrg lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 3415692f60a7Smrg deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 3416692f60a7Smrg dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 3417692f60a7Smrg done 3418692f60a7Smrg 3419692f60a7Smrg if test -n "$xrpath"; then 3420692f60a7Smrg # If the user specified any rpath flags, then add them. 3421692f60a7Smrg temp_xrpath= 3422692f60a7Smrg for libdir in $xrpath; do 3423692f60a7Smrg temp_xrpath="$temp_xrpath -R$libdir" 3424692f60a7Smrg case "$finalize_rpath " in 3425692f60a7Smrg *" $libdir "*) ;; 3426692f60a7Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 3427692f60a7Smrg esac 3428692f60a7Smrg done 3429692f60a7Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 3430692f60a7Smrg dependency_libs="$temp_xrpath $dependency_libs" 3431692f60a7Smrg fi 3432692f60a7Smrg fi 3433692f60a7Smrg 3434692f60a7Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 3435692f60a7Smrg old_dlfiles="$dlfiles" 3436692f60a7Smrg dlfiles= 3437692f60a7Smrg for lib in $old_dlfiles; do 3438692f60a7Smrg case " $dlprefiles $dlfiles " in 3439692f60a7Smrg *" $lib "*) ;; 3440692f60a7Smrg *) dlfiles="$dlfiles $lib" ;; 3441692f60a7Smrg esac 3442692f60a7Smrg done 3443692f60a7Smrg 3444692f60a7Smrg # Make sure dlprefiles contains only unique files 3445692f60a7Smrg old_dlprefiles="$dlprefiles" 3446692f60a7Smrg dlprefiles= 3447692f60a7Smrg for lib in $old_dlprefiles; do 3448692f60a7Smrg case "$dlprefiles " in 3449692f60a7Smrg *" $lib "*) ;; 3450692f60a7Smrg *) dlprefiles="$dlprefiles $lib" ;; 3451692f60a7Smrg esac 3452692f60a7Smrg done 3453692f60a7Smrg 3454692f60a7Smrg if test "$build_libtool_libs" = yes; then 3455692f60a7Smrg if test -n "$rpath"; then 3456692f60a7Smrg case $host in 3457692f60a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 3458692f60a7Smrg # these systems don't actually have a c library (as such)! 3459692f60a7Smrg ;; 3460692f60a7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 3461692f60a7Smrg # Rhapsody C library is in the System framework 3462692f60a7Smrg deplibs="$deplibs -framework System" 3463692f60a7Smrg ;; 3464692f60a7Smrg *-*-netbsd*) 3465692f60a7Smrg # Don't link with libc until the a.out ld.so is fixed. 3466692f60a7Smrg ;; 3467692f60a7Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3468692f60a7Smrg # Do not include libc due to us having libc/libc_r. 3469692f60a7Smrg ;; 3470692f60a7Smrg *-*-sco3.2v5* | *-*-sco5v6*) 3471692f60a7Smrg # Causes problems with __ctype 3472692f60a7Smrg ;; 3473692f60a7Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 3474692f60a7Smrg # Compiler inserts libc in the correct place for threads to work 3475692f60a7Smrg ;; 3476692f60a7Smrg *) 3477692f60a7Smrg # Add libc to deplibs on all other systems if necessary. 3478692f60a7Smrg if test "$build_libtool_need_lc" = "yes"; then 3479692f60a7Smrg deplibs="$deplibs -lc" 3480692f60a7Smrg fi 3481692f60a7Smrg ;; 3482692f60a7Smrg esac 3483692f60a7Smrg fi 3484692f60a7Smrg 3485692f60a7Smrg # Transform deplibs into only deplibs that can be linked in shared. 3486692f60a7Smrg name_save=$name 3487692f60a7Smrg libname_save=$libname 3488692f60a7Smrg release_save=$release 3489692f60a7Smrg versuffix_save=$versuffix 3490692f60a7Smrg major_save=$major 3491692f60a7Smrg # I'm not sure if I'm treating the release correctly. I think 3492692f60a7Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 3493692f60a7Smrg # add it in twice. Is that correct? 3494692f60a7Smrg release="" 3495692f60a7Smrg versuffix="" 3496692f60a7Smrg major="" 3497692f60a7Smrg newdeplibs= 3498692f60a7Smrg droppeddeps=no 3499692f60a7Smrg case $deplibs_check_method in 3500692f60a7Smrg pass_all) 3501692f60a7Smrg # Don't check for shared/static. Everything works. 3502692f60a7Smrg # This might be a little naive. We might want to check 3503692f60a7Smrg # whether the library exists or not. But this is on 3504692f60a7Smrg # osf3 & osf4 and I'm not really sure... Just 3505692f60a7Smrg # implementing what was already the behavior. 3506692f60a7Smrg newdeplibs=$deplibs 3507692f60a7Smrg ;; 3508692f60a7Smrg test_compile) 3509692f60a7Smrg # This code stresses the "libraries are programs" paradigm to its 3510692f60a7Smrg # limits. Maybe even breaks it. We compile a program, linking it 3511692f60a7Smrg # against the deplibs as a proxy for the library. Then we can check 3512692f60a7Smrg # whether they linked in statically or dynamically with ldd. 3513692f60a7Smrg $rm conftest.c 3514692f60a7Smrg cat > conftest.c <<EOF 3515692f60a7Smrg int main() { return 0; } 3516692f60a7SmrgEOF 3517692f60a7Smrg $rm conftest 3518692f60a7Smrg $LTCC $LTCFLAGS -o conftest conftest.c $deplibs 3519692f60a7Smrg if test "$?" -eq 0 ; then 3520692f60a7Smrg ldd_output=`ldd conftest` 3521692f60a7Smrg for i in $deplibs; do 3522692f60a7Smrg name=`expr $i : '-l\(.*\)'` 3523692f60a7Smrg # If $name is empty we are operating on a -L argument. 3524692f60a7Smrg if test "$name" != "" && test "$name" -ne "0"; then 3525692f60a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3526692f60a7Smrg case " $predeps $postdeps " in 3527692f60a7Smrg *" $i "*) 3528692f60a7Smrg newdeplibs="$newdeplibs $i" 3529692f60a7Smrg i="" 3530692f60a7Smrg ;; 3531692f60a7Smrg esac 3532692f60a7Smrg fi 3533692f60a7Smrg if test -n "$i" ; then 3534692f60a7Smrg libname=`eval \\$echo \"$libname_spec\"` 3535692f60a7Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 3536692f60a7Smrg set dummy $deplib_matches 3537692f60a7Smrg deplib_match=$2 3538692f60a7Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3539692f60a7Smrg newdeplibs="$newdeplibs $i" 3540692f60a7Smrg else 3541692f60a7Smrg droppeddeps=yes 3542692f60a7Smrg $echo 3543692f60a7Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 3544692f60a7Smrg $echo "*** I have the capability to make that library automatically link in when" 3545692f60a7Smrg $echo "*** you link to this library. But I can only do this if you have a" 3546692f60a7Smrg $echo "*** shared version of the library, which I believe you do not have" 3547692f60a7Smrg $echo "*** because a test_compile did reveal that the linker did not use it for" 3548692f60a7Smrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 3549692f60a7Smrg fi 3550692f60a7Smrg fi 3551692f60a7Smrg else 3552692f60a7Smrg newdeplibs="$newdeplibs $i" 3553692f60a7Smrg fi 3554692f60a7Smrg done 3555692f60a7Smrg else 3556692f60a7Smrg # Error occurred in the first compile. Let's try to salvage 3557692f60a7Smrg # the situation: Compile a separate program for each library. 3558692f60a7Smrg for i in $deplibs; do 3559692f60a7Smrg name=`expr $i : '-l\(.*\)'` 3560692f60a7Smrg # If $name is empty we are operating on a -L argument. 3561692f60a7Smrg if test "$name" != "" && test "$name" != "0"; then 3562692f60a7Smrg $rm conftest 3563692f60a7Smrg $LTCC $LTCFLAGS -o conftest conftest.c $i 3564692f60a7Smrg # Did it work? 3565692f60a7Smrg if test "$?" -eq 0 ; then 3566692f60a7Smrg ldd_output=`ldd conftest` 3567692f60a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3568692f60a7Smrg case " $predeps $postdeps " in 3569692f60a7Smrg *" $i "*) 3570692f60a7Smrg newdeplibs="$newdeplibs $i" 3571692f60a7Smrg i="" 3572692f60a7Smrg ;; 3573692f60a7Smrg esac 3574692f60a7Smrg fi 3575692f60a7Smrg if test -n "$i" ; then 3576692f60a7Smrg libname=`eval \\$echo \"$libname_spec\"` 3577692f60a7Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 3578692f60a7Smrg set dummy $deplib_matches 3579692f60a7Smrg deplib_match=$2 3580692f60a7Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3581692f60a7Smrg newdeplibs="$newdeplibs $i" 3582692f60a7Smrg else 3583692f60a7Smrg droppeddeps=yes 3584692f60a7Smrg $echo 3585692f60a7Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 3586692f60a7Smrg $echo "*** I have the capability to make that library automatically link in when" 3587692f60a7Smrg $echo "*** you link to this library. But I can only do this if you have a" 3588692f60a7Smrg $echo "*** shared version of the library, which you do not appear to have" 3589692f60a7Smrg $echo "*** because a test_compile did reveal that the linker did not use this one" 3590692f60a7Smrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 3591692f60a7Smrg fi 3592692f60a7Smrg fi 3593692f60a7Smrg else 3594692f60a7Smrg droppeddeps=yes 3595692f60a7Smrg $echo 3596692f60a7Smrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 3597692f60a7Smrg $echo "*** make it link in! You will probably need to install it or some" 3598692f60a7Smrg $echo "*** library that it depends on before this library will be fully" 3599692f60a7Smrg $echo "*** functional. Installing it before continuing would be even better." 3600692f60a7Smrg fi 3601692f60a7Smrg else 3602692f60a7Smrg newdeplibs="$newdeplibs $i" 3603692f60a7Smrg fi 3604692f60a7Smrg done 3605692f60a7Smrg fi 3606692f60a7Smrg ;; 3607692f60a7Smrg file_magic*) 3608692f60a7Smrg set dummy $deplibs_check_method 3609692f60a7Smrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3610692f60a7Smrg for a_deplib in $deplibs; do 3611692f60a7Smrg name=`expr $a_deplib : '-l\(.*\)'` 3612692f60a7Smrg # If $name is empty we are operating on a -L argument. 3613692f60a7Smrg if test "$name" != "" && test "$name" != "0"; then 3614692f60a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3615692f60a7Smrg case " $predeps $postdeps " in 3616692f60a7Smrg *" $a_deplib "*) 3617692f60a7Smrg newdeplibs="$newdeplibs $a_deplib" 3618692f60a7Smrg a_deplib="" 3619692f60a7Smrg ;; 3620692f60a7Smrg esac 3621692f60a7Smrg fi 3622692f60a7Smrg if test -n "$a_deplib" ; then 3623692f60a7Smrg libname=`eval \\$echo \"$libname_spec\"` 3624692f60a7Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3625692f60a7Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3626692f60a7Smrg for potent_lib in $potential_libs; do 3627692f60a7Smrg # Follow soft links. 3628692f60a7Smrg if ls -lLd "$potent_lib" 2>/dev/null \ 3629692f60a7Smrg | grep " -> " >/dev/null; then 3630692f60a7Smrg continue 3631692f60a7Smrg fi 3632692f60a7Smrg # The statement above tries to avoid entering an 3633692f60a7Smrg # endless loop below, in case of cyclic links. 3634692f60a7Smrg # We might still enter an endless loop, since a link 3635692f60a7Smrg # loop can be closed while we follow links, 3636692f60a7Smrg # but so what? 3637692f60a7Smrg potlib="$potent_lib" 3638692f60a7Smrg while test -h "$potlib" 2>/dev/null; do 3639692f60a7Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 3640692f60a7Smrg case $potliblink in 3641692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 3642692f60a7Smrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 3643692f60a7Smrg esac 3644692f60a7Smrg done 3645692f60a7Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 3646692f60a7Smrg | ${SED} 10q \ 3647692f60a7Smrg | $EGREP "$file_magic_regex" > /dev/null; then 3648692f60a7Smrg newdeplibs="$newdeplibs $a_deplib" 3649692f60a7Smrg a_deplib="" 3650692f60a7Smrg break 2 3651692f60a7Smrg fi 3652692f60a7Smrg done 3653692f60a7Smrg done 3654692f60a7Smrg fi 3655692f60a7Smrg if test -n "$a_deplib" ; then 3656692f60a7Smrg droppeddeps=yes 3657692f60a7Smrg $echo 3658692f60a7Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 3659692f60a7Smrg $echo "*** I have the capability to make that library automatically link in when" 3660692f60a7Smrg $echo "*** you link to this library. But I can only do this if you have a" 3661692f60a7Smrg $echo "*** shared version of the library, which you do not appear to have" 3662692f60a7Smrg $echo "*** because I did check the linker path looking for a file starting" 3663692f60a7Smrg if test -z "$potlib" ; then 3664692f60a7Smrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 3665692f60a7Smrg else 3666692f60a7Smrg $echo "*** with $libname and none of the candidates passed a file format test" 3667692f60a7Smrg $echo "*** using a file magic. Last file checked: $potlib" 3668692f60a7Smrg fi 3669692f60a7Smrg fi 3670692f60a7Smrg else 3671692f60a7Smrg # Add a -L argument. 3672692f60a7Smrg newdeplibs="$newdeplibs $a_deplib" 3673692f60a7Smrg fi 3674692f60a7Smrg done # Gone through all deplibs. 3675692f60a7Smrg ;; 3676692f60a7Smrg match_pattern*) 3677692f60a7Smrg set dummy $deplibs_check_method 3678692f60a7Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3679692f60a7Smrg for a_deplib in $deplibs; do 3680692f60a7Smrg name=`expr $a_deplib : '-l\(.*\)'` 3681692f60a7Smrg # If $name is empty we are operating on a -L argument. 3682692f60a7Smrg if test -n "$name" && test "$name" != "0"; then 3683692f60a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3684692f60a7Smrg case " $predeps $postdeps " in 3685692f60a7Smrg *" $a_deplib "*) 3686692f60a7Smrg newdeplibs="$newdeplibs $a_deplib" 3687692f60a7Smrg a_deplib="" 3688692f60a7Smrg ;; 3689692f60a7Smrg esac 3690692f60a7Smrg fi 3691692f60a7Smrg if test -n "$a_deplib" ; then 3692692f60a7Smrg libname=`eval \\$echo \"$libname_spec\"` 3693692f60a7Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3694692f60a7Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3695692f60a7Smrg for potent_lib in $potential_libs; do 3696692f60a7Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 3697692f60a7Smrg if eval $echo \"$potent_lib\" 2>/dev/null \ 3698692f60a7Smrg | ${SED} 10q \ 3699692f60a7Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 3700692f60a7Smrg newdeplibs="$newdeplibs $a_deplib" 3701692f60a7Smrg a_deplib="" 3702692f60a7Smrg break 2 3703692f60a7Smrg fi 3704692f60a7Smrg done 3705692f60a7Smrg done 3706692f60a7Smrg fi 3707692f60a7Smrg if test -n "$a_deplib" ; then 3708692f60a7Smrg droppeddeps=yes 3709692f60a7Smrg $echo 3710692f60a7Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 3711692f60a7Smrg $echo "*** I have the capability to make that library automatically link in when" 3712692f60a7Smrg $echo "*** you link to this library. But I can only do this if you have a" 3713692f60a7Smrg $echo "*** shared version of the library, which you do not appear to have" 3714692f60a7Smrg $echo "*** because I did check the linker path looking for a file starting" 3715692f60a7Smrg if test -z "$potlib" ; then 3716692f60a7Smrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 3717692f60a7Smrg else 3718692f60a7Smrg $echo "*** with $libname and none of the candidates passed a file format test" 3719692f60a7Smrg $echo "*** using a regex pattern. Last file checked: $potlib" 3720692f60a7Smrg fi 3721692f60a7Smrg fi 3722692f60a7Smrg else 3723692f60a7Smrg # Add a -L argument. 3724692f60a7Smrg newdeplibs="$newdeplibs $a_deplib" 3725692f60a7Smrg fi 3726692f60a7Smrg done # Gone through all deplibs. 3727692f60a7Smrg ;; 3728692f60a7Smrg none | unknown | *) 3729692f60a7Smrg newdeplibs="" 3730692f60a7Smrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 3731692f60a7Smrg -e 's/ -[LR][^ ]*//g'` 3732692f60a7Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3733692f60a7Smrg for i in $predeps $postdeps ; do 3734692f60a7Smrg # can't use Xsed below, because $i might contain '/' 3735692f60a7Smrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 3736692f60a7Smrg done 3737692f60a7Smrg fi 3738692f60a7Smrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 3739692f60a7Smrg | grep . >/dev/null; then 3740692f60a7Smrg $echo 3741692f60a7Smrg if test "X$deplibs_check_method" = "Xnone"; then 3742692f60a7Smrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 3743692f60a7Smrg else 3744692f60a7Smrg $echo "*** Warning: inter-library dependencies are not known to be supported." 3745692f60a7Smrg fi 3746692f60a7Smrg $echo "*** All declared inter-library dependencies are being dropped." 3747692f60a7Smrg droppeddeps=yes 3748692f60a7Smrg fi 3749692f60a7Smrg ;; 3750692f60a7Smrg esac 3751692f60a7Smrg versuffix=$versuffix_save 3752692f60a7Smrg major=$major_save 3753692f60a7Smrg release=$release_save 3754692f60a7Smrg libname=$libname_save 3755692f60a7Smrg name=$name_save 3756692f60a7Smrg 3757692f60a7Smrg case $host in 3758692f60a7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 3759692f60a7Smrg # On Rhapsody replace the C library is the System framework 3760692f60a7Smrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 3761692f60a7Smrg ;; 3762692f60a7Smrg esac 3763692f60a7Smrg 3764692f60a7Smrg if test "$droppeddeps" = yes; then 3765692f60a7Smrg if test "$module" = yes; then 3766692f60a7Smrg $echo 3767692f60a7Smrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 3768692f60a7Smrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 3769692f60a7Smrg $echo "*** a static module, that should work as long as the dlopening" 3770692f60a7Smrg $echo "*** application is linked with the -dlopen flag." 3771692f60a7Smrg if test -z "$global_symbol_pipe"; then 3772692f60a7Smrg $echo 3773692f60a7Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 3774692f60a7Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 3775692f60a7Smrg $echo "*** not find such a program. So, this module is probably useless." 3776692f60a7Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 3777692f60a7Smrg fi 3778692f60a7Smrg if test "$build_old_libs" = no; then 3779692f60a7Smrg oldlibs="$output_objdir/$libname.$libext" 3780692f60a7Smrg build_libtool_libs=module 3781692f60a7Smrg build_old_libs=yes 3782692f60a7Smrg else 3783692f60a7Smrg build_libtool_libs=no 3784692f60a7Smrg fi 3785692f60a7Smrg else 3786692f60a7Smrg $echo "*** The inter-library dependencies that have been dropped here will be" 3787692f60a7Smrg $echo "*** automatically added whenever a program is linked with this library" 3788692f60a7Smrg $echo "*** or is declared to -dlopen it." 3789692f60a7Smrg 3790692f60a7Smrg if test "$allow_undefined" = no; then 3791692f60a7Smrg $echo 3792692f60a7Smrg $echo "*** Since this library must not contain undefined symbols," 3793692f60a7Smrg $echo "*** because either the platform does not support them or" 3794692f60a7Smrg $echo "*** it was explicitly requested with -no-undefined," 3795692f60a7Smrg $echo "*** libtool will only create a static version of it." 3796692f60a7Smrg if test "$build_old_libs" = no; then 3797692f60a7Smrg oldlibs="$output_objdir/$libname.$libext" 3798692f60a7Smrg build_libtool_libs=module 3799692f60a7Smrg build_old_libs=yes 3800692f60a7Smrg else 3801692f60a7Smrg build_libtool_libs=no 3802692f60a7Smrg fi 3803692f60a7Smrg fi 3804692f60a7Smrg fi 3805692f60a7Smrg fi 3806692f60a7Smrg # Done checking deplibs! 3807692f60a7Smrg deplibs=$newdeplibs 3808692f60a7Smrg fi 3809692f60a7Smrg 3810692f60a7Smrg 3811692f60a7Smrg # move library search paths that coincide with paths to not yet 3812692f60a7Smrg # installed libraries to the beginning of the library search list 3813692f60a7Smrg new_libs= 3814692f60a7Smrg for path in $notinst_path; do 3815692f60a7Smrg case " $new_libs " in 3816692f60a7Smrg *" -L$path/$objdir "*) ;; 3817692f60a7Smrg *) 3818692f60a7Smrg case " $deplibs " in 3819692f60a7Smrg *" -L$path/$objdir "*) 3820692f60a7Smrg new_libs="$new_libs -L$path/$objdir" ;; 3821692f60a7Smrg esac 3822692f60a7Smrg ;; 3823692f60a7Smrg esac 3824692f60a7Smrg done 3825692f60a7Smrg for deplib in $deplibs; do 3826692f60a7Smrg case $deplib in 3827692f60a7Smrg -L*) 3828692f60a7Smrg case " $new_libs " in 3829692f60a7Smrg *" $deplib "*) ;; 3830692f60a7Smrg *) new_libs="$new_libs $deplib" ;; 3831692f60a7Smrg esac 3832692f60a7Smrg ;; 3833692f60a7Smrg *) new_libs="$new_libs $deplib" ;; 3834692f60a7Smrg esac 3835692f60a7Smrg done 3836692f60a7Smrg deplibs="$new_libs" 3837692f60a7Smrg 3838692f60a7Smrg 3839692f60a7Smrg # All the library-specific variables (install_libdir is set above). 3840692f60a7Smrg library_names= 3841692f60a7Smrg old_library= 3842692f60a7Smrg dlname= 3843692f60a7Smrg 3844692f60a7Smrg # Test again, we may have decided not to build it any more 3845692f60a7Smrg if test "$build_libtool_libs" = yes; then 3846692f60a7Smrg if test "$hardcode_into_libs" = yes; then 3847692f60a7Smrg # Hardcode the library paths 3848692f60a7Smrg hardcode_libdirs= 3849692f60a7Smrg dep_rpath= 3850692f60a7Smrg rpath="$finalize_rpath" 3851692f60a7Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 3852692f60a7Smrg for libdir in $rpath; do 3853692f60a7Smrg if test -n "$hardcode_libdir_flag_spec"; then 3854692f60a7Smrg if test -n "$hardcode_libdir_separator"; then 3855692f60a7Smrg if test -z "$hardcode_libdirs"; then 3856692f60a7Smrg hardcode_libdirs="$libdir" 3857692f60a7Smrg else 3858692f60a7Smrg # Just accumulate the unique libdirs. 3859692f60a7Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3860692f60a7Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3861692f60a7Smrg ;; 3862692f60a7Smrg *) 3863692f60a7Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3864692f60a7Smrg ;; 3865692f60a7Smrg esac 3866692f60a7Smrg fi 3867692f60a7Smrg else 3868692f60a7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 3869692f60a7Smrg dep_rpath="$dep_rpath $flag" 3870692f60a7Smrg fi 3871692f60a7Smrg elif test -n "$runpath_var"; then 3872692f60a7Smrg case "$perm_rpath " in 3873692f60a7Smrg *" $libdir "*) ;; 3874692f60a7Smrg *) perm_rpath="$perm_rpath $libdir" ;; 3875692f60a7Smrg esac 3876692f60a7Smrg fi 3877692f60a7Smrg done 3878692f60a7Smrg # Substitute the hardcoded libdirs into the rpath. 3879692f60a7Smrg if test -n "$hardcode_libdir_separator" && 3880692f60a7Smrg test -n "$hardcode_libdirs"; then 3881692f60a7Smrg libdir="$hardcode_libdirs" 3882692f60a7Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 3883692f60a7Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 3884692f60a7Smrg else 3885692f60a7Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3886692f60a7Smrg fi 3887692f60a7Smrg fi 3888692f60a7Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 3889692f60a7Smrg # We should set the runpath_var. 3890692f60a7Smrg rpath= 3891692f60a7Smrg for dir in $perm_rpath; do 3892692f60a7Smrg rpath="$rpath$dir:" 3893692f60a7Smrg done 3894692f60a7Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3895692f60a7Smrg fi 3896692f60a7Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3897692f60a7Smrg fi 3898692f60a7Smrg 3899692f60a7Smrg shlibpath="$finalize_shlibpath" 3900692f60a7Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 3901692f60a7Smrg if test -n "$shlibpath"; then 3902692f60a7Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 3903692f60a7Smrg fi 3904692f60a7Smrg 3905692f60a7Smrg # Get the real and link names of the library. 3906692f60a7Smrg eval shared_ext=\"$shrext_cmds\" 3907692f60a7Smrg eval library_names=\"$library_names_spec\" 3908692f60a7Smrg set dummy $library_names 3909692f60a7Smrg realname="$2" 3910692f60a7Smrg shift; shift 3911692f60a7Smrg 3912692f60a7Smrg if test -n "$soname_spec"; then 3913692f60a7Smrg eval soname=\"$soname_spec\" 3914692f60a7Smrg else 3915692f60a7Smrg soname="$realname" 3916692f60a7Smrg fi 3917692f60a7Smrg if test -z "$dlname"; then 3918692f60a7Smrg dlname=$soname 3919692f60a7Smrg fi 3920692f60a7Smrg 3921692f60a7Smrg lib="$output_objdir/$realname" 3922692f60a7Smrg linknames= 3923692f60a7Smrg for link 3924692f60a7Smrg do 3925692f60a7Smrg linknames="$linknames $link" 3926692f60a7Smrg done 3927692f60a7Smrg 3928692f60a7Smrg # Use standard objects if they are pic 3929692f60a7Smrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 3930692f60a7Smrg 3931692f60a7Smrg # Prepare the list of exported symbols 3932692f60a7Smrg if test -z "$export_symbols"; then 3933692f60a7Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 3934692f60a7Smrg $show "generating symbol list for \`$libname.la'" 3935692f60a7Smrg export_symbols="$output_objdir/$libname.exp" 3936692f60a7Smrg $run $rm $export_symbols 3937692f60a7Smrg cmds=$export_symbols_cmds 3938692f60a7Smrg save_ifs="$IFS"; IFS='~' 3939692f60a7Smrg for cmd in $cmds; do 3940692f60a7Smrg IFS="$save_ifs" 3941692f60a7Smrg eval cmd=\"$cmd\" 3942692f60a7Smrg if len=`expr "X$cmd" : ".*"` && 3943692f60a7Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 3944692f60a7Smrg $show "$cmd" 3945692f60a7Smrg $run eval "$cmd" || exit $? 3946692f60a7Smrg skipped_export=false 3947692f60a7Smrg else 3948692f60a7Smrg # The command line is too long to execute in one step. 3949692f60a7Smrg $show "using reloadable object file for export list..." 3950692f60a7Smrg skipped_export=: 3951692f60a7Smrg # Break out early, otherwise skipped_export may be 3952692f60a7Smrg # set to false by a later but shorter cmd. 3953692f60a7Smrg break 3954692f60a7Smrg fi 3955692f60a7Smrg done 3956692f60a7Smrg IFS="$save_ifs" 3957692f60a7Smrg if test -n "$export_symbols_regex"; then 3958692f60a7Smrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 3959692f60a7Smrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 3960692f60a7Smrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 3961692f60a7Smrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 3962692f60a7Smrg fi 3963692f60a7Smrg fi 3964692f60a7Smrg fi 3965692f60a7Smrg 3966692f60a7Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 3967692f60a7Smrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 3968692f60a7Smrg fi 3969692f60a7Smrg 3970692f60a7Smrg tmp_deplibs= 3971692f60a7Smrg for test_deplib in $deplibs; do 3972692f60a7Smrg case " $convenience " in 3973692f60a7Smrg *" $test_deplib "*) ;; 3974692f60a7Smrg *) 3975692f60a7Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 3976692f60a7Smrg ;; 3977692f60a7Smrg esac 3978692f60a7Smrg done 3979692f60a7Smrg deplibs="$tmp_deplibs" 3980692f60a7Smrg 3981692f60a7Smrg if test -n "$convenience"; then 3982692f60a7Smrg if test -n "$whole_archive_flag_spec"; then 3983692f60a7Smrg save_libobjs=$libobjs 3984692f60a7Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3985692f60a7Smrg else 3986692f60a7Smrg gentop="$output_objdir/${outputname}x" 3987692f60a7Smrg generated="$generated $gentop" 3988692f60a7Smrg 3989692f60a7Smrg func_extract_archives $gentop $convenience 3990692f60a7Smrg libobjs="$libobjs $func_extract_archives_result" 3991692f60a7Smrg fi 3992692f60a7Smrg fi 3993692f60a7Smrg 3994692f60a7Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 3995692f60a7Smrg eval flag=\"$thread_safe_flag_spec\" 3996692f60a7Smrg linker_flags="$linker_flags $flag" 3997692f60a7Smrg fi 3998692f60a7Smrg 3999692f60a7Smrg # Make a backup of the uninstalled library when relinking 4000692f60a7Smrg if test "$mode" = relink; then 4001692f60a7Smrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 4002692f60a7Smrg fi 4003692f60a7Smrg 4004692f60a7Smrg # Do each of the archive commands. 4005692f60a7Smrg if test "$module" = yes && test -n "$module_cmds" ; then 4006692f60a7Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4007692f60a7Smrg eval test_cmds=\"$module_expsym_cmds\" 4008692f60a7Smrg cmds=$module_expsym_cmds 4009692f60a7Smrg else 4010692f60a7Smrg eval test_cmds=\"$module_cmds\" 4011692f60a7Smrg cmds=$module_cmds 4012692f60a7Smrg fi 4013692f60a7Smrg else 4014692f60a7Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4015692f60a7Smrg eval test_cmds=\"$archive_expsym_cmds\" 4016692f60a7Smrg cmds=$archive_expsym_cmds 4017692f60a7Smrg else 4018692f60a7Smrg eval test_cmds=\"$archive_cmds\" 4019692f60a7Smrg cmds=$archive_cmds 4020692f60a7Smrg fi 4021692f60a7Smrg fi 4022692f60a7Smrg 4023692f60a7Smrg if test "X$skipped_export" != "X:" && 4024692f60a7Smrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4025692f60a7Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4026692f60a7Smrg : 4027692f60a7Smrg else 4028692f60a7Smrg # The command line is too long to link in one step, link piecewise. 4029692f60a7Smrg $echo "creating reloadable object files..." 4030692f60a7Smrg 4031692f60a7Smrg # Save the value of $output and $libobjs because we want to 4032692f60a7Smrg # use them later. If we have whole_archive_flag_spec, we 4033692f60a7Smrg # want to use save_libobjs as it was before 4034692f60a7Smrg # whole_archive_flag_spec was expanded, because we can't 4035692f60a7Smrg # assume the linker understands whole_archive_flag_spec. 4036692f60a7Smrg # This may have to be revisited, in case too many 4037692f60a7Smrg # convenience libraries get linked in and end up exceeding 4038692f60a7Smrg # the spec. 4039692f60a7Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4040692f60a7Smrg save_libobjs=$libobjs 4041692f60a7Smrg fi 4042692f60a7Smrg save_output=$output 4043692f60a7Smrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 4044692f60a7Smrg 4045692f60a7Smrg # Clear the reloadable object creation command queue and 4046692f60a7Smrg # initialize k to one. 4047692f60a7Smrg test_cmds= 4048692f60a7Smrg concat_cmds= 4049692f60a7Smrg objlist= 4050692f60a7Smrg delfiles= 4051692f60a7Smrg last_robj= 4052692f60a7Smrg k=1 4053692f60a7Smrg output=$output_objdir/$output_la-${k}.$objext 4054692f60a7Smrg # Loop over the list of objects to be linked. 4055692f60a7Smrg for obj in $save_libobjs 4056692f60a7Smrg do 4057692f60a7Smrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4058692f60a7Smrg if test "X$objlist" = X || 4059692f60a7Smrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4060692f60a7Smrg test "$len" -le "$max_cmd_len"; }; then 4061692f60a7Smrg objlist="$objlist $obj" 4062692f60a7Smrg else 4063692f60a7Smrg # The command $test_cmds is almost too long, add a 4064692f60a7Smrg # command to the queue. 4065692f60a7Smrg if test "$k" -eq 1 ; then 4066692f60a7Smrg # The first file doesn't have a previous command to add. 4067692f60a7Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 4068692f60a7Smrg else 4069692f60a7Smrg # All subsequent reloadable object files will link in 4070692f60a7Smrg # the last one created. 4071692f60a7Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4072692f60a7Smrg fi 4073692f60a7Smrg last_robj=$output_objdir/$output_la-${k}.$objext 4074692f60a7Smrg k=`expr $k + 1` 4075692f60a7Smrg output=$output_objdir/$output_la-${k}.$objext 4076692f60a7Smrg objlist=$obj 4077692f60a7Smrg len=1 4078692f60a7Smrg fi 4079692f60a7Smrg done 4080692f60a7Smrg # Handle the remaining objects by creating one last 4081692f60a7Smrg # reloadable object file. All subsequent reloadable object 4082692f60a7Smrg # files will link in the last one created. 4083692f60a7Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4084692f60a7Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 4085692f60a7Smrg 4086692f60a7Smrg if ${skipped_export-false}; then 4087692f60a7Smrg $show "generating symbol list for \`$libname.la'" 4088692f60a7Smrg export_symbols="$output_objdir/$libname.exp" 4089692f60a7Smrg $run $rm $export_symbols 4090692f60a7Smrg libobjs=$output 4091692f60a7Smrg # Append the command to create the export file. 4092692f60a7Smrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4093692f60a7Smrg fi 4094692f60a7Smrg 4095692f60a7Smrg # Set up a command to remove the reloadable object files 4096692f60a7Smrg # after they are used. 4097692f60a7Smrg i=0 4098692f60a7Smrg while test "$i" -lt "$k" 4099692f60a7Smrg do 4100692f60a7Smrg i=`expr $i + 1` 4101692f60a7Smrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 4102692f60a7Smrg done 4103692f60a7Smrg 4104692f60a7Smrg $echo "creating a temporary reloadable object file: $output" 4105692f60a7Smrg 4106692f60a7Smrg # Loop through the commands generated above and execute them. 4107692f60a7Smrg save_ifs="$IFS"; IFS='~' 4108692f60a7Smrg for cmd in $concat_cmds; do 4109692f60a7Smrg IFS="$save_ifs" 4110692f60a7Smrg $show "$cmd" 4111692f60a7Smrg $run eval "$cmd" || exit $? 4112692f60a7Smrg done 4113692f60a7Smrg IFS="$save_ifs" 4114692f60a7Smrg 4115692f60a7Smrg libobjs=$output 4116692f60a7Smrg # Restore the value of output. 4117692f60a7Smrg output=$save_output 4118692f60a7Smrg 4119692f60a7Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 4120692f60a7Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4121692f60a7Smrg fi 4122692f60a7Smrg # Expand the library linking commands again to reset the 4123692f60a7Smrg # value of $libobjs for piecewise linking. 4124692f60a7Smrg 4125692f60a7Smrg # Do each of the archive commands. 4126692f60a7Smrg if test "$module" = yes && test -n "$module_cmds" ; then 4127692f60a7Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4128692f60a7Smrg cmds=$module_expsym_cmds 4129692f60a7Smrg else 4130692f60a7Smrg cmds=$module_cmds 4131692f60a7Smrg fi 4132692f60a7Smrg else 4133692f60a7Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4134692f60a7Smrg cmds=$archive_expsym_cmds 4135692f60a7Smrg else 4136692f60a7Smrg cmds=$archive_cmds 4137692f60a7Smrg fi 4138692f60a7Smrg fi 4139692f60a7Smrg 4140692f60a7Smrg # Append the command to remove the reloadable object files 4141692f60a7Smrg # to the just-reset $cmds. 4142692f60a7Smrg eval cmds=\"\$cmds~\$rm $delfiles\" 4143692f60a7Smrg fi 4144692f60a7Smrg save_ifs="$IFS"; IFS='~' 4145692f60a7Smrg for cmd in $cmds; do 4146692f60a7Smrg IFS="$save_ifs" 4147692f60a7Smrg eval cmd=\"$cmd\" 4148692f60a7Smrg $show "$cmd" 4149692f60a7Smrg $run eval "$cmd" || { 4150692f60a7Smrg lt_exit=$? 4151692f60a7Smrg 4152692f60a7Smrg # Restore the uninstalled library and exit 4153692f60a7Smrg if test "$mode" = relink; then 4154692f60a7Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 4155692f60a7Smrg fi 4156692f60a7Smrg 4157692f60a7Smrg exit $lt_exit 4158692f60a7Smrg } 4159692f60a7Smrg done 4160692f60a7Smrg IFS="$save_ifs" 4161692f60a7Smrg 4162692f60a7Smrg # Restore the uninstalled library and exit 4163692f60a7Smrg if test "$mode" = relink; then 4164692f60a7Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4165692f60a7Smrg 4166692f60a7Smrg if test -n "$convenience"; then 4167692f60a7Smrg if test -z "$whole_archive_flag_spec"; then 4168692f60a7Smrg $show "${rm}r $gentop" 4169692f60a7Smrg $run ${rm}r "$gentop" 4170692f60a7Smrg fi 4171692f60a7Smrg fi 4172692f60a7Smrg 4173692f60a7Smrg exit $EXIT_SUCCESS 4174692f60a7Smrg fi 4175692f60a7Smrg 4176692f60a7Smrg # Create links to the real library. 4177692f60a7Smrg for linkname in $linknames; do 4178692f60a7Smrg if test "$realname" != "$linkname"; then 4179692f60a7Smrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 4180692f60a7Smrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 4181692f60a7Smrg fi 4182692f60a7Smrg done 4183692f60a7Smrg 4184692f60a7Smrg # If -module or -export-dynamic was specified, set the dlname. 4185692f60a7Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 4186692f60a7Smrg # On all known operating systems, these are identical. 4187692f60a7Smrg dlname="$soname" 4188692f60a7Smrg fi 4189692f60a7Smrg fi 4190692f60a7Smrg ;; 4191692f60a7Smrg 4192692f60a7Smrg obj) 4193692f60a7Smrg if test -n "$deplibs"; then 4194692f60a7Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 4195692f60a7Smrg fi 4196692f60a7Smrg 4197692f60a7Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4198692f60a7Smrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 4199692f60a7Smrg fi 4200692f60a7Smrg 4201692f60a7Smrg if test -n "$rpath"; then 4202692f60a7Smrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 4203692f60a7Smrg fi 4204692f60a7Smrg 4205692f60a7Smrg if test -n "$xrpath"; then 4206692f60a7Smrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 4207692f60a7Smrg fi 4208692f60a7Smrg 4209692f60a7Smrg if test -n "$vinfo"; then 4210692f60a7Smrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 4211692f60a7Smrg fi 4212692f60a7Smrg 4213692f60a7Smrg if test -n "$release"; then 4214692f60a7Smrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 4215692f60a7Smrg fi 4216692f60a7Smrg 4217692f60a7Smrg case $output in 4218692f60a7Smrg *.lo) 4219692f60a7Smrg if test -n "$objs$old_deplibs"; then 4220692f60a7Smrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 4221692f60a7Smrg exit $EXIT_FAILURE 4222692f60a7Smrg fi 4223692f60a7Smrg libobj="$output" 4224692f60a7Smrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 4225692f60a7Smrg ;; 4226692f60a7Smrg *) 4227692f60a7Smrg libobj= 4228692f60a7Smrg obj="$output" 4229692f60a7Smrg ;; 4230692f60a7Smrg esac 4231692f60a7Smrg 4232692f60a7Smrg # Delete the old objects. 4233692f60a7Smrg $run $rm $obj $libobj 4234692f60a7Smrg 4235692f60a7Smrg # Objects from convenience libraries. This assumes 4236692f60a7Smrg # single-version convenience libraries. Whenever we create 4237692f60a7Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 4238692f60a7Smrg # the extraction. 4239692f60a7Smrg reload_conv_objs= 4240692f60a7Smrg gentop= 4241692f60a7Smrg # reload_cmds runs $LD directly, so let us get rid of 4242692f60a7Smrg # -Wl from whole_archive_flag_spec 4243692f60a7Smrg wl= 4244692f60a7Smrg 4245692f60a7Smrg if test -n "$convenience"; then 4246692f60a7Smrg if test -n "$whole_archive_flag_spec"; then 4247692f60a7Smrg eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 4248692f60a7Smrg else 4249692f60a7Smrg gentop="$output_objdir/${obj}x" 4250692f60a7Smrg generated="$generated $gentop" 4251692f60a7Smrg 4252692f60a7Smrg func_extract_archives $gentop $convenience 4253692f60a7Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 4254692f60a7Smrg fi 4255692f60a7Smrg fi 4256692f60a7Smrg 4257692f60a7Smrg # Create the old-style object. 4258692f60a7Smrg 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 4259692f60a7Smrg 4260692f60a7Smrg output="$obj" 4261692f60a7Smrg cmds=$reload_cmds 4262692f60a7Smrg save_ifs="$IFS"; IFS='~' 4263692f60a7Smrg for cmd in $cmds; do 4264692f60a7Smrg IFS="$save_ifs" 4265692f60a7Smrg eval cmd=\"$cmd\" 4266692f60a7Smrg $show "$cmd" 4267692f60a7Smrg $run eval "$cmd" || exit $? 4268692f60a7Smrg done 4269692f60a7Smrg IFS="$save_ifs" 4270692f60a7Smrg 4271692f60a7Smrg # Exit if we aren't doing a library object file. 4272692f60a7Smrg if test -z "$libobj"; then 4273692f60a7Smrg if test -n "$gentop"; then 4274692f60a7Smrg $show "${rm}r $gentop" 4275692f60a7Smrg $run ${rm}r $gentop 4276692f60a7Smrg fi 4277692f60a7Smrg 4278692f60a7Smrg exit $EXIT_SUCCESS 4279692f60a7Smrg fi 4280692f60a7Smrg 4281692f60a7Smrg if test "$build_libtool_libs" != yes; then 4282692f60a7Smrg if test -n "$gentop"; then 4283692f60a7Smrg $show "${rm}r $gentop" 4284692f60a7Smrg $run ${rm}r $gentop 4285692f60a7Smrg fi 4286692f60a7Smrg 4287692f60a7Smrg # Create an invalid libtool object if no PIC, so that we don't 4288692f60a7Smrg # accidentally link it into a program. 4289692f60a7Smrg # $show "echo timestamp > $libobj" 4290692f60a7Smrg # $run eval "echo timestamp > $libobj" || exit $? 4291692f60a7Smrg exit $EXIT_SUCCESS 4292692f60a7Smrg fi 4293692f60a7Smrg 4294692f60a7Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 4295692f60a7Smrg # Only do commands if we really have different PIC objects. 4296692f60a7Smrg reload_objs="$libobjs $reload_conv_objs" 4297692f60a7Smrg output="$libobj" 4298692f60a7Smrg cmds=$reload_cmds 4299692f60a7Smrg save_ifs="$IFS"; IFS='~' 4300692f60a7Smrg for cmd in $cmds; do 4301692f60a7Smrg IFS="$save_ifs" 4302692f60a7Smrg eval cmd=\"$cmd\" 4303692f60a7Smrg $show "$cmd" 4304692f60a7Smrg $run eval "$cmd" || exit $? 4305692f60a7Smrg done 4306692f60a7Smrg IFS="$save_ifs" 4307692f60a7Smrg fi 4308692f60a7Smrg 4309692f60a7Smrg if test -n "$gentop"; then 4310692f60a7Smrg $show "${rm}r $gentop" 4311692f60a7Smrg $run ${rm}r $gentop 4312692f60a7Smrg fi 4313692f60a7Smrg 4314692f60a7Smrg exit $EXIT_SUCCESS 4315692f60a7Smrg ;; 4316692f60a7Smrg 4317692f60a7Smrg prog) 4318692f60a7Smrg case $host in 4319692f60a7Smrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 4320692f60a7Smrg esac 4321692f60a7Smrg if test -n "$vinfo"; then 4322692f60a7Smrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 4323692f60a7Smrg fi 4324692f60a7Smrg 4325692f60a7Smrg if test -n "$release"; then 4326692f60a7Smrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 4327692f60a7Smrg fi 4328692f60a7Smrg 4329692f60a7Smrg if test "$preload" = yes; then 4330692f60a7Smrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 4331692f60a7Smrg test "$dlopen_self_static" = unknown; then 4332692f60a7Smrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 4333692f60a7Smrg fi 4334692f60a7Smrg fi 4335692f60a7Smrg 4336692f60a7Smrg case $host in 4337692f60a7Smrg *-*-rhapsody* | *-*-darwin1.[012]) 4338692f60a7Smrg # On Rhapsody replace the C library is the System framework 4339692f60a7Smrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4340692f60a7Smrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4341692f60a7Smrg ;; 4342692f60a7Smrg esac 4343692f60a7Smrg 4344692f60a7Smrg case $host in 4345692f60a7Smrg *darwin*) 4346692f60a7Smrg # Don't allow lazy linking, it breaks C++ global constructors 4347692f60a7Smrg if test "$tagname" = CXX ; then 4348692f60a7Smrg compile_command="$compile_command ${wl}-bind_at_load" 4349692f60a7Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 4350692f60a7Smrg fi 4351692f60a7Smrg ;; 4352692f60a7Smrg esac 4353692f60a7Smrg 4354692f60a7Smrg 4355692f60a7Smrg # move library search paths that coincide with paths to not yet 4356692f60a7Smrg # installed libraries to the beginning of the library search list 4357692f60a7Smrg new_libs= 4358692f60a7Smrg for path in $notinst_path; do 4359692f60a7Smrg case " $new_libs " in 4360692f60a7Smrg *" -L$path/$objdir "*) ;; 4361692f60a7Smrg *) 4362692f60a7Smrg case " $compile_deplibs " in 4363692f60a7Smrg *" -L$path/$objdir "*) 4364692f60a7Smrg new_libs="$new_libs -L$path/$objdir" ;; 4365692f60a7Smrg esac 4366692f60a7Smrg ;; 4367692f60a7Smrg esac 4368692f60a7Smrg done 4369692f60a7Smrg for deplib in $compile_deplibs; do 4370692f60a7Smrg case $deplib in 4371692f60a7Smrg -L*) 4372692f60a7Smrg case " $new_libs " in 4373692f60a7Smrg *" $deplib "*) ;; 4374692f60a7Smrg *) new_libs="$new_libs $deplib" ;; 4375692f60a7Smrg esac 4376692f60a7Smrg ;; 4377692f60a7Smrg *) new_libs="$new_libs $deplib" ;; 4378692f60a7Smrg esac 4379692f60a7Smrg done 4380692f60a7Smrg compile_deplibs="$new_libs" 4381692f60a7Smrg 4382692f60a7Smrg 4383692f60a7Smrg compile_command="$compile_command $compile_deplibs" 4384692f60a7Smrg finalize_command="$finalize_command $finalize_deplibs" 4385692f60a7Smrg 4386692f60a7Smrg if test -n "$rpath$xrpath"; then 4387692f60a7Smrg # If the user specified any rpath flags, then add them. 4388692f60a7Smrg for libdir in $rpath $xrpath; do 4389692f60a7Smrg # This is the magic to use -rpath. 4390692f60a7Smrg case "$finalize_rpath " in 4391692f60a7Smrg *" $libdir "*) ;; 4392692f60a7Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 4393692f60a7Smrg esac 4394692f60a7Smrg done 4395692f60a7Smrg fi 4396692f60a7Smrg 4397692f60a7Smrg # Now hardcode the library paths 4398692f60a7Smrg rpath= 4399692f60a7Smrg hardcode_libdirs= 4400692f60a7Smrg for libdir in $compile_rpath $finalize_rpath; do 4401692f60a7Smrg if test -n "$hardcode_libdir_flag_spec"; then 4402692f60a7Smrg if test -n "$hardcode_libdir_separator"; then 4403692f60a7Smrg if test -z "$hardcode_libdirs"; then 4404692f60a7Smrg hardcode_libdirs="$libdir" 4405692f60a7Smrg else 4406692f60a7Smrg # Just accumulate the unique libdirs. 4407692f60a7Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4408692f60a7Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4409692f60a7Smrg ;; 4410692f60a7Smrg *) 4411692f60a7Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4412692f60a7Smrg ;; 4413692f60a7Smrg esac 4414692f60a7Smrg fi 4415692f60a7Smrg else 4416692f60a7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 4417692f60a7Smrg rpath="$rpath $flag" 4418692f60a7Smrg fi 4419692f60a7Smrg elif test -n "$runpath_var"; then 4420692f60a7Smrg case "$perm_rpath " in 4421692f60a7Smrg *" $libdir "*) ;; 4422692f60a7Smrg *) perm_rpath="$perm_rpath $libdir" ;; 4423692f60a7Smrg esac 4424692f60a7Smrg fi 4425692f60a7Smrg case $host in 4426692f60a7Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4427692f60a7Smrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 4428692f60a7Smrg case :$dllsearchpath: in 4429692f60a7Smrg *":$libdir:"*) ;; 4430692f60a7Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 4431692f60a7Smrg esac 4432692f60a7Smrg case :$dllsearchpath: in 4433692f60a7Smrg *":$testbindir:"*) ;; 4434692f60a7Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 4435692f60a7Smrg esac 4436692f60a7Smrg ;; 4437692f60a7Smrg esac 4438692f60a7Smrg done 4439692f60a7Smrg # Substitute the hardcoded libdirs into the rpath. 4440692f60a7Smrg if test -n "$hardcode_libdir_separator" && 4441692f60a7Smrg test -n "$hardcode_libdirs"; then 4442692f60a7Smrg libdir="$hardcode_libdirs" 4443692f60a7Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 4444692f60a7Smrg fi 4445692f60a7Smrg compile_rpath="$rpath" 4446692f60a7Smrg 4447692f60a7Smrg rpath= 4448692f60a7Smrg hardcode_libdirs= 4449692f60a7Smrg for libdir in $finalize_rpath; do 4450692f60a7Smrg if test -n "$hardcode_libdir_flag_spec"; then 4451692f60a7Smrg if test -n "$hardcode_libdir_separator"; then 4452692f60a7Smrg if test -z "$hardcode_libdirs"; then 4453692f60a7Smrg hardcode_libdirs="$libdir" 4454692f60a7Smrg else 4455692f60a7Smrg # Just accumulate the unique libdirs. 4456692f60a7Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4457692f60a7Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4458692f60a7Smrg ;; 4459692f60a7Smrg *) 4460692f60a7Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4461692f60a7Smrg ;; 4462692f60a7Smrg esac 4463692f60a7Smrg fi 4464692f60a7Smrg else 4465692f60a7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 4466692f60a7Smrg rpath="$rpath $flag" 4467692f60a7Smrg fi 4468692f60a7Smrg elif test -n "$runpath_var"; then 4469692f60a7Smrg case "$finalize_perm_rpath " in 4470692f60a7Smrg *" $libdir "*) ;; 4471692f60a7Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 4472692f60a7Smrg esac 4473692f60a7Smrg fi 4474692f60a7Smrg done 4475692f60a7Smrg # Substitute the hardcoded libdirs into the rpath. 4476692f60a7Smrg if test -n "$hardcode_libdir_separator" && 4477692f60a7Smrg test -n "$hardcode_libdirs"; then 4478692f60a7Smrg libdir="$hardcode_libdirs" 4479692f60a7Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 4480692f60a7Smrg fi 4481692f60a7Smrg finalize_rpath="$rpath" 4482692f60a7Smrg 4483692f60a7Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 4484692f60a7Smrg # Transform all the library objects into standard objects. 4485692f60a7Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4486692f60a7Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4487692f60a7Smrg fi 4488692f60a7Smrg 4489692f60a7Smrg dlsyms= 4490692f60a7Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4491692f60a7Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 4492692f60a7Smrg dlsyms="${outputname}S.c" 4493692f60a7Smrg else 4494692f60a7Smrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 4495692f60a7Smrg fi 4496692f60a7Smrg fi 4497692f60a7Smrg 4498692f60a7Smrg if test -n "$dlsyms"; then 4499692f60a7Smrg case $dlsyms in 4500692f60a7Smrg "") ;; 4501692f60a7Smrg *.c) 4502692f60a7Smrg # Discover the nlist of each of the dlfiles. 4503692f60a7Smrg nlist="$output_objdir/${outputname}.nm" 4504692f60a7Smrg 4505692f60a7Smrg $show "$rm $nlist ${nlist}S ${nlist}T" 4506692f60a7Smrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 4507692f60a7Smrg 4508692f60a7Smrg # Parse the name list into a source file. 4509692f60a7Smrg $show "creating $output_objdir/$dlsyms" 4510692f60a7Smrg 4511692f60a7Smrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 4512692f60a7Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 4513692f60a7Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 4514692f60a7Smrg 4515692f60a7Smrg#ifdef __cplusplus 4516692f60a7Smrgextern \"C\" { 4517692f60a7Smrg#endif 4518692f60a7Smrg 4519692f60a7Smrg/* Prevent the only kind of declaration conflicts we can make. */ 4520692f60a7Smrg#define lt_preloaded_symbols some_other_symbol 4521692f60a7Smrg 4522692f60a7Smrg/* External symbol declarations for the compiler. */\ 4523692f60a7Smrg" 4524692f60a7Smrg 4525692f60a7Smrg if test "$dlself" = yes; then 4526692f60a7Smrg $show "generating symbol list for \`$output'" 4527692f60a7Smrg 4528692f60a7Smrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 4529692f60a7Smrg 4530692f60a7Smrg # Add our own program objects to the symbol list. 4531692f60a7Smrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4532692f60a7Smrg for arg in $progfiles; do 4533692f60a7Smrg $show "extracting global C symbols from \`$arg'" 4534692f60a7Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4535692f60a7Smrg done 4536692f60a7Smrg 4537692f60a7Smrg if test -n "$exclude_expsyms"; then 4538692f60a7Smrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4539692f60a7Smrg $run eval '$mv "$nlist"T "$nlist"' 4540692f60a7Smrg fi 4541692f60a7Smrg 4542692f60a7Smrg if test -n "$export_symbols_regex"; then 4543692f60a7Smrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4544692f60a7Smrg $run eval '$mv "$nlist"T "$nlist"' 4545692f60a7Smrg fi 4546692f60a7Smrg 4547692f60a7Smrg # Prepare the list of exported symbols 4548692f60a7Smrg if test -z "$export_symbols"; then 4549692f60a7Smrg export_symbols="$output_objdir/$outputname.exp" 4550692f60a7Smrg $run $rm $export_symbols 4551692f60a7Smrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4552692f60a7Smrg case $host in 4553692f60a7Smrg *cygwin* | *mingw* ) 4554692f60a7Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4555692f60a7Smrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4556692f60a7Smrg ;; 4557692f60a7Smrg esac 4558692f60a7Smrg else 4559692f60a7Smrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4560692f60a7Smrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4561692f60a7Smrg $run eval 'mv "$nlist"T "$nlist"' 4562692f60a7Smrg case $host in 4563692f60a7Smrg *cygwin* | *mingw* ) 4564692f60a7Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4565692f60a7Smrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4566692f60a7Smrg ;; 4567692f60a7Smrg esac 4568692f60a7Smrg fi 4569692f60a7Smrg fi 4570692f60a7Smrg 4571692f60a7Smrg for arg in $dlprefiles; do 4572692f60a7Smrg $show "extracting global C symbols from \`$arg'" 4573692f60a7Smrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 4574692f60a7Smrg $run eval '$echo ": $name " >> "$nlist"' 4575692f60a7Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4576692f60a7Smrg done 4577692f60a7Smrg 4578692f60a7Smrg if test -z "$run"; then 4579692f60a7Smrg # Make sure we have at least an empty file. 4580692f60a7Smrg test -f "$nlist" || : > "$nlist" 4581692f60a7Smrg 4582692f60a7Smrg if test -n "$exclude_expsyms"; then 4583692f60a7Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4584692f60a7Smrg $mv "$nlist"T "$nlist" 4585692f60a7Smrg fi 4586692f60a7Smrg 4587692f60a7Smrg # Try sorting and uniquifying the output. 4588692f60a7Smrg if grep -v "^: " < "$nlist" | 4589692f60a7Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 4590692f60a7Smrg sort -k 3 4591692f60a7Smrg else 4592692f60a7Smrg sort +2 4593692f60a7Smrg fi | 4594692f60a7Smrg uniq > "$nlist"S; then 4595692f60a7Smrg : 4596692f60a7Smrg else 4597692f60a7Smrg grep -v "^: " < "$nlist" > "$nlist"S 4598692f60a7Smrg fi 4599692f60a7Smrg 4600692f60a7Smrg if test -f "$nlist"S; then 4601692f60a7Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 4602692f60a7Smrg else 4603692f60a7Smrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 4604692f60a7Smrg fi 4605692f60a7Smrg 4606692f60a7Smrg $echo >> "$output_objdir/$dlsyms" "\ 4607692f60a7Smrg 4608692f60a7Smrg#undef lt_preloaded_symbols 4609692f60a7Smrg 4610692f60a7Smrg#if defined (__STDC__) && __STDC__ 4611692f60a7Smrg# define lt_ptr void * 4612692f60a7Smrg#else 4613692f60a7Smrg# define lt_ptr char * 4614692f60a7Smrg# define const 4615692f60a7Smrg#endif 4616692f60a7Smrg 4617692f60a7Smrg/* The mapping between symbol names and symbols. */ 4618692f60a7Smrg" 4619692f60a7Smrg 4620692f60a7Smrg case $host in 4621692f60a7Smrg *cygwin* | *mingw* ) 4622692f60a7Smrg $echo >> "$output_objdir/$dlsyms" "\ 4623692f60a7Smrg/* DATA imports from DLLs on WIN32 can't be const, because 4624692f60a7Smrg runtime relocations are performed -- see ld's documentation 4625692f60a7Smrg on pseudo-relocs */ 4626692f60a7Smrgstruct { 4627692f60a7Smrg" 4628692f60a7Smrg ;; 4629692f60a7Smrg * ) 4630692f60a7Smrg $echo >> "$output_objdir/$dlsyms" "\ 4631692f60a7Smrgconst struct { 4632692f60a7Smrg" 4633692f60a7Smrg ;; 4634692f60a7Smrg esac 4635692f60a7Smrg 4636692f60a7Smrg 4637692f60a7Smrg $echo >> "$output_objdir/$dlsyms" "\ 4638692f60a7Smrg const char *name; 4639692f60a7Smrg lt_ptr address; 4640692f60a7Smrg} 4641692f60a7Smrglt_preloaded_symbols[] = 4642692f60a7Smrg{\ 4643692f60a7Smrg" 4644692f60a7Smrg 4645692f60a7Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 4646692f60a7Smrg 4647692f60a7Smrg $echo >> "$output_objdir/$dlsyms" "\ 4648692f60a7Smrg {0, (lt_ptr) 0} 4649692f60a7Smrg}; 4650692f60a7Smrg 4651692f60a7Smrg/* This works around a problem in FreeBSD linker */ 4652692f60a7Smrg#ifdef FREEBSD_WORKAROUND 4653692f60a7Smrgstatic const void *lt_preloaded_setup() { 4654692f60a7Smrg return lt_preloaded_symbols; 4655692f60a7Smrg} 4656692f60a7Smrg#endif 4657692f60a7Smrg 4658692f60a7Smrg#ifdef __cplusplus 4659692f60a7Smrg} 4660692f60a7Smrg#endif\ 4661692f60a7Smrg" 4662692f60a7Smrg fi 4663692f60a7Smrg 4664692f60a7Smrg pic_flag_for_symtable= 4665692f60a7Smrg case $host in 4666692f60a7Smrg # compiling the symbol table file with pic_flag works around 4667692f60a7Smrg # a FreeBSD bug that causes programs to crash when -lm is 4668692f60a7Smrg # linked before any other PIC object. But we must not use 4669692f60a7Smrg # pic_flag when linking with -static. The problem exists in 4670692f60a7Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 4671692f60a7Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 4672692f60a7Smrg case "$compile_command " in 4673692f60a7Smrg *" -static "*) ;; 4674692f60a7Smrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 4675692f60a7Smrg esac;; 4676692f60a7Smrg *-*-hpux*) 4677692f60a7Smrg case "$compile_command " in 4678692f60a7Smrg *" -static "*) ;; 4679692f60a7Smrg *) pic_flag_for_symtable=" $pic_flag";; 4680692f60a7Smrg esac 4681692f60a7Smrg esac 4682692f60a7Smrg 4683692f60a7Smrg # Now compile the dynamic symbol file. 4684692f60a7Smrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4685692f60a7Smrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 4686692f60a7Smrg 4687692f60a7Smrg # Clean up the generated files. 4688692f60a7Smrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4689692f60a7Smrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4690692f60a7Smrg 4691692f60a7Smrg # Transform the symbol file into the correct name. 4692692f60a7Smrg case $host in 4693692f60a7Smrg *cygwin* | *mingw* ) 4694692f60a7Smrg if test -f "$output_objdir/${outputname}.def" ; then 4695692f60a7Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 4696692f60a7Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 4697692f60a7Smrg else 4698692f60a7Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4699692f60a7Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4700692f60a7Smrg fi 4701692f60a7Smrg ;; 4702692f60a7Smrg * ) 4703692f60a7Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4704692f60a7Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4705692f60a7Smrg ;; 4706692f60a7Smrg esac 4707692f60a7Smrg ;; 4708692f60a7Smrg *) 4709692f60a7Smrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4710692f60a7Smrg exit $EXIT_FAILURE 4711692f60a7Smrg ;; 4712692f60a7Smrg esac 4713692f60a7Smrg else 4714692f60a7Smrg # We keep going just in case the user didn't refer to 4715692f60a7Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 4716692f60a7Smrg # really was required. 4717692f60a7Smrg 4718692f60a7Smrg # Nullify the symbol file. 4719692f60a7Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 4720692f60a7Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 4721692f60a7Smrg fi 4722692f60a7Smrg 4723692f60a7Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 4724692f60a7Smrg # Replace the output file specification. 4725692f60a7Smrg compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4726692f60a7Smrg link_command="$compile_command$compile_rpath" 4727692f60a7Smrg 4728692f60a7Smrg # We have no uninstalled library dependencies, so finalize right now. 4729692f60a7Smrg $show "$link_command" 4730692f60a7Smrg $run eval "$link_command" 4731692f60a7Smrg exit_status=$? 4732692f60a7Smrg 4733692f60a7Smrg # Delete the generated files. 4734692f60a7Smrg if test -n "$dlsyms"; then 4735692f60a7Smrg $show "$rm $output_objdir/${outputname}S.${objext}" 4736692f60a7Smrg $run $rm "$output_objdir/${outputname}S.${objext}" 4737692f60a7Smrg fi 4738692f60a7Smrg 4739692f60a7Smrg exit $exit_status 4740692f60a7Smrg fi 4741692f60a7Smrg 4742692f60a7Smrg if test -n "$shlibpath_var"; then 4743692f60a7Smrg # We should set the shlibpath_var 4744692f60a7Smrg rpath= 4745692f60a7Smrg for dir in $temp_rpath; do 4746692f60a7Smrg case $dir in 4747692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) 4748692f60a7Smrg # Absolute path. 4749692f60a7Smrg rpath="$rpath$dir:" 4750692f60a7Smrg ;; 4751692f60a7Smrg *) 4752692f60a7Smrg # Relative path: add a thisdir entry. 4753692f60a7Smrg rpath="$rpath\$thisdir/$dir:" 4754692f60a7Smrg ;; 4755692f60a7Smrg esac 4756692f60a7Smrg done 4757692f60a7Smrg temp_rpath="$rpath" 4758692f60a7Smrg fi 4759692f60a7Smrg 4760692f60a7Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 4761692f60a7Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 4762692f60a7Smrg fi 4763692f60a7Smrg if test -n "$finalize_shlibpath"; then 4764692f60a7Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 4765692f60a7Smrg fi 4766692f60a7Smrg 4767692f60a7Smrg compile_var= 4768692f60a7Smrg finalize_var= 4769692f60a7Smrg if test -n "$runpath_var"; then 4770692f60a7Smrg if test -n "$perm_rpath"; then 4771692f60a7Smrg # We should set the runpath_var. 4772692f60a7Smrg rpath= 4773692f60a7Smrg for dir in $perm_rpath; do 4774692f60a7Smrg rpath="$rpath$dir:" 4775692f60a7Smrg done 4776692f60a7Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 4777692f60a7Smrg fi 4778692f60a7Smrg if test -n "$finalize_perm_rpath"; then 4779692f60a7Smrg # We should set the runpath_var. 4780692f60a7Smrg rpath= 4781692f60a7Smrg for dir in $finalize_perm_rpath; do 4782692f60a7Smrg rpath="$rpath$dir:" 4783692f60a7Smrg done 4784692f60a7Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 4785692f60a7Smrg fi 4786692f60a7Smrg fi 4787692f60a7Smrg 4788692f60a7Smrg if test "$no_install" = yes; then 4789692f60a7Smrg # We don't need to create a wrapper script. 4790692f60a7Smrg link_command="$compile_var$compile_command$compile_rpath" 4791692f60a7Smrg # Replace the output file specification. 4792692f60a7Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4793692f60a7Smrg # Delete the old output file. 4794692f60a7Smrg $run $rm $output 4795692f60a7Smrg # Link the executable and exit 4796692f60a7Smrg $show "$link_command" 4797692f60a7Smrg $run eval "$link_command" || exit $? 4798692f60a7Smrg exit $EXIT_SUCCESS 4799692f60a7Smrg fi 4800692f60a7Smrg 4801692f60a7Smrg if test "$hardcode_action" = relink; then 4802692f60a7Smrg # Fast installation is not supported 4803692f60a7Smrg link_command="$compile_var$compile_command$compile_rpath" 4804692f60a7Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 4805692f60a7Smrg 4806692f60a7Smrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 4807692f60a7Smrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 4808692f60a7Smrg else 4809692f60a7Smrg if test "$fast_install" != no; then 4810692f60a7Smrg link_command="$finalize_var$compile_command$finalize_rpath" 4811692f60a7Smrg if test "$fast_install" = yes; then 4812692f60a7Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 4813692f60a7Smrg else 4814692f60a7Smrg # fast_install is set to needless 4815692f60a7Smrg relink_command= 4816692f60a7Smrg fi 4817692f60a7Smrg else 4818692f60a7Smrg link_command="$compile_var$compile_command$compile_rpath" 4819692f60a7Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 4820692f60a7Smrg fi 4821692f60a7Smrg fi 4822692f60a7Smrg 4823692f60a7Smrg # Replace the output file specification. 4824692f60a7Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 4825692f60a7Smrg 4826692f60a7Smrg # Delete the old output files. 4827692f60a7Smrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 4828692f60a7Smrg 4829692f60a7Smrg $show "$link_command" 4830692f60a7Smrg $run eval "$link_command" || exit $? 4831692f60a7Smrg 4832692f60a7Smrg # Now create the wrapper script. 4833692f60a7Smrg $show "creating $output" 4834692f60a7Smrg 4835692f60a7Smrg # Quote the relink command for shipping. 4836692f60a7Smrg if test -n "$relink_command"; then 4837692f60a7Smrg # Preserve any variables that may affect compiler behavior 4838692f60a7Smrg for var in $variables_saved_for_relink; do 4839692f60a7Smrg if eval test -z \"\${$var+set}\"; then 4840692f60a7Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4841692f60a7Smrg elif eval var_value=\$$var; test -z "$var_value"; then 4842692f60a7Smrg relink_command="$var=; export $var; $relink_command" 4843692f60a7Smrg else 4844692f60a7Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4845692f60a7Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 4846692f60a7Smrg fi 4847692f60a7Smrg done 4848692f60a7Smrg relink_command="(cd `pwd`; $relink_command)" 4849692f60a7Smrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 4850692f60a7Smrg fi 4851692f60a7Smrg 4852692f60a7Smrg # Quote $echo for shipping. 4853692f60a7Smrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 4854692f60a7Smrg case $progpath in 4855692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 4856692f60a7Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 4857692f60a7Smrg esac 4858692f60a7Smrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 4859692f60a7Smrg else 4860692f60a7Smrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 4861692f60a7Smrg fi 4862692f60a7Smrg 4863692f60a7Smrg # Only actually do things if our run command is non-null. 4864692f60a7Smrg if test -z "$run"; then 4865692f60a7Smrg # win32 will think the script is a binary if it has 4866692f60a7Smrg # a .exe suffix, so we strip it off here. 4867692f60a7Smrg case $output in 4868692f60a7Smrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 4869692f60a7Smrg esac 4870692f60a7Smrg # test for cygwin because mv fails w/o .exe extensions 4871692f60a7Smrg case $host in 4872692f60a7Smrg *cygwin*) 4873692f60a7Smrg exeext=.exe 4874692f60a7Smrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4875692f60a7Smrg *) exeext= ;; 4876692f60a7Smrg esac 4877692f60a7Smrg case $host in 4878692f60a7Smrg *cygwin* | *mingw* ) 4879692f60a7Smrg output_name=`basename $output` 4880692f60a7Smrg output_path=`dirname $output` 4881692f60a7Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 4882692f60a7Smrg cwrapper="$output_path/$output_name.exe" 4883692f60a7Smrg $rm $cwrappersource $cwrapper 4884692f60a7Smrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4885692f60a7Smrg 4886692f60a7Smrg cat > $cwrappersource <<EOF 4887692f60a7Smrg 4888692f60a7Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4889692f60a7Smrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4890692f60a7Smrg 4891692f60a7Smrg The $output program cannot be directly executed until all the libtool 4892692f60a7Smrg libraries that it depends on are installed. 4893692f60a7Smrg 4894692f60a7Smrg This wrapper executable should never be moved out of the build directory. 4895692f60a7Smrg If it is, it will not operate correctly. 4896692f60a7Smrg 4897692f60a7Smrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 4898692f60a7Smrg but could eventually absorb all of the scripts functionality and 4899692f60a7Smrg exec $objdir/$outputname directly. 4900692f60a7Smrg*/ 4901692f60a7SmrgEOF 4902692f60a7Smrg cat >> $cwrappersource<<"EOF" 4903692f60a7Smrg#include <stdio.h> 4904692f60a7Smrg#include <stdlib.h> 4905692f60a7Smrg#include <unistd.h> 4906692f60a7Smrg#include <malloc.h> 4907692f60a7Smrg#include <stdarg.h> 4908692f60a7Smrg#include <assert.h> 4909692f60a7Smrg#include <string.h> 4910692f60a7Smrg#include <ctype.h> 4911692f60a7Smrg#include <sys/stat.h> 4912692f60a7Smrg 4913692f60a7Smrg#if defined(PATH_MAX) 4914692f60a7Smrg# define LT_PATHMAX PATH_MAX 4915692f60a7Smrg#elif defined(MAXPATHLEN) 4916692f60a7Smrg# define LT_PATHMAX MAXPATHLEN 4917692f60a7Smrg#else 4918692f60a7Smrg# define LT_PATHMAX 1024 4919692f60a7Smrg#endif 4920692f60a7Smrg 4921692f60a7Smrg#ifndef DIR_SEPARATOR 4922692f60a7Smrg# define DIR_SEPARATOR '/' 4923692f60a7Smrg# define PATH_SEPARATOR ':' 4924692f60a7Smrg#endif 4925692f60a7Smrg 4926692f60a7Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4927692f60a7Smrg defined (__OS2__) 4928692f60a7Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 4929692f60a7Smrg# ifndef DIR_SEPARATOR_2 4930692f60a7Smrg# define DIR_SEPARATOR_2 '\\' 4931692f60a7Smrg# endif 4932692f60a7Smrg# ifndef PATH_SEPARATOR_2 4933692f60a7Smrg# define PATH_SEPARATOR_2 ';' 4934692f60a7Smrg# endif 4935692f60a7Smrg#endif 4936692f60a7Smrg 4937692f60a7Smrg#ifndef DIR_SEPARATOR_2 4938692f60a7Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4939692f60a7Smrg#else /* DIR_SEPARATOR_2 */ 4940692f60a7Smrg# define IS_DIR_SEPARATOR(ch) \ 4941692f60a7Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4942692f60a7Smrg#endif /* DIR_SEPARATOR_2 */ 4943692f60a7Smrg 4944692f60a7Smrg#ifndef PATH_SEPARATOR_2 4945692f60a7Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 4946692f60a7Smrg#else /* PATH_SEPARATOR_2 */ 4947692f60a7Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 4948692f60a7Smrg#endif /* PATH_SEPARATOR_2 */ 4949692f60a7Smrg 4950692f60a7Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4951692f60a7Smrg#define XFREE(stale) do { \ 4952692f60a7Smrg if (stale) { free ((void *) stale); stale = 0; } \ 4953692f60a7Smrg} while (0) 4954692f60a7Smrg 4955692f60a7Smrg/* -DDEBUG is fairly common in CFLAGS. */ 4956692f60a7Smrg#undef DEBUG 4957692f60a7Smrg#if defined DEBUGWRAPPER 4958692f60a7Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 4959692f60a7Smrg#else 4960692f60a7Smrg# define DEBUG(format, ...) 4961692f60a7Smrg#endif 4962692f60a7Smrg 4963692f60a7Smrgconst char *program_name = NULL; 4964692f60a7Smrg 4965692f60a7Smrgvoid * xmalloc (size_t num); 4966692f60a7Smrgchar * xstrdup (const char *string); 4967692f60a7Smrgconst char * base_name (const char *name); 4968692f60a7Smrgchar * find_executable(const char *wrapper); 4969692f60a7Smrgint check_executable(const char *path); 4970692f60a7Smrgchar * strendzap(char *str, const char *pat); 4971692f60a7Smrgvoid lt_fatal (const char *message, ...); 4972692f60a7Smrg 4973692f60a7Smrgint 4974692f60a7Smrgmain (int argc, char *argv[]) 4975692f60a7Smrg{ 4976692f60a7Smrg char **newargz; 4977692f60a7Smrg int i; 4978692f60a7Smrg 4979692f60a7Smrg program_name = (char *) xstrdup (base_name (argv[0])); 4980692f60a7Smrg DEBUG("(main) argv[0] : %s\n",argv[0]); 4981692f60a7Smrg DEBUG("(main) program_name : %s\n",program_name); 4982692f60a7Smrg newargz = XMALLOC(char *, argc+2); 4983692f60a7SmrgEOF 4984692f60a7Smrg 4985692f60a7Smrg cat >> $cwrappersource <<EOF 4986692f60a7Smrg newargz[0] = (char *) xstrdup("$SHELL"); 4987692f60a7SmrgEOF 4988692f60a7Smrg 4989692f60a7Smrg cat >> $cwrappersource <<"EOF" 4990692f60a7Smrg newargz[1] = find_executable(argv[0]); 4991692f60a7Smrg if (newargz[1] == NULL) 4992692f60a7Smrg lt_fatal("Couldn't find %s", argv[0]); 4993692f60a7Smrg DEBUG("(main) found exe at : %s\n",newargz[1]); 4994692f60a7Smrg /* we know the script has the same name, without the .exe */ 4995692f60a7Smrg /* so make sure newargz[1] doesn't end in .exe */ 4996692f60a7Smrg strendzap(newargz[1],".exe"); 4997692f60a7Smrg for (i = 1; i < argc; i++) 4998692f60a7Smrg newargz[i+1] = xstrdup(argv[i]); 4999692f60a7Smrg newargz[argc+1] = NULL; 5000692f60a7Smrg 5001692f60a7Smrg for (i=0; i<argc+1; i++) 5002692f60a7Smrg { 5003692f60a7Smrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 5004692f60a7Smrg ; 5005692f60a7Smrg } 5006692f60a7Smrg 5007692f60a7SmrgEOF 5008692f60a7Smrg 5009692f60a7Smrg case $host_os in 5010692f60a7Smrg mingw*) 5011692f60a7Smrg cat >> $cwrappersource <<EOF 5012692f60a7Smrg execv("$SHELL",(char const **)newargz); 5013692f60a7SmrgEOF 5014692f60a7Smrg ;; 5015692f60a7Smrg *) 5016692f60a7Smrg cat >> $cwrappersource <<EOF 5017692f60a7Smrg execv("$SHELL",newargz); 5018692f60a7SmrgEOF 5019692f60a7Smrg ;; 5020692f60a7Smrg esac 5021692f60a7Smrg 5022692f60a7Smrg cat >> $cwrappersource <<"EOF" 5023692f60a7Smrg return 127; 5024692f60a7Smrg} 5025692f60a7Smrg 5026692f60a7Smrgvoid * 5027692f60a7Smrgxmalloc (size_t num) 5028692f60a7Smrg{ 5029692f60a7Smrg void * p = (void *) malloc (num); 5030692f60a7Smrg if (!p) 5031692f60a7Smrg lt_fatal ("Memory exhausted"); 5032692f60a7Smrg 5033692f60a7Smrg return p; 5034692f60a7Smrg} 5035692f60a7Smrg 5036692f60a7Smrgchar * 5037692f60a7Smrgxstrdup (const char *string) 5038692f60a7Smrg{ 5039692f60a7Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5040692f60a7Smrg; 5041692f60a7Smrg} 5042692f60a7Smrg 5043692f60a7Smrgconst char * 5044692f60a7Smrgbase_name (const char *name) 5045692f60a7Smrg{ 5046692f60a7Smrg const char *base; 5047692f60a7Smrg 5048692f60a7Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5049692f60a7Smrg /* Skip over the disk name in MSDOS pathnames. */ 5050692f60a7Smrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 5051692f60a7Smrg name += 2; 5052692f60a7Smrg#endif 5053692f60a7Smrg 5054692f60a7Smrg for (base = name; *name; name++) 5055692f60a7Smrg if (IS_DIR_SEPARATOR (*name)) 5056692f60a7Smrg base = name + 1; 5057692f60a7Smrg return base; 5058692f60a7Smrg} 5059692f60a7Smrg 5060692f60a7Smrgint 5061692f60a7Smrgcheck_executable(const char * path) 5062692f60a7Smrg{ 5063692f60a7Smrg struct stat st; 5064692f60a7Smrg 5065692f60a7Smrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 5066692f60a7Smrg if ((!path) || (!*path)) 5067692f60a7Smrg return 0; 5068692f60a7Smrg 5069692f60a7Smrg if ((stat (path, &st) >= 0) && 5070692f60a7Smrg ( 5071692f60a7Smrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 5072692f60a7Smrg#if defined (S_IXOTH) 5073692f60a7Smrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 5074692f60a7Smrg#endif 5075692f60a7Smrg#if defined (S_IXGRP) 5076692f60a7Smrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 5077692f60a7Smrg#endif 5078692f60a7Smrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 5079692f60a7Smrg ) 5080692f60a7Smrg return 1; 5081692f60a7Smrg else 5082692f60a7Smrg return 0; 5083692f60a7Smrg} 5084692f60a7Smrg 5085692f60a7Smrg/* Searches for the full path of the wrapper. Returns 5086692f60a7Smrg newly allocated full path name if found, NULL otherwise */ 5087692f60a7Smrgchar * 5088692f60a7Smrgfind_executable (const char* wrapper) 5089692f60a7Smrg{ 5090692f60a7Smrg int has_slash = 0; 5091692f60a7Smrg const char* p; 5092692f60a7Smrg const char* p_next; 5093692f60a7Smrg /* static buffer for getcwd */ 5094692f60a7Smrg char tmp[LT_PATHMAX + 1]; 5095692f60a7Smrg int tmp_len; 5096692f60a7Smrg char* concat_name; 5097692f60a7Smrg 5098692f60a7Smrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 5099692f60a7Smrg 5100692f60a7Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 5101692f60a7Smrg return NULL; 5102692f60a7Smrg 5103692f60a7Smrg /* Absolute path? */ 5104692f60a7Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5105692f60a7Smrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 5106692f60a7Smrg { 5107692f60a7Smrg concat_name = xstrdup (wrapper); 5108692f60a7Smrg if (check_executable(concat_name)) 5109692f60a7Smrg return concat_name; 5110692f60a7Smrg XFREE(concat_name); 5111692f60a7Smrg } 5112692f60a7Smrg else 5113692f60a7Smrg { 5114692f60a7Smrg#endif 5115692f60a7Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 5116692f60a7Smrg { 5117692f60a7Smrg concat_name = xstrdup (wrapper); 5118692f60a7Smrg if (check_executable(concat_name)) 5119692f60a7Smrg return concat_name; 5120692f60a7Smrg XFREE(concat_name); 5121692f60a7Smrg } 5122692f60a7Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5123692f60a7Smrg } 5124692f60a7Smrg#endif 5125692f60a7Smrg 5126692f60a7Smrg for (p = wrapper; *p; p++) 5127692f60a7Smrg if (*p == '/') 5128692f60a7Smrg { 5129692f60a7Smrg has_slash = 1; 5130692f60a7Smrg break; 5131692f60a7Smrg } 5132692f60a7Smrg if (!has_slash) 5133692f60a7Smrg { 5134692f60a7Smrg /* no slashes; search PATH */ 5135692f60a7Smrg const char* path = getenv ("PATH"); 5136692f60a7Smrg if (path != NULL) 5137692f60a7Smrg { 5138692f60a7Smrg for (p = path; *p; p = p_next) 5139692f60a7Smrg { 5140692f60a7Smrg const char* q; 5141692f60a7Smrg size_t p_len; 5142692f60a7Smrg for (q = p; *q; q++) 5143692f60a7Smrg if (IS_PATH_SEPARATOR(*q)) 5144692f60a7Smrg break; 5145692f60a7Smrg p_len = q - p; 5146692f60a7Smrg p_next = (*q == '\0' ? q : q + 1); 5147692f60a7Smrg if (p_len == 0) 5148692f60a7Smrg { 5149692f60a7Smrg /* empty path: current directory */ 5150692f60a7Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 5151692f60a7Smrg lt_fatal ("getcwd failed"); 5152692f60a7Smrg tmp_len = strlen(tmp); 5153692f60a7Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5154692f60a7Smrg memcpy (concat_name, tmp, tmp_len); 5155692f60a7Smrg concat_name[tmp_len] = '/'; 5156692f60a7Smrg strcpy (concat_name + tmp_len + 1, wrapper); 5157692f60a7Smrg } 5158692f60a7Smrg else 5159692f60a7Smrg { 5160692f60a7Smrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 5161692f60a7Smrg memcpy (concat_name, p, p_len); 5162692f60a7Smrg concat_name[p_len] = '/'; 5163692f60a7Smrg strcpy (concat_name + p_len + 1, wrapper); 5164692f60a7Smrg } 5165692f60a7Smrg if (check_executable(concat_name)) 5166692f60a7Smrg return concat_name; 5167692f60a7Smrg XFREE(concat_name); 5168692f60a7Smrg } 5169692f60a7Smrg } 5170692f60a7Smrg /* not found in PATH; assume curdir */ 5171692f60a7Smrg } 5172692f60a7Smrg /* Relative path | not found in path: prepend cwd */ 5173692f60a7Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 5174692f60a7Smrg lt_fatal ("getcwd failed"); 5175692f60a7Smrg tmp_len = strlen(tmp); 5176692f60a7Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5177692f60a7Smrg memcpy (concat_name, tmp, tmp_len); 5178692f60a7Smrg concat_name[tmp_len] = '/'; 5179692f60a7Smrg strcpy (concat_name + tmp_len + 1, wrapper); 5180692f60a7Smrg 5181692f60a7Smrg if (check_executable(concat_name)) 5182692f60a7Smrg return concat_name; 5183692f60a7Smrg XFREE(concat_name); 5184692f60a7Smrg return NULL; 5185692f60a7Smrg} 5186692f60a7Smrg 5187692f60a7Smrgchar * 5188692f60a7Smrgstrendzap(char *str, const char *pat) 5189692f60a7Smrg{ 5190692f60a7Smrg size_t len, patlen; 5191692f60a7Smrg 5192692f60a7Smrg assert(str != NULL); 5193692f60a7Smrg assert(pat != NULL); 5194692f60a7Smrg 5195692f60a7Smrg len = strlen(str); 5196692f60a7Smrg patlen = strlen(pat); 5197692f60a7Smrg 5198692f60a7Smrg if (patlen <= len) 5199692f60a7Smrg { 5200692f60a7Smrg str += len - patlen; 5201692f60a7Smrg if (strcmp(str, pat) == 0) 5202692f60a7Smrg *str = '\0'; 5203692f60a7Smrg } 5204692f60a7Smrg return str; 5205692f60a7Smrg} 5206692f60a7Smrg 5207692f60a7Smrgstatic void 5208692f60a7Smrglt_error_core (int exit_status, const char * mode, 5209692f60a7Smrg const char * message, va_list ap) 5210692f60a7Smrg{ 5211692f60a7Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 5212692f60a7Smrg vfprintf (stderr, message, ap); 5213692f60a7Smrg fprintf (stderr, ".\n"); 5214692f60a7Smrg 5215692f60a7Smrg if (exit_status >= 0) 5216692f60a7Smrg exit (exit_status); 5217692f60a7Smrg} 5218692f60a7Smrg 5219692f60a7Smrgvoid 5220692f60a7Smrglt_fatal (const char *message, ...) 5221692f60a7Smrg{ 5222692f60a7Smrg va_list ap; 5223692f60a7Smrg va_start (ap, message); 5224692f60a7Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5225692f60a7Smrg va_end (ap); 5226692f60a7Smrg} 5227692f60a7SmrgEOF 5228692f60a7Smrg # we should really use a build-platform specific compiler 5229692f60a7Smrg # here, but OTOH, the wrappers (shell script and this C one) 5230692f60a7Smrg # are only useful if you want to execute the "real" binary. 5231692f60a7Smrg # Since the "real" binary is built for $host, then this 5232692f60a7Smrg # wrapper might as well be built for $host, too. 5233692f60a7Smrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 5234692f60a7Smrg ;; 5235692f60a7Smrg esac 5236692f60a7Smrg $rm $output 5237692f60a7Smrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5238692f60a7Smrg 5239692f60a7Smrg $echo > $output "\ 5240692f60a7Smrg#! $SHELL 5241692f60a7Smrg 5242692f60a7Smrg# $output - temporary wrapper script for $objdir/$outputname 5243692f60a7Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5244692f60a7Smrg# 5245692f60a7Smrg# The $output program cannot be directly executed until all the libtool 5246692f60a7Smrg# libraries that it depends on are installed. 5247692f60a7Smrg# 5248692f60a7Smrg# This wrapper script should never be moved out of the build directory. 5249692f60a7Smrg# If it is, it will not operate correctly. 5250692f60a7Smrg 5251692f60a7Smrg# Sed substitution that helps us do robust quoting. It backslashifies 5252692f60a7Smrg# metacharacters that are still active within double-quoted strings. 5253692f60a7SmrgXsed='${SED} -e 1s/^X//' 5254692f60a7Smrgsed_quote_subst='$sed_quote_subst' 5255692f60a7Smrg 5256692f60a7Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 5257692f60a7Smrg# if CDPATH is set. 5258692f60a7Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5259692f60a7Smrg 5260692f60a7Smrgrelink_command=\"$relink_command\" 5261692f60a7Smrg 5262692f60a7Smrg# This environment variable determines our operation mode. 5263692f60a7Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 5264692f60a7Smrg # install mode needs the following variable: 5265692f60a7Smrg notinst_deplibs='$notinst_deplibs' 5266692f60a7Smrgelse 5267692f60a7Smrg # When we are sourced in execute mode, \$file and \$echo are already set. 5268692f60a7Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 5269692f60a7Smrg echo=\"$qecho\" 5270692f60a7Smrg file=\"\$0\" 5271692f60a7Smrg # Make sure echo works. 5272692f60a7Smrg if test \"X\$1\" = X--no-reexec; then 5273692f60a7Smrg # Discard the --no-reexec flag, and continue. 5274692f60a7Smrg shift 5275692f60a7Smrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 5276692f60a7Smrg # Yippee, \$echo works! 5277692f60a7Smrg : 5278692f60a7Smrg else 5279692f60a7Smrg # Restart under the correct shell, and then maybe \$echo will work. 5280692f60a7Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 5281692f60a7Smrg fi 5282692f60a7Smrg fi\ 5283692f60a7Smrg" 5284692f60a7Smrg $echo >> $output "\ 5285692f60a7Smrg 5286692f60a7Smrg # Find the directory that this script lives in. 5287692f60a7Smrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 5288692f60a7Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 5289692f60a7Smrg 5290692f60a7Smrg # Follow symbolic links until we get to the real thisdir. 5291692f60a7Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 5292692f60a7Smrg while test -n \"\$file\"; do 5293692f60a7Smrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 5294692f60a7Smrg 5295692f60a7Smrg # If there was a directory component, then change thisdir. 5296692f60a7Smrg if test \"x\$destdir\" != \"x\$file\"; then 5297692f60a7Smrg case \"\$destdir\" in 5298692f60a7Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5299692f60a7Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 5300692f60a7Smrg esac 5301692f60a7Smrg fi 5302692f60a7Smrg 5303692f60a7Smrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 5304692f60a7Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 5305692f60a7Smrg done 5306692f60a7Smrg 5307692f60a7Smrg # Try to get the absolute directory name. 5308692f60a7Smrg absdir=\`cd \"\$thisdir\" && pwd\` 5309692f60a7Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 5310692f60a7Smrg" 5311692f60a7Smrg 5312692f60a7Smrg if test "$fast_install" = yes; then 5313692f60a7Smrg $echo >> $output "\ 5314692f60a7Smrg program=lt-'$outputname'$exeext 5315692f60a7Smrg progdir=\"\$thisdir/$objdir\" 5316692f60a7Smrg 5317692f60a7Smrg if test ! -f \"\$progdir/\$program\" || \\ 5318692f60a7Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 5319692f60a7Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 5320692f60a7Smrg 5321692f60a7Smrg file=\"\$\$-\$program\" 5322692f60a7Smrg 5323692f60a7Smrg if test ! -d \"\$progdir\"; then 5324692f60a7Smrg $mkdir \"\$progdir\" 5325692f60a7Smrg else 5326692f60a7Smrg $rm \"\$progdir/\$file\" 5327692f60a7Smrg fi" 5328692f60a7Smrg 5329692f60a7Smrg $echo >> $output "\ 5330692f60a7Smrg 5331692f60a7Smrg # relink executable if necessary 5332692f60a7Smrg if test -n \"\$relink_command\"; then 5333692f60a7Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5334692f60a7Smrg else 5335692f60a7Smrg $echo \"\$relink_command_output\" >&2 5336692f60a7Smrg $rm \"\$progdir/\$file\" 5337692f60a7Smrg exit $EXIT_FAILURE 5338692f60a7Smrg fi 5339692f60a7Smrg fi 5340692f60a7Smrg 5341692f60a7Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5342692f60a7Smrg { $rm \"\$progdir/\$program\"; 5343692f60a7Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5344692f60a7Smrg $rm \"\$progdir/\$file\" 5345692f60a7Smrg fi" 5346692f60a7Smrg else 5347692f60a7Smrg $echo >> $output "\ 5348692f60a7Smrg program='$outputname' 5349692f60a7Smrg progdir=\"\$thisdir/$objdir\" 5350692f60a7Smrg" 5351692f60a7Smrg fi 5352692f60a7Smrg 5353692f60a7Smrg $echo >> $output "\ 5354692f60a7Smrg 5355692f60a7Smrg if test -f \"\$progdir/\$program\"; then" 5356692f60a7Smrg 5357692f60a7Smrg # Export our shlibpath_var if we have one. 5358692f60a7Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5359692f60a7Smrg $echo >> $output "\ 5360692f60a7Smrg # Add our own library path to $shlibpath_var 5361692f60a7Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 5362692f60a7Smrg 5363692f60a7Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 5364692f60a7Smrg # The second colon is a workaround for a bug in BeOS R4 sed 5365692f60a7Smrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 5366692f60a7Smrg 5367692f60a7Smrg export $shlibpath_var 5368692f60a7Smrg" 5369692f60a7Smrg fi 5370692f60a7Smrg 5371692f60a7Smrg # fixup the dll searchpath if we need to. 5372692f60a7Smrg if test -n "$dllsearchpath"; then 5373692f60a7Smrg $echo >> $output "\ 5374692f60a7Smrg # Add the dll search path components to the executable PATH 5375692f60a7Smrg PATH=$dllsearchpath:\$PATH 5376692f60a7Smrg" 5377692f60a7Smrg fi 5378692f60a7Smrg 5379692f60a7Smrg $echo >> $output "\ 5380692f60a7Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 5381692f60a7Smrg # Run the actual program with our arguments. 5382692f60a7Smrg" 5383692f60a7Smrg case $host in 5384692f60a7Smrg # Backslashes separate directories on plain windows 5385692f60a7Smrg *-*-mingw | *-*-os2*) 5386692f60a7Smrg $echo >> $output "\ 5387692f60a7Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5388692f60a7Smrg" 5389692f60a7Smrg ;; 5390692f60a7Smrg 5391692f60a7Smrg *) 5392692f60a7Smrg $echo >> $output "\ 5393692f60a7Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 5394692f60a7Smrg" 5395692f60a7Smrg ;; 5396692f60a7Smrg esac 5397692f60a7Smrg $echo >> $output "\ 5398692f60a7Smrg \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 5399692f60a7Smrg exit $EXIT_FAILURE 5400692f60a7Smrg fi 5401692f60a7Smrg else 5402692f60a7Smrg # The program doesn't exist. 5403692f60a7Smrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 5404692f60a7Smrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 5405692f60a7Smrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5406692f60a7Smrg exit $EXIT_FAILURE 5407692f60a7Smrg fi 5408692f60a7Smrgfi\ 5409692f60a7Smrg" 5410692f60a7Smrg chmod +x $output 5411692f60a7Smrg fi 5412692f60a7Smrg exit $EXIT_SUCCESS 5413692f60a7Smrg ;; 5414692f60a7Smrg esac 5415692f60a7Smrg 5416692f60a7Smrg # See if we need to build an old-fashioned archive. 5417692f60a7Smrg for oldlib in $oldlibs; do 5418692f60a7Smrg 5419692f60a7Smrg if test "$build_libtool_libs" = convenience; then 5420692f60a7Smrg oldobjs="$libobjs_save" 5421692f60a7Smrg addlibs="$convenience" 5422692f60a7Smrg build_libtool_libs=no 5423692f60a7Smrg else 5424692f60a7Smrg if test "$build_libtool_libs" = module; then 5425692f60a7Smrg oldobjs="$libobjs_save" 5426692f60a7Smrg build_libtool_libs=no 5427692f60a7Smrg else 5428692f60a7Smrg oldobjs="$old_deplibs $non_pic_objects" 5429692f60a7Smrg fi 5430692f60a7Smrg addlibs="$old_convenience" 5431692f60a7Smrg fi 5432692f60a7Smrg 5433692f60a7Smrg if test -n "$addlibs"; then 5434692f60a7Smrg gentop="$output_objdir/${outputname}x" 5435692f60a7Smrg generated="$generated $gentop" 5436692f60a7Smrg 5437692f60a7Smrg func_extract_archives $gentop $addlibs 5438692f60a7Smrg oldobjs="$oldobjs $func_extract_archives_result" 5439692f60a7Smrg fi 5440692f60a7Smrg 5441692f60a7Smrg # Do each command in the archive commands. 5442692f60a7Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5443692f60a7Smrg cmds=$old_archive_from_new_cmds 5444692f60a7Smrg else 5445692f60a7Smrg # POSIX demands no paths to be encoded in archives. We have 5446692f60a7Smrg # to avoid creating archives with duplicate basenames if we 5447692f60a7Smrg # might have to extract them afterwards, e.g., when creating a 5448692f60a7Smrg # static archive out of a convenience library, or when linking 5449692f60a7Smrg # the entirety of a libtool archive into another (currently 5450692f60a7Smrg # not supported by libtool). 5451692f60a7Smrg if (for obj in $oldobjs 5452692f60a7Smrg do 5453692f60a7Smrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 5454692f60a7Smrg done | sort | sort -uc >/dev/null 2>&1); then 5455692f60a7Smrg : 5456692f60a7Smrg else 5457692f60a7Smrg $echo "copying selected object files to avoid basename conflicts..." 5458692f60a7Smrg 5459692f60a7Smrg if test -z "$gentop"; then 5460692f60a7Smrg gentop="$output_objdir/${outputname}x" 5461692f60a7Smrg generated="$generated $gentop" 5462692f60a7Smrg 5463692f60a7Smrg $show "${rm}r $gentop" 5464692f60a7Smrg $run ${rm}r "$gentop" 5465692f60a7Smrg $show "$mkdir $gentop" 5466692f60a7Smrg $run $mkdir "$gentop" 5467692f60a7Smrg exit_status=$? 5468692f60a7Smrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 5469692f60a7Smrg exit $exit_status 5470692f60a7Smrg fi 5471692f60a7Smrg fi 5472692f60a7Smrg 5473692f60a7Smrg save_oldobjs=$oldobjs 5474692f60a7Smrg oldobjs= 5475692f60a7Smrg counter=1 5476692f60a7Smrg for obj in $save_oldobjs 5477692f60a7Smrg do 5478692f60a7Smrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 5479692f60a7Smrg case " $oldobjs " in 5480692f60a7Smrg " ") oldobjs=$obj ;; 5481692f60a7Smrg *[\ /]"$objbase "*) 5482692f60a7Smrg while :; do 5483692f60a7Smrg # Make sure we don't pick an alternate name that also 5484692f60a7Smrg # overlaps. 5485692f60a7Smrg newobj=lt$counter-$objbase 5486692f60a7Smrg counter=`expr $counter + 1` 5487692f60a7Smrg case " $oldobjs " in 5488692f60a7Smrg *[\ /]"$newobj "*) ;; 5489692f60a7Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 5490692f60a7Smrg esac 5491692f60a7Smrg done 5492692f60a7Smrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 5493692f60a7Smrg $run ln "$obj" "$gentop/$newobj" || 5494692f60a7Smrg $run cp "$obj" "$gentop/$newobj" 5495692f60a7Smrg oldobjs="$oldobjs $gentop/$newobj" 5496692f60a7Smrg ;; 5497692f60a7Smrg *) oldobjs="$oldobjs $obj" ;; 5498692f60a7Smrg esac 5499692f60a7Smrg done 5500692f60a7Smrg fi 5501692f60a7Smrg 5502692f60a7Smrg eval cmds=\"$old_archive_cmds\" 5503692f60a7Smrg 5504692f60a7Smrg if len=`expr "X$cmds" : ".*"` && 5505692f60a7Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5506692f60a7Smrg cmds=$old_archive_cmds 5507692f60a7Smrg else 5508692f60a7Smrg # the command line is too long to link in one step, link in parts 5509692f60a7Smrg $echo "using piecewise archive linking..." 5510692f60a7Smrg save_RANLIB=$RANLIB 5511692f60a7Smrg RANLIB=: 5512692f60a7Smrg objlist= 5513692f60a7Smrg concat_cmds= 5514692f60a7Smrg save_oldobjs=$oldobjs 5515692f60a7Smrg 5516692f60a7Smrg # Is there a better way of finding the last object in the list? 5517692f60a7Smrg for obj in $save_oldobjs 5518692f60a7Smrg do 5519692f60a7Smrg last_oldobj=$obj 5520692f60a7Smrg done 5521692f60a7Smrg for obj in $save_oldobjs 5522692f60a7Smrg do 5523692f60a7Smrg oldobjs="$objlist $obj" 5524692f60a7Smrg objlist="$objlist $obj" 5525692f60a7Smrg eval test_cmds=\"$old_archive_cmds\" 5526692f60a7Smrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5527692f60a7Smrg test "$len" -le "$max_cmd_len"; then 5528692f60a7Smrg : 5529692f60a7Smrg else 5530692f60a7Smrg # the above command should be used before it gets too long 5531692f60a7Smrg oldobjs=$objlist 5532692f60a7Smrg if test "$obj" = "$last_oldobj" ; then 5533692f60a7Smrg RANLIB=$save_RANLIB 5534692f60a7Smrg fi 5535692f60a7Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5536692f60a7Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 5537692f60a7Smrg objlist= 5538692f60a7Smrg fi 5539692f60a7Smrg done 5540692f60a7Smrg RANLIB=$save_RANLIB 5541692f60a7Smrg oldobjs=$objlist 5542692f60a7Smrg if test "X$oldobjs" = "X" ; then 5543692f60a7Smrg eval cmds=\"\$concat_cmds\" 5544692f60a7Smrg else 5545692f60a7Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 5546692f60a7Smrg fi 5547692f60a7Smrg fi 5548692f60a7Smrg fi 5549692f60a7Smrg save_ifs="$IFS"; IFS='~' 5550692f60a7Smrg for cmd in $cmds; do 5551692f60a7Smrg eval cmd=\"$cmd\" 5552692f60a7Smrg IFS="$save_ifs" 5553692f60a7Smrg $show "$cmd" 5554692f60a7Smrg $run eval "$cmd" || exit $? 5555692f60a7Smrg done 5556692f60a7Smrg IFS="$save_ifs" 5557692f60a7Smrg done 5558692f60a7Smrg 5559692f60a7Smrg if test -n "$generated"; then 5560692f60a7Smrg $show "${rm}r$generated" 5561692f60a7Smrg $run ${rm}r$generated 5562692f60a7Smrg fi 5563692f60a7Smrg 5564692f60a7Smrg # Now create the libtool archive. 5565692f60a7Smrg case $output in 5566692f60a7Smrg *.la) 5567692f60a7Smrg old_library= 5568692f60a7Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 5569692f60a7Smrg $show "creating $output" 5570692f60a7Smrg 5571692f60a7Smrg # Preserve any variables that may affect compiler behavior 5572692f60a7Smrg for var in $variables_saved_for_relink; do 5573692f60a7Smrg if eval test -z \"\${$var+set}\"; then 5574692f60a7Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 5575692f60a7Smrg elif eval var_value=\$$var; test -z "$var_value"; then 5576692f60a7Smrg relink_command="$var=; export $var; $relink_command" 5577692f60a7Smrg else 5578692f60a7Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 5579692f60a7Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 5580692f60a7Smrg fi 5581692f60a7Smrg done 5582692f60a7Smrg # Quote the link command for shipping. 5583692f60a7Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 5584692f60a7Smrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 5585692f60a7Smrg if test "$hardcode_automatic" = yes ; then 5586692f60a7Smrg relink_command= 5587692f60a7Smrg fi 5588692f60a7Smrg 5589692f60a7Smrg 5590692f60a7Smrg # Only create the output if not a dry run. 5591692f60a7Smrg if test -z "$run"; then 5592692f60a7Smrg for installed in no yes; do 5593692f60a7Smrg if test "$installed" = yes; then 5594692f60a7Smrg if test -z "$install_libdir"; then 5595692f60a7Smrg break 5596692f60a7Smrg fi 5597692f60a7Smrg output="$output_objdir/$outputname"i 5598692f60a7Smrg # Replace all uninstalled libtool libraries with the installed ones 5599692f60a7Smrg newdependency_libs= 5600692f60a7Smrg for deplib in $dependency_libs; do 5601692f60a7Smrg case $deplib in 5602692f60a7Smrg *.la) 5603692f60a7Smrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 5604692f60a7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5605692f60a7Smrg if test -z "$libdir"; then 5606692f60a7Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 5607692f60a7Smrg exit $EXIT_FAILURE 5608692f60a7Smrg fi 5609692f60a7Smrg newdependency_libs="$newdependency_libs $libdir/$name" 5610692f60a7Smrg ;; 5611692f60a7Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 5612692f60a7Smrg esac 5613692f60a7Smrg done 5614692f60a7Smrg dependency_libs="$newdependency_libs" 5615692f60a7Smrg newdlfiles= 5616692f60a7Smrg for lib in $dlfiles; do 5617692f60a7Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5618692f60a7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5619692f60a7Smrg if test -z "$libdir"; then 5620692f60a7Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5621692f60a7Smrg exit $EXIT_FAILURE 5622692f60a7Smrg fi 5623692f60a7Smrg newdlfiles="$newdlfiles $libdir/$name" 5624692f60a7Smrg done 5625692f60a7Smrg dlfiles="$newdlfiles" 5626692f60a7Smrg newdlprefiles= 5627692f60a7Smrg for lib in $dlprefiles; do 5628692f60a7Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5629692f60a7Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5630692f60a7Smrg if test -z "$libdir"; then 5631692f60a7Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5632692f60a7Smrg exit $EXIT_FAILURE 5633692f60a7Smrg fi 5634692f60a7Smrg newdlprefiles="$newdlprefiles $libdir/$name" 5635692f60a7Smrg done 5636692f60a7Smrg dlprefiles="$newdlprefiles" 5637692f60a7Smrg else 5638692f60a7Smrg newdlfiles= 5639692f60a7Smrg for lib in $dlfiles; do 5640692f60a7Smrg case $lib in 5641692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5642692f60a7Smrg *) abs=`pwd`"/$lib" ;; 5643692f60a7Smrg esac 5644692f60a7Smrg newdlfiles="$newdlfiles $abs" 5645692f60a7Smrg done 5646692f60a7Smrg dlfiles="$newdlfiles" 5647692f60a7Smrg newdlprefiles= 5648692f60a7Smrg for lib in $dlprefiles; do 5649692f60a7Smrg case $lib in 5650692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5651692f60a7Smrg *) abs=`pwd`"/$lib" ;; 5652692f60a7Smrg esac 5653692f60a7Smrg newdlprefiles="$newdlprefiles $abs" 5654692f60a7Smrg done 5655692f60a7Smrg dlprefiles="$newdlprefiles" 5656692f60a7Smrg fi 5657692f60a7Smrg $rm $output 5658692f60a7Smrg # place dlname in correct position for cygwin 5659692f60a7Smrg tdlname=$dlname 5660692f60a7Smrg case $host,$output,$installed,$module,$dlname in 5661692f60a7Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 5662692f60a7Smrg esac 5663692f60a7Smrg $echo > $output "\ 5664692f60a7Smrg# $outputname - a libtool library file 5665692f60a7Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5666692f60a7Smrg# 5667692f60a7Smrg# Please DO NOT delete this file! 5668692f60a7Smrg# It is necessary for linking the library. 5669692f60a7Smrg 5670692f60a7Smrg# The name that we can dlopen(3). 5671692f60a7Smrgdlname='$tdlname' 5672692f60a7Smrg 5673692f60a7Smrg# Names of this library. 5674692f60a7Smrglibrary_names='$library_names' 5675692f60a7Smrg 5676692f60a7Smrg# The name of the static archive. 5677692f60a7Smrgold_library='$old_library' 5678692f60a7Smrg 5679692f60a7Smrg# Libraries that this one depends upon. 5680692f60a7Smrgdependency_libs='$dependency_libs' 5681692f60a7Smrg 5682692f60a7Smrg# Version information for $libname. 5683692f60a7Smrgcurrent=$current 5684692f60a7Smrgage=$age 5685692f60a7Smrgrevision=$revision 5686692f60a7Smrg 5687692f60a7Smrg# Is this an already installed library? 5688692f60a7Smrginstalled=$installed 5689692f60a7Smrg 5690692f60a7Smrg# Should we warn about portability when linking against -modules? 5691692f60a7Smrgshouldnotlink=$module 5692692f60a7Smrg 5693692f60a7Smrg# Files to dlopen/dlpreopen 5694692f60a7Smrgdlopen='$dlfiles' 5695692f60a7Smrgdlpreopen='$dlprefiles' 5696692f60a7Smrg 5697692f60a7Smrg# Directory that this library needs to be installed in: 5698692f60a7Smrglibdir='$install_libdir'" 5699692f60a7Smrg if test "$installed" = no && test "$need_relink" = yes; then 5700692f60a7Smrg $echo >> $output "\ 5701692f60a7Smrgrelink_command=\"$relink_command\"" 5702692f60a7Smrg fi 5703692f60a7Smrg done 5704692f60a7Smrg fi 5705692f60a7Smrg 5706692f60a7Smrg # Do a symbolic link so that the libtool archive can be found in 5707692f60a7Smrg # LD_LIBRARY_PATH before the program is installed. 5708692f60a7Smrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 5709692f60a7Smrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 5710692f60a7Smrg ;; 5711692f60a7Smrg esac 5712692f60a7Smrg exit $EXIT_SUCCESS 5713692f60a7Smrg ;; 5714692f60a7Smrg 5715692f60a7Smrg # libtool install mode 5716692f60a7Smrg install) 5717692f60a7Smrg modename="$modename: install" 5718692f60a7Smrg 5719692f60a7Smrg # There may be an optional sh(1) argument at the beginning of 5720692f60a7Smrg # install_prog (especially on Windows NT). 5721692f60a7Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5722692f60a7Smrg # Allow the use of GNU shtool's install command. 5723692f60a7Smrg $echo "X$nonopt" | grep shtool > /dev/null; then 5724692f60a7Smrg # Aesthetically quote it. 5725692f60a7Smrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5726692f60a7Smrg case $arg in 5727692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5728692f60a7Smrg arg="\"$arg\"" 5729692f60a7Smrg ;; 5730692f60a7Smrg esac 5731692f60a7Smrg install_prog="$arg " 5732692f60a7Smrg arg="$1" 5733692f60a7Smrg shift 5734692f60a7Smrg else 5735692f60a7Smrg install_prog= 5736692f60a7Smrg arg=$nonopt 5737692f60a7Smrg fi 5738692f60a7Smrg 5739692f60a7Smrg # The real first argument should be the name of the installation program. 5740692f60a7Smrg # Aesthetically quote it. 5741692f60a7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5742692f60a7Smrg case $arg in 5743692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5744692f60a7Smrg arg="\"$arg\"" 5745692f60a7Smrg ;; 5746692f60a7Smrg esac 5747692f60a7Smrg install_prog="$install_prog$arg" 5748692f60a7Smrg 5749692f60a7Smrg # We need to accept at least all the BSD install flags. 5750692f60a7Smrg dest= 5751692f60a7Smrg files= 5752692f60a7Smrg opts= 5753692f60a7Smrg prev= 5754692f60a7Smrg install_type= 5755692f60a7Smrg isdir=no 5756692f60a7Smrg stripme= 5757692f60a7Smrg for arg 5758692f60a7Smrg do 5759692f60a7Smrg if test -n "$dest"; then 5760692f60a7Smrg files="$files $dest" 5761692f60a7Smrg dest=$arg 5762692f60a7Smrg continue 5763692f60a7Smrg fi 5764692f60a7Smrg 5765692f60a7Smrg case $arg in 5766692f60a7Smrg -d) isdir=yes ;; 5767692f60a7Smrg -f) 5768692f60a7Smrg case " $install_prog " in 5769692f60a7Smrg *[\\\ /]cp\ *) ;; 5770692f60a7Smrg *) prev=$arg ;; 5771692f60a7Smrg esac 5772692f60a7Smrg ;; 5773692f60a7Smrg -g | -m | -o) prev=$arg ;; 5774692f60a7Smrg -s) 5775692f60a7Smrg stripme=" -s" 5776692f60a7Smrg continue 5777692f60a7Smrg ;; 5778692f60a7Smrg -*) 5779692f60a7Smrg ;; 5780692f60a7Smrg *) 5781692f60a7Smrg # If the previous option needed an argument, then skip it. 5782692f60a7Smrg if test -n "$prev"; then 5783692f60a7Smrg prev= 5784692f60a7Smrg else 5785692f60a7Smrg dest=$arg 5786692f60a7Smrg continue 5787692f60a7Smrg fi 5788692f60a7Smrg ;; 5789692f60a7Smrg esac 5790692f60a7Smrg 5791692f60a7Smrg # Aesthetically quote the argument. 5792692f60a7Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5793692f60a7Smrg case $arg in 5794692f60a7Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5795692f60a7Smrg arg="\"$arg\"" 5796692f60a7Smrg ;; 5797692f60a7Smrg esac 5798692f60a7Smrg install_prog="$install_prog $arg" 5799692f60a7Smrg done 5800692f60a7Smrg 5801692f60a7Smrg if test -z "$install_prog"; then 5802692f60a7Smrg $echo "$modename: you must specify an install program" 1>&2 5803692f60a7Smrg $echo "$help" 1>&2 5804692f60a7Smrg exit $EXIT_FAILURE 5805692f60a7Smrg fi 5806692f60a7Smrg 5807692f60a7Smrg if test -n "$prev"; then 5808692f60a7Smrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 5809692f60a7Smrg $echo "$help" 1>&2 5810692f60a7Smrg exit $EXIT_FAILURE 5811692f60a7Smrg fi 5812692f60a7Smrg 5813692f60a7Smrg if test -z "$files"; then 5814692f60a7Smrg if test -z "$dest"; then 5815692f60a7Smrg $echo "$modename: no file or destination specified" 1>&2 5816692f60a7Smrg else 5817692f60a7Smrg $echo "$modename: you must specify a destination" 1>&2 5818692f60a7Smrg fi 5819692f60a7Smrg $echo "$help" 1>&2 5820692f60a7Smrg exit $EXIT_FAILURE 5821692f60a7Smrg fi 5822692f60a7Smrg 5823692f60a7Smrg # Strip any trailing slash from the destination. 5824692f60a7Smrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 5825692f60a7Smrg 5826692f60a7Smrg # Check to see that the destination is a directory. 5827692f60a7Smrg test -d "$dest" && isdir=yes 5828692f60a7Smrg if test "$isdir" = yes; then 5829692f60a7Smrg destdir="$dest" 5830692f60a7Smrg destname= 5831692f60a7Smrg else 5832692f60a7Smrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 5833692f60a7Smrg test "X$destdir" = "X$dest" && destdir=. 5834692f60a7Smrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 5835692f60a7Smrg 5836692f60a7Smrg # Not a directory, so check to see that there is only one file specified. 5837692f60a7Smrg set dummy $files 5838692f60a7Smrg if test "$#" -gt 2; then 5839692f60a7Smrg $echo "$modename: \`$dest' is not a directory" 1>&2 5840692f60a7Smrg $echo "$help" 1>&2 5841692f60a7Smrg exit $EXIT_FAILURE 5842692f60a7Smrg fi 5843692f60a7Smrg fi 5844692f60a7Smrg case $destdir in 5845692f60a7Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 5846692f60a7Smrg *) 5847692f60a7Smrg for file in $files; do 5848692f60a7Smrg case $file in 5849692f60a7Smrg *.lo) ;; 5850692f60a7Smrg *) 5851692f60a7Smrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 5852692f60a7Smrg $echo "$help" 1>&2 5853692f60a7Smrg exit $EXIT_FAILURE 5854692f60a7Smrg ;; 5855692f60a7Smrg esac 5856692f60a7Smrg done 5857692f60a7Smrg ;; 5858692f60a7Smrg esac 5859692f60a7Smrg 5860692f60a7Smrg # This variable tells wrapper scripts just to set variables rather 5861692f60a7Smrg # than running their programs. 5862692f60a7Smrg libtool_install_magic="$magic" 5863692f60a7Smrg 5864692f60a7Smrg staticlibs= 5865692f60a7Smrg future_libdirs= 5866692f60a7Smrg current_libdirs= 5867692f60a7Smrg for file in $files; do 5868692f60a7Smrg 5869692f60a7Smrg # Do each installation. 5870692f60a7Smrg case $file in 5871692f60a7Smrg *.$libext) 5872692f60a7Smrg # Do the static libraries later. 5873692f60a7Smrg staticlibs="$staticlibs $file" 5874692f60a7Smrg ;; 5875692f60a7Smrg 5876692f60a7Smrg *.la) 5877692f60a7Smrg # Check to see that this really is a libtool archive. 5878692f60a7Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 5879692f60a7Smrg else 5880692f60a7Smrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 5881692f60a7Smrg $echo "$help" 1>&2 5882692f60a7Smrg exit $EXIT_FAILURE 5883692f60a7Smrg fi 5884692f60a7Smrg 5885692f60a7Smrg library_names= 5886692f60a7Smrg old_library= 5887692f60a7Smrg relink_command= 5888692f60a7Smrg # If there is no directory component, then add one. 5889692f60a7Smrg case $file in 5890692f60a7Smrg */* | *\\*) . $file ;; 5891692f60a7Smrg *) . ./$file ;; 5892692f60a7Smrg esac 5893692f60a7Smrg 5894692f60a7Smrg # Add the libdir to current_libdirs if it is the destination. 5895692f60a7Smrg if test "X$destdir" = "X$libdir"; then 5896692f60a7Smrg case "$current_libdirs " in 5897692f60a7Smrg *" $libdir "*) ;; 5898692f60a7Smrg *) current_libdirs="$current_libdirs $libdir" ;; 5899692f60a7Smrg esac 5900692f60a7Smrg else 5901692f60a7Smrg # Note the libdir as a future libdir. 5902692f60a7Smrg case "$future_libdirs " in 5903692f60a7Smrg *" $libdir "*) ;; 5904692f60a7Smrg *) future_libdirs="$future_libdirs $libdir" ;; 5905692f60a7Smrg esac 5906692f60a7Smrg fi 5907692f60a7Smrg 5908692f60a7Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 5909692f60a7Smrg test "X$dir" = "X$file/" && dir= 5910692f60a7Smrg dir="$dir$objdir" 5911692f60a7Smrg 5912692f60a7Smrg if test -n "$relink_command"; then 5913692f60a7Smrg # Determine the prefix the user has applied to our future dir. 5914692f60a7Smrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 5915692f60a7Smrg 5916692f60a7Smrg # Don't allow the user to place us outside of our expected 5917692f60a7Smrg # location b/c this prevents finding dependent libraries that 5918692f60a7Smrg # are installed to the same prefix. 5919692f60a7Smrg # At present, this check doesn't affect windows .dll's that 5920692f60a7Smrg # are installed into $libdir/../bin (currently, that works fine) 5921692f60a7Smrg # but it's something to keep an eye on. 5922692f60a7Smrg if test "$inst_prefix_dir" = "$destdir"; then 5923692f60a7Smrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 5924692f60a7Smrg exit $EXIT_FAILURE 5925692f60a7Smrg fi 5926692f60a7Smrg 5927692f60a7Smrg if test -n "$inst_prefix_dir"; then 5928692f60a7Smrg # Stick the inst_prefix_dir data into the link command. 5929692f60a7Smrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 5930692f60a7Smrg else 5931692f60a7Smrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 5932692f60a7Smrg fi 5933692f60a7Smrg 5934692f60a7Smrg $echo "$modename: warning: relinking \`$file'" 1>&2 5935692f60a7Smrg $show "$relink_command" 5936692f60a7Smrg if $run eval "$relink_command"; then : 5937692f60a7Smrg else 5938692f60a7Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 5939692f60a7Smrg exit $EXIT_FAILURE 5940692f60a7Smrg fi 5941692f60a7Smrg fi 5942692f60a7Smrg 5943692f60a7Smrg # See the names of the shared library. 5944692f60a7Smrg set dummy $library_names 5945692f60a7Smrg if test -n "$2"; then 5946692f60a7Smrg realname="$2" 5947692f60a7Smrg shift 5948692f60a7Smrg shift 5949692f60a7Smrg 5950692f60a7Smrg srcname="$realname" 5951692f60a7Smrg test -n "$relink_command" && srcname="$realname"T 5952692f60a7Smrg 5953692f60a7Smrg # Install the shared library and build the symlinks. 5954692f60a7Smrg $show "$install_prog $dir/$srcname $destdir/$realname" 5955692f60a7Smrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 5956692f60a7Smrg if test -n "$stripme" && test -n "$striplib"; then 5957692f60a7Smrg $show "$striplib $destdir/$realname" 5958692f60a7Smrg $run eval "$striplib $destdir/$realname" || exit $? 5959692f60a7Smrg fi 5960692f60a7Smrg 5961692f60a7Smrg if test "$#" -gt 0; then 5962692f60a7Smrg # Delete the old symlinks, and create new ones. 5963692f60a7Smrg # Try `ln -sf' first, because the `ln' binary might depend on 5964692f60a7Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 5965692f60a7Smrg # so we also need to try rm && ln -s. 5966692f60a7Smrg for linkname 5967692f60a7Smrg do 5968692f60a7Smrg if test "$linkname" != "$realname"; then 5969692f60a7Smrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 5970692f60a7Smrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 5971692f60a7Smrg fi 5972692f60a7Smrg done 5973692f60a7Smrg fi 5974692f60a7Smrg 5975692f60a7Smrg # Do each command in the postinstall commands. 5976692f60a7Smrg lib="$destdir/$realname" 5977692f60a7Smrg cmds=$postinstall_cmds 5978692f60a7Smrg save_ifs="$IFS"; IFS='~' 5979692f60a7Smrg for cmd in $cmds; do 5980692f60a7Smrg IFS="$save_ifs" 5981692f60a7Smrg eval cmd=\"$cmd\" 5982692f60a7Smrg $show "$cmd" 5983692f60a7Smrg $run eval "$cmd" || { 5984692f60a7Smrg lt_exit=$? 5985692f60a7Smrg 5986692f60a7Smrg # Restore the uninstalled library and exit 5987692f60a7Smrg if test "$mode" = relink; then 5988692f60a7Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 5989692f60a7Smrg fi 5990692f60a7Smrg 5991692f60a7Smrg exit $lt_exit 5992692f60a7Smrg } 5993692f60a7Smrg done 5994692f60a7Smrg IFS="$save_ifs" 5995692f60a7Smrg fi 5996692f60a7Smrg 5997692f60a7Smrg # Install the pseudo-library for information purposes. 5998692f60a7Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 5999692f60a7Smrg instname="$dir/$name"i 6000692f60a7Smrg $show "$install_prog $instname $destdir/$name" 6001692f60a7Smrg $run eval "$install_prog $instname $destdir/$name" || exit $? 6002692f60a7Smrg 6003692f60a7Smrg # Maybe install the static library, too. 6004692f60a7Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 6005692f60a7Smrg ;; 6006692f60a7Smrg 6007692f60a7Smrg *.lo) 6008692f60a7Smrg # Install (i.e. copy) a libtool object. 6009692f60a7Smrg 6010692f60a7Smrg # Figure out destination file name, if it wasn't already specified. 6011692f60a7Smrg if test -n "$destname"; then 6012692f60a7Smrg destfile="$destdir/$destname" 6013692f60a7Smrg else 6014692f60a7Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6015692f60a7Smrg destfile="$destdir/$destfile" 6016692f60a7Smrg fi 6017692f60a7Smrg 6018692f60a7Smrg # Deduce the name of the destination old-style object file. 6019692f60a7Smrg case $destfile in 6020692f60a7Smrg *.lo) 6021692f60a7Smrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 6022692f60a7Smrg ;; 6023692f60a7Smrg *.$objext) 6024692f60a7Smrg staticdest="$destfile" 6025692f60a7Smrg destfile= 6026692f60a7Smrg ;; 6027692f60a7Smrg *) 6028692f60a7Smrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 6029692f60a7Smrg $echo "$help" 1>&2 6030692f60a7Smrg exit $EXIT_FAILURE 6031692f60a7Smrg ;; 6032692f60a7Smrg esac 6033692f60a7Smrg 6034692f60a7Smrg # Install the libtool object if requested. 6035692f60a7Smrg if test -n "$destfile"; then 6036692f60a7Smrg $show "$install_prog $file $destfile" 6037692f60a7Smrg $run eval "$install_prog $file $destfile" || exit $? 6038692f60a7Smrg fi 6039692f60a7Smrg 6040692f60a7Smrg # Install the old object if enabled. 6041692f60a7Smrg if test "$build_old_libs" = yes; then 6042692f60a7Smrg # Deduce the name of the old-style object file. 6043692f60a7Smrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 6044692f60a7Smrg 6045692f60a7Smrg $show "$install_prog $staticobj $staticdest" 6046692f60a7Smrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 6047692f60a7Smrg fi 6048692f60a7Smrg exit $EXIT_SUCCESS 6049692f60a7Smrg ;; 6050692f60a7Smrg 6051692f60a7Smrg *) 6052692f60a7Smrg # Figure out destination file name, if it wasn't already specified. 6053692f60a7Smrg if test -n "$destname"; then 6054692f60a7Smrg destfile="$destdir/$destname" 6055692f60a7Smrg else 6056692f60a7Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6057692f60a7Smrg destfile="$destdir/$destfile" 6058692f60a7Smrg fi 6059692f60a7Smrg 6060692f60a7Smrg # If the file is missing, and there is a .exe on the end, strip it 6061692f60a7Smrg # because it is most likely a libtool script we actually want to 6062692f60a7Smrg # install 6063692f60a7Smrg stripped_ext="" 6064692f60a7Smrg case $file in 6065692f60a7Smrg *.exe) 6066692f60a7Smrg if test ! -f "$file"; then 6067692f60a7Smrg file=`$echo $file|${SED} 's,.exe$,,'` 6068692f60a7Smrg stripped_ext=".exe" 6069692f60a7Smrg fi 6070692f60a7Smrg ;; 6071692f60a7Smrg esac 6072692f60a7Smrg 6073692f60a7Smrg # Do a test to see if this is really a libtool program. 6074692f60a7Smrg case $host in 6075692f60a7Smrg *cygwin*|*mingw*) 6076692f60a7Smrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 6077692f60a7Smrg ;; 6078692f60a7Smrg *) 6079692f60a7Smrg wrapper=$file 6080692f60a7Smrg ;; 6081692f60a7Smrg esac 6082692f60a7Smrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6083692f60a7Smrg notinst_deplibs= 6084692f60a7Smrg relink_command= 6085692f60a7Smrg 6086692f60a7Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 6087692f60a7Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 6088692f60a7Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 6089692f60a7Smrg # `FILE.' does not work on cygwin managed mounts. 6090692f60a7Smrg # 6091692f60a7Smrg # If there is no directory component, then add one. 6092692f60a7Smrg case $wrapper in 6093692f60a7Smrg */* | *\\*) . ${wrapper} ;; 6094692f60a7Smrg *) . ./${wrapper} ;; 6095692f60a7Smrg esac 6096692f60a7Smrg 6097692f60a7Smrg # Check the variables that should have been set. 6098692f60a7Smrg if test -z "$notinst_deplibs"; then 6099692f60a7Smrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6100692f60a7Smrg exit $EXIT_FAILURE 6101692f60a7Smrg fi 6102692f60a7Smrg 6103692f60a7Smrg finalize=yes 6104692f60a7Smrg for lib in $notinst_deplibs; do 6105692f60a7Smrg # Check to see that each library is installed. 6106692f60a7Smrg libdir= 6107692f60a7Smrg if test -f "$lib"; then 6108692f60a7Smrg # If there is no directory component, then add one. 6109692f60a7Smrg case $lib in 6110692f60a7Smrg */* | *\\*) . $lib ;; 6111692f60a7Smrg *) . ./$lib ;; 6112692f60a7Smrg esac 6113692f60a7Smrg fi 6114692f60a7Smrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 6115692f60a7Smrg if test -n "$libdir" && test ! -f "$libfile"; then 6116692f60a7Smrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 6117692f60a7Smrg finalize=no 6118692f60a7Smrg fi 6119692f60a7Smrg done 6120692f60a7Smrg 6121692f60a7Smrg relink_command= 6122692f60a7Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 6123692f60a7Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 6124692f60a7Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 6125692f60a7Smrg # `FILE.' does not work on cygwin managed mounts. 6126692f60a7Smrg # 6127692f60a7Smrg # If there is no directory component, then add one. 6128692f60a7Smrg case $wrapper in 6129692f60a7Smrg */* | *\\*) . ${wrapper} ;; 6130692f60a7Smrg *) . ./${wrapper} ;; 6131692f60a7Smrg esac 6132692f60a7Smrg 6133692f60a7Smrg outputname= 6134692f60a7Smrg if test "$fast_install" = no && test -n "$relink_command"; then 6135692f60a7Smrg if test "$finalize" = yes && test -z "$run"; then 6136692f60a7Smrg tmpdir=`func_mktempdir` 6137692f60a7Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6138692f60a7Smrg outputname="$tmpdir/$file" 6139692f60a7Smrg # Replace the output file specification. 6140692f60a7Smrg relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 6141692f60a7Smrg 6142692f60a7Smrg $show "$relink_command" 6143692f60a7Smrg if $run eval "$relink_command"; then : 6144692f60a7Smrg else 6145692f60a7Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6146692f60a7Smrg ${rm}r "$tmpdir" 6147692f60a7Smrg continue 6148692f60a7Smrg fi 6149692f60a7Smrg file="$outputname" 6150692f60a7Smrg else 6151692f60a7Smrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 6152692f60a7Smrg fi 6153692f60a7Smrg else 6154692f60a7Smrg # Install the binary that we compiled earlier. 6155692f60a7Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 6156692f60a7Smrg fi 6157692f60a7Smrg fi 6158692f60a7Smrg 6159692f60a7Smrg # remove .exe since cygwin /usr/bin/install will append another 6160692f60a7Smrg # one anyway 6161692f60a7Smrg case $install_prog,$host in 6162692f60a7Smrg */usr/bin/install*,*cygwin*) 6163692f60a7Smrg case $file:$destfile in 6164692f60a7Smrg *.exe:*.exe) 6165692f60a7Smrg # this is ok 6166692f60a7Smrg ;; 6167692f60a7Smrg *.exe:*) 6168692f60a7Smrg destfile=$destfile.exe 6169692f60a7Smrg ;; 6170692f60a7Smrg *:*.exe) 6171692f60a7Smrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 6172692f60a7Smrg ;; 6173692f60a7Smrg esac 6174692f60a7Smrg ;; 6175692f60a7Smrg esac 6176692f60a7Smrg $show "$install_prog$stripme $file $destfile" 6177692f60a7Smrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 6178692f60a7Smrg test -n "$outputname" && ${rm}r "$tmpdir" 6179692f60a7Smrg ;; 6180692f60a7Smrg esac 6181692f60a7Smrg done 6182692f60a7Smrg 6183692f60a7Smrg for file in $staticlibs; do 6184692f60a7Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6185692f60a7Smrg 6186692f60a7Smrg # Set up the ranlib parameters. 6187692f60a7Smrg oldlib="$destdir/$name" 6188692f60a7Smrg 6189692f60a7Smrg $show "$install_prog $file $oldlib" 6190692f60a7Smrg $run eval "$install_prog \$file \$oldlib" || exit $? 6191692f60a7Smrg 6192692f60a7Smrg if test -n "$stripme" && test -n "$old_striplib"; then 6193692f60a7Smrg $show "$old_striplib $oldlib" 6194692f60a7Smrg $run eval "$old_striplib $oldlib" || exit $? 6195692f60a7Smrg fi 6196692f60a7Smrg 6197692f60a7Smrg # Do each command in the postinstall commands. 6198692f60a7Smrg cmds=$old_postinstall_cmds 6199692f60a7Smrg save_ifs="$IFS"; IFS='~' 6200692f60a7Smrg for cmd in $cmds; do 6201692f60a7Smrg IFS="$save_ifs" 6202692f60a7Smrg eval cmd=\"$cmd\" 6203692f60a7Smrg $show "$cmd" 6204692f60a7Smrg $run eval "$cmd" || exit $? 6205692f60a7Smrg done 6206692f60a7Smrg IFS="$save_ifs" 6207692f60a7Smrg done 6208692f60a7Smrg 6209692f60a7Smrg if test -n "$future_libdirs"; then 6210692f60a7Smrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 6211692f60a7Smrg fi 6212692f60a7Smrg 6213692f60a7Smrg if test -n "$current_libdirs"; then 6214692f60a7Smrg # Maybe just do a dry run. 6215692f60a7Smrg test -n "$run" && current_libdirs=" -n$current_libdirs" 6216692f60a7Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 6217692f60a7Smrg else 6218692f60a7Smrg exit $EXIT_SUCCESS 6219692f60a7Smrg fi 6220692f60a7Smrg ;; 6221692f60a7Smrg 6222692f60a7Smrg # libtool finish mode 6223692f60a7Smrg finish) 6224692f60a7Smrg modename="$modename: finish" 6225692f60a7Smrg libdirs="$nonopt" 6226692f60a7Smrg admincmds= 6227692f60a7Smrg 6228692f60a7Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 6229692f60a7Smrg for dir 6230692f60a7Smrg do 6231692f60a7Smrg libdirs="$libdirs $dir" 6232692f60a7Smrg done 6233692f60a7Smrg 6234692f60a7Smrg for libdir in $libdirs; do 6235692f60a7Smrg if test -n "$finish_cmds"; then 6236692f60a7Smrg # Do each command in the finish commands. 6237692f60a7Smrg cmds=$finish_cmds 6238692f60a7Smrg save_ifs="$IFS"; IFS='~' 6239692f60a7Smrg for cmd in $cmds; do 6240692f60a7Smrg IFS="$save_ifs" 6241692f60a7Smrg eval cmd=\"$cmd\" 6242692f60a7Smrg $show "$cmd" 6243692f60a7Smrg $run eval "$cmd" || admincmds="$admincmds 6244692f60a7Smrg $cmd" 6245692f60a7Smrg done 6246692f60a7Smrg IFS="$save_ifs" 6247692f60a7Smrg fi 6248692f60a7Smrg if test -n "$finish_eval"; then 6249692f60a7Smrg # Do the single finish_eval. 6250692f60a7Smrg eval cmds=\"$finish_eval\" 6251692f60a7Smrg $run eval "$cmds" || admincmds="$admincmds 6252692f60a7Smrg $cmds" 6253692f60a7Smrg fi 6254692f60a7Smrg done 6255692f60a7Smrg fi 6256692f60a7Smrg 6257692f60a7Smrg # Exit here if they wanted silent mode. 6258692f60a7Smrg test "$show" = : && exit $EXIT_SUCCESS 6259692f60a7Smrg 6260692f60a7Smrg $echo "X----------------------------------------------------------------------" | $Xsed 6261692f60a7Smrg $echo "Libraries have been installed in:" 6262692f60a7Smrg for libdir in $libdirs; do 6263692f60a7Smrg $echo " $libdir" 6264692f60a7Smrg done 6265692f60a7Smrg $echo 6266692f60a7Smrg $echo "If you ever happen to want to link against installed libraries" 6267692f60a7Smrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 6268692f60a7Smrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 6269692f60a7Smrg $echo "flag during linking and do at least one of the following:" 6270692f60a7Smrg if test -n "$shlibpath_var"; then 6271692f60a7Smrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 6272692f60a7Smrg $echo " during execution" 6273692f60a7Smrg fi 6274692f60a7Smrg if test -n "$runpath_var"; then 6275692f60a7Smrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 6276692f60a7Smrg $echo " during linking" 6277692f60a7Smrg fi 6278692f60a7Smrg if test -n "$hardcode_libdir_flag_spec"; then 6279692f60a7Smrg libdir=LIBDIR 6280692f60a7Smrg eval flag=\"$hardcode_libdir_flag_spec\" 6281692f60a7Smrg 6282692f60a7Smrg $echo " - use the \`$flag' linker flag" 6283692f60a7Smrg fi 6284692f60a7Smrg if test -n "$admincmds"; then 6285692f60a7Smrg $echo " - have your system administrator run these commands:$admincmds" 6286692f60a7Smrg fi 6287692f60a7Smrg if test -f /etc/ld.so.conf; then 6288692f60a7Smrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6289692f60a7Smrg fi 6290692f60a7Smrg $echo 6291692f60a7Smrg $echo "See any operating system documentation about shared libraries for" 6292692f60a7Smrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6293692f60a7Smrg $echo "X----------------------------------------------------------------------" | $Xsed 6294692f60a7Smrg exit $EXIT_SUCCESS 6295692f60a7Smrg ;; 6296692f60a7Smrg 6297692f60a7Smrg # libtool execute mode 6298692f60a7Smrg execute) 6299692f60a7Smrg modename="$modename: execute" 6300692f60a7Smrg 6301692f60a7Smrg # The first argument is the command name. 6302692f60a7Smrg cmd="$nonopt" 6303692f60a7Smrg if test -z "$cmd"; then 6304692f60a7Smrg $echo "$modename: you must specify a COMMAND" 1>&2 6305692f60a7Smrg $echo "$help" 6306692f60a7Smrg exit $EXIT_FAILURE 6307692f60a7Smrg fi 6308692f60a7Smrg 6309692f60a7Smrg # Handle -dlopen flags immediately. 6310692f60a7Smrg for file in $execute_dlfiles; do 6311692f60a7Smrg if test ! -f "$file"; then 6312692f60a7Smrg $echo "$modename: \`$file' is not a file" 1>&2 6313692f60a7Smrg $echo "$help" 1>&2 6314692f60a7Smrg exit $EXIT_FAILURE 6315692f60a7Smrg fi 6316692f60a7Smrg 6317692f60a7Smrg dir= 6318692f60a7Smrg case $file in 6319692f60a7Smrg *.la) 6320692f60a7Smrg # Check to see that this really is a libtool archive. 6321692f60a7Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 6322692f60a7Smrg else 6323692f60a7Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 6324692f60a7Smrg $echo "$help" 1>&2 6325692f60a7Smrg exit $EXIT_FAILURE 6326692f60a7Smrg fi 6327692f60a7Smrg 6328692f60a7Smrg # Read the libtool library. 6329692f60a7Smrg dlname= 6330692f60a7Smrg library_names= 6331692f60a7Smrg 6332692f60a7Smrg # If there is no directory component, then add one. 6333692f60a7Smrg case $file in 6334692f60a7Smrg */* | *\\*) . $file ;; 6335692f60a7Smrg *) . ./$file ;; 6336692f60a7Smrg esac 6337692f60a7Smrg 6338692f60a7Smrg # Skip this library if it cannot be dlopened. 6339692f60a7Smrg if test -z "$dlname"; then 6340692f60a7Smrg # Warn if it was a shared library. 6341692f60a7Smrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 6342692f60a7Smrg continue 6343692f60a7Smrg fi 6344692f60a7Smrg 6345692f60a7Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6346692f60a7Smrg test "X$dir" = "X$file" && dir=. 6347692f60a7Smrg 6348692f60a7Smrg if test -f "$dir/$objdir/$dlname"; then 6349692f60a7Smrg dir="$dir/$objdir" 6350692f60a7Smrg else 6351692f60a7Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 6352692f60a7Smrg exit $EXIT_FAILURE 6353692f60a7Smrg fi 6354692f60a7Smrg ;; 6355692f60a7Smrg 6356692f60a7Smrg *.lo) 6357692f60a7Smrg # Just add the directory containing the .lo file. 6358692f60a7Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6359692f60a7Smrg test "X$dir" = "X$file" && dir=. 6360692f60a7Smrg ;; 6361692f60a7Smrg 6362692f60a7Smrg *) 6363692f60a7Smrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 6364692f60a7Smrg continue 6365692f60a7Smrg ;; 6366692f60a7Smrg esac 6367692f60a7Smrg 6368692f60a7Smrg # Get the absolute pathname. 6369692f60a7Smrg absdir=`cd "$dir" && pwd` 6370692f60a7Smrg test -n "$absdir" && dir="$absdir" 6371692f60a7Smrg 6372692f60a7Smrg # Now add the directory to shlibpath_var. 6373692f60a7Smrg if eval "test -z \"\$$shlibpath_var\""; then 6374692f60a7Smrg eval "$shlibpath_var=\"\$dir\"" 6375692f60a7Smrg else 6376692f60a7Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 6377692f60a7Smrg fi 6378692f60a7Smrg done 6379692f60a7Smrg 6380692f60a7Smrg # This variable tells wrapper scripts just to set shlibpath_var 6381692f60a7Smrg # rather than running their programs. 6382692f60a7Smrg libtool_execute_magic="$magic" 6383692f60a7Smrg 6384692f60a7Smrg # Check if any of the arguments is a wrapper script. 6385692f60a7Smrg args= 6386692f60a7Smrg for file 6387692f60a7Smrg do 6388692f60a7Smrg case $file in 6389692f60a7Smrg -*) ;; 6390692f60a7Smrg *) 6391692f60a7Smrg # Do a test to see if this is really a libtool program. 6392692f60a7Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6393692f60a7Smrg # If there is no directory component, then add one. 6394692f60a7Smrg case $file in 6395692f60a7Smrg */* | *\\*) . $file ;; 6396692f60a7Smrg *) . ./$file ;; 6397692f60a7Smrg esac 6398692f60a7Smrg 6399692f60a7Smrg # Transform arg to wrapped name. 6400692f60a7Smrg file="$progdir/$program" 6401692f60a7Smrg fi 6402692f60a7Smrg ;; 6403692f60a7Smrg esac 6404692f60a7Smrg # Quote arguments (to preserve shell metacharacters). 6405692f60a7Smrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 6406692f60a7Smrg args="$args \"$file\"" 6407692f60a7Smrg done 6408692f60a7Smrg 6409692f60a7Smrg if test -z "$run"; then 6410692f60a7Smrg if test -n "$shlibpath_var"; then 6411692f60a7Smrg # Export the shlibpath_var. 6412692f60a7Smrg eval "export $shlibpath_var" 6413692f60a7Smrg fi 6414692f60a7Smrg 6415692f60a7Smrg # Restore saved environment variables 6416692f60a7Smrg if test "${save_LC_ALL+set}" = set; then 6417692f60a7Smrg LC_ALL="$save_LC_ALL"; export LC_ALL 6418692f60a7Smrg fi 6419692f60a7Smrg if test "${save_LANG+set}" = set; then 6420692f60a7Smrg LANG="$save_LANG"; export LANG 6421692f60a7Smrg fi 6422692f60a7Smrg 6423692f60a7Smrg # Now prepare to actually exec the command. 6424692f60a7Smrg exec_cmd="\$cmd$args" 6425692f60a7Smrg else 6426692f60a7Smrg # Display what would be done. 6427692f60a7Smrg if test -n "$shlibpath_var"; then 6428692f60a7Smrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 6429692f60a7Smrg $echo "export $shlibpath_var" 6430692f60a7Smrg fi 6431692f60a7Smrg $echo "$cmd$args" 6432692f60a7Smrg exit $EXIT_SUCCESS 6433692f60a7Smrg fi 6434692f60a7Smrg ;; 6435692f60a7Smrg 6436692f60a7Smrg # libtool clean and uninstall mode 6437692f60a7Smrg clean | uninstall) 6438692f60a7Smrg modename="$modename: $mode" 6439692f60a7Smrg rm="$nonopt" 6440692f60a7Smrg files= 6441692f60a7Smrg rmforce= 6442692f60a7Smrg exit_status=0 6443692f60a7Smrg 6444692f60a7Smrg # This variable tells wrapper scripts just to set variables rather 6445692f60a7Smrg # than running their programs. 6446692f60a7Smrg libtool_install_magic="$magic" 6447692f60a7Smrg 6448692f60a7Smrg for arg 6449692f60a7Smrg do 6450692f60a7Smrg case $arg in 6451692f60a7Smrg -f) rm="$rm $arg"; rmforce=yes ;; 6452692f60a7Smrg -*) rm="$rm $arg" ;; 6453692f60a7Smrg *) files="$files $arg" ;; 6454692f60a7Smrg esac 6455692f60a7Smrg done 6456692f60a7Smrg 6457692f60a7Smrg if test -z "$rm"; then 6458692f60a7Smrg $echo "$modename: you must specify an RM program" 1>&2 6459692f60a7Smrg $echo "$help" 1>&2 6460692f60a7Smrg exit $EXIT_FAILURE 6461692f60a7Smrg fi 6462692f60a7Smrg 6463692f60a7Smrg rmdirs= 6464692f60a7Smrg 6465692f60a7Smrg origobjdir="$objdir" 6466692f60a7Smrg for file in $files; do 6467692f60a7Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6468692f60a7Smrg if test "X$dir" = "X$file"; then 6469692f60a7Smrg dir=. 6470692f60a7Smrg objdir="$origobjdir" 6471692f60a7Smrg else 6472692f60a7Smrg objdir="$dir/$origobjdir" 6473692f60a7Smrg fi 6474692f60a7Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6475692f60a7Smrg test "$mode" = uninstall && objdir="$dir" 6476692f60a7Smrg 6477692f60a7Smrg # Remember objdir for removal later, being careful to avoid duplicates 6478692f60a7Smrg if test "$mode" = clean; then 6479692f60a7Smrg case " $rmdirs " in 6480692f60a7Smrg *" $objdir "*) ;; 6481692f60a7Smrg *) rmdirs="$rmdirs $objdir" ;; 6482692f60a7Smrg esac 6483692f60a7Smrg fi 6484692f60a7Smrg 6485692f60a7Smrg # Don't error if the file doesn't exist and rm -f was used. 6486692f60a7Smrg if (test -L "$file") >/dev/null 2>&1 \ 6487692f60a7Smrg || (test -h "$file") >/dev/null 2>&1 \ 6488692f60a7Smrg || test -f "$file"; then 6489692f60a7Smrg : 6490692f60a7Smrg elif test -d "$file"; then 6491692f60a7Smrg exit_status=1 6492692f60a7Smrg continue 6493692f60a7Smrg elif test "$rmforce" = yes; then 6494692f60a7Smrg continue 6495692f60a7Smrg fi 6496692f60a7Smrg 6497692f60a7Smrg rmfiles="$file" 6498692f60a7Smrg 6499692f60a7Smrg case $name in 6500692f60a7Smrg *.la) 6501692f60a7Smrg # Possibly a libtool archive, so verify it. 6502692f60a7Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6503692f60a7Smrg . $dir/$name 6504692f60a7Smrg 6505692f60a7Smrg # Delete the libtool libraries and symlinks. 6506692f60a7Smrg for n in $library_names; do 6507692f60a7Smrg rmfiles="$rmfiles $objdir/$n" 6508692f60a7Smrg done 6509692f60a7Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6510692f60a7Smrg 6511692f60a7Smrg case "$mode" in 6512692f60a7Smrg clean) 6513692f60a7Smrg case " $library_names " in 6514692f60a7Smrg # " " in the beginning catches empty $dlname 6515692f60a7Smrg *" $dlname "*) ;; 6516692f60a7Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 6517692f60a7Smrg esac 6518692f60a7Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 6519692f60a7Smrg ;; 6520692f60a7Smrg uninstall) 6521692f60a7Smrg if test -n "$library_names"; then 6522692f60a7Smrg # Do each command in the postuninstall commands. 6523692f60a7Smrg cmds=$postuninstall_cmds 6524692f60a7Smrg save_ifs="$IFS"; IFS='~' 6525692f60a7Smrg for cmd in $cmds; do 6526692f60a7Smrg IFS="$save_ifs" 6527692f60a7Smrg eval cmd=\"$cmd\" 6528692f60a7Smrg $show "$cmd" 6529692f60a7Smrg $run eval "$cmd" 6530692f60a7Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 6531692f60a7Smrg exit_status=1 6532692f60a7Smrg fi 6533692f60a7Smrg done 6534692f60a7Smrg IFS="$save_ifs" 6535692f60a7Smrg fi 6536692f60a7Smrg 6537692f60a7Smrg if test -n "$old_library"; then 6538692f60a7Smrg # Do each command in the old_postuninstall commands. 6539692f60a7Smrg cmds=$old_postuninstall_cmds 6540692f60a7Smrg save_ifs="$IFS"; IFS='~' 6541692f60a7Smrg for cmd in $cmds; do 6542692f60a7Smrg IFS="$save_ifs" 6543692f60a7Smrg eval cmd=\"$cmd\" 6544692f60a7Smrg $show "$cmd" 6545692f60a7Smrg $run eval "$cmd" 6546692f60a7Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 6547692f60a7Smrg exit_status=1 6548692f60a7Smrg fi 6549692f60a7Smrg done 6550692f60a7Smrg IFS="$save_ifs" 6551692f60a7Smrg fi 6552692f60a7Smrg # FIXME: should reinstall the best remaining shared library. 6553692f60a7Smrg ;; 6554692f60a7Smrg esac 6555692f60a7Smrg fi 6556692f60a7Smrg ;; 6557692f60a7Smrg 6558692f60a7Smrg *.lo) 6559692f60a7Smrg # Possibly a libtool object, so verify it. 6560692f60a7Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6561692f60a7Smrg 6562692f60a7Smrg # Read the .lo file 6563692f60a7Smrg . $dir/$name 6564692f60a7Smrg 6565692f60a7Smrg # Add PIC object to the list of files to remove. 6566692f60a7Smrg if test -n "$pic_object" \ 6567692f60a7Smrg && test "$pic_object" != none; then 6568692f60a7Smrg rmfiles="$rmfiles $dir/$pic_object" 6569692f60a7Smrg fi 6570692f60a7Smrg 6571692f60a7Smrg # Add non-PIC object to the list of files to remove. 6572692f60a7Smrg if test -n "$non_pic_object" \ 6573692f60a7Smrg && test "$non_pic_object" != none; then 6574692f60a7Smrg rmfiles="$rmfiles $dir/$non_pic_object" 6575692f60a7Smrg fi 6576692f60a7Smrg fi 6577692f60a7Smrg ;; 6578692f60a7Smrg 6579692f60a7Smrg *) 6580692f60a7Smrg if test "$mode" = clean ; then 6581692f60a7Smrg noexename=$name 6582692f60a7Smrg case $file in 6583692f60a7Smrg *.exe) 6584692f60a7Smrg file=`$echo $file|${SED} 's,.exe$,,'` 6585692f60a7Smrg noexename=`$echo $name|${SED} 's,.exe$,,'` 6586692f60a7Smrg # $file with .exe has already been added to rmfiles, 6587692f60a7Smrg # add $file without .exe 6588692f60a7Smrg rmfiles="$rmfiles $file" 6589692f60a7Smrg ;; 6590692f60a7Smrg esac 6591692f60a7Smrg # Do a test to see if this is a libtool program. 6592692f60a7Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6593692f60a7Smrg relink_command= 6594692f60a7Smrg . $dir/$noexename 6595692f60a7Smrg 6596692f60a7Smrg # note $name still contains .exe if it was in $file originally 6597692f60a7Smrg # as does the version of $file that was added into $rmfiles 6598692f60a7Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 6599692f60a7Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 6600692f60a7Smrg rmfiles="$rmfiles $objdir/lt-$name" 6601692f60a7Smrg fi 6602692f60a7Smrg if test "X$noexename" != "X$name" ; then 6603692f60a7Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 6604692f60a7Smrg fi 6605692f60a7Smrg fi 6606692f60a7Smrg fi 6607692f60a7Smrg ;; 6608692f60a7Smrg esac 6609692f60a7Smrg $show "$rm $rmfiles" 6610692f60a7Smrg $run $rm $rmfiles || exit_status=1 6611692f60a7Smrg done 6612692f60a7Smrg objdir="$origobjdir" 6613692f60a7Smrg 6614692f60a7Smrg # Try to remove the ${objdir}s in the directories where we deleted files 6615692f60a7Smrg for dir in $rmdirs; do 6616692f60a7Smrg if test -d "$dir"; then 6617692f60a7Smrg $show "rmdir $dir" 6618692f60a7Smrg $run rmdir $dir >/dev/null 2>&1 6619692f60a7Smrg fi 6620692f60a7Smrg done 6621692f60a7Smrg 6622692f60a7Smrg exit $exit_status 6623692f60a7Smrg ;; 6624692f60a7Smrg 6625692f60a7Smrg "") 6626692f60a7Smrg $echo "$modename: you must specify a MODE" 1>&2 6627692f60a7Smrg $echo "$generic_help" 1>&2 6628692f60a7Smrg exit $EXIT_FAILURE 6629692f60a7Smrg ;; 6630692f60a7Smrg esac 6631692f60a7Smrg 6632692f60a7Smrg if test -z "$exec_cmd"; then 6633692f60a7Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 6634692f60a7Smrg $echo "$generic_help" 1>&2 6635692f60a7Smrg exit $EXIT_FAILURE 6636692f60a7Smrg fi 6637692f60a7Smrgfi # test -z "$show_help" 6638692f60a7Smrg 6639692f60a7Smrgif test -n "$exec_cmd"; then 6640692f60a7Smrg eval exec $exec_cmd 6641692f60a7Smrg exit $EXIT_FAILURE 6642692f60a7Smrgfi 6643692f60a7Smrg 6644692f60a7Smrg# We need to display help for each of the modes. 6645692f60a7Smrgcase $mode in 6646692f60a7Smrg"") $echo \ 6647692f60a7Smrg"Usage: $modename [OPTION]... [MODE-ARG]... 6648692f60a7Smrg 6649692f60a7SmrgProvide generalized library-building support services. 6650692f60a7Smrg 6651692f60a7Smrg --config show all configuration variables 6652692f60a7Smrg --debug enable verbose shell tracing 6653692f60a7Smrg-n, --dry-run display commands without modifying any files 6654692f60a7Smrg --features display basic configuration information and exit 6655692f60a7Smrg --finish same as \`--mode=finish' 6656692f60a7Smrg --help display this help message and exit 6657692f60a7Smrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 6658692f60a7Smrg --quiet same as \`--silent' 6659692f60a7Smrg --silent don't print informational messages 6660692f60a7Smrg --tag=TAG use configuration variables from tag TAG 6661692f60a7Smrg --version print version information 6662692f60a7Smrg 6663692f60a7SmrgMODE must be one of the following: 6664692f60a7Smrg 6665692f60a7Smrg clean remove files from the build directory 6666692f60a7Smrg compile compile a source file into a libtool object 6667692f60a7Smrg execute automatically set library path, then run a program 6668692f60a7Smrg finish complete the installation of libtool libraries 6669692f60a7Smrg install install libraries or executables 6670692f60a7Smrg link create a library or an executable 6671692f60a7Smrg uninstall remove libraries from an installed directory 6672692f60a7Smrg 6673692f60a7SmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 6674692f60a7Smrga more detailed description of MODE. 6675692f60a7Smrg 6676692f60a7SmrgReport bugs to <bug-libtool@gnu.org>." 6677692f60a7Smrg exit $EXIT_SUCCESS 6678692f60a7Smrg ;; 6679692f60a7Smrg 6680692f60a7Smrgclean) 6681692f60a7Smrg $echo \ 6682692f60a7Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 6683692f60a7Smrg 6684692f60a7SmrgRemove files from the build directory. 6685692f60a7Smrg 6686692f60a7SmrgRM is the name of the program to use to delete files associated with each FILE 6687692f60a7Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6688692f60a7Smrgto RM. 6689692f60a7Smrg 6690692f60a7SmrgIf FILE is a libtool library, object or program, all the files associated 6691692f60a7Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 6692692f60a7Smrg ;; 6693692f60a7Smrg 6694692f60a7Smrgcompile) 6695692f60a7Smrg $echo \ 6696692f60a7Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 6697692f60a7Smrg 6698692f60a7SmrgCompile a source file into a libtool library object. 6699692f60a7Smrg 6700692f60a7SmrgThis mode accepts the following additional options: 6701692f60a7Smrg 6702692f60a7Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 6703692f60a7Smrg -prefer-pic try to building PIC objects only 6704692f60a7Smrg -prefer-non-pic try to building non-PIC objects only 6705692f60a7Smrg -static always build a \`.o' file suitable for static linking 6706692f60a7Smrg 6707692f60a7SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 6708692f60a7Smrgfrom the given SOURCEFILE. 6709692f60a7Smrg 6710692f60a7SmrgThe output file name is determined by removing the directory component from 6711692f60a7SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 6712692f60a7Smrglibrary object suffix, \`.lo'." 6713692f60a7Smrg ;; 6714692f60a7Smrg 6715692f60a7Smrgexecute) 6716692f60a7Smrg $echo \ 6717692f60a7Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 6718692f60a7Smrg 6719692f60a7SmrgAutomatically set library path, then run a program. 6720692f60a7Smrg 6721692f60a7SmrgThis mode accepts the following additional options: 6722692f60a7Smrg 6723692f60a7Smrg -dlopen FILE add the directory containing FILE to the library path 6724692f60a7Smrg 6725692f60a7SmrgThis mode sets the library path environment variable according to \`-dlopen' 6726692f60a7Smrgflags. 6727692f60a7Smrg 6728692f60a7SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 6729692f60a7Smrginto their corresponding uninstalled binary, and any of their required library 6730692f60a7Smrgdirectories are added to the library path. 6731692f60a7Smrg 6732692f60a7SmrgThen, COMMAND is executed, with ARGS as arguments." 6733692f60a7Smrg ;; 6734692f60a7Smrg 6735692f60a7Smrgfinish) 6736692f60a7Smrg $echo \ 6737692f60a7Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 6738692f60a7Smrg 6739692f60a7SmrgComplete the installation of libtool libraries. 6740692f60a7Smrg 6741692f60a7SmrgEach LIBDIR is a directory that contains libtool libraries. 6742692f60a7Smrg 6743692f60a7SmrgThe commands that this mode executes may require superuser privileges. Use 6744692f60a7Smrgthe \`--dry-run' option if you just want to see what would be executed." 6745692f60a7Smrg ;; 6746692f60a7Smrg 6747692f60a7Smrginstall) 6748692f60a7Smrg $echo \ 6749692f60a7Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 6750692f60a7Smrg 6751692f60a7SmrgInstall executables or libraries. 6752692f60a7Smrg 6753692f60a7SmrgINSTALL-COMMAND is the installation command. The first component should be 6754692f60a7Smrgeither the \`install' or \`cp' program. 6755692f60a7Smrg 6756692f60a7SmrgThe rest of the components are interpreted as arguments to that command (only 6757692f60a7SmrgBSD-compatible install options are recognized)." 6758692f60a7Smrg ;; 6759692f60a7Smrg 6760692f60a7Smrglink) 6761692f60a7Smrg $echo \ 6762692f60a7Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 6763692f60a7Smrg 6764692f60a7SmrgLink object files or libraries together to form another library, or to 6765692f60a7Smrgcreate an executable program. 6766692f60a7Smrg 6767692f60a7SmrgLINK-COMMAND is a command using the C compiler that you would use to create 6768692f60a7Smrga program from several object files. 6769692f60a7Smrg 6770692f60a7SmrgThe following components of LINK-COMMAND are treated specially: 6771692f60a7Smrg 6772692f60a7Smrg -all-static do not do any dynamic linking at all 6773692f60a7Smrg -avoid-version do not add a version suffix if possible 6774692f60a7Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 6775692f60a7Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 6776692f60a7Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 6777692f60a7Smrg -export-symbols SYMFILE 6778692f60a7Smrg try to export only the symbols listed in SYMFILE 6779692f60a7Smrg -export-symbols-regex REGEX 6780692f60a7Smrg try to export only the symbols matching REGEX 6781692f60a7Smrg -LLIBDIR search LIBDIR for required installed libraries 6782692f60a7Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 6783692f60a7Smrg -module build a library that can dlopened 6784692f60a7Smrg -no-fast-install disable the fast-install mode 6785692f60a7Smrg -no-install link a not-installable executable 6786692f60a7Smrg -no-undefined declare that a library does not refer to external symbols 6787692f60a7Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 6788692f60a7Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 6789692f60a7Smrg -precious-files-regex REGEX 6790692f60a7Smrg don't remove output files matching REGEX 6791692f60a7Smrg -release RELEASE specify package release information 6792692f60a7Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 6793692f60a7Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 6794692f60a7Smrg -static do not do any dynamic linking of libtool libraries 6795692f60a7Smrg -version-info CURRENT[:REVISION[:AGE]] 6796692f60a7Smrg specify library version info [each variable defaults to 0] 6797692f60a7Smrg 6798692f60a7SmrgAll other options (arguments beginning with \`-') are ignored. 6799692f60a7Smrg 6800692f60a7SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 6801692f60a7Smrgtreated as uninstalled libtool libraries, other files are standard or library 6802692f60a7Smrgobject files. 6803692f60a7Smrg 6804692f60a7SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 6805692f60a7Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 6806692f60a7Smrgrequired, except when creating a convenience library. 6807692f60a7Smrg 6808692f60a7SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 6809692f60a7Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 6810692f60a7Smrg 6811692f60a7SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 6812692f60a7Smrgis created, otherwise an executable program is created." 6813692f60a7Smrg ;; 6814692f60a7Smrg 6815692f60a7Smrguninstall) 6816692f60a7Smrg $echo \ 6817692f60a7Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 6818692f60a7Smrg 6819692f60a7SmrgRemove libraries from an installation directory. 6820692f60a7Smrg 6821692f60a7SmrgRM is the name of the program to use to delete files associated with each FILE 6822692f60a7Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6823692f60a7Smrgto RM. 6824692f60a7Smrg 6825692f60a7SmrgIf FILE is a libtool library, all the files associated with it are deleted. 6826692f60a7SmrgOtherwise, only FILE itself is deleted using RM." 6827692f60a7Smrg ;; 6828692f60a7Smrg 6829692f60a7Smrg*) 6830692f60a7Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 6831692f60a7Smrg $echo "$help" 1>&2 6832692f60a7Smrg exit $EXIT_FAILURE 6833692f60a7Smrg ;; 6834692f60a7Smrgesac 6835692f60a7Smrg 6836692f60a7Smrg$echo 6837692f60a7Smrg$echo "Try \`$modename --help' for more information about other modes." 6838692f60a7Smrg 6839692f60a7Smrgexit $? 6840692f60a7Smrg 6841692f60a7Smrg# The TAGs below are defined such that we never get into a situation 6842692f60a7Smrg# in which we disable both kinds of libraries. Given conflicting 6843692f60a7Smrg# choices, we go for a static library, that is the most portable, 6844692f60a7Smrg# since we can't tell whether shared libraries were disabled because 6845692f60a7Smrg# the user asked for that or because the platform doesn't support 6846692f60a7Smrg# them. This is particularly important on AIX, because we don't 6847692f60a7Smrg# support having both static and shared libraries enabled at the same 6848692f60a7Smrg# time on that platform, so we default to a shared-only configuration. 6849692f60a7Smrg# If a disable-shared tag is given, we'll fallback to a static-only 6850692f60a7Smrg# configuration. But we'll never go from static-only to shared-only. 6851692f60a7Smrg 6852692f60a7Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6853692f60a7Smrgdisable_libs=shared 6854692f60a7Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 6855692f60a7Smrg 6856692f60a7Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6857692f60a7Smrgdisable_libs=static 6858692f60a7Smrg# ### END LIBTOOL TAG CONFIG: disable-static 6859692f60a7Smrg 6860692f60a7Smrg# Local Variables: 6861692f60a7Smrg# mode:shell-script 6862692f60a7Smrg# sh-indentation:2 6863692f60a7Smrg# End: 6864