ltmain.sh revision 126a8a12
1126a8a12Smrg# ltmain.sh - Provide generalized library-building support services. 2126a8a12Smrg# NOTE: Changing this file will not affect anything until you rerun configure. 3126a8a12Smrg# 4126a8a12Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 5126a8a12Smrg# Free Software Foundation, Inc. 6126a8a12Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7126a8a12Smrg# 8126a8a12Smrg# This program is free software; you can redistribute it and/or modify 9126a8a12Smrg# it under the terms of the GNU General Public License as published by 10126a8a12Smrg# the Free Software Foundation; either version 2 of the License, or 11126a8a12Smrg# (at your option) any later version. 12126a8a12Smrg# 13126a8a12Smrg# This program is distributed in the hope that it will be useful, but 14126a8a12Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 15126a8a12Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16126a8a12Smrg# General Public License for more details. 17126a8a12Smrg# 18126a8a12Smrg# You should have received a copy of the GNU General Public License 19126a8a12Smrg# along with this program; if not, write to the Free Software 20126a8a12Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21126a8a12Smrg# 22126a8a12Smrg# As a special exception to the GNU General Public License, if you 23126a8a12Smrg# distribute this file as part of a program that contains a 24126a8a12Smrg# configuration script generated by Autoconf, you may include it under 25126a8a12Smrg# the same distribution terms that you use for the rest of that program. 26126a8a12Smrg 27126a8a12Smrgbasename="s,^.*/,,g" 28126a8a12Smrg 29126a8a12Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 30126a8a12Smrg# is ksh but when the shell is invoked as "sh" and the current value of 31126a8a12Smrg# the _XPG environment variable is not equal to 1 (one), the special 32126a8a12Smrg# positional parameter $0, within a function call, is the name of the 33126a8a12Smrg# function. 34126a8a12Smrgprogpath="$0" 35126a8a12Smrg 36126a8a12Smrg# The name of this program: 37126a8a12Smrgprogname=`echo "$progpath" | $SED $basename` 38126a8a12Smrgmodename="$progname" 39126a8a12Smrg 40126a8a12Smrg# Global variables: 41126a8a12SmrgEXIT_SUCCESS=0 42126a8a12SmrgEXIT_FAILURE=1 43126a8a12Smrg 44126a8a12SmrgPROGRAM=ltmain.sh 45126a8a12SmrgPACKAGE=libtool 46126a8a12SmrgVERSION=1.5.22 47126a8a12SmrgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" 48126a8a12Smrg 49126a8a12Smrg# See if we are running on zsh, and set the options which allow our 50126a8a12Smrg# commands through without removal of \ escapes. 51126a8a12Smrgif test -n "${ZSH_VERSION+set}" ; then 52126a8a12Smrg setopt NO_GLOB_SUBST 53126a8a12Smrgfi 54126a8a12Smrg 55126a8a12Smrg# Check that we have a working $echo. 56126a8a12Smrgif test "X$1" = X--no-reexec; then 57126a8a12Smrg # Discard the --no-reexec flag, and continue. 58126a8a12Smrg shift 59126a8a12Smrgelif test "X$1" = X--fallback-echo; then 60126a8a12Smrg # Avoid inline document here, it may be left over 61126a8a12Smrg : 62126a8a12Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 63126a8a12Smrg # Yippee, $echo works! 64126a8a12Smrg : 65126a8a12Smrgelse 66126a8a12Smrg # Restart under the correct shell, and then maybe $echo will work. 67126a8a12Smrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 68126a8a12Smrgfi 69126a8a12Smrg 70126a8a12Smrgif test "X$1" = X--fallback-echo; then 71126a8a12Smrg # used as fallback echo 72126a8a12Smrg shift 73126a8a12Smrg cat <<EOF 74126a8a12Smrg$* 75126a8a12SmrgEOF 76126a8a12Smrg exit $EXIT_SUCCESS 77126a8a12Smrgfi 78126a8a12Smrg 79126a8a12Smrgdefault_mode= 80126a8a12Smrghelp="Try \`$progname --help' for more information." 81126a8a12Smrgmagic="%%%MAGIC variable%%%" 82126a8a12Smrgmkdir="mkdir" 83126a8a12Smrgmv="mv -f" 84126a8a12Smrgrm="rm -f" 85126a8a12Smrg 86126a8a12Smrg# Sed substitution that helps us do robust quoting. It backslashifies 87126a8a12Smrg# metacharacters that are still active within double-quoted strings. 88126a8a12SmrgXsed="${SED}"' -e 1s/^X//' 89126a8a12Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 90126a8a12Smrg# test EBCDIC or ASCII 91126a8a12Smrgcase `echo X|tr X '\101'` in 92126a8a12Smrg A) # ASCII based system 93126a8a12Smrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 94126a8a12Smrg SP2NL='tr \040 \012' 95126a8a12Smrg NL2SP='tr \015\012 \040\040' 96126a8a12Smrg ;; 97126a8a12Smrg *) # EBCDIC based system 98126a8a12Smrg SP2NL='tr \100 \n' 99126a8a12Smrg NL2SP='tr \r\n \100\100' 100126a8a12Smrg ;; 101126a8a12Smrgesac 102126a8a12Smrg 103126a8a12Smrg# NLS nuisances. 104126a8a12Smrg# Only set LANG and LC_ALL to C if already set. 105126a8a12Smrg# These must not be set unconditionally because not all systems understand 106126a8a12Smrg# e.g. LANG=C (notably SCO). 107126a8a12Smrg# We save the old values to restore during execute mode. 108126a8a12Smrgif test "${LC_ALL+set}" = set; then 109126a8a12Smrg save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL 110126a8a12Smrgfi 111126a8a12Smrgif test "${LANG+set}" = set; then 112126a8a12Smrg save_LANG="$LANG"; LANG=C; export LANG 113126a8a12Smrgfi 114126a8a12Smrg 115126a8a12Smrg# Make sure IFS has a sensible default 116126a8a12Smrglt_nl=' 117126a8a12Smrg' 118126a8a12SmrgIFS=" $lt_nl" 119126a8a12Smrg 120126a8a12Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 121126a8a12Smrg $echo "$modename: not configured to build any kind of library" 1>&2 122126a8a12Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 123126a8a12Smrg exit $EXIT_FAILURE 124126a8a12Smrgfi 125126a8a12Smrg 126126a8a12Smrg# Global variables. 127126a8a12Smrgmode=$default_mode 128126a8a12Smrgnonopt= 129126a8a12Smrgprev= 130126a8a12Smrgprevopt= 131126a8a12Smrgrun= 132126a8a12Smrgshow="$echo" 133126a8a12Smrgshow_help= 134126a8a12Smrgexecute_dlfiles= 135126a8a12Smrgduplicate_deps=no 136126a8a12Smrgpreserve_args= 137126a8a12Smrglo2o="s/\\.lo\$/.${objext}/" 138126a8a12Smrgo2lo="s/\\.${objext}\$/.lo/" 139126a8a12Smrg 140126a8a12Smrg##################################### 141126a8a12Smrg# Shell function definitions: 142126a8a12Smrg# This seems to be the best place for them 143126a8a12Smrg 144126a8a12Smrg# func_mktempdir [string] 145126a8a12Smrg# Make a temporary directory that won't clash with other running 146126a8a12Smrg# libtool processes, and avoids race conditions if possible. If 147126a8a12Smrg# given, STRING is the basename for that directory. 148126a8a12Smrgfunc_mktempdir () 149126a8a12Smrg{ 150126a8a12Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 151126a8a12Smrg 152126a8a12Smrg if test "$run" = ":"; then 153126a8a12Smrg # Return a directory name, but don't create it in dry-run mode 154126a8a12Smrg my_tmpdir="${my_template}-$$" 155126a8a12Smrg else 156126a8a12Smrg 157126a8a12Smrg # If mktemp works, use that first and foremost 158126a8a12Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 159126a8a12Smrg 160126a8a12Smrg if test ! -d "$my_tmpdir"; then 161126a8a12Smrg # Failing that, at least try and use $RANDOM to avoid a race 162126a8a12Smrg my_tmpdir="${my_template}-${RANDOM-0}$$" 163126a8a12Smrg 164126a8a12Smrg save_mktempdir_umask=`umask` 165126a8a12Smrg umask 0077 166126a8a12Smrg $mkdir "$my_tmpdir" 167126a8a12Smrg umask $save_mktempdir_umask 168126a8a12Smrg fi 169126a8a12Smrg 170126a8a12Smrg # If we're not in dry-run mode, bomb out on failure 171126a8a12Smrg test -d "$my_tmpdir" || { 172126a8a12Smrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 173126a8a12Smrg exit $EXIT_FAILURE 174126a8a12Smrg } 175126a8a12Smrg fi 176126a8a12Smrg 177126a8a12Smrg $echo "X$my_tmpdir" | $Xsed 178126a8a12Smrg} 179126a8a12Smrg 180126a8a12Smrg 181126a8a12Smrg# func_win32_libid arg 182126a8a12Smrg# return the library type of file 'arg' 183126a8a12Smrg# 184126a8a12Smrg# Need a lot of goo to handle *both* DLLs and import libs 185126a8a12Smrg# Has to be a shell function in order to 'eat' the argument 186126a8a12Smrg# that is supplied when $file_magic_command is called. 187126a8a12Smrgfunc_win32_libid () 188126a8a12Smrg{ 189126a8a12Smrg win32_libid_type="unknown" 190126a8a12Smrg win32_fileres=`file -L $1 2>/dev/null` 191126a8a12Smrg case $win32_fileres in 192126a8a12Smrg *ar\ archive\ import\ library*) # definitely import 193126a8a12Smrg win32_libid_type="x86 archive import" 194126a8a12Smrg ;; 195126a8a12Smrg *ar\ archive*) # could be an import, or static 196126a8a12Smrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 197126a8a12Smrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 198126a8a12Smrg win32_nmres=`eval $NM -f posix -A $1 | \ 199126a8a12Smrg $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` 200126a8a12Smrg case $win32_nmres in 201126a8a12Smrg import*) win32_libid_type="x86 archive import";; 202126a8a12Smrg *) win32_libid_type="x86 archive static";; 203126a8a12Smrg esac 204126a8a12Smrg fi 205126a8a12Smrg ;; 206126a8a12Smrg *DLL*) 207126a8a12Smrg win32_libid_type="x86 DLL" 208126a8a12Smrg ;; 209126a8a12Smrg *executable*) # but shell scripts are "executable" too... 210126a8a12Smrg case $win32_fileres in 211126a8a12Smrg *MS\ Windows\ PE\ Intel*) 212126a8a12Smrg win32_libid_type="x86 DLL" 213126a8a12Smrg ;; 214126a8a12Smrg esac 215126a8a12Smrg ;; 216126a8a12Smrg esac 217126a8a12Smrg $echo $win32_libid_type 218126a8a12Smrg} 219126a8a12Smrg 220126a8a12Smrg 221126a8a12Smrg# func_infer_tag arg 222126a8a12Smrg# Infer tagged configuration to use if any are available and 223126a8a12Smrg# if one wasn't chosen via the "--tag" command line option. 224126a8a12Smrg# Only attempt this if the compiler in the base compile 225126a8a12Smrg# command doesn't match the default compiler. 226126a8a12Smrg# arg is usually of the form 'gcc ...' 227126a8a12Smrgfunc_infer_tag () 228126a8a12Smrg{ 229126a8a12Smrg if test -n "$available_tags" && test -z "$tagname"; then 230126a8a12Smrg CC_quoted= 231126a8a12Smrg for arg in $CC; do 232126a8a12Smrg case $arg in 233126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 234126a8a12Smrg arg="\"$arg\"" 235126a8a12Smrg ;; 236126a8a12Smrg esac 237126a8a12Smrg CC_quoted="$CC_quoted $arg" 238126a8a12Smrg done 239126a8a12Smrg case $@ in 240126a8a12Smrg # Blanks in the command may have been stripped by the calling shell, 241126a8a12Smrg # but not from the CC environment variable when configure was run. 242126a8a12Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 243126a8a12Smrg # Blanks at the start of $base_compile will cause this to fail 244126a8a12Smrg # if we don't check for them as well. 245126a8a12Smrg *) 246126a8a12Smrg for z in $available_tags; do 247126a8a12Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 248126a8a12Smrg # Evaluate the configuration. 249126a8a12Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 250126a8a12Smrg CC_quoted= 251126a8a12Smrg for arg in $CC; do 252126a8a12Smrg # Double-quote args containing other shell metacharacters. 253126a8a12Smrg case $arg in 254126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 255126a8a12Smrg arg="\"$arg\"" 256126a8a12Smrg ;; 257126a8a12Smrg esac 258126a8a12Smrg CC_quoted="$CC_quoted $arg" 259126a8a12Smrg done 260126a8a12Smrg case "$@ " in 261126a8a12Smrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 262126a8a12Smrg # The compiler in the base compile command matches 263126a8a12Smrg # the one in the tagged configuration. 264126a8a12Smrg # Assume this is the tagged configuration we want. 265126a8a12Smrg tagname=$z 266126a8a12Smrg break 267126a8a12Smrg ;; 268126a8a12Smrg esac 269126a8a12Smrg fi 270126a8a12Smrg done 271126a8a12Smrg # If $tagname still isn't set, then no tagged configuration 272126a8a12Smrg # was found and let the user know that the "--tag" command 273126a8a12Smrg # line option must be used. 274126a8a12Smrg if test -z "$tagname"; then 275126a8a12Smrg $echo "$modename: unable to infer tagged configuration" 276126a8a12Smrg $echo "$modename: specify a tag with \`--tag'" 1>&2 277126a8a12Smrg exit $EXIT_FAILURE 278126a8a12Smrg# else 279126a8a12Smrg# $echo "$modename: using $tagname tagged configuration" 280126a8a12Smrg fi 281126a8a12Smrg ;; 282126a8a12Smrg esac 283126a8a12Smrg fi 284126a8a12Smrg} 285126a8a12Smrg 286126a8a12Smrg 287126a8a12Smrg# func_extract_an_archive dir oldlib 288126a8a12Smrgfunc_extract_an_archive () 289126a8a12Smrg{ 290126a8a12Smrg f_ex_an_ar_dir="$1"; shift 291126a8a12Smrg f_ex_an_ar_oldlib="$1" 292126a8a12Smrg 293126a8a12Smrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 294126a8a12Smrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 295126a8a12Smrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 296126a8a12Smrg : 297126a8a12Smrg else 298126a8a12Smrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 299126a8a12Smrg exit $EXIT_FAILURE 300126a8a12Smrg fi 301126a8a12Smrg} 302126a8a12Smrg 303126a8a12Smrg# func_extract_archives gentop oldlib ... 304126a8a12Smrgfunc_extract_archives () 305126a8a12Smrg{ 306126a8a12Smrg my_gentop="$1"; shift 307126a8a12Smrg my_oldlibs=${1+"$@"} 308126a8a12Smrg my_oldobjs="" 309126a8a12Smrg my_xlib="" 310126a8a12Smrg my_xabs="" 311126a8a12Smrg my_xdir="" 312126a8a12Smrg my_status="" 313126a8a12Smrg 314126a8a12Smrg $show "${rm}r $my_gentop" 315126a8a12Smrg $run ${rm}r "$my_gentop" 316126a8a12Smrg $show "$mkdir $my_gentop" 317126a8a12Smrg $run $mkdir "$my_gentop" 318126a8a12Smrg my_status=$? 319126a8a12Smrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 320126a8a12Smrg exit $my_status 321126a8a12Smrg fi 322126a8a12Smrg 323126a8a12Smrg for my_xlib in $my_oldlibs; do 324126a8a12Smrg # Extract the objects. 325126a8a12Smrg case $my_xlib in 326126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 327126a8a12Smrg *) my_xabs=`pwd`"/$my_xlib" ;; 328126a8a12Smrg esac 329126a8a12Smrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 330126a8a12Smrg my_xdir="$my_gentop/$my_xlib" 331126a8a12Smrg 332126a8a12Smrg $show "${rm}r $my_xdir" 333126a8a12Smrg $run ${rm}r "$my_xdir" 334126a8a12Smrg $show "$mkdir $my_xdir" 335126a8a12Smrg $run $mkdir "$my_xdir" 336126a8a12Smrg exit_status=$? 337126a8a12Smrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 338126a8a12Smrg exit $exit_status 339126a8a12Smrg fi 340126a8a12Smrg case $host in 341126a8a12Smrg *-darwin*) 342126a8a12Smrg $show "Extracting $my_xabs" 343126a8a12Smrg # Do not bother doing anything if just a dry run 344126a8a12Smrg if test -z "$run"; then 345126a8a12Smrg darwin_orig_dir=`pwd` 346126a8a12Smrg cd $my_xdir || exit $? 347126a8a12Smrg darwin_archive=$my_xabs 348126a8a12Smrg darwin_curdir=`pwd` 349126a8a12Smrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 350126a8a12Smrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 351126a8a12Smrg if test -n "$darwin_arches"; then 352126a8a12Smrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 353126a8a12Smrg darwin_arch= 354126a8a12Smrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 355126a8a12Smrg for darwin_arch in $darwin_arches ; do 356126a8a12Smrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 357126a8a12Smrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 358126a8a12Smrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 359126a8a12Smrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 360126a8a12Smrg cd "$darwin_curdir" 361126a8a12Smrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 362126a8a12Smrg done # $darwin_arches 363126a8a12Smrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 364126a8a12Smrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 365126a8a12Smrg darwin_file= 366126a8a12Smrg darwin_files= 367126a8a12Smrg for darwin_file in $darwin_filelist; do 368126a8a12Smrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 369126a8a12Smrg lipo -create -output "$darwin_file" $darwin_files 370126a8a12Smrg done # $darwin_filelist 371126a8a12Smrg ${rm}r unfat-$$ 372126a8a12Smrg cd "$darwin_orig_dir" 373126a8a12Smrg else 374126a8a12Smrg cd "$darwin_orig_dir" 375126a8a12Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 376126a8a12Smrg fi # $darwin_arches 377126a8a12Smrg fi # $run 378126a8a12Smrg ;; 379126a8a12Smrg *) 380126a8a12Smrg func_extract_an_archive "$my_xdir" "$my_xabs" 381126a8a12Smrg ;; 382126a8a12Smrg esac 383126a8a12Smrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 384126a8a12Smrg done 385126a8a12Smrg func_extract_archives_result="$my_oldobjs" 386126a8a12Smrg} 387126a8a12Smrg# End of Shell function definitions 388126a8a12Smrg##################################### 389126a8a12Smrg 390126a8a12Smrg# Darwin sucks 391126a8a12Smrgeval std_shrext=\"$shrext_cmds\" 392126a8a12Smrg 393126a8a12Smrgdisable_libs=no 394126a8a12Smrg 395126a8a12Smrg# Parse our command line options once, thoroughly. 396126a8a12Smrgwhile test "$#" -gt 0 397126a8a12Smrgdo 398126a8a12Smrg arg="$1" 399126a8a12Smrg shift 400126a8a12Smrg 401126a8a12Smrg case $arg in 402126a8a12Smrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 403126a8a12Smrg *) optarg= ;; 404126a8a12Smrg esac 405126a8a12Smrg 406126a8a12Smrg # If the previous option needs an argument, assign it. 407126a8a12Smrg if test -n "$prev"; then 408126a8a12Smrg case $prev in 409126a8a12Smrg execute_dlfiles) 410126a8a12Smrg execute_dlfiles="$execute_dlfiles $arg" 411126a8a12Smrg ;; 412126a8a12Smrg tag) 413126a8a12Smrg tagname="$arg" 414126a8a12Smrg preserve_args="${preserve_args}=$arg" 415126a8a12Smrg 416126a8a12Smrg # Check whether tagname contains only valid characters 417126a8a12Smrg case $tagname in 418126a8a12Smrg *[!-_A-Za-z0-9,/]*) 419126a8a12Smrg $echo "$progname: invalid tag name: $tagname" 1>&2 420126a8a12Smrg exit $EXIT_FAILURE 421126a8a12Smrg ;; 422126a8a12Smrg esac 423126a8a12Smrg 424126a8a12Smrg case $tagname in 425126a8a12Smrg CC) 426126a8a12Smrg # Don't test for the "default" C tag, as we know, it's there, but 427126a8a12Smrg # not specially marked. 428126a8a12Smrg ;; 429126a8a12Smrg *) 430126a8a12Smrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 431126a8a12Smrg taglist="$taglist $tagname" 432126a8a12Smrg # Evaluate the configuration. 433126a8a12Smrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 434126a8a12Smrg else 435126a8a12Smrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 436126a8a12Smrg fi 437126a8a12Smrg ;; 438126a8a12Smrg esac 439126a8a12Smrg ;; 440126a8a12Smrg *) 441126a8a12Smrg eval "$prev=\$arg" 442126a8a12Smrg ;; 443126a8a12Smrg esac 444126a8a12Smrg 445126a8a12Smrg prev= 446126a8a12Smrg prevopt= 447126a8a12Smrg continue 448126a8a12Smrg fi 449126a8a12Smrg 450126a8a12Smrg # Have we seen a non-optional argument yet? 451126a8a12Smrg case $arg in 452126a8a12Smrg --help) 453126a8a12Smrg show_help=yes 454126a8a12Smrg ;; 455126a8a12Smrg 456126a8a12Smrg --version) 457126a8a12Smrg $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 458126a8a12Smrg $echo 459126a8a12Smrg $echo "Copyright (C) 2005 Free Software Foundation, Inc." 460126a8a12Smrg $echo "This is free software; see the source for copying conditions. There is NO" 461126a8a12Smrg $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 462126a8a12Smrg exit $? 463126a8a12Smrg ;; 464126a8a12Smrg 465126a8a12Smrg --config) 466126a8a12Smrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 467126a8a12Smrg # Now print the configurations for the tags. 468126a8a12Smrg for tagname in $taglist; do 469126a8a12Smrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 470126a8a12Smrg done 471126a8a12Smrg exit $? 472126a8a12Smrg ;; 473126a8a12Smrg 474126a8a12Smrg --debug) 475126a8a12Smrg $echo "$progname: enabling shell trace mode" 476126a8a12Smrg set -x 477126a8a12Smrg preserve_args="$preserve_args $arg" 478126a8a12Smrg ;; 479126a8a12Smrg 480126a8a12Smrg --dry-run | -n) 481126a8a12Smrg run=: 482126a8a12Smrg ;; 483126a8a12Smrg 484126a8a12Smrg --features) 485126a8a12Smrg $echo "host: $host" 486126a8a12Smrg if test "$build_libtool_libs" = yes; then 487126a8a12Smrg $echo "enable shared libraries" 488126a8a12Smrg else 489126a8a12Smrg $echo "disable shared libraries" 490126a8a12Smrg fi 491126a8a12Smrg if test "$build_old_libs" = yes; then 492126a8a12Smrg $echo "enable static libraries" 493126a8a12Smrg else 494126a8a12Smrg $echo "disable static libraries" 495126a8a12Smrg fi 496126a8a12Smrg exit $? 497126a8a12Smrg ;; 498126a8a12Smrg 499126a8a12Smrg --finish) mode="finish" ;; 500126a8a12Smrg 501126a8a12Smrg --mode) prevopt="--mode" prev=mode ;; 502126a8a12Smrg --mode=*) mode="$optarg" ;; 503126a8a12Smrg 504126a8a12Smrg --preserve-dup-deps) duplicate_deps="yes" ;; 505126a8a12Smrg 506126a8a12Smrg --quiet | --silent) 507126a8a12Smrg show=: 508126a8a12Smrg preserve_args="$preserve_args $arg" 509126a8a12Smrg ;; 510126a8a12Smrg 511126a8a12Smrg --tag) 512126a8a12Smrg prevopt="--tag" 513126a8a12Smrg prev=tag 514126a8a12Smrg preserve_args="$preserve_args --tag" 515126a8a12Smrg ;; 516126a8a12Smrg --tag=*) 517126a8a12Smrg set tag "$optarg" ${1+"$@"} 518126a8a12Smrg shift 519126a8a12Smrg prev=tag 520126a8a12Smrg preserve_args="$preserve_args --tag" 521126a8a12Smrg ;; 522126a8a12Smrg 523126a8a12Smrg -dlopen) 524126a8a12Smrg prevopt="-dlopen" 525126a8a12Smrg prev=execute_dlfiles 526126a8a12Smrg ;; 527126a8a12Smrg 528126a8a12Smrg -*) 529126a8a12Smrg $echo "$modename: unrecognized option \`$arg'" 1>&2 530126a8a12Smrg $echo "$help" 1>&2 531126a8a12Smrg exit $EXIT_FAILURE 532126a8a12Smrg ;; 533126a8a12Smrg 534126a8a12Smrg *) 535126a8a12Smrg nonopt="$arg" 536126a8a12Smrg break 537126a8a12Smrg ;; 538126a8a12Smrg esac 539126a8a12Smrgdone 540126a8a12Smrg 541126a8a12Smrgif test -n "$prevopt"; then 542126a8a12Smrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 543126a8a12Smrg $echo "$help" 1>&2 544126a8a12Smrg exit $EXIT_FAILURE 545126a8a12Smrgfi 546126a8a12Smrg 547126a8a12Smrgcase $disable_libs in 548126a8a12Smrgno) 549126a8a12Smrg ;; 550126a8a12Smrgshared) 551126a8a12Smrg build_libtool_libs=no 552126a8a12Smrg build_old_libs=yes 553126a8a12Smrg ;; 554126a8a12Smrgstatic) 555126a8a12Smrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 556126a8a12Smrg ;; 557126a8a12Smrgesac 558126a8a12Smrg 559126a8a12Smrg# If this variable is set in any of the actions, the command in it 560126a8a12Smrg# will be execed at the end. This prevents here-documents from being 561126a8a12Smrg# left over by shells. 562126a8a12Smrgexec_cmd= 563126a8a12Smrg 564126a8a12Smrgif test -z "$show_help"; then 565126a8a12Smrg 566126a8a12Smrg # Infer the operation mode. 567126a8a12Smrg if test -z "$mode"; then 568126a8a12Smrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 569126a8a12Smrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 570126a8a12Smrg case $nonopt in 571126a8a12Smrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 572126a8a12Smrg mode=link 573126a8a12Smrg for arg 574126a8a12Smrg do 575126a8a12Smrg case $arg in 576126a8a12Smrg -c) 577126a8a12Smrg mode=compile 578126a8a12Smrg break 579126a8a12Smrg ;; 580126a8a12Smrg esac 581126a8a12Smrg done 582126a8a12Smrg ;; 583126a8a12Smrg *db | *dbx | *strace | *truss) 584126a8a12Smrg mode=execute 585126a8a12Smrg ;; 586126a8a12Smrg *install*|cp|mv) 587126a8a12Smrg mode=install 588126a8a12Smrg ;; 589126a8a12Smrg *rm) 590126a8a12Smrg mode=uninstall 591126a8a12Smrg ;; 592126a8a12Smrg *) 593126a8a12Smrg # If we have no mode, but dlfiles were specified, then do execute mode. 594126a8a12Smrg test -n "$execute_dlfiles" && mode=execute 595126a8a12Smrg 596126a8a12Smrg # Just use the default operation mode. 597126a8a12Smrg if test -z "$mode"; then 598126a8a12Smrg if test -n "$nonopt"; then 599126a8a12Smrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 600126a8a12Smrg else 601126a8a12Smrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 602126a8a12Smrg fi 603126a8a12Smrg fi 604126a8a12Smrg ;; 605126a8a12Smrg esac 606126a8a12Smrg fi 607126a8a12Smrg 608126a8a12Smrg # Only execute mode is allowed to have -dlopen flags. 609126a8a12Smrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 610126a8a12Smrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 611126a8a12Smrg $echo "$help" 1>&2 612126a8a12Smrg exit $EXIT_FAILURE 613126a8a12Smrg fi 614126a8a12Smrg 615126a8a12Smrg # Change the help message to a mode-specific one. 616126a8a12Smrg generic_help="$help" 617126a8a12Smrg help="Try \`$modename --help --mode=$mode' for more information." 618126a8a12Smrg 619126a8a12Smrg # These modes are in order of execution frequency so that they run quickly. 620126a8a12Smrg case $mode in 621126a8a12Smrg # libtool compile mode 622126a8a12Smrg compile) 623126a8a12Smrg modename="$modename: compile" 624126a8a12Smrg # Get the compilation command and the source file. 625126a8a12Smrg base_compile= 626126a8a12Smrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 627126a8a12Smrg suppress_opt=yes 628126a8a12Smrg suppress_output= 629126a8a12Smrg arg_mode=normal 630126a8a12Smrg libobj= 631126a8a12Smrg later= 632126a8a12Smrg 633126a8a12Smrg for arg 634126a8a12Smrg do 635126a8a12Smrg case $arg_mode in 636126a8a12Smrg arg ) 637126a8a12Smrg # do not "continue". Instead, add this to base_compile 638126a8a12Smrg lastarg="$arg" 639126a8a12Smrg arg_mode=normal 640126a8a12Smrg ;; 641126a8a12Smrg 642126a8a12Smrg target ) 643126a8a12Smrg libobj="$arg" 644126a8a12Smrg arg_mode=normal 645126a8a12Smrg continue 646126a8a12Smrg ;; 647126a8a12Smrg 648126a8a12Smrg normal ) 649126a8a12Smrg # Accept any command-line options. 650126a8a12Smrg case $arg in 651126a8a12Smrg -o) 652126a8a12Smrg if test -n "$libobj" ; then 653126a8a12Smrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 654126a8a12Smrg exit $EXIT_FAILURE 655126a8a12Smrg fi 656126a8a12Smrg arg_mode=target 657126a8a12Smrg continue 658126a8a12Smrg ;; 659126a8a12Smrg 660126a8a12Smrg -static | -prefer-pic | -prefer-non-pic) 661126a8a12Smrg later="$later $arg" 662126a8a12Smrg continue 663126a8a12Smrg ;; 664126a8a12Smrg 665126a8a12Smrg -no-suppress) 666126a8a12Smrg suppress_opt=no 667126a8a12Smrg continue 668126a8a12Smrg ;; 669126a8a12Smrg 670126a8a12Smrg -Xcompiler) 671126a8a12Smrg arg_mode=arg # the next one goes into the "base_compile" arg list 672126a8a12Smrg continue # The current "srcfile" will either be retained or 673126a8a12Smrg ;; # replaced later. I would guess that would be a bug. 674126a8a12Smrg 675126a8a12Smrg -Wc,*) 676126a8a12Smrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 677126a8a12Smrg lastarg= 678126a8a12Smrg save_ifs="$IFS"; IFS=',' 679126a8a12Smrg for arg in $args; do 680126a8a12Smrg IFS="$save_ifs" 681126a8a12Smrg 682126a8a12Smrg # Double-quote args containing other shell metacharacters. 683126a8a12Smrg # Many Bourne shells cannot handle close brackets correctly 684126a8a12Smrg # in scan sets, so we specify it separately. 685126a8a12Smrg case $arg in 686126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 687126a8a12Smrg arg="\"$arg\"" 688126a8a12Smrg ;; 689126a8a12Smrg esac 690126a8a12Smrg lastarg="$lastarg $arg" 691126a8a12Smrg done 692126a8a12Smrg IFS="$save_ifs" 693126a8a12Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 694126a8a12Smrg 695126a8a12Smrg # Add the arguments to base_compile. 696126a8a12Smrg base_compile="$base_compile $lastarg" 697126a8a12Smrg continue 698126a8a12Smrg ;; 699126a8a12Smrg 700126a8a12Smrg * ) 701126a8a12Smrg # Accept the current argument as the source file. 702126a8a12Smrg # The previous "srcfile" becomes the current argument. 703126a8a12Smrg # 704126a8a12Smrg lastarg="$srcfile" 705126a8a12Smrg srcfile="$arg" 706126a8a12Smrg ;; 707126a8a12Smrg esac # case $arg 708126a8a12Smrg ;; 709126a8a12Smrg esac # case $arg_mode 710126a8a12Smrg 711126a8a12Smrg # Aesthetically quote the previous argument. 712126a8a12Smrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 713126a8a12Smrg 714126a8a12Smrg case $lastarg in 715126a8a12Smrg # Double-quote args containing other shell metacharacters. 716126a8a12Smrg # Many Bourne shells cannot handle close brackets correctly 717126a8a12Smrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 718126a8a12Smrg # in scan sets (worked around with variable expansion), 719126a8a12Smrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 720126a8a12Smrg # at all, so we specify them separately. 721126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 722126a8a12Smrg lastarg="\"$lastarg\"" 723126a8a12Smrg ;; 724126a8a12Smrg esac 725126a8a12Smrg 726126a8a12Smrg base_compile="$base_compile $lastarg" 727126a8a12Smrg done # for arg 728126a8a12Smrg 729126a8a12Smrg case $arg_mode in 730126a8a12Smrg arg) 731126a8a12Smrg $echo "$modename: you must specify an argument for -Xcompile" 732126a8a12Smrg exit $EXIT_FAILURE 733126a8a12Smrg ;; 734126a8a12Smrg target) 735126a8a12Smrg $echo "$modename: you must specify a target with \`-o'" 1>&2 736126a8a12Smrg exit $EXIT_FAILURE 737126a8a12Smrg ;; 738126a8a12Smrg *) 739126a8a12Smrg # Get the name of the library object. 740126a8a12Smrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 741126a8a12Smrg ;; 742126a8a12Smrg esac 743126a8a12Smrg 744126a8a12Smrg # Recognize several different file suffixes. 745126a8a12Smrg # If the user specifies -o file.o, it is replaced with file.lo 746126a8a12Smrg xform='[cCFSifmso]' 747126a8a12Smrg case $libobj in 748126a8a12Smrg *.ada) xform=ada ;; 749126a8a12Smrg *.adb) xform=adb ;; 750126a8a12Smrg *.ads) xform=ads ;; 751126a8a12Smrg *.asm) xform=asm ;; 752126a8a12Smrg *.c++) xform=c++ ;; 753126a8a12Smrg *.cc) xform=cc ;; 754126a8a12Smrg *.ii) xform=ii ;; 755126a8a12Smrg *.class) xform=class ;; 756126a8a12Smrg *.cpp) xform=cpp ;; 757126a8a12Smrg *.cxx) xform=cxx ;; 758126a8a12Smrg *.f90) xform=f90 ;; 759126a8a12Smrg *.for) xform=for ;; 760126a8a12Smrg *.java) xform=java ;; 761126a8a12Smrg esac 762126a8a12Smrg 763126a8a12Smrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 764126a8a12Smrg 765126a8a12Smrg case $libobj in 766126a8a12Smrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 767126a8a12Smrg *) 768126a8a12Smrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 769126a8a12Smrg exit $EXIT_FAILURE 770126a8a12Smrg ;; 771126a8a12Smrg esac 772126a8a12Smrg 773126a8a12Smrg func_infer_tag $base_compile 774126a8a12Smrg 775126a8a12Smrg for arg in $later; do 776126a8a12Smrg case $arg in 777126a8a12Smrg -static) 778126a8a12Smrg build_old_libs=yes 779126a8a12Smrg continue 780126a8a12Smrg ;; 781126a8a12Smrg 782126a8a12Smrg -prefer-pic) 783126a8a12Smrg pic_mode=yes 784126a8a12Smrg continue 785126a8a12Smrg ;; 786126a8a12Smrg 787126a8a12Smrg -prefer-non-pic) 788126a8a12Smrg pic_mode=no 789126a8a12Smrg continue 790126a8a12Smrg ;; 791126a8a12Smrg esac 792126a8a12Smrg done 793126a8a12Smrg 794126a8a12Smrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 795126a8a12Smrg case $qlibobj in 796126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 797126a8a12Smrg qlibobj="\"$qlibobj\"" ;; 798126a8a12Smrg esac 799126a8a12Smrg test "X$libobj" != "X$qlibobj" \ 800126a8a12Smrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 801126a8a12Smrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 802126a8a12Smrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 803126a8a12Smrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 804126a8a12Smrg if test "X$xdir" = "X$obj"; then 805126a8a12Smrg xdir= 806126a8a12Smrg else 807126a8a12Smrg xdir=$xdir/ 808126a8a12Smrg fi 809126a8a12Smrg lobj=${xdir}$objdir/$objname 810126a8a12Smrg 811126a8a12Smrg if test -z "$base_compile"; then 812126a8a12Smrg $echo "$modename: you must specify a compilation command" 1>&2 813126a8a12Smrg $echo "$help" 1>&2 814126a8a12Smrg exit $EXIT_FAILURE 815126a8a12Smrg fi 816126a8a12Smrg 817126a8a12Smrg # Delete any leftover library objects. 818126a8a12Smrg if test "$build_old_libs" = yes; then 819126a8a12Smrg removelist="$obj $lobj $libobj ${libobj}T" 820126a8a12Smrg else 821126a8a12Smrg removelist="$lobj $libobj ${libobj}T" 822126a8a12Smrg fi 823126a8a12Smrg 824126a8a12Smrg $run $rm $removelist 825126a8a12Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 826126a8a12Smrg 827126a8a12Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 828126a8a12Smrg case $host_os in 829126a8a12Smrg cygwin* | mingw* | pw32* | os2*) 830126a8a12Smrg pic_mode=default 831126a8a12Smrg ;; 832126a8a12Smrg esac 833126a8a12Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 834126a8a12Smrg # non-PIC code in shared libraries is not supported 835126a8a12Smrg pic_mode=default 836126a8a12Smrg fi 837126a8a12Smrg 838126a8a12Smrg # Calculate the filename of the output object if compiler does 839126a8a12Smrg # not support -o with -c 840126a8a12Smrg if test "$compiler_c_o" = no; then 841126a8a12Smrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 842126a8a12Smrg lockfile="$output_obj.lock" 843126a8a12Smrg removelist="$removelist $output_obj $lockfile" 844126a8a12Smrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 845126a8a12Smrg else 846126a8a12Smrg output_obj= 847126a8a12Smrg need_locks=no 848126a8a12Smrg lockfile= 849126a8a12Smrg fi 850126a8a12Smrg 851126a8a12Smrg # Lock this critical section if it is needed 852126a8a12Smrg # We use this script file to make the link, it avoids creating a new file 853126a8a12Smrg if test "$need_locks" = yes; then 854126a8a12Smrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 855126a8a12Smrg $show "Waiting for $lockfile to be removed" 856126a8a12Smrg sleep 2 857126a8a12Smrg done 858126a8a12Smrg elif test "$need_locks" = warn; then 859126a8a12Smrg if test -f "$lockfile"; then 860126a8a12Smrg $echo "\ 861126a8a12Smrg*** ERROR, $lockfile exists and contains: 862126a8a12Smrg`cat $lockfile 2>/dev/null` 863126a8a12Smrg 864126a8a12SmrgThis indicates that another process is trying to use the same 865126a8a12Smrgtemporary object file, and libtool could not work around it because 866126a8a12Smrgyour compiler does not support \`-c' and \`-o' together. If you 867126a8a12Smrgrepeat this compilation, it may succeed, by chance, but you had better 868126a8a12Smrgavoid parallel builds (make -j) in this platform, or get a better 869126a8a12Smrgcompiler." 870126a8a12Smrg 871126a8a12Smrg $run $rm $removelist 872126a8a12Smrg exit $EXIT_FAILURE 873126a8a12Smrg fi 874126a8a12Smrg $echo "$srcfile" > "$lockfile" 875126a8a12Smrg fi 876126a8a12Smrg 877126a8a12Smrg if test -n "$fix_srcfile_path"; then 878126a8a12Smrg eval srcfile=\"$fix_srcfile_path\" 879126a8a12Smrg fi 880126a8a12Smrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 881126a8a12Smrg case $qsrcfile in 882126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 883126a8a12Smrg qsrcfile="\"$qsrcfile\"" ;; 884126a8a12Smrg esac 885126a8a12Smrg 886126a8a12Smrg $run $rm "$libobj" "${libobj}T" 887126a8a12Smrg 888126a8a12Smrg # Create a libtool object file (analogous to a ".la" file), 889126a8a12Smrg # but don't create it if we're doing a dry run. 890126a8a12Smrg test -z "$run" && cat > ${libobj}T <<EOF 891126a8a12Smrg# $libobj - a libtool object file 892126a8a12Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 893126a8a12Smrg# 894126a8a12Smrg# Please DO NOT delete this file! 895126a8a12Smrg# It is necessary for linking the library. 896126a8a12Smrg 897126a8a12Smrg# Name of the PIC object. 898126a8a12SmrgEOF 899126a8a12Smrg 900126a8a12Smrg # Only build a PIC object if we are building libtool libraries. 901126a8a12Smrg if test "$build_libtool_libs" = yes; then 902126a8a12Smrg # Without this assignment, base_compile gets emptied. 903126a8a12Smrg fbsd_hideous_sh_bug=$base_compile 904126a8a12Smrg 905126a8a12Smrg if test "$pic_mode" != no; then 906126a8a12Smrg command="$base_compile $qsrcfile $pic_flag" 907126a8a12Smrg else 908126a8a12Smrg # Don't build PIC code 909126a8a12Smrg command="$base_compile $qsrcfile" 910126a8a12Smrg fi 911126a8a12Smrg 912126a8a12Smrg if test ! -d "${xdir}$objdir"; then 913126a8a12Smrg $show "$mkdir ${xdir}$objdir" 914126a8a12Smrg $run $mkdir ${xdir}$objdir 915126a8a12Smrg exit_status=$? 916126a8a12Smrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 917126a8a12Smrg exit $exit_status 918126a8a12Smrg fi 919126a8a12Smrg fi 920126a8a12Smrg 921126a8a12Smrg if test -z "$output_obj"; then 922126a8a12Smrg # Place PIC objects in $objdir 923126a8a12Smrg command="$command -o $lobj" 924126a8a12Smrg fi 925126a8a12Smrg 926126a8a12Smrg $run $rm "$lobj" "$output_obj" 927126a8a12Smrg 928126a8a12Smrg $show "$command" 929126a8a12Smrg if $run eval "$command"; then : 930126a8a12Smrg else 931126a8a12Smrg test -n "$output_obj" && $run $rm $removelist 932126a8a12Smrg exit $EXIT_FAILURE 933126a8a12Smrg fi 934126a8a12Smrg 935126a8a12Smrg if test "$need_locks" = warn && 936126a8a12Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 937126a8a12Smrg $echo "\ 938126a8a12Smrg*** ERROR, $lockfile contains: 939126a8a12Smrg`cat $lockfile 2>/dev/null` 940126a8a12Smrg 941126a8a12Smrgbut it should contain: 942126a8a12Smrg$srcfile 943126a8a12Smrg 944126a8a12SmrgThis indicates that another process is trying to use the same 945126a8a12Smrgtemporary object file, and libtool could not work around it because 946126a8a12Smrgyour compiler does not support \`-c' and \`-o' together. If you 947126a8a12Smrgrepeat this compilation, it may succeed, by chance, but you had better 948126a8a12Smrgavoid parallel builds (make -j) in this platform, or get a better 949126a8a12Smrgcompiler." 950126a8a12Smrg 951126a8a12Smrg $run $rm $removelist 952126a8a12Smrg exit $EXIT_FAILURE 953126a8a12Smrg fi 954126a8a12Smrg 955126a8a12Smrg # Just move the object if needed, then go on to compile the next one 956126a8a12Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 957126a8a12Smrg $show "$mv $output_obj $lobj" 958126a8a12Smrg if $run $mv $output_obj $lobj; then : 959126a8a12Smrg else 960126a8a12Smrg error=$? 961126a8a12Smrg $run $rm $removelist 962126a8a12Smrg exit $error 963126a8a12Smrg fi 964126a8a12Smrg fi 965126a8a12Smrg 966126a8a12Smrg # Append the name of the PIC object to the libtool object file. 967126a8a12Smrg test -z "$run" && cat >> ${libobj}T <<EOF 968126a8a12Smrgpic_object='$objdir/$objname' 969126a8a12Smrg 970126a8a12SmrgEOF 971126a8a12Smrg 972126a8a12Smrg # Allow error messages only from the first compilation. 973126a8a12Smrg if test "$suppress_opt" = yes; then 974126a8a12Smrg suppress_output=' >/dev/null 2>&1' 975126a8a12Smrg fi 976126a8a12Smrg else 977126a8a12Smrg # No PIC object so indicate it doesn't exist in the libtool 978126a8a12Smrg # object file. 979126a8a12Smrg test -z "$run" && cat >> ${libobj}T <<EOF 980126a8a12Smrgpic_object=none 981126a8a12Smrg 982126a8a12SmrgEOF 983126a8a12Smrg fi 984126a8a12Smrg 985126a8a12Smrg # Only build a position-dependent object if we build old libraries. 986126a8a12Smrg if test "$build_old_libs" = yes; then 987126a8a12Smrg if test "$pic_mode" != yes; then 988126a8a12Smrg # Don't build PIC code 989126a8a12Smrg command="$base_compile $qsrcfile" 990126a8a12Smrg else 991126a8a12Smrg command="$base_compile $qsrcfile $pic_flag" 992126a8a12Smrg fi 993126a8a12Smrg if test "$compiler_c_o" = yes; then 994126a8a12Smrg command="$command -o $obj" 995126a8a12Smrg fi 996126a8a12Smrg 997126a8a12Smrg # Suppress compiler output if we already did a PIC compilation. 998126a8a12Smrg command="$command$suppress_output" 999126a8a12Smrg $run $rm "$obj" "$output_obj" 1000126a8a12Smrg $show "$command" 1001126a8a12Smrg if $run eval "$command"; then : 1002126a8a12Smrg else 1003126a8a12Smrg $run $rm $removelist 1004126a8a12Smrg exit $EXIT_FAILURE 1005126a8a12Smrg fi 1006126a8a12Smrg 1007126a8a12Smrg if test "$need_locks" = warn && 1008126a8a12Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1009126a8a12Smrg $echo "\ 1010126a8a12Smrg*** ERROR, $lockfile contains: 1011126a8a12Smrg`cat $lockfile 2>/dev/null` 1012126a8a12Smrg 1013126a8a12Smrgbut it should contain: 1014126a8a12Smrg$srcfile 1015126a8a12Smrg 1016126a8a12SmrgThis indicates that another process is trying to use the same 1017126a8a12Smrgtemporary object file, and libtool could not work around it because 1018126a8a12Smrgyour compiler does not support \`-c' and \`-o' together. If you 1019126a8a12Smrgrepeat this compilation, it may succeed, by chance, but you had better 1020126a8a12Smrgavoid parallel builds (make -j) in this platform, or get a better 1021126a8a12Smrgcompiler." 1022126a8a12Smrg 1023126a8a12Smrg $run $rm $removelist 1024126a8a12Smrg exit $EXIT_FAILURE 1025126a8a12Smrg fi 1026126a8a12Smrg 1027126a8a12Smrg # Just move the object if needed 1028126a8a12Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1029126a8a12Smrg $show "$mv $output_obj $obj" 1030126a8a12Smrg if $run $mv $output_obj $obj; then : 1031126a8a12Smrg else 1032126a8a12Smrg error=$? 1033126a8a12Smrg $run $rm $removelist 1034126a8a12Smrg exit $error 1035126a8a12Smrg fi 1036126a8a12Smrg fi 1037126a8a12Smrg 1038126a8a12Smrg # Append the name of the non-PIC object the libtool object file. 1039126a8a12Smrg # Only append if the libtool object file exists. 1040126a8a12Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1041126a8a12Smrg# Name of the non-PIC object. 1042126a8a12Smrgnon_pic_object='$objname' 1043126a8a12Smrg 1044126a8a12SmrgEOF 1045126a8a12Smrg else 1046126a8a12Smrg # Append the name of the non-PIC object the libtool object file. 1047126a8a12Smrg # Only append if the libtool object file exists. 1048126a8a12Smrg test -z "$run" && cat >> ${libobj}T <<EOF 1049126a8a12Smrg# Name of the non-PIC object. 1050126a8a12Smrgnon_pic_object=none 1051126a8a12Smrg 1052126a8a12SmrgEOF 1053126a8a12Smrg fi 1054126a8a12Smrg 1055126a8a12Smrg $run $mv "${libobj}T" "${libobj}" 1056126a8a12Smrg 1057126a8a12Smrg # Unlock the critical section if it was locked 1058126a8a12Smrg if test "$need_locks" != no; then 1059126a8a12Smrg $run $rm "$lockfile" 1060126a8a12Smrg fi 1061126a8a12Smrg 1062126a8a12Smrg exit $EXIT_SUCCESS 1063126a8a12Smrg ;; 1064126a8a12Smrg 1065126a8a12Smrg # libtool link mode 1066126a8a12Smrg link | relink) 1067126a8a12Smrg modename="$modename: link" 1068126a8a12Smrg case $host in 1069126a8a12Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1070126a8a12Smrg # It is impossible to link a dll without this setting, and 1071126a8a12Smrg # we shouldn't force the makefile maintainer to figure out 1072126a8a12Smrg # which system we are compiling for in order to pass an extra 1073126a8a12Smrg # flag for every libtool invocation. 1074126a8a12Smrg # allow_undefined=no 1075126a8a12Smrg 1076126a8a12Smrg # FIXME: Unfortunately, there are problems with the above when trying 1077126a8a12Smrg # to make a dll which has undefined symbols, in which case not 1078126a8a12Smrg # even a static library is built. For now, we need to specify 1079126a8a12Smrg # -no-undefined on the libtool link line when we can be certain 1080126a8a12Smrg # that all symbols are satisfied, otherwise we get a static library. 1081126a8a12Smrg allow_undefined=yes 1082126a8a12Smrg ;; 1083126a8a12Smrg *) 1084126a8a12Smrg allow_undefined=yes 1085126a8a12Smrg ;; 1086126a8a12Smrg esac 1087126a8a12Smrg libtool_args="$nonopt" 1088126a8a12Smrg base_compile="$nonopt $@" 1089126a8a12Smrg compile_command="$nonopt" 1090126a8a12Smrg finalize_command="$nonopt" 1091126a8a12Smrg 1092126a8a12Smrg compile_rpath= 1093126a8a12Smrg finalize_rpath= 1094126a8a12Smrg compile_shlibpath= 1095126a8a12Smrg finalize_shlibpath= 1096126a8a12Smrg convenience= 1097126a8a12Smrg old_convenience= 1098126a8a12Smrg deplibs= 1099126a8a12Smrg old_deplibs= 1100126a8a12Smrg compiler_flags= 1101126a8a12Smrg linker_flags= 1102126a8a12Smrg dllsearchpath= 1103126a8a12Smrg lib_search_path=`pwd` 1104126a8a12Smrg inst_prefix_dir= 1105126a8a12Smrg 1106126a8a12Smrg avoid_version=no 1107126a8a12Smrg dlfiles= 1108126a8a12Smrg dlprefiles= 1109126a8a12Smrg dlself=no 1110126a8a12Smrg export_dynamic=no 1111126a8a12Smrg export_symbols= 1112126a8a12Smrg export_symbols_regex= 1113126a8a12Smrg generated= 1114126a8a12Smrg libobjs= 1115126a8a12Smrg ltlibs= 1116126a8a12Smrg module=no 1117126a8a12Smrg no_install=no 1118126a8a12Smrg objs= 1119126a8a12Smrg non_pic_objects= 1120126a8a12Smrg notinst_path= # paths that contain not-installed libtool libraries 1121126a8a12Smrg precious_files_regex= 1122126a8a12Smrg prefer_static_libs=no 1123126a8a12Smrg preload=no 1124126a8a12Smrg prev= 1125126a8a12Smrg prevarg= 1126126a8a12Smrg release= 1127126a8a12Smrg rpath= 1128126a8a12Smrg xrpath= 1129126a8a12Smrg perm_rpath= 1130126a8a12Smrg temp_rpath= 1131126a8a12Smrg thread_safe=no 1132126a8a12Smrg vinfo= 1133126a8a12Smrg vinfo_number=no 1134126a8a12Smrg 1135126a8a12Smrg func_infer_tag $base_compile 1136126a8a12Smrg 1137126a8a12Smrg # We need to know -static, to get the right output filenames. 1138126a8a12Smrg for arg 1139126a8a12Smrg do 1140126a8a12Smrg case $arg in 1141126a8a12Smrg -all-static | -static) 1142126a8a12Smrg if test "X$arg" = "X-all-static"; then 1143126a8a12Smrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 1144126a8a12Smrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1145126a8a12Smrg fi 1146126a8a12Smrg if test -n "$link_static_flag"; then 1147126a8a12Smrg dlopen_self=$dlopen_self_static 1148126a8a12Smrg fi 1149126a8a12Smrg prefer_static_libs=yes 1150126a8a12Smrg else 1151126a8a12Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 1152126a8a12Smrg dlopen_self=$dlopen_self_static 1153126a8a12Smrg fi 1154126a8a12Smrg prefer_static_libs=built 1155126a8a12Smrg fi 1156126a8a12Smrg build_libtool_libs=no 1157126a8a12Smrg build_old_libs=yes 1158126a8a12Smrg break 1159126a8a12Smrg ;; 1160126a8a12Smrg esac 1161126a8a12Smrg done 1162126a8a12Smrg 1163126a8a12Smrg # See if our shared archives depend on static archives. 1164126a8a12Smrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 1165126a8a12Smrg 1166126a8a12Smrg # Go through the arguments, transforming them on the way. 1167126a8a12Smrg while test "$#" -gt 0; do 1168126a8a12Smrg arg="$1" 1169126a8a12Smrg shift 1170126a8a12Smrg case $arg in 1171126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1172126a8a12Smrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 1173126a8a12Smrg ;; 1174126a8a12Smrg *) qarg=$arg ;; 1175126a8a12Smrg esac 1176126a8a12Smrg libtool_args="$libtool_args $qarg" 1177126a8a12Smrg 1178126a8a12Smrg # If the previous option needs an argument, assign it. 1179126a8a12Smrg if test -n "$prev"; then 1180126a8a12Smrg case $prev in 1181126a8a12Smrg output) 1182126a8a12Smrg compile_command="$compile_command @OUTPUT@" 1183126a8a12Smrg finalize_command="$finalize_command @OUTPUT@" 1184126a8a12Smrg ;; 1185126a8a12Smrg esac 1186126a8a12Smrg 1187126a8a12Smrg case $prev in 1188126a8a12Smrg dlfiles|dlprefiles) 1189126a8a12Smrg if test "$preload" = no; then 1190126a8a12Smrg # Add the symbol object into the linking commands. 1191126a8a12Smrg compile_command="$compile_command @SYMFILE@" 1192126a8a12Smrg finalize_command="$finalize_command @SYMFILE@" 1193126a8a12Smrg preload=yes 1194126a8a12Smrg fi 1195126a8a12Smrg case $arg in 1196126a8a12Smrg *.la | *.lo) ;; # We handle these cases below. 1197126a8a12Smrg force) 1198126a8a12Smrg if test "$dlself" = no; then 1199126a8a12Smrg dlself=needless 1200126a8a12Smrg export_dynamic=yes 1201126a8a12Smrg fi 1202126a8a12Smrg prev= 1203126a8a12Smrg continue 1204126a8a12Smrg ;; 1205126a8a12Smrg self) 1206126a8a12Smrg if test "$prev" = dlprefiles; then 1207126a8a12Smrg dlself=yes 1208126a8a12Smrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 1209126a8a12Smrg dlself=yes 1210126a8a12Smrg else 1211126a8a12Smrg dlself=needless 1212126a8a12Smrg export_dynamic=yes 1213126a8a12Smrg fi 1214126a8a12Smrg prev= 1215126a8a12Smrg continue 1216126a8a12Smrg ;; 1217126a8a12Smrg *) 1218126a8a12Smrg if test "$prev" = dlfiles; then 1219126a8a12Smrg dlfiles="$dlfiles $arg" 1220126a8a12Smrg else 1221126a8a12Smrg dlprefiles="$dlprefiles $arg" 1222126a8a12Smrg fi 1223126a8a12Smrg prev= 1224126a8a12Smrg continue 1225126a8a12Smrg ;; 1226126a8a12Smrg esac 1227126a8a12Smrg ;; 1228126a8a12Smrg expsyms) 1229126a8a12Smrg export_symbols="$arg" 1230126a8a12Smrg if test ! -f "$arg"; then 1231126a8a12Smrg $echo "$modename: symbol file \`$arg' does not exist" 1232126a8a12Smrg exit $EXIT_FAILURE 1233126a8a12Smrg fi 1234126a8a12Smrg prev= 1235126a8a12Smrg continue 1236126a8a12Smrg ;; 1237126a8a12Smrg expsyms_regex) 1238126a8a12Smrg export_symbols_regex="$arg" 1239126a8a12Smrg prev= 1240126a8a12Smrg continue 1241126a8a12Smrg ;; 1242126a8a12Smrg inst_prefix) 1243126a8a12Smrg inst_prefix_dir="$arg" 1244126a8a12Smrg prev= 1245126a8a12Smrg continue 1246126a8a12Smrg ;; 1247126a8a12Smrg precious_regex) 1248126a8a12Smrg precious_files_regex="$arg" 1249126a8a12Smrg prev= 1250126a8a12Smrg continue 1251126a8a12Smrg ;; 1252126a8a12Smrg release) 1253126a8a12Smrg release="-$arg" 1254126a8a12Smrg prev= 1255126a8a12Smrg continue 1256126a8a12Smrg ;; 1257126a8a12Smrg objectlist) 1258126a8a12Smrg if test -f "$arg"; then 1259126a8a12Smrg save_arg=$arg 1260126a8a12Smrg moreargs= 1261126a8a12Smrg for fil in `cat $save_arg` 1262126a8a12Smrg do 1263126a8a12Smrg# moreargs="$moreargs $fil" 1264126a8a12Smrg arg=$fil 1265126a8a12Smrg # A libtool-controlled object. 1266126a8a12Smrg 1267126a8a12Smrg # Check to see that this really is a libtool object. 1268126a8a12Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1269126a8a12Smrg pic_object= 1270126a8a12Smrg non_pic_object= 1271126a8a12Smrg 1272126a8a12Smrg # Read the .lo file 1273126a8a12Smrg # If there is no directory component, then add one. 1274126a8a12Smrg case $arg in 1275126a8a12Smrg */* | *\\*) . $arg ;; 1276126a8a12Smrg *) . ./$arg ;; 1277126a8a12Smrg esac 1278126a8a12Smrg 1279126a8a12Smrg if test -z "$pic_object" || \ 1280126a8a12Smrg test -z "$non_pic_object" || 1281126a8a12Smrg test "$pic_object" = none && \ 1282126a8a12Smrg test "$non_pic_object" = none; then 1283126a8a12Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1284126a8a12Smrg exit $EXIT_FAILURE 1285126a8a12Smrg fi 1286126a8a12Smrg 1287126a8a12Smrg # Extract subdirectory from the argument. 1288126a8a12Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1289126a8a12Smrg if test "X$xdir" = "X$arg"; then 1290126a8a12Smrg xdir= 1291126a8a12Smrg else 1292126a8a12Smrg xdir="$xdir/" 1293126a8a12Smrg fi 1294126a8a12Smrg 1295126a8a12Smrg if test "$pic_object" != none; then 1296126a8a12Smrg # Prepend the subdirectory the object is found in. 1297126a8a12Smrg pic_object="$xdir$pic_object" 1298126a8a12Smrg 1299126a8a12Smrg if test "$prev" = dlfiles; then 1300126a8a12Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1301126a8a12Smrg dlfiles="$dlfiles $pic_object" 1302126a8a12Smrg prev= 1303126a8a12Smrg continue 1304126a8a12Smrg else 1305126a8a12Smrg # If libtool objects are unsupported, then we need to preload. 1306126a8a12Smrg prev=dlprefiles 1307126a8a12Smrg fi 1308126a8a12Smrg fi 1309126a8a12Smrg 1310126a8a12Smrg # CHECK ME: I think I busted this. -Ossama 1311126a8a12Smrg if test "$prev" = dlprefiles; then 1312126a8a12Smrg # Preload the old-style object. 1313126a8a12Smrg dlprefiles="$dlprefiles $pic_object" 1314126a8a12Smrg prev= 1315126a8a12Smrg fi 1316126a8a12Smrg 1317126a8a12Smrg # A PIC object. 1318126a8a12Smrg libobjs="$libobjs $pic_object" 1319126a8a12Smrg arg="$pic_object" 1320126a8a12Smrg fi 1321126a8a12Smrg 1322126a8a12Smrg # Non-PIC object. 1323126a8a12Smrg if test "$non_pic_object" != none; then 1324126a8a12Smrg # Prepend the subdirectory the object is found in. 1325126a8a12Smrg non_pic_object="$xdir$non_pic_object" 1326126a8a12Smrg 1327126a8a12Smrg # A standard non-PIC object 1328126a8a12Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1329126a8a12Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 1330126a8a12Smrg arg="$non_pic_object" 1331126a8a12Smrg fi 1332126a8a12Smrg else 1333126a8a12Smrg # If the PIC object exists, use it instead. 1334126a8a12Smrg # $xdir was prepended to $pic_object above. 1335126a8a12Smrg non_pic_object="$pic_object" 1336126a8a12Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1337126a8a12Smrg fi 1338126a8a12Smrg else 1339126a8a12Smrg # Only an error if not doing a dry-run. 1340126a8a12Smrg if test -z "$run"; then 1341126a8a12Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1342126a8a12Smrg exit $EXIT_FAILURE 1343126a8a12Smrg else 1344126a8a12Smrg # Dry-run case. 1345126a8a12Smrg 1346126a8a12Smrg # Extract subdirectory from the argument. 1347126a8a12Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1348126a8a12Smrg if test "X$xdir" = "X$arg"; then 1349126a8a12Smrg xdir= 1350126a8a12Smrg else 1351126a8a12Smrg xdir="$xdir/" 1352126a8a12Smrg fi 1353126a8a12Smrg 1354126a8a12Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1355126a8a12Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1356126a8a12Smrg libobjs="$libobjs $pic_object" 1357126a8a12Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1358126a8a12Smrg fi 1359126a8a12Smrg fi 1360126a8a12Smrg done 1361126a8a12Smrg else 1362126a8a12Smrg $echo "$modename: link input file \`$save_arg' does not exist" 1363126a8a12Smrg exit $EXIT_FAILURE 1364126a8a12Smrg fi 1365126a8a12Smrg arg=$save_arg 1366126a8a12Smrg prev= 1367126a8a12Smrg continue 1368126a8a12Smrg ;; 1369126a8a12Smrg rpath | xrpath) 1370126a8a12Smrg # We need an absolute path. 1371126a8a12Smrg case $arg in 1372126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1373126a8a12Smrg *) 1374126a8a12Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 1375126a8a12Smrg exit $EXIT_FAILURE 1376126a8a12Smrg ;; 1377126a8a12Smrg esac 1378126a8a12Smrg if test "$prev" = rpath; then 1379126a8a12Smrg case "$rpath " in 1380126a8a12Smrg *" $arg "*) ;; 1381126a8a12Smrg *) rpath="$rpath $arg" ;; 1382126a8a12Smrg esac 1383126a8a12Smrg else 1384126a8a12Smrg case "$xrpath " in 1385126a8a12Smrg *" $arg "*) ;; 1386126a8a12Smrg *) xrpath="$xrpath $arg" ;; 1387126a8a12Smrg esac 1388126a8a12Smrg fi 1389126a8a12Smrg prev= 1390126a8a12Smrg continue 1391126a8a12Smrg ;; 1392126a8a12Smrg xcompiler) 1393126a8a12Smrg compiler_flags="$compiler_flags $qarg" 1394126a8a12Smrg prev= 1395126a8a12Smrg compile_command="$compile_command $qarg" 1396126a8a12Smrg finalize_command="$finalize_command $qarg" 1397126a8a12Smrg continue 1398126a8a12Smrg ;; 1399126a8a12Smrg xlinker) 1400126a8a12Smrg linker_flags="$linker_flags $qarg" 1401126a8a12Smrg compiler_flags="$compiler_flags $wl$qarg" 1402126a8a12Smrg prev= 1403126a8a12Smrg compile_command="$compile_command $wl$qarg" 1404126a8a12Smrg finalize_command="$finalize_command $wl$qarg" 1405126a8a12Smrg continue 1406126a8a12Smrg ;; 1407126a8a12Smrg xcclinker) 1408126a8a12Smrg linker_flags="$linker_flags $qarg" 1409126a8a12Smrg compiler_flags="$compiler_flags $qarg" 1410126a8a12Smrg prev= 1411126a8a12Smrg compile_command="$compile_command $qarg" 1412126a8a12Smrg finalize_command="$finalize_command $qarg" 1413126a8a12Smrg continue 1414126a8a12Smrg ;; 1415126a8a12Smrg shrext) 1416126a8a12Smrg shrext_cmds="$arg" 1417126a8a12Smrg prev= 1418126a8a12Smrg continue 1419126a8a12Smrg ;; 1420126a8a12Smrg darwin_framework|darwin_framework_skip) 1421126a8a12Smrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 1422126a8a12Smrg compile_command="$compile_command $arg" 1423126a8a12Smrg finalize_command="$finalize_command $arg" 1424126a8a12Smrg prev= 1425126a8a12Smrg continue 1426126a8a12Smrg ;; 1427126a8a12Smrg *) 1428126a8a12Smrg eval "$prev=\"\$arg\"" 1429126a8a12Smrg prev= 1430126a8a12Smrg continue 1431126a8a12Smrg ;; 1432126a8a12Smrg esac 1433126a8a12Smrg fi # test -n "$prev" 1434126a8a12Smrg 1435126a8a12Smrg prevarg="$arg" 1436126a8a12Smrg 1437126a8a12Smrg case $arg in 1438126a8a12Smrg -all-static) 1439126a8a12Smrg if test -n "$link_static_flag"; then 1440126a8a12Smrg compile_command="$compile_command $link_static_flag" 1441126a8a12Smrg finalize_command="$finalize_command $link_static_flag" 1442126a8a12Smrg fi 1443126a8a12Smrg continue 1444126a8a12Smrg ;; 1445126a8a12Smrg 1446126a8a12Smrg -allow-undefined) 1447126a8a12Smrg # FIXME: remove this flag sometime in the future. 1448126a8a12Smrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1449126a8a12Smrg continue 1450126a8a12Smrg ;; 1451126a8a12Smrg 1452126a8a12Smrg -avoid-version) 1453126a8a12Smrg avoid_version=yes 1454126a8a12Smrg continue 1455126a8a12Smrg ;; 1456126a8a12Smrg 1457126a8a12Smrg -dlopen) 1458126a8a12Smrg prev=dlfiles 1459126a8a12Smrg continue 1460126a8a12Smrg ;; 1461126a8a12Smrg 1462126a8a12Smrg -dlpreopen) 1463126a8a12Smrg prev=dlprefiles 1464126a8a12Smrg continue 1465126a8a12Smrg ;; 1466126a8a12Smrg 1467126a8a12Smrg -export-dynamic) 1468126a8a12Smrg export_dynamic=yes 1469126a8a12Smrg continue 1470126a8a12Smrg ;; 1471126a8a12Smrg 1472126a8a12Smrg -export-symbols | -export-symbols-regex) 1473126a8a12Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1474126a8a12Smrg $echo "$modename: more than one -exported-symbols argument is not allowed" 1475126a8a12Smrg exit $EXIT_FAILURE 1476126a8a12Smrg fi 1477126a8a12Smrg if test "X$arg" = "X-export-symbols"; then 1478126a8a12Smrg prev=expsyms 1479126a8a12Smrg else 1480126a8a12Smrg prev=expsyms_regex 1481126a8a12Smrg fi 1482126a8a12Smrg continue 1483126a8a12Smrg ;; 1484126a8a12Smrg 1485126a8a12Smrg -framework|-arch|-isysroot) 1486126a8a12Smrg case " $CC " in 1487126a8a12Smrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 1488126a8a12Smrg prev=darwin_framework_skip ;; 1489126a8a12Smrg *) compiler_flags="$compiler_flags $arg" 1490126a8a12Smrg prev=darwin_framework ;; 1491126a8a12Smrg esac 1492126a8a12Smrg compile_command="$compile_command $arg" 1493126a8a12Smrg finalize_command="$finalize_command $arg" 1494126a8a12Smrg continue 1495126a8a12Smrg ;; 1496126a8a12Smrg 1497126a8a12Smrg -inst-prefix-dir) 1498126a8a12Smrg prev=inst_prefix 1499126a8a12Smrg continue 1500126a8a12Smrg ;; 1501126a8a12Smrg 1502126a8a12Smrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1503126a8a12Smrg # so, if we see these flags be careful not to treat them like -L 1504126a8a12Smrg -L[A-Z][A-Z]*:*) 1505126a8a12Smrg case $with_gcc/$host in 1506126a8a12Smrg no/*-*-irix* | /*-*-irix*) 1507126a8a12Smrg compile_command="$compile_command $arg" 1508126a8a12Smrg finalize_command="$finalize_command $arg" 1509126a8a12Smrg ;; 1510126a8a12Smrg esac 1511126a8a12Smrg continue 1512126a8a12Smrg ;; 1513126a8a12Smrg 1514126a8a12Smrg -L*) 1515126a8a12Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1516126a8a12Smrg # We need an absolute path. 1517126a8a12Smrg case $dir in 1518126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1519126a8a12Smrg *) 1520126a8a12Smrg absdir=`cd "$dir" && pwd` 1521126a8a12Smrg if test -z "$absdir"; then 1522126a8a12Smrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1523126a8a12Smrg absdir="$dir" 1524126a8a12Smrg notinst_path="$notinst_path $dir" 1525126a8a12Smrg fi 1526126a8a12Smrg dir="$absdir" 1527126a8a12Smrg ;; 1528126a8a12Smrg esac 1529126a8a12Smrg case "$deplibs " in 1530126a8a12Smrg *" -L$dir "*) ;; 1531126a8a12Smrg *) 1532126a8a12Smrg deplibs="$deplibs -L$dir" 1533126a8a12Smrg lib_search_path="$lib_search_path $dir" 1534126a8a12Smrg ;; 1535126a8a12Smrg esac 1536126a8a12Smrg case $host in 1537126a8a12Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1538126a8a12Smrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 1539126a8a12Smrg case :$dllsearchpath: in 1540126a8a12Smrg *":$dir:"*) ;; 1541126a8a12Smrg *) dllsearchpath="$dllsearchpath:$dir";; 1542126a8a12Smrg esac 1543126a8a12Smrg case :$dllsearchpath: in 1544126a8a12Smrg *":$testbindir:"*) ;; 1545126a8a12Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 1546126a8a12Smrg esac 1547126a8a12Smrg ;; 1548126a8a12Smrg esac 1549126a8a12Smrg continue 1550126a8a12Smrg ;; 1551126a8a12Smrg 1552126a8a12Smrg -l*) 1553126a8a12Smrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1554126a8a12Smrg case $host in 1555126a8a12Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 1556126a8a12Smrg # These systems don't actually have a C or math library (as such) 1557126a8a12Smrg continue 1558126a8a12Smrg ;; 1559126a8a12Smrg *-*-os2*) 1560126a8a12Smrg # These systems don't actually have a C library (as such) 1561126a8a12Smrg test "X$arg" = "X-lc" && continue 1562126a8a12Smrg ;; 1563126a8a12Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1564126a8a12Smrg # Do not include libc due to us having libc/libc_r. 1565126a8a12Smrg test "X$arg" = "X-lc" && continue 1566126a8a12Smrg ;; 1567126a8a12Smrg *-*-rhapsody* | *-*-darwin1.[012]) 1568126a8a12Smrg # Rhapsody C and math libraries are in the System framework 1569126a8a12Smrg deplibs="$deplibs -framework System" 1570126a8a12Smrg continue 1571126a8a12Smrg ;; 1572126a8a12Smrg *-*-sco3.2v5* | *-*-sco5v6*) 1573126a8a12Smrg # Causes problems with __ctype 1574126a8a12Smrg test "X$arg" = "X-lc" && continue 1575126a8a12Smrg ;; 1576126a8a12Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 1577126a8a12Smrg # Compiler inserts libc in the correct place for threads to work 1578126a8a12Smrg test "X$arg" = "X-lc" && continue 1579126a8a12Smrg ;; 1580126a8a12Smrg esac 1581126a8a12Smrg elif test "X$arg" = "X-lc_r"; then 1582126a8a12Smrg case $host in 1583126a8a12Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1584126a8a12Smrg # Do not include libc_r directly, use -pthread flag. 1585126a8a12Smrg continue 1586126a8a12Smrg ;; 1587126a8a12Smrg esac 1588126a8a12Smrg fi 1589126a8a12Smrg deplibs="$deplibs $arg" 1590126a8a12Smrg continue 1591126a8a12Smrg ;; 1592126a8a12Smrg 1593126a8a12Smrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 1594126a8a12Smrg # classes, name mangling, and exception handling. 1595126a8a12Smrg -model) 1596126a8a12Smrg compile_command="$compile_command $arg" 1597126a8a12Smrg compiler_flags="$compiler_flags $arg" 1598126a8a12Smrg finalize_command="$finalize_command $arg" 1599126a8a12Smrg prev=xcompiler 1600126a8a12Smrg continue 1601126a8a12Smrg ;; 1602126a8a12Smrg 1603126a8a12Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 1604126a8a12Smrg compiler_flags="$compiler_flags $arg" 1605126a8a12Smrg compile_command="$compile_command $arg" 1606126a8a12Smrg finalize_command="$finalize_command $arg" 1607126a8a12Smrg continue 1608126a8a12Smrg ;; 1609126a8a12Smrg 1610126a8a12Smrg -module) 1611126a8a12Smrg module=yes 1612126a8a12Smrg continue 1613126a8a12Smrg ;; 1614126a8a12Smrg 1615126a8a12Smrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 1616126a8a12Smrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 1617126a8a12Smrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 1618126a8a12Smrg # +DA*, +DD* enable 64-bit mode on the HP compiler 1619126a8a12Smrg # -q* pass through compiler args for the IBM compiler 1620126a8a12Smrg # -m* pass through architecture-specific compiler args for GCC 1621126a8a12Smrg # -m*, -t[45]*, -txscale* pass through architecture-specific 1622126a8a12Smrg # compiler args for GCC 1623126a8a12Smrg # -pg pass through profiling flag for GCC 1624126a8a12Smrg # @file GCC response files 1625126a8a12Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ 1626126a8a12Smrg -t[45]*|-txscale*|@*) 1627126a8a12Smrg 1628126a8a12Smrg # Unknown arguments in both finalize_command and compile_command need 1629126a8a12Smrg # to be aesthetically quoted because they are evaled later. 1630126a8a12Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1631126a8a12Smrg case $arg in 1632126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1633126a8a12Smrg arg="\"$arg\"" 1634126a8a12Smrg ;; 1635126a8a12Smrg esac 1636126a8a12Smrg compile_command="$compile_command $arg" 1637126a8a12Smrg finalize_command="$finalize_command $arg" 1638126a8a12Smrg compiler_flags="$compiler_flags $arg" 1639126a8a12Smrg continue 1640126a8a12Smrg ;; 1641126a8a12Smrg 1642126a8a12Smrg -shrext) 1643126a8a12Smrg prev=shrext 1644126a8a12Smrg continue 1645126a8a12Smrg ;; 1646126a8a12Smrg 1647126a8a12Smrg -no-fast-install) 1648126a8a12Smrg fast_install=no 1649126a8a12Smrg continue 1650126a8a12Smrg ;; 1651126a8a12Smrg 1652126a8a12Smrg -no-install) 1653126a8a12Smrg case $host in 1654126a8a12Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1655126a8a12Smrg # The PATH hackery in wrapper scripts is required on Windows 1656126a8a12Smrg # in order for the loader to find any dlls it needs. 1657126a8a12Smrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1658126a8a12Smrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1659126a8a12Smrg fast_install=no 1660126a8a12Smrg ;; 1661126a8a12Smrg *) no_install=yes ;; 1662126a8a12Smrg esac 1663126a8a12Smrg continue 1664126a8a12Smrg ;; 1665126a8a12Smrg 1666126a8a12Smrg -no-undefined) 1667126a8a12Smrg allow_undefined=no 1668126a8a12Smrg continue 1669126a8a12Smrg ;; 1670126a8a12Smrg 1671126a8a12Smrg -objectlist) 1672126a8a12Smrg prev=objectlist 1673126a8a12Smrg continue 1674126a8a12Smrg ;; 1675126a8a12Smrg 1676126a8a12Smrg -o) prev=output ;; 1677126a8a12Smrg 1678126a8a12Smrg -precious-files-regex) 1679126a8a12Smrg prev=precious_regex 1680126a8a12Smrg continue 1681126a8a12Smrg ;; 1682126a8a12Smrg 1683126a8a12Smrg -release) 1684126a8a12Smrg prev=release 1685126a8a12Smrg continue 1686126a8a12Smrg ;; 1687126a8a12Smrg 1688126a8a12Smrg -rpath) 1689126a8a12Smrg prev=rpath 1690126a8a12Smrg continue 1691126a8a12Smrg ;; 1692126a8a12Smrg 1693126a8a12Smrg -R) 1694126a8a12Smrg prev=xrpath 1695126a8a12Smrg continue 1696126a8a12Smrg ;; 1697126a8a12Smrg 1698126a8a12Smrg -R*) 1699126a8a12Smrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1700126a8a12Smrg # We need an absolute path. 1701126a8a12Smrg case $dir in 1702126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 1703126a8a12Smrg *) 1704126a8a12Smrg $echo "$modename: only absolute run-paths are allowed" 1>&2 1705126a8a12Smrg exit $EXIT_FAILURE 1706126a8a12Smrg ;; 1707126a8a12Smrg esac 1708126a8a12Smrg case "$xrpath " in 1709126a8a12Smrg *" $dir "*) ;; 1710126a8a12Smrg *) xrpath="$xrpath $dir" ;; 1711126a8a12Smrg esac 1712126a8a12Smrg continue 1713126a8a12Smrg ;; 1714126a8a12Smrg 1715126a8a12Smrg -static) 1716126a8a12Smrg # The effects of -static are defined in a previous loop. 1717126a8a12Smrg # We used to do the same as -all-static on platforms that 1718126a8a12Smrg # didn't have a PIC flag, but the assumption that the effects 1719126a8a12Smrg # would be equivalent was wrong. It would break on at least 1720126a8a12Smrg # Digital Unix and AIX. 1721126a8a12Smrg continue 1722126a8a12Smrg ;; 1723126a8a12Smrg 1724126a8a12Smrg -thread-safe) 1725126a8a12Smrg thread_safe=yes 1726126a8a12Smrg continue 1727126a8a12Smrg ;; 1728126a8a12Smrg 1729126a8a12Smrg -version-info) 1730126a8a12Smrg prev=vinfo 1731126a8a12Smrg continue 1732126a8a12Smrg ;; 1733126a8a12Smrg -version-number) 1734126a8a12Smrg prev=vinfo 1735126a8a12Smrg vinfo_number=yes 1736126a8a12Smrg continue 1737126a8a12Smrg ;; 1738126a8a12Smrg 1739126a8a12Smrg -Wc,*) 1740126a8a12Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1741126a8a12Smrg arg= 1742126a8a12Smrg save_ifs="$IFS"; IFS=',' 1743126a8a12Smrg for flag in $args; do 1744126a8a12Smrg IFS="$save_ifs" 1745126a8a12Smrg case $flag in 1746126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1747126a8a12Smrg flag="\"$flag\"" 1748126a8a12Smrg ;; 1749126a8a12Smrg esac 1750126a8a12Smrg arg="$arg $wl$flag" 1751126a8a12Smrg compiler_flags="$compiler_flags $flag" 1752126a8a12Smrg done 1753126a8a12Smrg IFS="$save_ifs" 1754126a8a12Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1755126a8a12Smrg ;; 1756126a8a12Smrg 1757126a8a12Smrg -Wl,*) 1758126a8a12Smrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1759126a8a12Smrg arg= 1760126a8a12Smrg save_ifs="$IFS"; IFS=',' 1761126a8a12Smrg for flag in $args; do 1762126a8a12Smrg IFS="$save_ifs" 1763126a8a12Smrg case $flag in 1764126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1765126a8a12Smrg flag="\"$flag\"" 1766126a8a12Smrg ;; 1767126a8a12Smrg esac 1768126a8a12Smrg arg="$arg $wl$flag" 1769126a8a12Smrg compiler_flags="$compiler_flags $wl$flag" 1770126a8a12Smrg linker_flags="$linker_flags $flag" 1771126a8a12Smrg done 1772126a8a12Smrg IFS="$save_ifs" 1773126a8a12Smrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1774126a8a12Smrg ;; 1775126a8a12Smrg 1776126a8a12Smrg -Xcompiler) 1777126a8a12Smrg prev=xcompiler 1778126a8a12Smrg continue 1779126a8a12Smrg ;; 1780126a8a12Smrg 1781126a8a12Smrg -Xlinker) 1782126a8a12Smrg prev=xlinker 1783126a8a12Smrg continue 1784126a8a12Smrg ;; 1785126a8a12Smrg 1786126a8a12Smrg -XCClinker) 1787126a8a12Smrg prev=xcclinker 1788126a8a12Smrg continue 1789126a8a12Smrg ;; 1790126a8a12Smrg 1791126a8a12Smrg # Some other compiler flag. 1792126a8a12Smrg -* | +*) 1793126a8a12Smrg # Unknown arguments in both finalize_command and compile_command need 1794126a8a12Smrg # to be aesthetically quoted because they are evaled later. 1795126a8a12Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1796126a8a12Smrg case $arg in 1797126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1798126a8a12Smrg arg="\"$arg\"" 1799126a8a12Smrg ;; 1800126a8a12Smrg esac 1801126a8a12Smrg ;; 1802126a8a12Smrg 1803126a8a12Smrg *.$objext) 1804126a8a12Smrg # A standard object. 1805126a8a12Smrg objs="$objs $arg" 1806126a8a12Smrg ;; 1807126a8a12Smrg 1808126a8a12Smrg *.lo) 1809126a8a12Smrg # A libtool-controlled object. 1810126a8a12Smrg 1811126a8a12Smrg # Check to see that this really is a libtool object. 1812126a8a12Smrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1813126a8a12Smrg pic_object= 1814126a8a12Smrg non_pic_object= 1815126a8a12Smrg 1816126a8a12Smrg # Read the .lo file 1817126a8a12Smrg # If there is no directory component, then add one. 1818126a8a12Smrg case $arg in 1819126a8a12Smrg */* | *\\*) . $arg ;; 1820126a8a12Smrg *) . ./$arg ;; 1821126a8a12Smrg esac 1822126a8a12Smrg 1823126a8a12Smrg if test -z "$pic_object" || \ 1824126a8a12Smrg test -z "$non_pic_object" || 1825126a8a12Smrg test "$pic_object" = none && \ 1826126a8a12Smrg test "$non_pic_object" = none; then 1827126a8a12Smrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1828126a8a12Smrg exit $EXIT_FAILURE 1829126a8a12Smrg fi 1830126a8a12Smrg 1831126a8a12Smrg # Extract subdirectory from the argument. 1832126a8a12Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1833126a8a12Smrg if test "X$xdir" = "X$arg"; then 1834126a8a12Smrg xdir= 1835126a8a12Smrg else 1836126a8a12Smrg xdir="$xdir/" 1837126a8a12Smrg fi 1838126a8a12Smrg 1839126a8a12Smrg if test "$pic_object" != none; then 1840126a8a12Smrg # Prepend the subdirectory the object is found in. 1841126a8a12Smrg pic_object="$xdir$pic_object" 1842126a8a12Smrg 1843126a8a12Smrg if test "$prev" = dlfiles; then 1844126a8a12Smrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1845126a8a12Smrg dlfiles="$dlfiles $pic_object" 1846126a8a12Smrg prev= 1847126a8a12Smrg continue 1848126a8a12Smrg else 1849126a8a12Smrg # If libtool objects are unsupported, then we need to preload. 1850126a8a12Smrg prev=dlprefiles 1851126a8a12Smrg fi 1852126a8a12Smrg fi 1853126a8a12Smrg 1854126a8a12Smrg # CHECK ME: I think I busted this. -Ossama 1855126a8a12Smrg if test "$prev" = dlprefiles; then 1856126a8a12Smrg # Preload the old-style object. 1857126a8a12Smrg dlprefiles="$dlprefiles $pic_object" 1858126a8a12Smrg prev= 1859126a8a12Smrg fi 1860126a8a12Smrg 1861126a8a12Smrg # A PIC object. 1862126a8a12Smrg libobjs="$libobjs $pic_object" 1863126a8a12Smrg arg="$pic_object" 1864126a8a12Smrg fi 1865126a8a12Smrg 1866126a8a12Smrg # Non-PIC object. 1867126a8a12Smrg if test "$non_pic_object" != none; then 1868126a8a12Smrg # Prepend the subdirectory the object is found in. 1869126a8a12Smrg non_pic_object="$xdir$non_pic_object" 1870126a8a12Smrg 1871126a8a12Smrg # A standard non-PIC object 1872126a8a12Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1873126a8a12Smrg if test -z "$pic_object" || test "$pic_object" = none ; then 1874126a8a12Smrg arg="$non_pic_object" 1875126a8a12Smrg fi 1876126a8a12Smrg else 1877126a8a12Smrg # If the PIC object exists, use it instead. 1878126a8a12Smrg # $xdir was prepended to $pic_object above. 1879126a8a12Smrg non_pic_object="$pic_object" 1880126a8a12Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1881126a8a12Smrg fi 1882126a8a12Smrg else 1883126a8a12Smrg # Only an error if not doing a dry-run. 1884126a8a12Smrg if test -z "$run"; then 1885126a8a12Smrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1886126a8a12Smrg exit $EXIT_FAILURE 1887126a8a12Smrg else 1888126a8a12Smrg # Dry-run case. 1889126a8a12Smrg 1890126a8a12Smrg # Extract subdirectory from the argument. 1891126a8a12Smrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1892126a8a12Smrg if test "X$xdir" = "X$arg"; then 1893126a8a12Smrg xdir= 1894126a8a12Smrg else 1895126a8a12Smrg xdir="$xdir/" 1896126a8a12Smrg fi 1897126a8a12Smrg 1898126a8a12Smrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1899126a8a12Smrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1900126a8a12Smrg libobjs="$libobjs $pic_object" 1901126a8a12Smrg non_pic_objects="$non_pic_objects $non_pic_object" 1902126a8a12Smrg fi 1903126a8a12Smrg fi 1904126a8a12Smrg ;; 1905126a8a12Smrg 1906126a8a12Smrg *.$libext) 1907126a8a12Smrg # An archive. 1908126a8a12Smrg deplibs="$deplibs $arg" 1909126a8a12Smrg old_deplibs="$old_deplibs $arg" 1910126a8a12Smrg continue 1911126a8a12Smrg ;; 1912126a8a12Smrg 1913126a8a12Smrg *.la) 1914126a8a12Smrg # A libtool-controlled library. 1915126a8a12Smrg 1916126a8a12Smrg if test "$prev" = dlfiles; then 1917126a8a12Smrg # This library was specified with -dlopen. 1918126a8a12Smrg dlfiles="$dlfiles $arg" 1919126a8a12Smrg prev= 1920126a8a12Smrg elif test "$prev" = dlprefiles; then 1921126a8a12Smrg # The library was specified with -dlpreopen. 1922126a8a12Smrg dlprefiles="$dlprefiles $arg" 1923126a8a12Smrg prev= 1924126a8a12Smrg else 1925126a8a12Smrg deplibs="$deplibs $arg" 1926126a8a12Smrg fi 1927126a8a12Smrg continue 1928126a8a12Smrg ;; 1929126a8a12Smrg 1930126a8a12Smrg # Some other compiler argument. 1931126a8a12Smrg *) 1932126a8a12Smrg # Unknown arguments in both finalize_command and compile_command need 1933126a8a12Smrg # to be aesthetically quoted because they are evaled later. 1934126a8a12Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1935126a8a12Smrg case $arg in 1936126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1937126a8a12Smrg arg="\"$arg\"" 1938126a8a12Smrg ;; 1939126a8a12Smrg esac 1940126a8a12Smrg ;; 1941126a8a12Smrg esac # arg 1942126a8a12Smrg 1943126a8a12Smrg # Now actually substitute the argument into the commands. 1944126a8a12Smrg if test -n "$arg"; then 1945126a8a12Smrg compile_command="$compile_command $arg" 1946126a8a12Smrg finalize_command="$finalize_command $arg" 1947126a8a12Smrg fi 1948126a8a12Smrg done # argument parsing loop 1949126a8a12Smrg 1950126a8a12Smrg if test -n "$prev"; then 1951126a8a12Smrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 1952126a8a12Smrg $echo "$help" 1>&2 1953126a8a12Smrg exit $EXIT_FAILURE 1954126a8a12Smrg fi 1955126a8a12Smrg 1956126a8a12Smrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 1957126a8a12Smrg eval arg=\"$export_dynamic_flag_spec\" 1958126a8a12Smrg compile_command="$compile_command $arg" 1959126a8a12Smrg finalize_command="$finalize_command $arg" 1960126a8a12Smrg fi 1961126a8a12Smrg 1962126a8a12Smrg oldlibs= 1963126a8a12Smrg # calculate the name of the file, without its directory 1964126a8a12Smrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 1965126a8a12Smrg libobjs_save="$libobjs" 1966126a8a12Smrg 1967126a8a12Smrg if test -n "$shlibpath_var"; then 1968126a8a12Smrg # get the directories listed in $shlibpath_var 1969126a8a12Smrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 1970126a8a12Smrg else 1971126a8a12Smrg shlib_search_path= 1972126a8a12Smrg fi 1973126a8a12Smrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 1974126a8a12Smrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 1975126a8a12Smrg 1976126a8a12Smrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 1977126a8a12Smrg if test "X$output_objdir" = "X$output"; then 1978126a8a12Smrg output_objdir="$objdir" 1979126a8a12Smrg else 1980126a8a12Smrg output_objdir="$output_objdir/$objdir" 1981126a8a12Smrg fi 1982126a8a12Smrg # Create the object directory. 1983126a8a12Smrg if test ! -d "$output_objdir"; then 1984126a8a12Smrg $show "$mkdir $output_objdir" 1985126a8a12Smrg $run $mkdir $output_objdir 1986126a8a12Smrg exit_status=$? 1987126a8a12Smrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 1988126a8a12Smrg exit $exit_status 1989126a8a12Smrg fi 1990126a8a12Smrg fi 1991126a8a12Smrg 1992126a8a12Smrg # Determine the type of output 1993126a8a12Smrg case $output in 1994126a8a12Smrg "") 1995126a8a12Smrg $echo "$modename: you must specify an output file" 1>&2 1996126a8a12Smrg $echo "$help" 1>&2 1997126a8a12Smrg exit $EXIT_FAILURE 1998126a8a12Smrg ;; 1999126a8a12Smrg *.$libext) linkmode=oldlib ;; 2000126a8a12Smrg *.lo | *.$objext) linkmode=obj ;; 2001126a8a12Smrg *.la) linkmode=lib ;; 2002126a8a12Smrg *) linkmode=prog ;; # Anything else should be a program. 2003126a8a12Smrg esac 2004126a8a12Smrg 2005126a8a12Smrg case $host in 2006126a8a12Smrg *cygwin* | *mingw* | *pw32*) 2007126a8a12Smrg # don't eliminate duplications in $postdeps and $predeps 2008126a8a12Smrg duplicate_compiler_generated_deps=yes 2009126a8a12Smrg ;; 2010126a8a12Smrg *) 2011126a8a12Smrg duplicate_compiler_generated_deps=$duplicate_deps 2012126a8a12Smrg ;; 2013126a8a12Smrg esac 2014126a8a12Smrg specialdeplibs= 2015126a8a12Smrg 2016126a8a12Smrg libs= 2017126a8a12Smrg # Find all interdependent deplibs by searching for libraries 2018126a8a12Smrg # that are linked more than once (e.g. -la -lb -la) 2019126a8a12Smrg for deplib in $deplibs; do 2020126a8a12Smrg if test "X$duplicate_deps" = "Xyes" ; then 2021126a8a12Smrg case "$libs " in 2022126a8a12Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2023126a8a12Smrg esac 2024126a8a12Smrg fi 2025126a8a12Smrg libs="$libs $deplib" 2026126a8a12Smrg done 2027126a8a12Smrg 2028126a8a12Smrg if test "$linkmode" = lib; then 2029126a8a12Smrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 2030126a8a12Smrg 2031126a8a12Smrg # Compute libraries that are listed more than once in $predeps 2032126a8a12Smrg # $postdeps and mark them as special (i.e., whose duplicates are 2033126a8a12Smrg # not to be eliminated). 2034126a8a12Smrg pre_post_deps= 2035126a8a12Smrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 2036126a8a12Smrg for pre_post_dep in $predeps $postdeps; do 2037126a8a12Smrg case "$pre_post_deps " in 2038126a8a12Smrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 2039126a8a12Smrg esac 2040126a8a12Smrg pre_post_deps="$pre_post_deps $pre_post_dep" 2041126a8a12Smrg done 2042126a8a12Smrg fi 2043126a8a12Smrg pre_post_deps= 2044126a8a12Smrg fi 2045126a8a12Smrg 2046126a8a12Smrg deplibs= 2047126a8a12Smrg newdependency_libs= 2048126a8a12Smrg newlib_search_path= 2049126a8a12Smrg need_relink=no # whether we're linking any uninstalled libtool libraries 2050126a8a12Smrg notinst_deplibs= # not-installed libtool libraries 2051126a8a12Smrg case $linkmode in 2052126a8a12Smrg lib) 2053126a8a12Smrg passes="conv link" 2054126a8a12Smrg for file in $dlfiles $dlprefiles; do 2055126a8a12Smrg case $file in 2056126a8a12Smrg *.la) ;; 2057126a8a12Smrg *) 2058126a8a12Smrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 2059126a8a12Smrg exit $EXIT_FAILURE 2060126a8a12Smrg ;; 2061126a8a12Smrg esac 2062126a8a12Smrg done 2063126a8a12Smrg ;; 2064126a8a12Smrg prog) 2065126a8a12Smrg compile_deplibs= 2066126a8a12Smrg finalize_deplibs= 2067126a8a12Smrg alldeplibs=no 2068126a8a12Smrg newdlfiles= 2069126a8a12Smrg newdlprefiles= 2070126a8a12Smrg passes="conv scan dlopen dlpreopen link" 2071126a8a12Smrg ;; 2072126a8a12Smrg *) passes="conv" 2073126a8a12Smrg ;; 2074126a8a12Smrg esac 2075126a8a12Smrg for pass in $passes; do 2076126a8a12Smrg if test "$linkmode,$pass" = "lib,link" || 2077126a8a12Smrg test "$linkmode,$pass" = "prog,scan"; then 2078126a8a12Smrg libs="$deplibs" 2079126a8a12Smrg deplibs= 2080126a8a12Smrg fi 2081126a8a12Smrg if test "$linkmode" = prog; then 2082126a8a12Smrg case $pass in 2083126a8a12Smrg dlopen) libs="$dlfiles" ;; 2084126a8a12Smrg dlpreopen) libs="$dlprefiles" ;; 2085126a8a12Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 2086126a8a12Smrg esac 2087126a8a12Smrg fi 2088126a8a12Smrg if test "$pass" = dlopen; then 2089126a8a12Smrg # Collect dlpreopened libraries 2090126a8a12Smrg save_deplibs="$deplibs" 2091126a8a12Smrg deplibs= 2092126a8a12Smrg fi 2093126a8a12Smrg for deplib in $libs; do 2094126a8a12Smrg lib= 2095126a8a12Smrg found=no 2096126a8a12Smrg case $deplib in 2097126a8a12Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 2098126a8a12Smrg if test "$linkmode,$pass" = "prog,link"; then 2099126a8a12Smrg compile_deplibs="$deplib $compile_deplibs" 2100126a8a12Smrg finalize_deplibs="$deplib $finalize_deplibs" 2101126a8a12Smrg else 2102126a8a12Smrg compiler_flags="$compiler_flags $deplib" 2103126a8a12Smrg fi 2104126a8a12Smrg continue 2105126a8a12Smrg ;; 2106126a8a12Smrg -l*) 2107126a8a12Smrg if test "$linkmode" != lib && test "$linkmode" != prog; then 2108126a8a12Smrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2109126a8a12Smrg continue 2110126a8a12Smrg fi 2111126a8a12Smrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 2112126a8a12Smrg for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 2113126a8a12Smrg for search_ext in .la $std_shrext .so .a; do 2114126a8a12Smrg # Search the libtool library 2115126a8a12Smrg lib="$searchdir/lib${name}${search_ext}" 2116126a8a12Smrg if test -f "$lib"; then 2117126a8a12Smrg if test "$search_ext" = ".la"; then 2118126a8a12Smrg found=yes 2119126a8a12Smrg else 2120126a8a12Smrg found=no 2121126a8a12Smrg fi 2122126a8a12Smrg break 2 2123126a8a12Smrg fi 2124126a8a12Smrg done 2125126a8a12Smrg done 2126126a8a12Smrg if test "$found" != yes; then 2127126a8a12Smrg # deplib doesn't seem to be a libtool library 2128126a8a12Smrg if test "$linkmode,$pass" = "prog,link"; then 2129126a8a12Smrg compile_deplibs="$deplib $compile_deplibs" 2130126a8a12Smrg finalize_deplibs="$deplib $finalize_deplibs" 2131126a8a12Smrg else 2132126a8a12Smrg deplibs="$deplib $deplibs" 2133126a8a12Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2134126a8a12Smrg fi 2135126a8a12Smrg continue 2136126a8a12Smrg else # deplib is a libtool library 2137126a8a12Smrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 2138126a8a12Smrg # We need to do some special things here, and not later. 2139126a8a12Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 2140126a8a12Smrg case " $predeps $postdeps " in 2141126a8a12Smrg *" $deplib "*) 2142126a8a12Smrg if (${SED} -e '2q' $lib | 2143126a8a12Smrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 2144126a8a12Smrg library_names= 2145126a8a12Smrg old_library= 2146126a8a12Smrg case $lib in 2147126a8a12Smrg */* | *\\*) . $lib ;; 2148126a8a12Smrg *) . ./$lib ;; 2149126a8a12Smrg esac 2150126a8a12Smrg for l in $old_library $library_names; do 2151126a8a12Smrg ll="$l" 2152126a8a12Smrg done 2153126a8a12Smrg if test "X$ll" = "X$old_library" ; then # only static version available 2154126a8a12Smrg found=no 2155126a8a12Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2156126a8a12Smrg test "X$ladir" = "X$lib" && ladir="." 2157126a8a12Smrg lib=$ladir/$old_library 2158126a8a12Smrg if test "$linkmode,$pass" = "prog,link"; then 2159126a8a12Smrg compile_deplibs="$deplib $compile_deplibs" 2160126a8a12Smrg finalize_deplibs="$deplib $finalize_deplibs" 2161126a8a12Smrg else 2162126a8a12Smrg deplibs="$deplib $deplibs" 2163126a8a12Smrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2164126a8a12Smrg fi 2165126a8a12Smrg continue 2166126a8a12Smrg fi 2167126a8a12Smrg fi 2168126a8a12Smrg ;; 2169126a8a12Smrg *) ;; 2170126a8a12Smrg esac 2171126a8a12Smrg fi 2172126a8a12Smrg fi 2173126a8a12Smrg ;; # -l 2174126a8a12Smrg -L*) 2175126a8a12Smrg case $linkmode in 2176126a8a12Smrg lib) 2177126a8a12Smrg deplibs="$deplib $deplibs" 2178126a8a12Smrg test "$pass" = conv && continue 2179126a8a12Smrg newdependency_libs="$deplib $newdependency_libs" 2180126a8a12Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2181126a8a12Smrg ;; 2182126a8a12Smrg prog) 2183126a8a12Smrg if test "$pass" = conv; then 2184126a8a12Smrg deplibs="$deplib $deplibs" 2185126a8a12Smrg continue 2186126a8a12Smrg fi 2187126a8a12Smrg if test "$pass" = scan; then 2188126a8a12Smrg deplibs="$deplib $deplibs" 2189126a8a12Smrg else 2190126a8a12Smrg compile_deplibs="$deplib $compile_deplibs" 2191126a8a12Smrg finalize_deplibs="$deplib $finalize_deplibs" 2192126a8a12Smrg fi 2193126a8a12Smrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2194126a8a12Smrg ;; 2195126a8a12Smrg *) 2196126a8a12Smrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 2197126a8a12Smrg ;; 2198126a8a12Smrg esac # linkmode 2199126a8a12Smrg continue 2200126a8a12Smrg ;; # -L 2201126a8a12Smrg -R*) 2202126a8a12Smrg if test "$pass" = link; then 2203126a8a12Smrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 2204126a8a12Smrg # Make sure the xrpath contains only unique directories. 2205126a8a12Smrg case "$xrpath " in 2206126a8a12Smrg *" $dir "*) ;; 2207126a8a12Smrg *) xrpath="$xrpath $dir" ;; 2208126a8a12Smrg esac 2209126a8a12Smrg fi 2210126a8a12Smrg deplibs="$deplib $deplibs" 2211126a8a12Smrg continue 2212126a8a12Smrg ;; 2213126a8a12Smrg *.la) lib="$deplib" ;; 2214126a8a12Smrg *.$libext) 2215126a8a12Smrg if test "$pass" = conv; then 2216126a8a12Smrg deplibs="$deplib $deplibs" 2217126a8a12Smrg continue 2218126a8a12Smrg fi 2219126a8a12Smrg case $linkmode in 2220126a8a12Smrg lib) 2221126a8a12Smrg valid_a_lib=no 2222126a8a12Smrg case $deplibs_check_method in 2223126a8a12Smrg match_pattern*) 2224126a8a12Smrg set dummy $deplibs_check_method 2225126a8a12Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2226126a8a12Smrg if eval $echo \"$deplib\" 2>/dev/null \ 2227126a8a12Smrg | $SED 10q \ 2228126a8a12Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 2229126a8a12Smrg valid_a_lib=yes 2230126a8a12Smrg fi 2231126a8a12Smrg ;; 2232126a8a12Smrg pass_all) 2233126a8a12Smrg valid_a_lib=yes 2234126a8a12Smrg ;; 2235126a8a12Smrg esac 2236126a8a12Smrg if test "$valid_a_lib" != yes; then 2237126a8a12Smrg $echo 2238126a8a12Smrg $echo "*** Warning: Trying to link with static lib archive $deplib." 2239126a8a12Smrg $echo "*** I have the capability to make that library automatically link in when" 2240126a8a12Smrg $echo "*** you link to this library. But I can only do this if you have a" 2241126a8a12Smrg $echo "*** shared version of the library, which you do not appear to have" 2242126a8a12Smrg $echo "*** because the file extensions .$libext of this argument makes me believe" 2243126a8a12Smrg $echo "*** that it is just a static archive that I should not used here." 2244126a8a12Smrg else 2245126a8a12Smrg $echo 2246126a8a12Smrg $echo "*** Warning: Linking the shared library $output against the" 2247126a8a12Smrg $echo "*** static library $deplib is not portable!" 2248126a8a12Smrg deplibs="$deplib $deplibs" 2249126a8a12Smrg fi 2250126a8a12Smrg continue 2251126a8a12Smrg ;; 2252126a8a12Smrg prog) 2253126a8a12Smrg if test "$pass" != link; then 2254126a8a12Smrg deplibs="$deplib $deplibs" 2255126a8a12Smrg else 2256126a8a12Smrg compile_deplibs="$deplib $compile_deplibs" 2257126a8a12Smrg finalize_deplibs="$deplib $finalize_deplibs" 2258126a8a12Smrg fi 2259126a8a12Smrg continue 2260126a8a12Smrg ;; 2261126a8a12Smrg esac # linkmode 2262126a8a12Smrg ;; # *.$libext 2263126a8a12Smrg *.lo | *.$objext) 2264126a8a12Smrg if test "$pass" = conv; then 2265126a8a12Smrg deplibs="$deplib $deplibs" 2266126a8a12Smrg elif test "$linkmode" = prog; then 2267126a8a12Smrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 2268126a8a12Smrg # If there is no dlopen support or we're linking statically, 2269126a8a12Smrg # we need to preload. 2270126a8a12Smrg newdlprefiles="$newdlprefiles $deplib" 2271126a8a12Smrg compile_deplibs="$deplib $compile_deplibs" 2272126a8a12Smrg finalize_deplibs="$deplib $finalize_deplibs" 2273126a8a12Smrg else 2274126a8a12Smrg newdlfiles="$newdlfiles $deplib" 2275126a8a12Smrg fi 2276126a8a12Smrg fi 2277126a8a12Smrg continue 2278126a8a12Smrg ;; 2279126a8a12Smrg %DEPLIBS%) 2280126a8a12Smrg alldeplibs=yes 2281126a8a12Smrg continue 2282126a8a12Smrg ;; 2283126a8a12Smrg esac # case $deplib 2284126a8a12Smrg if test "$found" = yes || test -f "$lib"; then : 2285126a8a12Smrg else 2286126a8a12Smrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 2287126a8a12Smrg exit $EXIT_FAILURE 2288126a8a12Smrg fi 2289126a8a12Smrg 2290126a8a12Smrg # Check to see that this really is a libtool archive. 2291126a8a12Smrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2292126a8a12Smrg else 2293126a8a12Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 2294126a8a12Smrg exit $EXIT_FAILURE 2295126a8a12Smrg fi 2296126a8a12Smrg 2297126a8a12Smrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2298126a8a12Smrg test "X$ladir" = "X$lib" && ladir="." 2299126a8a12Smrg 2300126a8a12Smrg dlname= 2301126a8a12Smrg dlopen= 2302126a8a12Smrg dlpreopen= 2303126a8a12Smrg libdir= 2304126a8a12Smrg library_names= 2305126a8a12Smrg old_library= 2306126a8a12Smrg # If the library was installed with an old release of libtool, 2307126a8a12Smrg # it will not redefine variables installed, or shouldnotlink 2308126a8a12Smrg installed=yes 2309126a8a12Smrg shouldnotlink=no 2310126a8a12Smrg avoidtemprpath= 2311126a8a12Smrg 2312126a8a12Smrg 2313126a8a12Smrg # Read the .la file 2314126a8a12Smrg case $lib in 2315126a8a12Smrg */* | *\\*) . $lib ;; 2316126a8a12Smrg *) . ./$lib ;; 2317126a8a12Smrg esac 2318126a8a12Smrg 2319126a8a12Smrg if test "$linkmode,$pass" = "lib,link" || 2320126a8a12Smrg test "$linkmode,$pass" = "prog,scan" || 2321126a8a12Smrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 2322126a8a12Smrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 2323126a8a12Smrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 2324126a8a12Smrg fi 2325126a8a12Smrg 2326126a8a12Smrg if test "$pass" = conv; then 2327126a8a12Smrg # Only check for convenience libraries 2328126a8a12Smrg deplibs="$lib $deplibs" 2329126a8a12Smrg if test -z "$libdir"; then 2330126a8a12Smrg if test -z "$old_library"; then 2331126a8a12Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2332126a8a12Smrg exit $EXIT_FAILURE 2333126a8a12Smrg fi 2334126a8a12Smrg # It is a libtool convenience library, so add in its objects. 2335126a8a12Smrg convenience="$convenience $ladir/$objdir/$old_library" 2336126a8a12Smrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 2337126a8a12Smrg tmp_libs= 2338126a8a12Smrg for deplib in $dependency_libs; do 2339126a8a12Smrg deplibs="$deplib $deplibs" 2340126a8a12Smrg if test "X$duplicate_deps" = "Xyes" ; then 2341126a8a12Smrg case "$tmp_libs " in 2342126a8a12Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2343126a8a12Smrg esac 2344126a8a12Smrg fi 2345126a8a12Smrg tmp_libs="$tmp_libs $deplib" 2346126a8a12Smrg done 2347126a8a12Smrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 2348126a8a12Smrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 2349126a8a12Smrg exit $EXIT_FAILURE 2350126a8a12Smrg fi 2351126a8a12Smrg continue 2352126a8a12Smrg fi # $pass = conv 2353126a8a12Smrg 2354126a8a12Smrg 2355126a8a12Smrg # Get the name of the library we link against. 2356126a8a12Smrg linklib= 2357126a8a12Smrg for l in $old_library $library_names; do 2358126a8a12Smrg linklib="$l" 2359126a8a12Smrg done 2360126a8a12Smrg if test -z "$linklib"; then 2361126a8a12Smrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2362126a8a12Smrg exit $EXIT_FAILURE 2363126a8a12Smrg fi 2364126a8a12Smrg 2365126a8a12Smrg # This library was specified with -dlopen. 2366126a8a12Smrg if test "$pass" = dlopen; then 2367126a8a12Smrg if test -z "$libdir"; then 2368126a8a12Smrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 2369126a8a12Smrg exit $EXIT_FAILURE 2370126a8a12Smrg fi 2371126a8a12Smrg if test -z "$dlname" || 2372126a8a12Smrg test "$dlopen_support" != yes || 2373126a8a12Smrg test "$build_libtool_libs" = no; then 2374126a8a12Smrg # If there is no dlname, no dlopen support or we're linking 2375126a8a12Smrg # statically, we need to preload. We also need to preload any 2376126a8a12Smrg # dependent libraries so libltdl's deplib preloader doesn't 2377126a8a12Smrg # bomb out in the load deplibs phase. 2378126a8a12Smrg dlprefiles="$dlprefiles $lib $dependency_libs" 2379126a8a12Smrg else 2380126a8a12Smrg newdlfiles="$newdlfiles $lib" 2381126a8a12Smrg fi 2382126a8a12Smrg continue 2383126a8a12Smrg fi # $pass = dlopen 2384126a8a12Smrg 2385126a8a12Smrg # We need an absolute path. 2386126a8a12Smrg case $ladir in 2387126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 2388126a8a12Smrg *) 2389126a8a12Smrg abs_ladir=`cd "$ladir" && pwd` 2390126a8a12Smrg if test -z "$abs_ladir"; then 2391126a8a12Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 2392126a8a12Smrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 2393126a8a12Smrg abs_ladir="$ladir" 2394126a8a12Smrg fi 2395126a8a12Smrg ;; 2396126a8a12Smrg esac 2397126a8a12Smrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 2398126a8a12Smrg 2399126a8a12Smrg # Find the relevant object directory and library name. 2400126a8a12Smrg if test "X$installed" = Xyes; then 2401126a8a12Smrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2402126a8a12Smrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 2403126a8a12Smrg dir="$ladir" 2404126a8a12Smrg absdir="$abs_ladir" 2405126a8a12Smrg libdir="$abs_ladir" 2406126a8a12Smrg else 2407126a8a12Smrg dir="$libdir" 2408126a8a12Smrg absdir="$libdir" 2409126a8a12Smrg fi 2410126a8a12Smrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 2411126a8a12Smrg else 2412126a8a12Smrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2413126a8a12Smrg dir="$ladir" 2414126a8a12Smrg absdir="$abs_ladir" 2415126a8a12Smrg # Remove this search path later 2416126a8a12Smrg notinst_path="$notinst_path $abs_ladir" 2417126a8a12Smrg else 2418126a8a12Smrg dir="$ladir/$objdir" 2419126a8a12Smrg absdir="$abs_ladir/$objdir" 2420126a8a12Smrg # Remove this search path later 2421126a8a12Smrg notinst_path="$notinst_path $abs_ladir" 2422126a8a12Smrg fi 2423126a8a12Smrg fi # $installed = yes 2424126a8a12Smrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2425126a8a12Smrg 2426126a8a12Smrg # This library was specified with -dlpreopen. 2427126a8a12Smrg if test "$pass" = dlpreopen; then 2428126a8a12Smrg if test -z "$libdir"; then 2429126a8a12Smrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 2430126a8a12Smrg exit $EXIT_FAILURE 2431126a8a12Smrg fi 2432126a8a12Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 2433126a8a12Smrg # are required to link). 2434126a8a12Smrg if test -n "$old_library"; then 2435126a8a12Smrg newdlprefiles="$newdlprefiles $dir/$old_library" 2436126a8a12Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 2437126a8a12Smrg elif test -n "$dlname"; then 2438126a8a12Smrg newdlprefiles="$newdlprefiles $dir/$dlname" 2439126a8a12Smrg else 2440126a8a12Smrg newdlprefiles="$newdlprefiles $dir/$linklib" 2441126a8a12Smrg fi 2442126a8a12Smrg fi # $pass = dlpreopen 2443126a8a12Smrg 2444126a8a12Smrg if test -z "$libdir"; then 2445126a8a12Smrg # Link the convenience library 2446126a8a12Smrg if test "$linkmode" = lib; then 2447126a8a12Smrg deplibs="$dir/$old_library $deplibs" 2448126a8a12Smrg elif test "$linkmode,$pass" = "prog,link"; then 2449126a8a12Smrg compile_deplibs="$dir/$old_library $compile_deplibs" 2450126a8a12Smrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 2451126a8a12Smrg else 2452126a8a12Smrg deplibs="$lib $deplibs" # used for prog,scan pass 2453126a8a12Smrg fi 2454126a8a12Smrg continue 2455126a8a12Smrg fi 2456126a8a12Smrg 2457126a8a12Smrg 2458126a8a12Smrg if test "$linkmode" = prog && test "$pass" != link; then 2459126a8a12Smrg newlib_search_path="$newlib_search_path $ladir" 2460126a8a12Smrg deplibs="$lib $deplibs" 2461126a8a12Smrg 2462126a8a12Smrg linkalldeplibs=no 2463126a8a12Smrg if test "$link_all_deplibs" != no || test -z "$library_names" || 2464126a8a12Smrg test "$build_libtool_libs" = no; then 2465126a8a12Smrg linkalldeplibs=yes 2466126a8a12Smrg fi 2467126a8a12Smrg 2468126a8a12Smrg tmp_libs= 2469126a8a12Smrg for deplib in $dependency_libs; do 2470126a8a12Smrg case $deplib in 2471126a8a12Smrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 2472126a8a12Smrg esac 2473126a8a12Smrg # Need to link against all dependency_libs? 2474126a8a12Smrg if test "$linkalldeplibs" = yes; then 2475126a8a12Smrg deplibs="$deplib $deplibs" 2476126a8a12Smrg else 2477126a8a12Smrg # Need to hardcode shared library paths 2478126a8a12Smrg # or/and link against static libraries 2479126a8a12Smrg newdependency_libs="$deplib $newdependency_libs" 2480126a8a12Smrg fi 2481126a8a12Smrg if test "X$duplicate_deps" = "Xyes" ; then 2482126a8a12Smrg case "$tmp_libs " in 2483126a8a12Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2484126a8a12Smrg esac 2485126a8a12Smrg fi 2486126a8a12Smrg tmp_libs="$tmp_libs $deplib" 2487126a8a12Smrg done # for deplib 2488126a8a12Smrg continue 2489126a8a12Smrg fi # $linkmode = prog... 2490126a8a12Smrg 2491126a8a12Smrg if test "$linkmode,$pass" = "prog,link"; then 2492126a8a12Smrg if test -n "$library_names" && 2493126a8a12Smrg { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2494126a8a12Smrg # We need to hardcode the library path 2495126a8a12Smrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 2496126a8a12Smrg # Make sure the rpath contains only unique directories. 2497126a8a12Smrg case "$temp_rpath " in 2498126a8a12Smrg *" $dir "*) ;; 2499126a8a12Smrg *" $absdir "*) ;; 2500126a8a12Smrg *) temp_rpath="$temp_rpath $absdir" ;; 2501126a8a12Smrg esac 2502126a8a12Smrg fi 2503126a8a12Smrg 2504126a8a12Smrg # Hardcode the library path. 2505126a8a12Smrg # Skip directories that are in the system default run-time 2506126a8a12Smrg # search path. 2507126a8a12Smrg case " $sys_lib_dlsearch_path " in 2508126a8a12Smrg *" $absdir "*) ;; 2509126a8a12Smrg *) 2510126a8a12Smrg case "$compile_rpath " in 2511126a8a12Smrg *" $absdir "*) ;; 2512126a8a12Smrg *) compile_rpath="$compile_rpath $absdir" 2513126a8a12Smrg esac 2514126a8a12Smrg ;; 2515126a8a12Smrg esac 2516126a8a12Smrg case " $sys_lib_dlsearch_path " in 2517126a8a12Smrg *" $libdir "*) ;; 2518126a8a12Smrg *) 2519126a8a12Smrg case "$finalize_rpath " in 2520126a8a12Smrg *" $libdir "*) ;; 2521126a8a12Smrg *) finalize_rpath="$finalize_rpath $libdir" 2522126a8a12Smrg esac 2523126a8a12Smrg ;; 2524126a8a12Smrg esac 2525126a8a12Smrg fi # $linkmode,$pass = prog,link... 2526126a8a12Smrg 2527126a8a12Smrg if test "$alldeplibs" = yes && 2528126a8a12Smrg { test "$deplibs_check_method" = pass_all || 2529126a8a12Smrg { test "$build_libtool_libs" = yes && 2530126a8a12Smrg test -n "$library_names"; }; }; then 2531126a8a12Smrg # We only need to search for static libraries 2532126a8a12Smrg continue 2533126a8a12Smrg fi 2534126a8a12Smrg fi 2535126a8a12Smrg 2536126a8a12Smrg link_static=no # Whether the deplib will be linked statically 2537126a8a12Smrg use_static_libs=$prefer_static_libs 2538126a8a12Smrg if test "$use_static_libs" = built && test "$installed" = yes ; then 2539126a8a12Smrg use_static_libs=no 2540126a8a12Smrg fi 2541126a8a12Smrg if test -n "$library_names" && 2542126a8a12Smrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 2543126a8a12Smrg if test "$installed" = no; then 2544126a8a12Smrg notinst_deplibs="$notinst_deplibs $lib" 2545126a8a12Smrg need_relink=yes 2546126a8a12Smrg fi 2547126a8a12Smrg # This is a shared library 2548126a8a12Smrg 2549126a8a12Smrg # Warn about portability, can't link against -module's on 2550126a8a12Smrg # some systems (darwin) 2551126a8a12Smrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 2552126a8a12Smrg $echo 2553126a8a12Smrg if test "$linkmode" = prog; then 2554126a8a12Smrg $echo "*** Warning: Linking the executable $output against the loadable module" 2555126a8a12Smrg else 2556126a8a12Smrg $echo "*** Warning: Linking the shared library $output against the loadable module" 2557126a8a12Smrg fi 2558126a8a12Smrg $echo "*** $linklib is not portable!" 2559126a8a12Smrg fi 2560126a8a12Smrg if test "$linkmode" = lib && 2561126a8a12Smrg test "$hardcode_into_libs" = yes; then 2562126a8a12Smrg # Hardcode the library path. 2563126a8a12Smrg # Skip directories that are in the system default run-time 2564126a8a12Smrg # search path. 2565126a8a12Smrg case " $sys_lib_dlsearch_path " in 2566126a8a12Smrg *" $absdir "*) ;; 2567126a8a12Smrg *) 2568126a8a12Smrg case "$compile_rpath " in 2569126a8a12Smrg *" $absdir "*) ;; 2570126a8a12Smrg *) compile_rpath="$compile_rpath $absdir" 2571126a8a12Smrg esac 2572126a8a12Smrg ;; 2573126a8a12Smrg esac 2574126a8a12Smrg case " $sys_lib_dlsearch_path " in 2575126a8a12Smrg *" $libdir "*) ;; 2576126a8a12Smrg *) 2577126a8a12Smrg case "$finalize_rpath " in 2578126a8a12Smrg *" $libdir "*) ;; 2579126a8a12Smrg *) finalize_rpath="$finalize_rpath $libdir" 2580126a8a12Smrg esac 2581126a8a12Smrg ;; 2582126a8a12Smrg esac 2583126a8a12Smrg fi 2584126a8a12Smrg 2585126a8a12Smrg if test -n "$old_archive_from_expsyms_cmds"; then 2586126a8a12Smrg # figure out the soname 2587126a8a12Smrg set dummy $library_names 2588126a8a12Smrg realname="$2" 2589126a8a12Smrg shift; shift 2590126a8a12Smrg libname=`eval \\$echo \"$libname_spec\"` 2591126a8a12Smrg # use dlname if we got it. it's perfectly good, no? 2592126a8a12Smrg if test -n "$dlname"; then 2593126a8a12Smrg soname="$dlname" 2594126a8a12Smrg elif test -n "$soname_spec"; then 2595126a8a12Smrg # bleh windows 2596126a8a12Smrg case $host in 2597126a8a12Smrg *cygwin* | mingw*) 2598126a8a12Smrg major=`expr $current - $age` 2599126a8a12Smrg versuffix="-$major" 2600126a8a12Smrg ;; 2601126a8a12Smrg esac 2602126a8a12Smrg eval soname=\"$soname_spec\" 2603126a8a12Smrg else 2604126a8a12Smrg soname="$realname" 2605126a8a12Smrg fi 2606126a8a12Smrg 2607126a8a12Smrg # Make a new name for the extract_expsyms_cmds to use 2608126a8a12Smrg soroot="$soname" 2609126a8a12Smrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 2610126a8a12Smrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 2611126a8a12Smrg 2612126a8a12Smrg # If the library has no export list, then create one now 2613126a8a12Smrg if test -f "$output_objdir/$soname-def"; then : 2614126a8a12Smrg else 2615126a8a12Smrg $show "extracting exported symbol list from \`$soname'" 2616126a8a12Smrg save_ifs="$IFS"; IFS='~' 2617126a8a12Smrg cmds=$extract_expsyms_cmds 2618126a8a12Smrg for cmd in $cmds; do 2619126a8a12Smrg IFS="$save_ifs" 2620126a8a12Smrg eval cmd=\"$cmd\" 2621126a8a12Smrg $show "$cmd" 2622126a8a12Smrg $run eval "$cmd" || exit $? 2623126a8a12Smrg done 2624126a8a12Smrg IFS="$save_ifs" 2625126a8a12Smrg fi 2626126a8a12Smrg 2627126a8a12Smrg # Create $newlib 2628126a8a12Smrg if test -f "$output_objdir/$newlib"; then :; else 2629126a8a12Smrg $show "generating import library for \`$soname'" 2630126a8a12Smrg save_ifs="$IFS"; IFS='~' 2631126a8a12Smrg cmds=$old_archive_from_expsyms_cmds 2632126a8a12Smrg for cmd in $cmds; do 2633126a8a12Smrg IFS="$save_ifs" 2634126a8a12Smrg eval cmd=\"$cmd\" 2635126a8a12Smrg $show "$cmd" 2636126a8a12Smrg $run eval "$cmd" || exit $? 2637126a8a12Smrg done 2638126a8a12Smrg IFS="$save_ifs" 2639126a8a12Smrg fi 2640126a8a12Smrg # make sure the library variables are pointing to the new library 2641126a8a12Smrg dir=$output_objdir 2642126a8a12Smrg linklib=$newlib 2643126a8a12Smrg fi # test -n "$old_archive_from_expsyms_cmds" 2644126a8a12Smrg 2645126a8a12Smrg if test "$linkmode" = prog || test "$mode" != relink; then 2646126a8a12Smrg add_shlibpath= 2647126a8a12Smrg add_dir= 2648126a8a12Smrg add= 2649126a8a12Smrg lib_linked=yes 2650126a8a12Smrg case $hardcode_action in 2651126a8a12Smrg immediate | unsupported) 2652126a8a12Smrg if test "$hardcode_direct" = no; then 2653126a8a12Smrg add="$dir/$linklib" 2654126a8a12Smrg case $host in 2655126a8a12Smrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 2656126a8a12Smrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 2657126a8a12Smrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 2658126a8a12Smrg *-*-unixware7*) add_dir="-L$dir" ;; 2659126a8a12Smrg *-*-darwin* ) 2660126a8a12Smrg # if the lib is a module then we can not link against 2661126a8a12Smrg # it, someone is ignoring the new warnings I added 2662126a8a12Smrg if /usr/bin/file -L $add 2> /dev/null | 2663126a8a12Smrg $EGREP ": [^:]* bundle" >/dev/null ; then 2664126a8a12Smrg $echo "** Warning, lib $linklib is a module, not a shared library" 2665126a8a12Smrg if test -z "$old_library" ; then 2666126a8a12Smrg $echo 2667126a8a12Smrg $echo "** And there doesn't seem to be a static archive available" 2668126a8a12Smrg $echo "** The link will probably fail, sorry" 2669126a8a12Smrg else 2670126a8a12Smrg add="$dir/$old_library" 2671126a8a12Smrg fi 2672126a8a12Smrg fi 2673126a8a12Smrg esac 2674126a8a12Smrg elif test "$hardcode_minus_L" = no; then 2675126a8a12Smrg case $host in 2676126a8a12Smrg *-*-sunos*) add_shlibpath="$dir" ;; 2677126a8a12Smrg esac 2678126a8a12Smrg add_dir="-L$dir" 2679126a8a12Smrg add="-l$name" 2680126a8a12Smrg elif test "$hardcode_shlibpath_var" = no; then 2681126a8a12Smrg add_shlibpath="$dir" 2682126a8a12Smrg add="-l$name" 2683126a8a12Smrg else 2684126a8a12Smrg lib_linked=no 2685126a8a12Smrg fi 2686126a8a12Smrg ;; 2687126a8a12Smrg relink) 2688126a8a12Smrg if test "$hardcode_direct" = yes; then 2689126a8a12Smrg add="$dir/$linklib" 2690126a8a12Smrg elif test "$hardcode_minus_L" = yes; then 2691126a8a12Smrg add_dir="-L$dir" 2692126a8a12Smrg # Try looking first in the location we're being installed to. 2693126a8a12Smrg if test -n "$inst_prefix_dir"; then 2694126a8a12Smrg case $libdir in 2695126a8a12Smrg [\\/]*) 2696126a8a12Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 2697126a8a12Smrg ;; 2698126a8a12Smrg esac 2699126a8a12Smrg fi 2700126a8a12Smrg add="-l$name" 2701126a8a12Smrg elif test "$hardcode_shlibpath_var" = yes; then 2702126a8a12Smrg add_shlibpath="$dir" 2703126a8a12Smrg add="-l$name" 2704126a8a12Smrg else 2705126a8a12Smrg lib_linked=no 2706126a8a12Smrg fi 2707126a8a12Smrg ;; 2708126a8a12Smrg *) lib_linked=no ;; 2709126a8a12Smrg esac 2710126a8a12Smrg 2711126a8a12Smrg if test "$lib_linked" != yes; then 2712126a8a12Smrg $echo "$modename: configuration error: unsupported hardcode properties" 2713126a8a12Smrg exit $EXIT_FAILURE 2714126a8a12Smrg fi 2715126a8a12Smrg 2716126a8a12Smrg if test -n "$add_shlibpath"; then 2717126a8a12Smrg case :$compile_shlibpath: in 2718126a8a12Smrg *":$add_shlibpath:"*) ;; 2719126a8a12Smrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2720126a8a12Smrg esac 2721126a8a12Smrg fi 2722126a8a12Smrg if test "$linkmode" = prog; then 2723126a8a12Smrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2724126a8a12Smrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 2725126a8a12Smrg else 2726126a8a12Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 2727126a8a12Smrg test -n "$add" && deplibs="$add $deplibs" 2728126a8a12Smrg if test "$hardcode_direct" != yes && \ 2729126a8a12Smrg test "$hardcode_minus_L" != yes && \ 2730126a8a12Smrg test "$hardcode_shlibpath_var" = yes; then 2731126a8a12Smrg case :$finalize_shlibpath: in 2732126a8a12Smrg *":$libdir:"*) ;; 2733126a8a12Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2734126a8a12Smrg esac 2735126a8a12Smrg fi 2736126a8a12Smrg fi 2737126a8a12Smrg fi 2738126a8a12Smrg 2739126a8a12Smrg if test "$linkmode" = prog || test "$mode" = relink; then 2740126a8a12Smrg add_shlibpath= 2741126a8a12Smrg add_dir= 2742126a8a12Smrg add= 2743126a8a12Smrg # Finalize command for both is simple: just hardcode it. 2744126a8a12Smrg if test "$hardcode_direct" = yes; then 2745126a8a12Smrg add="$libdir/$linklib" 2746126a8a12Smrg elif test "$hardcode_minus_L" = yes; then 2747126a8a12Smrg add_dir="-L$libdir" 2748126a8a12Smrg add="-l$name" 2749126a8a12Smrg elif test "$hardcode_shlibpath_var" = yes; then 2750126a8a12Smrg case :$finalize_shlibpath: in 2751126a8a12Smrg *":$libdir:"*) ;; 2752126a8a12Smrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2753126a8a12Smrg esac 2754126a8a12Smrg add="-l$name" 2755126a8a12Smrg elif test "$hardcode_automatic" = yes; then 2756126a8a12Smrg if test -n "$inst_prefix_dir" && 2757126a8a12Smrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 2758126a8a12Smrg add="$inst_prefix_dir$libdir/$linklib" 2759126a8a12Smrg else 2760126a8a12Smrg add="$libdir/$linklib" 2761126a8a12Smrg fi 2762126a8a12Smrg else 2763126a8a12Smrg # We cannot seem to hardcode it, guess we'll fake it. 2764126a8a12Smrg add_dir="-L$libdir" 2765126a8a12Smrg # Try looking first in the location we're being installed to. 2766126a8a12Smrg if test -n "$inst_prefix_dir"; then 2767126a8a12Smrg case $libdir in 2768126a8a12Smrg [\\/]*) 2769126a8a12Smrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 2770126a8a12Smrg ;; 2771126a8a12Smrg esac 2772126a8a12Smrg fi 2773126a8a12Smrg add="-l$name" 2774126a8a12Smrg fi 2775126a8a12Smrg 2776126a8a12Smrg if test "$linkmode" = prog; then 2777126a8a12Smrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2778126a8a12Smrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2779126a8a12Smrg else 2780126a8a12Smrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 2781126a8a12Smrg test -n "$add" && deplibs="$add $deplibs" 2782126a8a12Smrg fi 2783126a8a12Smrg fi 2784126a8a12Smrg elif test "$linkmode" = prog; then 2785126a8a12Smrg # Here we assume that one of hardcode_direct or hardcode_minus_L 2786126a8a12Smrg # is not unsupported. This is valid on all known static and 2787126a8a12Smrg # shared platforms. 2788126a8a12Smrg if test "$hardcode_direct" != unsupported; then 2789126a8a12Smrg test -n "$old_library" && linklib="$old_library" 2790126a8a12Smrg compile_deplibs="$dir/$linklib $compile_deplibs" 2791126a8a12Smrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 2792126a8a12Smrg else 2793126a8a12Smrg compile_deplibs="-l$name -L$dir $compile_deplibs" 2794126a8a12Smrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2795126a8a12Smrg fi 2796126a8a12Smrg elif test "$build_libtool_libs" = yes; then 2797126a8a12Smrg # Not a shared library 2798126a8a12Smrg if test "$deplibs_check_method" != pass_all; then 2799126a8a12Smrg # We're trying link a shared library against a static one 2800126a8a12Smrg # but the system doesn't support it. 2801126a8a12Smrg 2802126a8a12Smrg # Just print a warning and add the library to dependency_libs so 2803126a8a12Smrg # that the program can be linked against the static library. 2804126a8a12Smrg $echo 2805126a8a12Smrg $echo "*** Warning: This system can not link to static lib archive $lib." 2806126a8a12Smrg $echo "*** I have the capability to make that library automatically link in when" 2807126a8a12Smrg $echo "*** you link to this library. But I can only do this if you have a" 2808126a8a12Smrg $echo "*** shared version of the library, which you do not appear to have." 2809126a8a12Smrg if test "$module" = yes; then 2810126a8a12Smrg $echo "*** But as you try to build a module library, libtool will still create " 2811126a8a12Smrg $echo "*** a static module, that should work as long as the dlopening application" 2812126a8a12Smrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 2813126a8a12Smrg if test -z "$global_symbol_pipe"; then 2814126a8a12Smrg $echo 2815126a8a12Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 2816126a8a12Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2817126a8a12Smrg $echo "*** not find such a program. So, this module is probably useless." 2818126a8a12Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 2819126a8a12Smrg fi 2820126a8a12Smrg if test "$build_old_libs" = no; then 2821126a8a12Smrg build_libtool_libs=module 2822126a8a12Smrg build_old_libs=yes 2823126a8a12Smrg else 2824126a8a12Smrg build_libtool_libs=no 2825126a8a12Smrg fi 2826126a8a12Smrg fi 2827126a8a12Smrg else 2828126a8a12Smrg deplibs="$dir/$old_library $deplibs" 2829126a8a12Smrg link_static=yes 2830126a8a12Smrg fi 2831126a8a12Smrg fi # link shared/static library? 2832126a8a12Smrg 2833126a8a12Smrg if test "$linkmode" = lib; then 2834126a8a12Smrg if test -n "$dependency_libs" && 2835126a8a12Smrg { test "$hardcode_into_libs" != yes || 2836126a8a12Smrg test "$build_old_libs" = yes || 2837126a8a12Smrg test "$link_static" = yes; }; then 2838126a8a12Smrg # Extract -R from dependency_libs 2839126a8a12Smrg temp_deplibs= 2840126a8a12Smrg for libdir in $dependency_libs; do 2841126a8a12Smrg case $libdir in 2842126a8a12Smrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2843126a8a12Smrg case " $xrpath " in 2844126a8a12Smrg *" $temp_xrpath "*) ;; 2845126a8a12Smrg *) xrpath="$xrpath $temp_xrpath";; 2846126a8a12Smrg esac;; 2847126a8a12Smrg *) temp_deplibs="$temp_deplibs $libdir";; 2848126a8a12Smrg esac 2849126a8a12Smrg done 2850126a8a12Smrg dependency_libs="$temp_deplibs" 2851126a8a12Smrg fi 2852126a8a12Smrg 2853126a8a12Smrg newlib_search_path="$newlib_search_path $absdir" 2854126a8a12Smrg # Link against this library 2855126a8a12Smrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2856126a8a12Smrg # ... and its dependency_libs 2857126a8a12Smrg tmp_libs= 2858126a8a12Smrg for deplib in $dependency_libs; do 2859126a8a12Smrg newdependency_libs="$deplib $newdependency_libs" 2860126a8a12Smrg if test "X$duplicate_deps" = "Xyes" ; then 2861126a8a12Smrg case "$tmp_libs " in 2862126a8a12Smrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2863126a8a12Smrg esac 2864126a8a12Smrg fi 2865126a8a12Smrg tmp_libs="$tmp_libs $deplib" 2866126a8a12Smrg done 2867126a8a12Smrg 2868126a8a12Smrg if test "$link_all_deplibs" != no; then 2869126a8a12Smrg # Add the search paths of all dependency libraries 2870126a8a12Smrg for deplib in $dependency_libs; do 2871126a8a12Smrg case $deplib in 2872126a8a12Smrg -L*) path="$deplib" ;; 2873126a8a12Smrg *.la) 2874126a8a12Smrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2875126a8a12Smrg test "X$dir" = "X$deplib" && dir="." 2876126a8a12Smrg # We need an absolute path. 2877126a8a12Smrg case $dir in 2878126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2879126a8a12Smrg *) 2880126a8a12Smrg absdir=`cd "$dir" && pwd` 2881126a8a12Smrg if test -z "$absdir"; then 2882126a8a12Smrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2883126a8a12Smrg absdir="$dir" 2884126a8a12Smrg fi 2885126a8a12Smrg ;; 2886126a8a12Smrg esac 2887126a8a12Smrg if grep "^installed=no" $deplib > /dev/null; then 2888126a8a12Smrg path="$absdir/$objdir" 2889126a8a12Smrg else 2890126a8a12Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2891126a8a12Smrg if test -z "$libdir"; then 2892126a8a12Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2893126a8a12Smrg exit $EXIT_FAILURE 2894126a8a12Smrg fi 2895126a8a12Smrg if test "$absdir" != "$libdir"; then 2896126a8a12Smrg $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2897126a8a12Smrg fi 2898126a8a12Smrg path="$absdir" 2899126a8a12Smrg fi 2900126a8a12Smrg depdepl= 2901126a8a12Smrg case $host in 2902126a8a12Smrg *-*-darwin*) 2903126a8a12Smrg # we do not want to link against static libs, 2904126a8a12Smrg # but need to link against shared 2905126a8a12Smrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 2906126a8a12Smrg if test -n "$deplibrary_names" ; then 2907126a8a12Smrg for tmp in $deplibrary_names ; do 2908126a8a12Smrg depdepl=$tmp 2909126a8a12Smrg done 2910126a8a12Smrg if test -f "$path/$depdepl" ; then 2911126a8a12Smrg depdepl="$path/$depdepl" 2912126a8a12Smrg fi 2913126a8a12Smrg # do not add paths which are already there 2914126a8a12Smrg case " $newlib_search_path " in 2915126a8a12Smrg *" $path "*) ;; 2916126a8a12Smrg *) newlib_search_path="$newlib_search_path $path";; 2917126a8a12Smrg esac 2918126a8a12Smrg fi 2919126a8a12Smrg path="" 2920126a8a12Smrg ;; 2921126a8a12Smrg *) 2922126a8a12Smrg path="-L$path" 2923126a8a12Smrg ;; 2924126a8a12Smrg esac 2925126a8a12Smrg ;; 2926126a8a12Smrg -l*) 2927126a8a12Smrg case $host in 2928126a8a12Smrg *-*-darwin*) 2929126a8a12Smrg # Again, we only want to link against shared libraries 2930126a8a12Smrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 2931126a8a12Smrg for tmp in $newlib_search_path ; do 2932126a8a12Smrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 2933126a8a12Smrg eval depdepl="$tmp/lib$tmp_libs.dylib" 2934126a8a12Smrg break 2935126a8a12Smrg fi 2936126a8a12Smrg done 2937126a8a12Smrg path="" 2938126a8a12Smrg ;; 2939126a8a12Smrg *) continue ;; 2940126a8a12Smrg esac 2941126a8a12Smrg ;; 2942126a8a12Smrg *) continue ;; 2943126a8a12Smrg esac 2944126a8a12Smrg case " $deplibs " in 2945126a8a12Smrg *" $path "*) ;; 2946126a8a12Smrg *) deplibs="$path $deplibs" ;; 2947126a8a12Smrg esac 2948126a8a12Smrg case " $deplibs " in 2949126a8a12Smrg *" $depdepl "*) ;; 2950126a8a12Smrg *) deplibs="$depdepl $deplibs" ;; 2951126a8a12Smrg esac 2952126a8a12Smrg done 2953126a8a12Smrg fi # link_all_deplibs != no 2954126a8a12Smrg fi # linkmode = lib 2955126a8a12Smrg done # for deplib in $libs 2956126a8a12Smrg dependency_libs="$newdependency_libs" 2957126a8a12Smrg if test "$pass" = dlpreopen; then 2958126a8a12Smrg # Link the dlpreopened libraries before other libraries 2959126a8a12Smrg for deplib in $save_deplibs; do 2960126a8a12Smrg deplibs="$deplib $deplibs" 2961126a8a12Smrg done 2962126a8a12Smrg fi 2963126a8a12Smrg if test "$pass" != dlopen; then 2964126a8a12Smrg if test "$pass" != conv; then 2965126a8a12Smrg # Make sure lib_search_path contains only unique directories. 2966126a8a12Smrg lib_search_path= 2967126a8a12Smrg for dir in $newlib_search_path; do 2968126a8a12Smrg case "$lib_search_path " in 2969126a8a12Smrg *" $dir "*) ;; 2970126a8a12Smrg *) lib_search_path="$lib_search_path $dir" ;; 2971126a8a12Smrg esac 2972126a8a12Smrg done 2973126a8a12Smrg newlib_search_path= 2974126a8a12Smrg fi 2975126a8a12Smrg 2976126a8a12Smrg if test "$linkmode,$pass" != "prog,link"; then 2977126a8a12Smrg vars="deplibs" 2978126a8a12Smrg else 2979126a8a12Smrg vars="compile_deplibs finalize_deplibs" 2980126a8a12Smrg fi 2981126a8a12Smrg for var in $vars dependency_libs; do 2982126a8a12Smrg # Add libraries to $var in reverse order 2983126a8a12Smrg eval tmp_libs=\"\$$var\" 2984126a8a12Smrg new_libs= 2985126a8a12Smrg for deplib in $tmp_libs; do 2986126a8a12Smrg # FIXME: Pedantically, this is the right thing to do, so 2987126a8a12Smrg # that some nasty dependency loop isn't accidentally 2988126a8a12Smrg # broken: 2989126a8a12Smrg #new_libs="$deplib $new_libs" 2990126a8a12Smrg # Pragmatically, this seems to cause very few problems in 2991126a8a12Smrg # practice: 2992126a8a12Smrg case $deplib in 2993126a8a12Smrg -L*) new_libs="$deplib $new_libs" ;; 2994126a8a12Smrg -R*) ;; 2995126a8a12Smrg *) 2996126a8a12Smrg # And here is the reason: when a library appears more 2997126a8a12Smrg # than once as an explicit dependence of a library, or 2998126a8a12Smrg # is implicitly linked in more than once by the 2999126a8a12Smrg # compiler, it is considered special, and multiple 3000126a8a12Smrg # occurrences thereof are not removed. Compare this 3001126a8a12Smrg # with having the same library being listed as a 3002126a8a12Smrg # dependency of multiple other libraries: in this case, 3003126a8a12Smrg # we know (pedantically, we assume) the library does not 3004126a8a12Smrg # need to be listed more than once, so we keep only the 3005126a8a12Smrg # last copy. This is not always right, but it is rare 3006126a8a12Smrg # enough that we require users that really mean to play 3007126a8a12Smrg # such unportable linking tricks to link the library 3008126a8a12Smrg # using -Wl,-lname, so that libtool does not consider it 3009126a8a12Smrg # for duplicate removal. 3010126a8a12Smrg case " $specialdeplibs " in 3011126a8a12Smrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 3012126a8a12Smrg *) 3013126a8a12Smrg case " $new_libs " in 3014126a8a12Smrg *" $deplib "*) ;; 3015126a8a12Smrg *) new_libs="$deplib $new_libs" ;; 3016126a8a12Smrg esac 3017126a8a12Smrg ;; 3018126a8a12Smrg esac 3019126a8a12Smrg ;; 3020126a8a12Smrg esac 3021126a8a12Smrg done 3022126a8a12Smrg tmp_libs= 3023126a8a12Smrg for deplib in $new_libs; do 3024126a8a12Smrg case $deplib in 3025126a8a12Smrg -L*) 3026126a8a12Smrg case " $tmp_libs " in 3027126a8a12Smrg *" $deplib "*) ;; 3028126a8a12Smrg *) tmp_libs="$tmp_libs $deplib" ;; 3029126a8a12Smrg esac 3030126a8a12Smrg ;; 3031126a8a12Smrg *) tmp_libs="$tmp_libs $deplib" ;; 3032126a8a12Smrg esac 3033126a8a12Smrg done 3034126a8a12Smrg eval $var=\"$tmp_libs\" 3035126a8a12Smrg done # for var 3036126a8a12Smrg fi 3037126a8a12Smrg # Last step: remove runtime libs from dependency_libs 3038126a8a12Smrg # (they stay in deplibs) 3039126a8a12Smrg tmp_libs= 3040126a8a12Smrg for i in $dependency_libs ; do 3041126a8a12Smrg case " $predeps $postdeps $compiler_lib_search_path " in 3042126a8a12Smrg *" $i "*) 3043126a8a12Smrg i="" 3044126a8a12Smrg ;; 3045126a8a12Smrg esac 3046126a8a12Smrg if test -n "$i" ; then 3047126a8a12Smrg tmp_libs="$tmp_libs $i" 3048126a8a12Smrg fi 3049126a8a12Smrg done 3050126a8a12Smrg dependency_libs=$tmp_libs 3051126a8a12Smrg done # for pass 3052126a8a12Smrg if test "$linkmode" = prog; then 3053126a8a12Smrg dlfiles="$newdlfiles" 3054126a8a12Smrg dlprefiles="$newdlprefiles" 3055126a8a12Smrg fi 3056126a8a12Smrg 3057126a8a12Smrg case $linkmode in 3058126a8a12Smrg oldlib) 3059126a8a12Smrg if test -n "$deplibs"; then 3060126a8a12Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 3061126a8a12Smrg fi 3062126a8a12Smrg 3063126a8a12Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3064126a8a12Smrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 3065126a8a12Smrg fi 3066126a8a12Smrg 3067126a8a12Smrg if test -n "$rpath"; then 3068126a8a12Smrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 3069126a8a12Smrg fi 3070126a8a12Smrg 3071126a8a12Smrg if test -n "$xrpath"; then 3072126a8a12Smrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 3073126a8a12Smrg fi 3074126a8a12Smrg 3075126a8a12Smrg if test -n "$vinfo"; then 3076126a8a12Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 3077126a8a12Smrg fi 3078126a8a12Smrg 3079126a8a12Smrg if test -n "$release"; then 3080126a8a12Smrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 3081126a8a12Smrg fi 3082126a8a12Smrg 3083126a8a12Smrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3084126a8a12Smrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 3085126a8a12Smrg fi 3086126a8a12Smrg 3087126a8a12Smrg # Now set the variables for building old libraries. 3088126a8a12Smrg build_libtool_libs=no 3089126a8a12Smrg oldlibs="$output" 3090126a8a12Smrg objs="$objs$old_deplibs" 3091126a8a12Smrg ;; 3092126a8a12Smrg 3093126a8a12Smrg lib) 3094126a8a12Smrg # Make sure we only generate libraries of the form `libNAME.la'. 3095126a8a12Smrg case $outputname in 3096126a8a12Smrg lib*) 3097126a8a12Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 3098126a8a12Smrg eval shared_ext=\"$shrext_cmds\" 3099126a8a12Smrg eval libname=\"$libname_spec\" 3100126a8a12Smrg ;; 3101126a8a12Smrg *) 3102126a8a12Smrg if test "$module" = no; then 3103126a8a12Smrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 3104126a8a12Smrg $echo "$help" 1>&2 3105126a8a12Smrg exit $EXIT_FAILURE 3106126a8a12Smrg fi 3107126a8a12Smrg if test "$need_lib_prefix" != no; then 3108126a8a12Smrg # Add the "lib" prefix for modules if required 3109126a8a12Smrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3110126a8a12Smrg eval shared_ext=\"$shrext_cmds\" 3111126a8a12Smrg eval libname=\"$libname_spec\" 3112126a8a12Smrg else 3113126a8a12Smrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3114126a8a12Smrg fi 3115126a8a12Smrg ;; 3116126a8a12Smrg esac 3117126a8a12Smrg 3118126a8a12Smrg if test -n "$objs"; then 3119126a8a12Smrg if test "$deplibs_check_method" != pass_all; then 3120126a8a12Smrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 3121126a8a12Smrg exit $EXIT_FAILURE 3122126a8a12Smrg else 3123126a8a12Smrg $echo 3124126a8a12Smrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 3125126a8a12Smrg $echo "*** objects $objs is not portable!" 3126126a8a12Smrg libobjs="$libobjs $objs" 3127126a8a12Smrg fi 3128126a8a12Smrg fi 3129126a8a12Smrg 3130126a8a12Smrg if test "$dlself" != no; then 3131126a8a12Smrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 3132126a8a12Smrg fi 3133126a8a12Smrg 3134126a8a12Smrg set dummy $rpath 3135126a8a12Smrg if test "$#" -gt 2; then 3136126a8a12Smrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 3137126a8a12Smrg fi 3138126a8a12Smrg install_libdir="$2" 3139126a8a12Smrg 3140126a8a12Smrg oldlibs= 3141126a8a12Smrg if test -z "$rpath"; then 3142126a8a12Smrg if test "$build_libtool_libs" = yes; then 3143126a8a12Smrg # Building a libtool convenience library. 3144126a8a12Smrg # Some compilers have problems with a `.al' extension so 3145126a8a12Smrg # convenience libraries should have the same extension an 3146126a8a12Smrg # archive normally would. 3147126a8a12Smrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 3148126a8a12Smrg build_libtool_libs=convenience 3149126a8a12Smrg build_old_libs=yes 3150126a8a12Smrg fi 3151126a8a12Smrg 3152126a8a12Smrg if test -n "$vinfo"; then 3153126a8a12Smrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 3154126a8a12Smrg fi 3155126a8a12Smrg 3156126a8a12Smrg if test -n "$release"; then 3157126a8a12Smrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 3158126a8a12Smrg fi 3159126a8a12Smrg else 3160126a8a12Smrg 3161126a8a12Smrg # Parse the version information argument. 3162126a8a12Smrg save_ifs="$IFS"; IFS=':' 3163126a8a12Smrg set dummy $vinfo 0 0 0 3164126a8a12Smrg IFS="$save_ifs" 3165126a8a12Smrg 3166126a8a12Smrg if test -n "$8"; then 3167126a8a12Smrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 3168126a8a12Smrg $echo "$help" 1>&2 3169126a8a12Smrg exit $EXIT_FAILURE 3170126a8a12Smrg fi 3171126a8a12Smrg 3172126a8a12Smrg # convert absolute version numbers to libtool ages 3173126a8a12Smrg # this retains compatibility with .la files and attempts 3174126a8a12Smrg # to make the code below a bit more comprehensible 3175126a8a12Smrg 3176126a8a12Smrg case $vinfo_number in 3177126a8a12Smrg yes) 3178126a8a12Smrg number_major="$2" 3179126a8a12Smrg number_minor="$3" 3180126a8a12Smrg number_revision="$4" 3181126a8a12Smrg # 3182126a8a12Smrg # There are really only two kinds -- those that 3183126a8a12Smrg # use the current revision as the major version 3184126a8a12Smrg # and those that subtract age and use age as 3185126a8a12Smrg # a minor version. But, then there is irix 3186126a8a12Smrg # which has an extra 1 added just for fun 3187126a8a12Smrg # 3188126a8a12Smrg case $version_type in 3189126a8a12Smrg darwin|linux|osf|windows) 3190126a8a12Smrg current=`expr $number_major + $number_minor` 3191126a8a12Smrg age="$number_minor" 3192126a8a12Smrg revision="$number_revision" 3193126a8a12Smrg ;; 3194126a8a12Smrg freebsd-aout|freebsd-elf|sunos) 3195126a8a12Smrg current="$number_major" 3196126a8a12Smrg revision="$number_minor" 3197126a8a12Smrg age="0" 3198126a8a12Smrg ;; 3199126a8a12Smrg irix|nonstopux) 3200126a8a12Smrg current=`expr $number_major + $number_minor - 1` 3201126a8a12Smrg age="$number_minor" 3202126a8a12Smrg revision="$number_minor" 3203126a8a12Smrg ;; 3204126a8a12Smrg esac 3205126a8a12Smrg ;; 3206126a8a12Smrg no) 3207126a8a12Smrg current="$2" 3208126a8a12Smrg revision="$3" 3209126a8a12Smrg age="$4" 3210126a8a12Smrg ;; 3211126a8a12Smrg esac 3212126a8a12Smrg 3213126a8a12Smrg # Check that each of the things are valid numbers. 3214126a8a12Smrg case $current in 3215126a8a12Smrg 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]) ;; 3216126a8a12Smrg *) 3217126a8a12Smrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 3218126a8a12Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3219126a8a12Smrg exit $EXIT_FAILURE 3220126a8a12Smrg ;; 3221126a8a12Smrg esac 3222126a8a12Smrg 3223126a8a12Smrg case $revision in 3224126a8a12Smrg 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]) ;; 3225126a8a12Smrg *) 3226126a8a12Smrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 3227126a8a12Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3228126a8a12Smrg exit $EXIT_FAILURE 3229126a8a12Smrg ;; 3230126a8a12Smrg esac 3231126a8a12Smrg 3232126a8a12Smrg case $age in 3233126a8a12Smrg 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]) ;; 3234126a8a12Smrg *) 3235126a8a12Smrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 3236126a8a12Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3237126a8a12Smrg exit $EXIT_FAILURE 3238126a8a12Smrg ;; 3239126a8a12Smrg esac 3240126a8a12Smrg 3241126a8a12Smrg if test "$age" -gt "$current"; then 3242126a8a12Smrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 3243126a8a12Smrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3244126a8a12Smrg exit $EXIT_FAILURE 3245126a8a12Smrg fi 3246126a8a12Smrg 3247126a8a12Smrg # Calculate the version variables. 3248126a8a12Smrg major= 3249126a8a12Smrg versuffix= 3250126a8a12Smrg verstring= 3251126a8a12Smrg case $version_type in 3252126a8a12Smrg none) ;; 3253126a8a12Smrg 3254126a8a12Smrg darwin) 3255126a8a12Smrg # Like Linux, but with the current version available in 3256126a8a12Smrg # verstring for coding it into the library header 3257126a8a12Smrg major=.`expr $current - $age` 3258126a8a12Smrg versuffix="$major.$age.$revision" 3259126a8a12Smrg # Darwin ld doesn't like 0 for these options... 3260126a8a12Smrg minor_current=`expr $current + 1` 3261126a8a12Smrg verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 3262126a8a12Smrg ;; 3263126a8a12Smrg 3264126a8a12Smrg freebsd-aout) 3265126a8a12Smrg major=".$current" 3266126a8a12Smrg versuffix=".$current.$revision"; 3267126a8a12Smrg ;; 3268126a8a12Smrg 3269126a8a12Smrg freebsd-elf) 3270126a8a12Smrg major=".$current" 3271126a8a12Smrg versuffix=".$current"; 3272126a8a12Smrg ;; 3273126a8a12Smrg 3274126a8a12Smrg irix | nonstopux) 3275126a8a12Smrg major=`expr $current - $age + 1` 3276126a8a12Smrg 3277126a8a12Smrg case $version_type in 3278126a8a12Smrg nonstopux) verstring_prefix=nonstopux ;; 3279126a8a12Smrg *) verstring_prefix=sgi ;; 3280126a8a12Smrg esac 3281126a8a12Smrg verstring="$verstring_prefix$major.$revision" 3282126a8a12Smrg 3283126a8a12Smrg # Add in all the interfaces that we are compatible with. 3284126a8a12Smrg loop=$revision 3285126a8a12Smrg while test "$loop" -ne 0; do 3286126a8a12Smrg iface=`expr $revision - $loop` 3287126a8a12Smrg loop=`expr $loop - 1` 3288126a8a12Smrg verstring="$verstring_prefix$major.$iface:$verstring" 3289126a8a12Smrg done 3290126a8a12Smrg 3291126a8a12Smrg # Before this point, $major must not contain `.'. 3292126a8a12Smrg major=.$major 3293126a8a12Smrg versuffix="$major.$revision" 3294126a8a12Smrg ;; 3295126a8a12Smrg 3296126a8a12Smrg linux) 3297126a8a12Smrg major=.`expr $current - $age` 3298126a8a12Smrg versuffix="$major.$age.$revision" 3299126a8a12Smrg ;; 3300126a8a12Smrg 3301126a8a12Smrg osf) 3302126a8a12Smrg major=.`expr $current - $age` 3303126a8a12Smrg versuffix=".$current.$age.$revision" 3304126a8a12Smrg verstring="$current.$age.$revision" 3305126a8a12Smrg 3306126a8a12Smrg # Add in all the interfaces that we are compatible with. 3307126a8a12Smrg loop=$age 3308126a8a12Smrg while test "$loop" -ne 0; do 3309126a8a12Smrg iface=`expr $current - $loop` 3310126a8a12Smrg loop=`expr $loop - 1` 3311126a8a12Smrg verstring="$verstring:${iface}.0" 3312126a8a12Smrg done 3313126a8a12Smrg 3314126a8a12Smrg # Make executables depend on our current version. 3315126a8a12Smrg verstring="$verstring:${current}.0" 3316126a8a12Smrg ;; 3317126a8a12Smrg 3318126a8a12Smrg sunos) 3319126a8a12Smrg major=".$current" 3320126a8a12Smrg versuffix=".$current.$revision" 3321126a8a12Smrg ;; 3322126a8a12Smrg 3323126a8a12Smrg windows) 3324126a8a12Smrg # Use '-' rather than '.', since we only want one 3325126a8a12Smrg # extension on DOS 8.3 filesystems. 3326126a8a12Smrg major=`expr $current - $age` 3327126a8a12Smrg versuffix="-$major" 3328126a8a12Smrg ;; 3329126a8a12Smrg 3330126a8a12Smrg *) 3331126a8a12Smrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 3332126a8a12Smrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 3333126a8a12Smrg exit $EXIT_FAILURE 3334126a8a12Smrg ;; 3335126a8a12Smrg esac 3336126a8a12Smrg 3337126a8a12Smrg # Clear the version info if we defaulted, and they specified a release. 3338126a8a12Smrg if test -z "$vinfo" && test -n "$release"; then 3339126a8a12Smrg major= 3340126a8a12Smrg case $version_type in 3341126a8a12Smrg darwin) 3342126a8a12Smrg # we can't check for "0.0" in archive_cmds due to quoting 3343126a8a12Smrg # problems, so we reset it completely 3344126a8a12Smrg verstring= 3345126a8a12Smrg ;; 3346126a8a12Smrg *) 3347126a8a12Smrg verstring="0.0" 3348126a8a12Smrg ;; 3349126a8a12Smrg esac 3350126a8a12Smrg if test "$need_version" = no; then 3351126a8a12Smrg versuffix= 3352126a8a12Smrg else 3353126a8a12Smrg versuffix=".0.0" 3354126a8a12Smrg fi 3355126a8a12Smrg fi 3356126a8a12Smrg 3357126a8a12Smrg # Remove version info from name if versioning should be avoided 3358126a8a12Smrg if test "$avoid_version" = yes && test "$need_version" = no; then 3359126a8a12Smrg major= 3360126a8a12Smrg versuffix= 3361126a8a12Smrg verstring="" 3362126a8a12Smrg fi 3363126a8a12Smrg 3364126a8a12Smrg # Check to see if the archive will have undefined symbols. 3365126a8a12Smrg if test "$allow_undefined" = yes; then 3366126a8a12Smrg if test "$allow_undefined_flag" = unsupported; then 3367126a8a12Smrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 3368126a8a12Smrg build_libtool_libs=no 3369126a8a12Smrg build_old_libs=yes 3370126a8a12Smrg fi 3371126a8a12Smrg else 3372126a8a12Smrg # Don't allow undefined symbols. 3373126a8a12Smrg allow_undefined_flag="$no_undefined_flag" 3374126a8a12Smrg fi 3375126a8a12Smrg fi 3376126a8a12Smrg 3377126a8a12Smrg if test "$mode" != relink; then 3378126a8a12Smrg # Remove our outputs, but don't remove object files since they 3379126a8a12Smrg # may have been created when compiling PIC objects. 3380126a8a12Smrg removelist= 3381126a8a12Smrg tempremovelist=`$echo "$output_objdir/*"` 3382126a8a12Smrg for p in $tempremovelist; do 3383126a8a12Smrg case $p in 3384126a8a12Smrg *.$objext) 3385126a8a12Smrg ;; 3386126a8a12Smrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 3387126a8a12Smrg if test "X$precious_files_regex" != "X"; then 3388126a8a12Smrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 3389126a8a12Smrg then 3390126a8a12Smrg continue 3391126a8a12Smrg fi 3392126a8a12Smrg fi 3393126a8a12Smrg removelist="$removelist $p" 3394126a8a12Smrg ;; 3395126a8a12Smrg *) ;; 3396126a8a12Smrg esac 3397126a8a12Smrg done 3398126a8a12Smrg if test -n "$removelist"; then 3399126a8a12Smrg $show "${rm}r $removelist" 3400126a8a12Smrg $run ${rm}r $removelist 3401126a8a12Smrg fi 3402126a8a12Smrg fi 3403126a8a12Smrg 3404126a8a12Smrg # Now set the variables for building old libraries. 3405126a8a12Smrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 3406126a8a12Smrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 3407126a8a12Smrg 3408126a8a12Smrg # Transform .lo files to .o files. 3409126a8a12Smrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3410126a8a12Smrg fi 3411126a8a12Smrg 3412126a8a12Smrg # Eliminate all temporary directories. 3413126a8a12Smrg for path in $notinst_path; do 3414126a8a12Smrg lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 3415126a8a12Smrg deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 3416126a8a12Smrg dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 3417126a8a12Smrg done 3418126a8a12Smrg 3419126a8a12Smrg if test -n "$xrpath"; then 3420126a8a12Smrg # If the user specified any rpath flags, then add them. 3421126a8a12Smrg temp_xrpath= 3422126a8a12Smrg for libdir in $xrpath; do 3423126a8a12Smrg temp_xrpath="$temp_xrpath -R$libdir" 3424126a8a12Smrg case "$finalize_rpath " in 3425126a8a12Smrg *" $libdir "*) ;; 3426126a8a12Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 3427126a8a12Smrg esac 3428126a8a12Smrg done 3429126a8a12Smrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 3430126a8a12Smrg dependency_libs="$temp_xrpath $dependency_libs" 3431126a8a12Smrg fi 3432126a8a12Smrg fi 3433126a8a12Smrg 3434126a8a12Smrg # Make sure dlfiles contains only unique files that won't be dlpreopened 3435126a8a12Smrg old_dlfiles="$dlfiles" 3436126a8a12Smrg dlfiles= 3437126a8a12Smrg for lib in $old_dlfiles; do 3438126a8a12Smrg case " $dlprefiles $dlfiles " in 3439126a8a12Smrg *" $lib "*) ;; 3440126a8a12Smrg *) dlfiles="$dlfiles $lib" ;; 3441126a8a12Smrg esac 3442126a8a12Smrg done 3443126a8a12Smrg 3444126a8a12Smrg # Make sure dlprefiles contains only unique files 3445126a8a12Smrg old_dlprefiles="$dlprefiles" 3446126a8a12Smrg dlprefiles= 3447126a8a12Smrg for lib in $old_dlprefiles; do 3448126a8a12Smrg case "$dlprefiles " in 3449126a8a12Smrg *" $lib "*) ;; 3450126a8a12Smrg *) dlprefiles="$dlprefiles $lib" ;; 3451126a8a12Smrg esac 3452126a8a12Smrg done 3453126a8a12Smrg 3454126a8a12Smrg if test "$build_libtool_libs" = yes; then 3455126a8a12Smrg if test -n "$rpath"; then 3456126a8a12Smrg case $host in 3457126a8a12Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 3458126a8a12Smrg # these systems don't actually have a c library (as such)! 3459126a8a12Smrg ;; 3460126a8a12Smrg *-*-rhapsody* | *-*-darwin1.[012]) 3461126a8a12Smrg # Rhapsody C library is in the System framework 3462126a8a12Smrg deplibs="$deplibs -framework System" 3463126a8a12Smrg ;; 3464126a8a12Smrg *-*-netbsd*) 3465126a8a12Smrg # Don't link with libc until the a.out ld.so is fixed. 3466126a8a12Smrg ;; 3467126a8a12Smrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3468126a8a12Smrg # Do not include libc due to us having libc/libc_r. 3469126a8a12Smrg ;; 3470126a8a12Smrg *-*-sco3.2v5* | *-*-sco5v6*) 3471126a8a12Smrg # Causes problems with __ctype 3472126a8a12Smrg ;; 3473126a8a12Smrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 3474126a8a12Smrg # Compiler inserts libc in the correct place for threads to work 3475126a8a12Smrg ;; 3476126a8a12Smrg *) 3477126a8a12Smrg # Add libc to deplibs on all other systems if necessary. 3478126a8a12Smrg if test "$build_libtool_need_lc" = "yes"; then 3479126a8a12Smrg deplibs="$deplibs -lc" 3480126a8a12Smrg fi 3481126a8a12Smrg ;; 3482126a8a12Smrg esac 3483126a8a12Smrg fi 3484126a8a12Smrg 3485126a8a12Smrg # Transform deplibs into only deplibs that can be linked in shared. 3486126a8a12Smrg name_save=$name 3487126a8a12Smrg libname_save=$libname 3488126a8a12Smrg release_save=$release 3489126a8a12Smrg versuffix_save=$versuffix 3490126a8a12Smrg major_save=$major 3491126a8a12Smrg # I'm not sure if I'm treating the release correctly. I think 3492126a8a12Smrg # release should show up in the -l (ie -lgmp5) so we don't want to 3493126a8a12Smrg # add it in twice. Is that correct? 3494126a8a12Smrg release="" 3495126a8a12Smrg versuffix="" 3496126a8a12Smrg major="" 3497126a8a12Smrg newdeplibs= 3498126a8a12Smrg droppeddeps=no 3499126a8a12Smrg case $deplibs_check_method in 3500126a8a12Smrg pass_all) 3501126a8a12Smrg # Don't check for shared/static. Everything works. 3502126a8a12Smrg # This might be a little naive. We might want to check 3503126a8a12Smrg # whether the library exists or not. But this is on 3504126a8a12Smrg # osf3 & osf4 and I'm not really sure... Just 3505126a8a12Smrg # implementing what was already the behavior. 3506126a8a12Smrg newdeplibs=$deplibs 3507126a8a12Smrg ;; 3508126a8a12Smrg test_compile) 3509126a8a12Smrg # This code stresses the "libraries are programs" paradigm to its 3510126a8a12Smrg # limits. Maybe even breaks it. We compile a program, linking it 3511126a8a12Smrg # against the deplibs as a proxy for the library. Then we can check 3512126a8a12Smrg # whether they linked in statically or dynamically with ldd. 3513126a8a12Smrg $rm conftest.c 3514126a8a12Smrg cat > conftest.c <<EOF 3515126a8a12Smrg int main() { return 0; } 3516126a8a12SmrgEOF 3517126a8a12Smrg $rm conftest 3518126a8a12Smrg $LTCC $LTCFLAGS -o conftest conftest.c $deplibs 3519126a8a12Smrg if test "$?" -eq 0 ; then 3520126a8a12Smrg ldd_output=`ldd conftest` 3521126a8a12Smrg for i in $deplibs; do 3522126a8a12Smrg name=`expr $i : '-l\(.*\)'` 3523126a8a12Smrg # If $name is empty we are operating on a -L argument. 3524126a8a12Smrg if test "$name" != "" && test "$name" -ne "0"; then 3525126a8a12Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3526126a8a12Smrg case " $predeps $postdeps " in 3527126a8a12Smrg *" $i "*) 3528126a8a12Smrg newdeplibs="$newdeplibs $i" 3529126a8a12Smrg i="" 3530126a8a12Smrg ;; 3531126a8a12Smrg esac 3532126a8a12Smrg fi 3533126a8a12Smrg if test -n "$i" ; then 3534126a8a12Smrg libname=`eval \\$echo \"$libname_spec\"` 3535126a8a12Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 3536126a8a12Smrg set dummy $deplib_matches 3537126a8a12Smrg deplib_match=$2 3538126a8a12Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3539126a8a12Smrg newdeplibs="$newdeplibs $i" 3540126a8a12Smrg else 3541126a8a12Smrg droppeddeps=yes 3542126a8a12Smrg $echo 3543126a8a12Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 3544126a8a12Smrg $echo "*** I have the capability to make that library automatically link in when" 3545126a8a12Smrg $echo "*** you link to this library. But I can only do this if you have a" 3546126a8a12Smrg $echo "*** shared version of the library, which I believe you do not have" 3547126a8a12Smrg $echo "*** because a test_compile did reveal that the linker did not use it for" 3548126a8a12Smrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 3549126a8a12Smrg fi 3550126a8a12Smrg fi 3551126a8a12Smrg else 3552126a8a12Smrg newdeplibs="$newdeplibs $i" 3553126a8a12Smrg fi 3554126a8a12Smrg done 3555126a8a12Smrg else 3556126a8a12Smrg # Error occurred in the first compile. Let's try to salvage 3557126a8a12Smrg # the situation: Compile a separate program for each library. 3558126a8a12Smrg for i in $deplibs; do 3559126a8a12Smrg name=`expr $i : '-l\(.*\)'` 3560126a8a12Smrg # If $name is empty we are operating on a -L argument. 3561126a8a12Smrg if test "$name" != "" && test "$name" != "0"; then 3562126a8a12Smrg $rm conftest 3563126a8a12Smrg $LTCC $LTCFLAGS -o conftest conftest.c $i 3564126a8a12Smrg # Did it work? 3565126a8a12Smrg if test "$?" -eq 0 ; then 3566126a8a12Smrg ldd_output=`ldd conftest` 3567126a8a12Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3568126a8a12Smrg case " $predeps $postdeps " in 3569126a8a12Smrg *" $i "*) 3570126a8a12Smrg newdeplibs="$newdeplibs $i" 3571126a8a12Smrg i="" 3572126a8a12Smrg ;; 3573126a8a12Smrg esac 3574126a8a12Smrg fi 3575126a8a12Smrg if test -n "$i" ; then 3576126a8a12Smrg libname=`eval \\$echo \"$libname_spec\"` 3577126a8a12Smrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 3578126a8a12Smrg set dummy $deplib_matches 3579126a8a12Smrg deplib_match=$2 3580126a8a12Smrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3581126a8a12Smrg newdeplibs="$newdeplibs $i" 3582126a8a12Smrg else 3583126a8a12Smrg droppeddeps=yes 3584126a8a12Smrg $echo 3585126a8a12Smrg $echo "*** Warning: dynamic linker does not accept needed library $i." 3586126a8a12Smrg $echo "*** I have the capability to make that library automatically link in when" 3587126a8a12Smrg $echo "*** you link to this library. But I can only do this if you have a" 3588126a8a12Smrg $echo "*** shared version of the library, which you do not appear to have" 3589126a8a12Smrg $echo "*** because a test_compile did reveal that the linker did not use this one" 3590126a8a12Smrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 3591126a8a12Smrg fi 3592126a8a12Smrg fi 3593126a8a12Smrg else 3594126a8a12Smrg droppeddeps=yes 3595126a8a12Smrg $echo 3596126a8a12Smrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 3597126a8a12Smrg $echo "*** make it link in! You will probably need to install it or some" 3598126a8a12Smrg $echo "*** library that it depends on before this library will be fully" 3599126a8a12Smrg $echo "*** functional. Installing it before continuing would be even better." 3600126a8a12Smrg fi 3601126a8a12Smrg else 3602126a8a12Smrg newdeplibs="$newdeplibs $i" 3603126a8a12Smrg fi 3604126a8a12Smrg done 3605126a8a12Smrg fi 3606126a8a12Smrg ;; 3607126a8a12Smrg file_magic*) 3608126a8a12Smrg set dummy $deplibs_check_method 3609126a8a12Smrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3610126a8a12Smrg for a_deplib in $deplibs; do 3611126a8a12Smrg name=`expr $a_deplib : '-l\(.*\)'` 3612126a8a12Smrg # If $name is empty we are operating on a -L argument. 3613126a8a12Smrg if test "$name" != "" && test "$name" != "0"; then 3614126a8a12Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3615126a8a12Smrg case " $predeps $postdeps " in 3616126a8a12Smrg *" $a_deplib "*) 3617126a8a12Smrg newdeplibs="$newdeplibs $a_deplib" 3618126a8a12Smrg a_deplib="" 3619126a8a12Smrg ;; 3620126a8a12Smrg esac 3621126a8a12Smrg fi 3622126a8a12Smrg if test -n "$a_deplib" ; then 3623126a8a12Smrg libname=`eval \\$echo \"$libname_spec\"` 3624126a8a12Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3625126a8a12Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3626126a8a12Smrg for potent_lib in $potential_libs; do 3627126a8a12Smrg # Follow soft links. 3628126a8a12Smrg if ls -lLd "$potent_lib" 2>/dev/null \ 3629126a8a12Smrg | grep " -> " >/dev/null; then 3630126a8a12Smrg continue 3631126a8a12Smrg fi 3632126a8a12Smrg # The statement above tries to avoid entering an 3633126a8a12Smrg # endless loop below, in case of cyclic links. 3634126a8a12Smrg # We might still enter an endless loop, since a link 3635126a8a12Smrg # loop can be closed while we follow links, 3636126a8a12Smrg # but so what? 3637126a8a12Smrg potlib="$potent_lib" 3638126a8a12Smrg while test -h "$potlib" 2>/dev/null; do 3639126a8a12Smrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 3640126a8a12Smrg case $potliblink in 3641126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 3642126a8a12Smrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 3643126a8a12Smrg esac 3644126a8a12Smrg done 3645126a8a12Smrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 3646126a8a12Smrg | ${SED} 10q \ 3647126a8a12Smrg | $EGREP "$file_magic_regex" > /dev/null; then 3648126a8a12Smrg newdeplibs="$newdeplibs $a_deplib" 3649126a8a12Smrg a_deplib="" 3650126a8a12Smrg break 2 3651126a8a12Smrg fi 3652126a8a12Smrg done 3653126a8a12Smrg done 3654126a8a12Smrg fi 3655126a8a12Smrg if test -n "$a_deplib" ; then 3656126a8a12Smrg droppeddeps=yes 3657126a8a12Smrg $echo 3658126a8a12Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 3659126a8a12Smrg $echo "*** I have the capability to make that library automatically link in when" 3660126a8a12Smrg $echo "*** you link to this library. But I can only do this if you have a" 3661126a8a12Smrg $echo "*** shared version of the library, which you do not appear to have" 3662126a8a12Smrg $echo "*** because I did check the linker path looking for a file starting" 3663126a8a12Smrg if test -z "$potlib" ; then 3664126a8a12Smrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 3665126a8a12Smrg else 3666126a8a12Smrg $echo "*** with $libname and none of the candidates passed a file format test" 3667126a8a12Smrg $echo "*** using a file magic. Last file checked: $potlib" 3668126a8a12Smrg fi 3669126a8a12Smrg fi 3670126a8a12Smrg else 3671126a8a12Smrg # Add a -L argument. 3672126a8a12Smrg newdeplibs="$newdeplibs $a_deplib" 3673126a8a12Smrg fi 3674126a8a12Smrg done # Gone through all deplibs. 3675126a8a12Smrg ;; 3676126a8a12Smrg match_pattern*) 3677126a8a12Smrg set dummy $deplibs_check_method 3678126a8a12Smrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3679126a8a12Smrg for a_deplib in $deplibs; do 3680126a8a12Smrg name=`expr $a_deplib : '-l\(.*\)'` 3681126a8a12Smrg # If $name is empty we are operating on a -L argument. 3682126a8a12Smrg if test -n "$name" && test "$name" != "0"; then 3683126a8a12Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3684126a8a12Smrg case " $predeps $postdeps " in 3685126a8a12Smrg *" $a_deplib "*) 3686126a8a12Smrg newdeplibs="$newdeplibs $a_deplib" 3687126a8a12Smrg a_deplib="" 3688126a8a12Smrg ;; 3689126a8a12Smrg esac 3690126a8a12Smrg fi 3691126a8a12Smrg if test -n "$a_deplib" ; then 3692126a8a12Smrg libname=`eval \\$echo \"$libname_spec\"` 3693126a8a12Smrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3694126a8a12Smrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3695126a8a12Smrg for potent_lib in $potential_libs; do 3696126a8a12Smrg potlib="$potent_lib" # see symlink-check above in file_magic test 3697126a8a12Smrg if eval $echo \"$potent_lib\" 2>/dev/null \ 3698126a8a12Smrg | ${SED} 10q \ 3699126a8a12Smrg | $EGREP "$match_pattern_regex" > /dev/null; then 3700126a8a12Smrg newdeplibs="$newdeplibs $a_deplib" 3701126a8a12Smrg a_deplib="" 3702126a8a12Smrg break 2 3703126a8a12Smrg fi 3704126a8a12Smrg done 3705126a8a12Smrg done 3706126a8a12Smrg fi 3707126a8a12Smrg if test -n "$a_deplib" ; then 3708126a8a12Smrg droppeddeps=yes 3709126a8a12Smrg $echo 3710126a8a12Smrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 3711126a8a12Smrg $echo "*** I have the capability to make that library automatically link in when" 3712126a8a12Smrg $echo "*** you link to this library. But I can only do this if you have a" 3713126a8a12Smrg $echo "*** shared version of the library, which you do not appear to have" 3714126a8a12Smrg $echo "*** because I did check the linker path looking for a file starting" 3715126a8a12Smrg if test -z "$potlib" ; then 3716126a8a12Smrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 3717126a8a12Smrg else 3718126a8a12Smrg $echo "*** with $libname and none of the candidates passed a file format test" 3719126a8a12Smrg $echo "*** using a regex pattern. Last file checked: $potlib" 3720126a8a12Smrg fi 3721126a8a12Smrg fi 3722126a8a12Smrg else 3723126a8a12Smrg # Add a -L argument. 3724126a8a12Smrg newdeplibs="$newdeplibs $a_deplib" 3725126a8a12Smrg fi 3726126a8a12Smrg done # Gone through all deplibs. 3727126a8a12Smrg ;; 3728126a8a12Smrg none | unknown | *) 3729126a8a12Smrg newdeplibs="" 3730126a8a12Smrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 3731126a8a12Smrg -e 's/ -[LR][^ ]*//g'` 3732126a8a12Smrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3733126a8a12Smrg for i in $predeps $postdeps ; do 3734126a8a12Smrg # can't use Xsed below, because $i might contain '/' 3735126a8a12Smrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 3736126a8a12Smrg done 3737126a8a12Smrg fi 3738126a8a12Smrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 3739126a8a12Smrg | grep . >/dev/null; then 3740126a8a12Smrg $echo 3741126a8a12Smrg if test "X$deplibs_check_method" = "Xnone"; then 3742126a8a12Smrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 3743126a8a12Smrg else 3744126a8a12Smrg $echo "*** Warning: inter-library dependencies are not known to be supported." 3745126a8a12Smrg fi 3746126a8a12Smrg $echo "*** All declared inter-library dependencies are being dropped." 3747126a8a12Smrg droppeddeps=yes 3748126a8a12Smrg fi 3749126a8a12Smrg ;; 3750126a8a12Smrg esac 3751126a8a12Smrg versuffix=$versuffix_save 3752126a8a12Smrg major=$major_save 3753126a8a12Smrg release=$release_save 3754126a8a12Smrg libname=$libname_save 3755126a8a12Smrg name=$name_save 3756126a8a12Smrg 3757126a8a12Smrg case $host in 3758126a8a12Smrg *-*-rhapsody* | *-*-darwin1.[012]) 3759126a8a12Smrg # On Rhapsody replace the C library is the System framework 3760126a8a12Smrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 3761126a8a12Smrg ;; 3762126a8a12Smrg esac 3763126a8a12Smrg 3764126a8a12Smrg if test "$droppeddeps" = yes; then 3765126a8a12Smrg if test "$module" = yes; then 3766126a8a12Smrg $echo 3767126a8a12Smrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 3768126a8a12Smrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 3769126a8a12Smrg $echo "*** a static module, that should work as long as the dlopening" 3770126a8a12Smrg $echo "*** application is linked with the -dlopen flag." 3771126a8a12Smrg if test -z "$global_symbol_pipe"; then 3772126a8a12Smrg $echo 3773126a8a12Smrg $echo "*** However, this would only work if libtool was able to extract symbol" 3774126a8a12Smrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 3775126a8a12Smrg $echo "*** not find such a program. So, this module is probably useless." 3776126a8a12Smrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 3777126a8a12Smrg fi 3778126a8a12Smrg if test "$build_old_libs" = no; then 3779126a8a12Smrg oldlibs="$output_objdir/$libname.$libext" 3780126a8a12Smrg build_libtool_libs=module 3781126a8a12Smrg build_old_libs=yes 3782126a8a12Smrg else 3783126a8a12Smrg build_libtool_libs=no 3784126a8a12Smrg fi 3785126a8a12Smrg else 3786126a8a12Smrg $echo "*** The inter-library dependencies that have been dropped here will be" 3787126a8a12Smrg $echo "*** automatically added whenever a program is linked with this library" 3788126a8a12Smrg $echo "*** or is declared to -dlopen it." 3789126a8a12Smrg 3790126a8a12Smrg if test "$allow_undefined" = no; then 3791126a8a12Smrg $echo 3792126a8a12Smrg $echo "*** Since this library must not contain undefined symbols," 3793126a8a12Smrg $echo "*** because either the platform does not support them or" 3794126a8a12Smrg $echo "*** it was explicitly requested with -no-undefined," 3795126a8a12Smrg $echo "*** libtool will only create a static version of it." 3796126a8a12Smrg if test "$build_old_libs" = no; then 3797126a8a12Smrg oldlibs="$output_objdir/$libname.$libext" 3798126a8a12Smrg build_libtool_libs=module 3799126a8a12Smrg build_old_libs=yes 3800126a8a12Smrg else 3801126a8a12Smrg build_libtool_libs=no 3802126a8a12Smrg fi 3803126a8a12Smrg fi 3804126a8a12Smrg fi 3805126a8a12Smrg fi 3806126a8a12Smrg # Done checking deplibs! 3807126a8a12Smrg deplibs=$newdeplibs 3808126a8a12Smrg fi 3809126a8a12Smrg 3810126a8a12Smrg 3811126a8a12Smrg # move library search paths that coincide with paths to not yet 3812126a8a12Smrg # installed libraries to the beginning of the library search list 3813126a8a12Smrg new_libs= 3814126a8a12Smrg for path in $notinst_path; do 3815126a8a12Smrg case " $new_libs " in 3816126a8a12Smrg *" -L$path/$objdir "*) ;; 3817126a8a12Smrg *) 3818126a8a12Smrg case " $deplibs " in 3819126a8a12Smrg *" -L$path/$objdir "*) 3820126a8a12Smrg new_libs="$new_libs -L$path/$objdir" ;; 3821126a8a12Smrg esac 3822126a8a12Smrg ;; 3823126a8a12Smrg esac 3824126a8a12Smrg done 3825126a8a12Smrg for deplib in $deplibs; do 3826126a8a12Smrg case $deplib in 3827126a8a12Smrg -L*) 3828126a8a12Smrg case " $new_libs " in 3829126a8a12Smrg *" $deplib "*) ;; 3830126a8a12Smrg *) new_libs="$new_libs $deplib" ;; 3831126a8a12Smrg esac 3832126a8a12Smrg ;; 3833126a8a12Smrg *) new_libs="$new_libs $deplib" ;; 3834126a8a12Smrg esac 3835126a8a12Smrg done 3836126a8a12Smrg deplibs="$new_libs" 3837126a8a12Smrg 3838126a8a12Smrg 3839126a8a12Smrg # All the library-specific variables (install_libdir is set above). 3840126a8a12Smrg library_names= 3841126a8a12Smrg old_library= 3842126a8a12Smrg dlname= 3843126a8a12Smrg 3844126a8a12Smrg # Test again, we may have decided not to build it any more 3845126a8a12Smrg if test "$build_libtool_libs" = yes; then 3846126a8a12Smrg if test "$hardcode_into_libs" = yes; then 3847126a8a12Smrg # Hardcode the library paths 3848126a8a12Smrg hardcode_libdirs= 3849126a8a12Smrg dep_rpath= 3850126a8a12Smrg rpath="$finalize_rpath" 3851126a8a12Smrg test "$mode" != relink && rpath="$compile_rpath$rpath" 3852126a8a12Smrg for libdir in $rpath; do 3853126a8a12Smrg if test -n "$hardcode_libdir_flag_spec"; then 3854126a8a12Smrg if test -n "$hardcode_libdir_separator"; then 3855126a8a12Smrg if test -z "$hardcode_libdirs"; then 3856126a8a12Smrg hardcode_libdirs="$libdir" 3857126a8a12Smrg else 3858126a8a12Smrg # Just accumulate the unique libdirs. 3859126a8a12Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3860126a8a12Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3861126a8a12Smrg ;; 3862126a8a12Smrg *) 3863126a8a12Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3864126a8a12Smrg ;; 3865126a8a12Smrg esac 3866126a8a12Smrg fi 3867126a8a12Smrg else 3868126a8a12Smrg eval flag=\"$hardcode_libdir_flag_spec\" 3869126a8a12Smrg dep_rpath="$dep_rpath $flag" 3870126a8a12Smrg fi 3871126a8a12Smrg elif test -n "$runpath_var"; then 3872126a8a12Smrg case "$perm_rpath " in 3873126a8a12Smrg *" $libdir "*) ;; 3874126a8a12Smrg *) perm_rpath="$perm_rpath $libdir" ;; 3875126a8a12Smrg esac 3876126a8a12Smrg fi 3877126a8a12Smrg done 3878126a8a12Smrg # Substitute the hardcoded libdirs into the rpath. 3879126a8a12Smrg if test -n "$hardcode_libdir_separator" && 3880126a8a12Smrg test -n "$hardcode_libdirs"; then 3881126a8a12Smrg libdir="$hardcode_libdirs" 3882126a8a12Smrg if test -n "$hardcode_libdir_flag_spec_ld"; then 3883126a8a12Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 3884126a8a12Smrg else 3885126a8a12Smrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3886126a8a12Smrg fi 3887126a8a12Smrg fi 3888126a8a12Smrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 3889126a8a12Smrg # We should set the runpath_var. 3890126a8a12Smrg rpath= 3891126a8a12Smrg for dir in $perm_rpath; do 3892126a8a12Smrg rpath="$rpath$dir:" 3893126a8a12Smrg done 3894126a8a12Smrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3895126a8a12Smrg fi 3896126a8a12Smrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3897126a8a12Smrg fi 3898126a8a12Smrg 3899126a8a12Smrg shlibpath="$finalize_shlibpath" 3900126a8a12Smrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 3901126a8a12Smrg if test -n "$shlibpath"; then 3902126a8a12Smrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 3903126a8a12Smrg fi 3904126a8a12Smrg 3905126a8a12Smrg # Get the real and link names of the library. 3906126a8a12Smrg eval shared_ext=\"$shrext_cmds\" 3907126a8a12Smrg eval library_names=\"$library_names_spec\" 3908126a8a12Smrg set dummy $library_names 3909126a8a12Smrg realname="$2" 3910126a8a12Smrg shift; shift 3911126a8a12Smrg 3912126a8a12Smrg if test -n "$soname_spec"; then 3913126a8a12Smrg eval soname=\"$soname_spec\" 3914126a8a12Smrg else 3915126a8a12Smrg soname="$realname" 3916126a8a12Smrg fi 3917126a8a12Smrg if test -z "$dlname"; then 3918126a8a12Smrg dlname=$soname 3919126a8a12Smrg fi 3920126a8a12Smrg 3921126a8a12Smrg lib="$output_objdir/$realname" 3922126a8a12Smrg linknames= 3923126a8a12Smrg for link 3924126a8a12Smrg do 3925126a8a12Smrg linknames="$linknames $link" 3926126a8a12Smrg done 3927126a8a12Smrg 3928126a8a12Smrg # Use standard objects if they are pic 3929126a8a12Smrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 3930126a8a12Smrg 3931126a8a12Smrg # Prepare the list of exported symbols 3932126a8a12Smrg if test -z "$export_symbols"; then 3933126a8a12Smrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 3934126a8a12Smrg $show "generating symbol list for \`$libname.la'" 3935126a8a12Smrg export_symbols="$output_objdir/$libname.exp" 3936126a8a12Smrg $run $rm $export_symbols 3937126a8a12Smrg cmds=$export_symbols_cmds 3938126a8a12Smrg save_ifs="$IFS"; IFS='~' 3939126a8a12Smrg for cmd in $cmds; do 3940126a8a12Smrg IFS="$save_ifs" 3941126a8a12Smrg eval cmd=\"$cmd\" 3942126a8a12Smrg if len=`expr "X$cmd" : ".*"` && 3943126a8a12Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 3944126a8a12Smrg $show "$cmd" 3945126a8a12Smrg $run eval "$cmd" || exit $? 3946126a8a12Smrg skipped_export=false 3947126a8a12Smrg else 3948126a8a12Smrg # The command line is too long to execute in one step. 3949126a8a12Smrg $show "using reloadable object file for export list..." 3950126a8a12Smrg skipped_export=: 3951126a8a12Smrg # Break out early, otherwise skipped_export may be 3952126a8a12Smrg # set to false by a later but shorter cmd. 3953126a8a12Smrg break 3954126a8a12Smrg fi 3955126a8a12Smrg done 3956126a8a12Smrg IFS="$save_ifs" 3957126a8a12Smrg if test -n "$export_symbols_regex"; then 3958126a8a12Smrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 3959126a8a12Smrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 3960126a8a12Smrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 3961126a8a12Smrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 3962126a8a12Smrg fi 3963126a8a12Smrg fi 3964126a8a12Smrg fi 3965126a8a12Smrg 3966126a8a12Smrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 3967126a8a12Smrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 3968126a8a12Smrg fi 3969126a8a12Smrg 3970126a8a12Smrg tmp_deplibs= 3971126a8a12Smrg for test_deplib in $deplibs; do 3972126a8a12Smrg case " $convenience " in 3973126a8a12Smrg *" $test_deplib "*) ;; 3974126a8a12Smrg *) 3975126a8a12Smrg tmp_deplibs="$tmp_deplibs $test_deplib" 3976126a8a12Smrg ;; 3977126a8a12Smrg esac 3978126a8a12Smrg done 3979126a8a12Smrg deplibs="$tmp_deplibs" 3980126a8a12Smrg 3981126a8a12Smrg if test -n "$convenience"; then 3982126a8a12Smrg if test -n "$whole_archive_flag_spec"; then 3983126a8a12Smrg save_libobjs=$libobjs 3984126a8a12Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3985126a8a12Smrg else 3986126a8a12Smrg gentop="$output_objdir/${outputname}x" 3987126a8a12Smrg generated="$generated $gentop" 3988126a8a12Smrg 3989126a8a12Smrg func_extract_archives $gentop $convenience 3990126a8a12Smrg libobjs="$libobjs $func_extract_archives_result" 3991126a8a12Smrg fi 3992126a8a12Smrg fi 3993126a8a12Smrg 3994126a8a12Smrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 3995126a8a12Smrg eval flag=\"$thread_safe_flag_spec\" 3996126a8a12Smrg linker_flags="$linker_flags $flag" 3997126a8a12Smrg fi 3998126a8a12Smrg 3999126a8a12Smrg # Make a backup of the uninstalled library when relinking 4000126a8a12Smrg if test "$mode" = relink; then 4001126a8a12Smrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 4002126a8a12Smrg fi 4003126a8a12Smrg 4004126a8a12Smrg # Do each of the archive commands. 4005126a8a12Smrg if test "$module" = yes && test -n "$module_cmds" ; then 4006126a8a12Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4007126a8a12Smrg eval test_cmds=\"$module_expsym_cmds\" 4008126a8a12Smrg cmds=$module_expsym_cmds 4009126a8a12Smrg else 4010126a8a12Smrg eval test_cmds=\"$module_cmds\" 4011126a8a12Smrg cmds=$module_cmds 4012126a8a12Smrg fi 4013126a8a12Smrg else 4014126a8a12Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4015126a8a12Smrg eval test_cmds=\"$archive_expsym_cmds\" 4016126a8a12Smrg cmds=$archive_expsym_cmds 4017126a8a12Smrg else 4018126a8a12Smrg eval test_cmds=\"$archive_cmds\" 4019126a8a12Smrg cmds=$archive_cmds 4020126a8a12Smrg fi 4021126a8a12Smrg fi 4022126a8a12Smrg 4023126a8a12Smrg if test "X$skipped_export" != "X:" && 4024126a8a12Smrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4025126a8a12Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4026126a8a12Smrg : 4027126a8a12Smrg else 4028126a8a12Smrg # The command line is too long to link in one step, link piecewise. 4029126a8a12Smrg $echo "creating reloadable object files..." 4030126a8a12Smrg 4031126a8a12Smrg # Save the value of $output and $libobjs because we want to 4032126a8a12Smrg # use them later. If we have whole_archive_flag_spec, we 4033126a8a12Smrg # want to use save_libobjs as it was before 4034126a8a12Smrg # whole_archive_flag_spec was expanded, because we can't 4035126a8a12Smrg # assume the linker understands whole_archive_flag_spec. 4036126a8a12Smrg # This may have to be revisited, in case too many 4037126a8a12Smrg # convenience libraries get linked in and end up exceeding 4038126a8a12Smrg # the spec. 4039126a8a12Smrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4040126a8a12Smrg save_libobjs=$libobjs 4041126a8a12Smrg fi 4042126a8a12Smrg save_output=$output 4043126a8a12Smrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 4044126a8a12Smrg 4045126a8a12Smrg # Clear the reloadable object creation command queue and 4046126a8a12Smrg # initialize k to one. 4047126a8a12Smrg test_cmds= 4048126a8a12Smrg concat_cmds= 4049126a8a12Smrg objlist= 4050126a8a12Smrg delfiles= 4051126a8a12Smrg last_robj= 4052126a8a12Smrg k=1 4053126a8a12Smrg output=$output_objdir/$output_la-${k}.$objext 4054126a8a12Smrg # Loop over the list of objects to be linked. 4055126a8a12Smrg for obj in $save_libobjs 4056126a8a12Smrg do 4057126a8a12Smrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4058126a8a12Smrg if test "X$objlist" = X || 4059126a8a12Smrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4060126a8a12Smrg test "$len" -le "$max_cmd_len"; }; then 4061126a8a12Smrg objlist="$objlist $obj" 4062126a8a12Smrg else 4063126a8a12Smrg # The command $test_cmds is almost too long, add a 4064126a8a12Smrg # command to the queue. 4065126a8a12Smrg if test "$k" -eq 1 ; then 4066126a8a12Smrg # The first file doesn't have a previous command to add. 4067126a8a12Smrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 4068126a8a12Smrg else 4069126a8a12Smrg # All subsequent reloadable object files will link in 4070126a8a12Smrg # the last one created. 4071126a8a12Smrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4072126a8a12Smrg fi 4073126a8a12Smrg last_robj=$output_objdir/$output_la-${k}.$objext 4074126a8a12Smrg k=`expr $k + 1` 4075126a8a12Smrg output=$output_objdir/$output_la-${k}.$objext 4076126a8a12Smrg objlist=$obj 4077126a8a12Smrg len=1 4078126a8a12Smrg fi 4079126a8a12Smrg done 4080126a8a12Smrg # Handle the remaining objects by creating one last 4081126a8a12Smrg # reloadable object file. All subsequent reloadable object 4082126a8a12Smrg # files will link in the last one created. 4083126a8a12Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4084126a8a12Smrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 4085126a8a12Smrg 4086126a8a12Smrg if ${skipped_export-false}; then 4087126a8a12Smrg $show "generating symbol list for \`$libname.la'" 4088126a8a12Smrg export_symbols="$output_objdir/$libname.exp" 4089126a8a12Smrg $run $rm $export_symbols 4090126a8a12Smrg libobjs=$output 4091126a8a12Smrg # Append the command to create the export file. 4092126a8a12Smrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4093126a8a12Smrg fi 4094126a8a12Smrg 4095126a8a12Smrg # Set up a command to remove the reloadable object files 4096126a8a12Smrg # after they are used. 4097126a8a12Smrg i=0 4098126a8a12Smrg while test "$i" -lt "$k" 4099126a8a12Smrg do 4100126a8a12Smrg i=`expr $i + 1` 4101126a8a12Smrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 4102126a8a12Smrg done 4103126a8a12Smrg 4104126a8a12Smrg $echo "creating a temporary reloadable object file: $output" 4105126a8a12Smrg 4106126a8a12Smrg # Loop through the commands generated above and execute them. 4107126a8a12Smrg save_ifs="$IFS"; IFS='~' 4108126a8a12Smrg for cmd in $concat_cmds; do 4109126a8a12Smrg IFS="$save_ifs" 4110126a8a12Smrg $show "$cmd" 4111126a8a12Smrg $run eval "$cmd" || exit $? 4112126a8a12Smrg done 4113126a8a12Smrg IFS="$save_ifs" 4114126a8a12Smrg 4115126a8a12Smrg libobjs=$output 4116126a8a12Smrg # Restore the value of output. 4117126a8a12Smrg output=$save_output 4118126a8a12Smrg 4119126a8a12Smrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 4120126a8a12Smrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4121126a8a12Smrg fi 4122126a8a12Smrg # Expand the library linking commands again to reset the 4123126a8a12Smrg # value of $libobjs for piecewise linking. 4124126a8a12Smrg 4125126a8a12Smrg # Do each of the archive commands. 4126126a8a12Smrg if test "$module" = yes && test -n "$module_cmds" ; then 4127126a8a12Smrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4128126a8a12Smrg cmds=$module_expsym_cmds 4129126a8a12Smrg else 4130126a8a12Smrg cmds=$module_cmds 4131126a8a12Smrg fi 4132126a8a12Smrg else 4133126a8a12Smrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4134126a8a12Smrg cmds=$archive_expsym_cmds 4135126a8a12Smrg else 4136126a8a12Smrg cmds=$archive_cmds 4137126a8a12Smrg fi 4138126a8a12Smrg fi 4139126a8a12Smrg 4140126a8a12Smrg # Append the command to remove the reloadable object files 4141126a8a12Smrg # to the just-reset $cmds. 4142126a8a12Smrg eval cmds=\"\$cmds~\$rm $delfiles\" 4143126a8a12Smrg fi 4144126a8a12Smrg save_ifs="$IFS"; IFS='~' 4145126a8a12Smrg for cmd in $cmds; do 4146126a8a12Smrg IFS="$save_ifs" 4147126a8a12Smrg eval cmd=\"$cmd\" 4148126a8a12Smrg $show "$cmd" 4149126a8a12Smrg $run eval "$cmd" || { 4150126a8a12Smrg lt_exit=$? 4151126a8a12Smrg 4152126a8a12Smrg # Restore the uninstalled library and exit 4153126a8a12Smrg if test "$mode" = relink; then 4154126a8a12Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 4155126a8a12Smrg fi 4156126a8a12Smrg 4157126a8a12Smrg exit $lt_exit 4158126a8a12Smrg } 4159126a8a12Smrg done 4160126a8a12Smrg IFS="$save_ifs" 4161126a8a12Smrg 4162126a8a12Smrg # Restore the uninstalled library and exit 4163126a8a12Smrg if test "$mode" = relink; then 4164126a8a12Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4165126a8a12Smrg 4166126a8a12Smrg if test -n "$convenience"; then 4167126a8a12Smrg if test -z "$whole_archive_flag_spec"; then 4168126a8a12Smrg $show "${rm}r $gentop" 4169126a8a12Smrg $run ${rm}r "$gentop" 4170126a8a12Smrg fi 4171126a8a12Smrg fi 4172126a8a12Smrg 4173126a8a12Smrg exit $EXIT_SUCCESS 4174126a8a12Smrg fi 4175126a8a12Smrg 4176126a8a12Smrg # Create links to the real library. 4177126a8a12Smrg for linkname in $linknames; do 4178126a8a12Smrg if test "$realname" != "$linkname"; then 4179126a8a12Smrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 4180126a8a12Smrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 4181126a8a12Smrg fi 4182126a8a12Smrg done 4183126a8a12Smrg 4184126a8a12Smrg # If -module or -export-dynamic was specified, set the dlname. 4185126a8a12Smrg if test "$module" = yes || test "$export_dynamic" = yes; then 4186126a8a12Smrg # On all known operating systems, these are identical. 4187126a8a12Smrg dlname="$soname" 4188126a8a12Smrg fi 4189126a8a12Smrg fi 4190126a8a12Smrg ;; 4191126a8a12Smrg 4192126a8a12Smrg obj) 4193126a8a12Smrg if test -n "$deplibs"; then 4194126a8a12Smrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 4195126a8a12Smrg fi 4196126a8a12Smrg 4197126a8a12Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4198126a8a12Smrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 4199126a8a12Smrg fi 4200126a8a12Smrg 4201126a8a12Smrg if test -n "$rpath"; then 4202126a8a12Smrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 4203126a8a12Smrg fi 4204126a8a12Smrg 4205126a8a12Smrg if test -n "$xrpath"; then 4206126a8a12Smrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 4207126a8a12Smrg fi 4208126a8a12Smrg 4209126a8a12Smrg if test -n "$vinfo"; then 4210126a8a12Smrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 4211126a8a12Smrg fi 4212126a8a12Smrg 4213126a8a12Smrg if test -n "$release"; then 4214126a8a12Smrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 4215126a8a12Smrg fi 4216126a8a12Smrg 4217126a8a12Smrg case $output in 4218126a8a12Smrg *.lo) 4219126a8a12Smrg if test -n "$objs$old_deplibs"; then 4220126a8a12Smrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 4221126a8a12Smrg exit $EXIT_FAILURE 4222126a8a12Smrg fi 4223126a8a12Smrg libobj="$output" 4224126a8a12Smrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 4225126a8a12Smrg ;; 4226126a8a12Smrg *) 4227126a8a12Smrg libobj= 4228126a8a12Smrg obj="$output" 4229126a8a12Smrg ;; 4230126a8a12Smrg esac 4231126a8a12Smrg 4232126a8a12Smrg # Delete the old objects. 4233126a8a12Smrg $run $rm $obj $libobj 4234126a8a12Smrg 4235126a8a12Smrg # Objects from convenience libraries. This assumes 4236126a8a12Smrg # single-version convenience libraries. Whenever we create 4237126a8a12Smrg # different ones for PIC/non-PIC, this we'll have to duplicate 4238126a8a12Smrg # the extraction. 4239126a8a12Smrg reload_conv_objs= 4240126a8a12Smrg gentop= 4241126a8a12Smrg # reload_cmds runs $LD directly, so let us get rid of 4242126a8a12Smrg # -Wl from whole_archive_flag_spec 4243126a8a12Smrg wl= 4244126a8a12Smrg 4245126a8a12Smrg if test -n "$convenience"; then 4246126a8a12Smrg if test -n "$whole_archive_flag_spec"; then 4247126a8a12Smrg eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 4248126a8a12Smrg else 4249126a8a12Smrg gentop="$output_objdir/${obj}x" 4250126a8a12Smrg generated="$generated $gentop" 4251126a8a12Smrg 4252126a8a12Smrg func_extract_archives $gentop $convenience 4253126a8a12Smrg reload_conv_objs="$reload_objs $func_extract_archives_result" 4254126a8a12Smrg fi 4255126a8a12Smrg fi 4256126a8a12Smrg 4257126a8a12Smrg # Create the old-style object. 4258126a8a12Smrg 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 4259126a8a12Smrg 4260126a8a12Smrg output="$obj" 4261126a8a12Smrg cmds=$reload_cmds 4262126a8a12Smrg save_ifs="$IFS"; IFS='~' 4263126a8a12Smrg for cmd in $cmds; do 4264126a8a12Smrg IFS="$save_ifs" 4265126a8a12Smrg eval cmd=\"$cmd\" 4266126a8a12Smrg $show "$cmd" 4267126a8a12Smrg $run eval "$cmd" || exit $? 4268126a8a12Smrg done 4269126a8a12Smrg IFS="$save_ifs" 4270126a8a12Smrg 4271126a8a12Smrg # Exit if we aren't doing a library object file. 4272126a8a12Smrg if test -z "$libobj"; then 4273126a8a12Smrg if test -n "$gentop"; then 4274126a8a12Smrg $show "${rm}r $gentop" 4275126a8a12Smrg $run ${rm}r $gentop 4276126a8a12Smrg fi 4277126a8a12Smrg 4278126a8a12Smrg exit $EXIT_SUCCESS 4279126a8a12Smrg fi 4280126a8a12Smrg 4281126a8a12Smrg if test "$build_libtool_libs" != yes; then 4282126a8a12Smrg if test -n "$gentop"; then 4283126a8a12Smrg $show "${rm}r $gentop" 4284126a8a12Smrg $run ${rm}r $gentop 4285126a8a12Smrg fi 4286126a8a12Smrg 4287126a8a12Smrg # Create an invalid libtool object if no PIC, so that we don't 4288126a8a12Smrg # accidentally link it into a program. 4289126a8a12Smrg # $show "echo timestamp > $libobj" 4290126a8a12Smrg # $run eval "echo timestamp > $libobj" || exit $? 4291126a8a12Smrg exit $EXIT_SUCCESS 4292126a8a12Smrg fi 4293126a8a12Smrg 4294126a8a12Smrg if test -n "$pic_flag" || test "$pic_mode" != default; then 4295126a8a12Smrg # Only do commands if we really have different PIC objects. 4296126a8a12Smrg reload_objs="$libobjs $reload_conv_objs" 4297126a8a12Smrg output="$libobj" 4298126a8a12Smrg cmds=$reload_cmds 4299126a8a12Smrg save_ifs="$IFS"; IFS='~' 4300126a8a12Smrg for cmd in $cmds; do 4301126a8a12Smrg IFS="$save_ifs" 4302126a8a12Smrg eval cmd=\"$cmd\" 4303126a8a12Smrg $show "$cmd" 4304126a8a12Smrg $run eval "$cmd" || exit $? 4305126a8a12Smrg done 4306126a8a12Smrg IFS="$save_ifs" 4307126a8a12Smrg fi 4308126a8a12Smrg 4309126a8a12Smrg if test -n "$gentop"; then 4310126a8a12Smrg $show "${rm}r $gentop" 4311126a8a12Smrg $run ${rm}r $gentop 4312126a8a12Smrg fi 4313126a8a12Smrg 4314126a8a12Smrg exit $EXIT_SUCCESS 4315126a8a12Smrg ;; 4316126a8a12Smrg 4317126a8a12Smrg prog) 4318126a8a12Smrg case $host in 4319126a8a12Smrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 4320126a8a12Smrg esac 4321126a8a12Smrg if test -n "$vinfo"; then 4322126a8a12Smrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 4323126a8a12Smrg fi 4324126a8a12Smrg 4325126a8a12Smrg if test -n "$release"; then 4326126a8a12Smrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 4327126a8a12Smrg fi 4328126a8a12Smrg 4329126a8a12Smrg if test "$preload" = yes; then 4330126a8a12Smrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 4331126a8a12Smrg test "$dlopen_self_static" = unknown; then 4332126a8a12Smrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 4333126a8a12Smrg fi 4334126a8a12Smrg fi 4335126a8a12Smrg 4336126a8a12Smrg case $host in 4337126a8a12Smrg *-*-rhapsody* | *-*-darwin1.[012]) 4338126a8a12Smrg # On Rhapsody replace the C library is the System framework 4339126a8a12Smrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4340126a8a12Smrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4341126a8a12Smrg ;; 4342126a8a12Smrg esac 4343126a8a12Smrg 4344126a8a12Smrg case $host in 4345126a8a12Smrg *darwin*) 4346126a8a12Smrg # Don't allow lazy linking, it breaks C++ global constructors 4347126a8a12Smrg if test "$tagname" = CXX ; then 4348126a8a12Smrg compile_command="$compile_command ${wl}-bind_at_load" 4349126a8a12Smrg finalize_command="$finalize_command ${wl}-bind_at_load" 4350126a8a12Smrg fi 4351126a8a12Smrg ;; 4352126a8a12Smrg esac 4353126a8a12Smrg 4354126a8a12Smrg 4355126a8a12Smrg # move library search paths that coincide with paths to not yet 4356126a8a12Smrg # installed libraries to the beginning of the library search list 4357126a8a12Smrg new_libs= 4358126a8a12Smrg for path in $notinst_path; do 4359126a8a12Smrg case " $new_libs " in 4360126a8a12Smrg *" -L$path/$objdir "*) ;; 4361126a8a12Smrg *) 4362126a8a12Smrg case " $compile_deplibs " in 4363126a8a12Smrg *" -L$path/$objdir "*) 4364126a8a12Smrg new_libs="$new_libs -L$path/$objdir" ;; 4365126a8a12Smrg esac 4366126a8a12Smrg ;; 4367126a8a12Smrg esac 4368126a8a12Smrg done 4369126a8a12Smrg for deplib in $compile_deplibs; do 4370126a8a12Smrg case $deplib in 4371126a8a12Smrg -L*) 4372126a8a12Smrg case " $new_libs " in 4373126a8a12Smrg *" $deplib "*) ;; 4374126a8a12Smrg *) new_libs="$new_libs $deplib" ;; 4375126a8a12Smrg esac 4376126a8a12Smrg ;; 4377126a8a12Smrg *) new_libs="$new_libs $deplib" ;; 4378126a8a12Smrg esac 4379126a8a12Smrg done 4380126a8a12Smrg compile_deplibs="$new_libs" 4381126a8a12Smrg 4382126a8a12Smrg 4383126a8a12Smrg compile_command="$compile_command $compile_deplibs" 4384126a8a12Smrg finalize_command="$finalize_command $finalize_deplibs" 4385126a8a12Smrg 4386126a8a12Smrg if test -n "$rpath$xrpath"; then 4387126a8a12Smrg # If the user specified any rpath flags, then add them. 4388126a8a12Smrg for libdir in $rpath $xrpath; do 4389126a8a12Smrg # This is the magic to use -rpath. 4390126a8a12Smrg case "$finalize_rpath " in 4391126a8a12Smrg *" $libdir "*) ;; 4392126a8a12Smrg *) finalize_rpath="$finalize_rpath $libdir" ;; 4393126a8a12Smrg esac 4394126a8a12Smrg done 4395126a8a12Smrg fi 4396126a8a12Smrg 4397126a8a12Smrg # Now hardcode the library paths 4398126a8a12Smrg rpath= 4399126a8a12Smrg hardcode_libdirs= 4400126a8a12Smrg for libdir in $compile_rpath $finalize_rpath; do 4401126a8a12Smrg if test -n "$hardcode_libdir_flag_spec"; then 4402126a8a12Smrg if test -n "$hardcode_libdir_separator"; then 4403126a8a12Smrg if test -z "$hardcode_libdirs"; then 4404126a8a12Smrg hardcode_libdirs="$libdir" 4405126a8a12Smrg else 4406126a8a12Smrg # Just accumulate the unique libdirs. 4407126a8a12Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4408126a8a12Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4409126a8a12Smrg ;; 4410126a8a12Smrg *) 4411126a8a12Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4412126a8a12Smrg ;; 4413126a8a12Smrg esac 4414126a8a12Smrg fi 4415126a8a12Smrg else 4416126a8a12Smrg eval flag=\"$hardcode_libdir_flag_spec\" 4417126a8a12Smrg rpath="$rpath $flag" 4418126a8a12Smrg fi 4419126a8a12Smrg elif test -n "$runpath_var"; then 4420126a8a12Smrg case "$perm_rpath " in 4421126a8a12Smrg *" $libdir "*) ;; 4422126a8a12Smrg *) perm_rpath="$perm_rpath $libdir" ;; 4423126a8a12Smrg esac 4424126a8a12Smrg fi 4425126a8a12Smrg case $host in 4426126a8a12Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4427126a8a12Smrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 4428126a8a12Smrg case :$dllsearchpath: in 4429126a8a12Smrg *":$libdir:"*) ;; 4430126a8a12Smrg *) dllsearchpath="$dllsearchpath:$libdir";; 4431126a8a12Smrg esac 4432126a8a12Smrg case :$dllsearchpath: in 4433126a8a12Smrg *":$testbindir:"*) ;; 4434126a8a12Smrg *) dllsearchpath="$dllsearchpath:$testbindir";; 4435126a8a12Smrg esac 4436126a8a12Smrg ;; 4437126a8a12Smrg esac 4438126a8a12Smrg done 4439126a8a12Smrg # Substitute the hardcoded libdirs into the rpath. 4440126a8a12Smrg if test -n "$hardcode_libdir_separator" && 4441126a8a12Smrg test -n "$hardcode_libdirs"; then 4442126a8a12Smrg libdir="$hardcode_libdirs" 4443126a8a12Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 4444126a8a12Smrg fi 4445126a8a12Smrg compile_rpath="$rpath" 4446126a8a12Smrg 4447126a8a12Smrg rpath= 4448126a8a12Smrg hardcode_libdirs= 4449126a8a12Smrg for libdir in $finalize_rpath; do 4450126a8a12Smrg if test -n "$hardcode_libdir_flag_spec"; then 4451126a8a12Smrg if test -n "$hardcode_libdir_separator"; then 4452126a8a12Smrg if test -z "$hardcode_libdirs"; then 4453126a8a12Smrg hardcode_libdirs="$libdir" 4454126a8a12Smrg else 4455126a8a12Smrg # Just accumulate the unique libdirs. 4456126a8a12Smrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4457126a8a12Smrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4458126a8a12Smrg ;; 4459126a8a12Smrg *) 4460126a8a12Smrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4461126a8a12Smrg ;; 4462126a8a12Smrg esac 4463126a8a12Smrg fi 4464126a8a12Smrg else 4465126a8a12Smrg eval flag=\"$hardcode_libdir_flag_spec\" 4466126a8a12Smrg rpath="$rpath $flag" 4467126a8a12Smrg fi 4468126a8a12Smrg elif test -n "$runpath_var"; then 4469126a8a12Smrg case "$finalize_perm_rpath " in 4470126a8a12Smrg *" $libdir "*) ;; 4471126a8a12Smrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 4472126a8a12Smrg esac 4473126a8a12Smrg fi 4474126a8a12Smrg done 4475126a8a12Smrg # Substitute the hardcoded libdirs into the rpath. 4476126a8a12Smrg if test -n "$hardcode_libdir_separator" && 4477126a8a12Smrg test -n "$hardcode_libdirs"; then 4478126a8a12Smrg libdir="$hardcode_libdirs" 4479126a8a12Smrg eval rpath=\" $hardcode_libdir_flag_spec\" 4480126a8a12Smrg fi 4481126a8a12Smrg finalize_rpath="$rpath" 4482126a8a12Smrg 4483126a8a12Smrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 4484126a8a12Smrg # Transform all the library objects into standard objects. 4485126a8a12Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4486126a8a12Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4487126a8a12Smrg fi 4488126a8a12Smrg 4489126a8a12Smrg dlsyms= 4490126a8a12Smrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4491126a8a12Smrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 4492126a8a12Smrg dlsyms="${outputname}S.c" 4493126a8a12Smrg else 4494126a8a12Smrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 4495126a8a12Smrg fi 4496126a8a12Smrg fi 4497126a8a12Smrg 4498126a8a12Smrg if test -n "$dlsyms"; then 4499126a8a12Smrg case $dlsyms in 4500126a8a12Smrg "") ;; 4501126a8a12Smrg *.c) 4502126a8a12Smrg # Discover the nlist of each of the dlfiles. 4503126a8a12Smrg nlist="$output_objdir/${outputname}.nm" 4504126a8a12Smrg 4505126a8a12Smrg $show "$rm $nlist ${nlist}S ${nlist}T" 4506126a8a12Smrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 4507126a8a12Smrg 4508126a8a12Smrg # Parse the name list into a source file. 4509126a8a12Smrg $show "creating $output_objdir/$dlsyms" 4510126a8a12Smrg 4511126a8a12Smrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 4512126a8a12Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 4513126a8a12Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 4514126a8a12Smrg 4515126a8a12Smrg#ifdef __cplusplus 4516126a8a12Smrgextern \"C\" { 4517126a8a12Smrg#endif 4518126a8a12Smrg 4519126a8a12Smrg/* Prevent the only kind of declaration conflicts we can make. */ 4520126a8a12Smrg#define lt_preloaded_symbols some_other_symbol 4521126a8a12Smrg 4522126a8a12Smrg/* External symbol declarations for the compiler. */\ 4523126a8a12Smrg" 4524126a8a12Smrg 4525126a8a12Smrg if test "$dlself" = yes; then 4526126a8a12Smrg $show "generating symbol list for \`$output'" 4527126a8a12Smrg 4528126a8a12Smrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 4529126a8a12Smrg 4530126a8a12Smrg # Add our own program objects to the symbol list. 4531126a8a12Smrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4532126a8a12Smrg for arg in $progfiles; do 4533126a8a12Smrg $show "extracting global C symbols from \`$arg'" 4534126a8a12Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4535126a8a12Smrg done 4536126a8a12Smrg 4537126a8a12Smrg if test -n "$exclude_expsyms"; then 4538126a8a12Smrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4539126a8a12Smrg $run eval '$mv "$nlist"T "$nlist"' 4540126a8a12Smrg fi 4541126a8a12Smrg 4542126a8a12Smrg if test -n "$export_symbols_regex"; then 4543126a8a12Smrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4544126a8a12Smrg $run eval '$mv "$nlist"T "$nlist"' 4545126a8a12Smrg fi 4546126a8a12Smrg 4547126a8a12Smrg # Prepare the list of exported symbols 4548126a8a12Smrg if test -z "$export_symbols"; then 4549126a8a12Smrg export_symbols="$output_objdir/$outputname.exp" 4550126a8a12Smrg $run $rm $export_symbols 4551126a8a12Smrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4552126a8a12Smrg case $host in 4553126a8a12Smrg *cygwin* | *mingw* ) 4554126a8a12Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4555126a8a12Smrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4556126a8a12Smrg ;; 4557126a8a12Smrg esac 4558126a8a12Smrg else 4559126a8a12Smrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4560126a8a12Smrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4561126a8a12Smrg $run eval 'mv "$nlist"T "$nlist"' 4562126a8a12Smrg case $host in 4563126a8a12Smrg *cygwin* | *mingw* ) 4564126a8a12Smrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4565126a8a12Smrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4566126a8a12Smrg ;; 4567126a8a12Smrg esac 4568126a8a12Smrg fi 4569126a8a12Smrg fi 4570126a8a12Smrg 4571126a8a12Smrg for arg in $dlprefiles; do 4572126a8a12Smrg $show "extracting global C symbols from \`$arg'" 4573126a8a12Smrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 4574126a8a12Smrg $run eval '$echo ": $name " >> "$nlist"' 4575126a8a12Smrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4576126a8a12Smrg done 4577126a8a12Smrg 4578126a8a12Smrg if test -z "$run"; then 4579126a8a12Smrg # Make sure we have at least an empty file. 4580126a8a12Smrg test -f "$nlist" || : > "$nlist" 4581126a8a12Smrg 4582126a8a12Smrg if test -n "$exclude_expsyms"; then 4583126a8a12Smrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4584126a8a12Smrg $mv "$nlist"T "$nlist" 4585126a8a12Smrg fi 4586126a8a12Smrg 4587126a8a12Smrg # Try sorting and uniquifying the output. 4588126a8a12Smrg if grep -v "^: " < "$nlist" | 4589126a8a12Smrg if sort -k 3 </dev/null >/dev/null 2>&1; then 4590126a8a12Smrg sort -k 3 4591126a8a12Smrg else 4592126a8a12Smrg sort +2 4593126a8a12Smrg fi | 4594126a8a12Smrg uniq > "$nlist"S; then 4595126a8a12Smrg : 4596126a8a12Smrg else 4597126a8a12Smrg grep -v "^: " < "$nlist" > "$nlist"S 4598126a8a12Smrg fi 4599126a8a12Smrg 4600126a8a12Smrg if test -f "$nlist"S; then 4601126a8a12Smrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 4602126a8a12Smrg else 4603126a8a12Smrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 4604126a8a12Smrg fi 4605126a8a12Smrg 4606126a8a12Smrg $echo >> "$output_objdir/$dlsyms" "\ 4607126a8a12Smrg 4608126a8a12Smrg#undef lt_preloaded_symbols 4609126a8a12Smrg 4610126a8a12Smrg#if defined (__STDC__) && __STDC__ 4611126a8a12Smrg# define lt_ptr void * 4612126a8a12Smrg#else 4613126a8a12Smrg# define lt_ptr char * 4614126a8a12Smrg# define const 4615126a8a12Smrg#endif 4616126a8a12Smrg 4617126a8a12Smrg/* The mapping between symbol names and symbols. */ 4618126a8a12Smrg" 4619126a8a12Smrg 4620126a8a12Smrg case $host in 4621126a8a12Smrg *cygwin* | *mingw* ) 4622126a8a12Smrg $echo >> "$output_objdir/$dlsyms" "\ 4623126a8a12Smrg/* DATA imports from DLLs on WIN32 can't be const, because 4624126a8a12Smrg runtime relocations are performed -- see ld's documentation 4625126a8a12Smrg on pseudo-relocs */ 4626126a8a12Smrgstruct { 4627126a8a12Smrg" 4628126a8a12Smrg ;; 4629126a8a12Smrg * ) 4630126a8a12Smrg $echo >> "$output_objdir/$dlsyms" "\ 4631126a8a12Smrgconst struct { 4632126a8a12Smrg" 4633126a8a12Smrg ;; 4634126a8a12Smrg esac 4635126a8a12Smrg 4636126a8a12Smrg 4637126a8a12Smrg $echo >> "$output_objdir/$dlsyms" "\ 4638126a8a12Smrg const char *name; 4639126a8a12Smrg lt_ptr address; 4640126a8a12Smrg} 4641126a8a12Smrglt_preloaded_symbols[] = 4642126a8a12Smrg{\ 4643126a8a12Smrg" 4644126a8a12Smrg 4645126a8a12Smrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 4646126a8a12Smrg 4647126a8a12Smrg $echo >> "$output_objdir/$dlsyms" "\ 4648126a8a12Smrg {0, (lt_ptr) 0} 4649126a8a12Smrg}; 4650126a8a12Smrg 4651126a8a12Smrg/* This works around a problem in FreeBSD linker */ 4652126a8a12Smrg#ifdef FREEBSD_WORKAROUND 4653126a8a12Smrgstatic const void *lt_preloaded_setup() { 4654126a8a12Smrg return lt_preloaded_symbols; 4655126a8a12Smrg} 4656126a8a12Smrg#endif 4657126a8a12Smrg 4658126a8a12Smrg#ifdef __cplusplus 4659126a8a12Smrg} 4660126a8a12Smrg#endif\ 4661126a8a12Smrg" 4662126a8a12Smrg fi 4663126a8a12Smrg 4664126a8a12Smrg pic_flag_for_symtable= 4665126a8a12Smrg case $host in 4666126a8a12Smrg # compiling the symbol table file with pic_flag works around 4667126a8a12Smrg # a FreeBSD bug that causes programs to crash when -lm is 4668126a8a12Smrg # linked before any other PIC object. But we must not use 4669126a8a12Smrg # pic_flag when linking with -static. The problem exists in 4670126a8a12Smrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 4671126a8a12Smrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 4672126a8a12Smrg case "$compile_command " in 4673126a8a12Smrg *" -static "*) ;; 4674126a8a12Smrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 4675126a8a12Smrg esac;; 4676126a8a12Smrg *-*-hpux*) 4677126a8a12Smrg case "$compile_command " in 4678126a8a12Smrg *" -static "*) ;; 4679126a8a12Smrg *) pic_flag_for_symtable=" $pic_flag";; 4680126a8a12Smrg esac 4681126a8a12Smrg esac 4682126a8a12Smrg 4683126a8a12Smrg # Now compile the dynamic symbol file. 4684126a8a12Smrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4685126a8a12Smrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 4686126a8a12Smrg 4687126a8a12Smrg # Clean up the generated files. 4688126a8a12Smrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4689126a8a12Smrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4690126a8a12Smrg 4691126a8a12Smrg # Transform the symbol file into the correct name. 4692126a8a12Smrg case $host in 4693126a8a12Smrg *cygwin* | *mingw* ) 4694126a8a12Smrg if test -f "$output_objdir/${outputname}.def" ; then 4695126a8a12Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 4696126a8a12Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 4697126a8a12Smrg else 4698126a8a12Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4699126a8a12Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4700126a8a12Smrg fi 4701126a8a12Smrg ;; 4702126a8a12Smrg * ) 4703126a8a12Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4704126a8a12Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4705126a8a12Smrg ;; 4706126a8a12Smrg esac 4707126a8a12Smrg ;; 4708126a8a12Smrg *) 4709126a8a12Smrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4710126a8a12Smrg exit $EXIT_FAILURE 4711126a8a12Smrg ;; 4712126a8a12Smrg esac 4713126a8a12Smrg else 4714126a8a12Smrg # We keep going just in case the user didn't refer to 4715126a8a12Smrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 4716126a8a12Smrg # really was required. 4717126a8a12Smrg 4718126a8a12Smrg # Nullify the symbol file. 4719126a8a12Smrg compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 4720126a8a12Smrg finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 4721126a8a12Smrg fi 4722126a8a12Smrg 4723126a8a12Smrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 4724126a8a12Smrg # Replace the output file specification. 4725126a8a12Smrg compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4726126a8a12Smrg link_command="$compile_command$compile_rpath" 4727126a8a12Smrg 4728126a8a12Smrg # We have no uninstalled library dependencies, so finalize right now. 4729126a8a12Smrg $show "$link_command" 4730126a8a12Smrg $run eval "$link_command" 4731126a8a12Smrg exit_status=$? 4732126a8a12Smrg 4733126a8a12Smrg # Delete the generated files. 4734126a8a12Smrg if test -n "$dlsyms"; then 4735126a8a12Smrg $show "$rm $output_objdir/${outputname}S.${objext}" 4736126a8a12Smrg $run $rm "$output_objdir/${outputname}S.${objext}" 4737126a8a12Smrg fi 4738126a8a12Smrg 4739126a8a12Smrg exit $exit_status 4740126a8a12Smrg fi 4741126a8a12Smrg 4742126a8a12Smrg if test -n "$shlibpath_var"; then 4743126a8a12Smrg # We should set the shlibpath_var 4744126a8a12Smrg rpath= 4745126a8a12Smrg for dir in $temp_rpath; do 4746126a8a12Smrg case $dir in 4747126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) 4748126a8a12Smrg # Absolute path. 4749126a8a12Smrg rpath="$rpath$dir:" 4750126a8a12Smrg ;; 4751126a8a12Smrg *) 4752126a8a12Smrg # Relative path: add a thisdir entry. 4753126a8a12Smrg rpath="$rpath\$thisdir/$dir:" 4754126a8a12Smrg ;; 4755126a8a12Smrg esac 4756126a8a12Smrg done 4757126a8a12Smrg temp_rpath="$rpath" 4758126a8a12Smrg fi 4759126a8a12Smrg 4760126a8a12Smrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 4761126a8a12Smrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 4762126a8a12Smrg fi 4763126a8a12Smrg if test -n "$finalize_shlibpath"; then 4764126a8a12Smrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 4765126a8a12Smrg fi 4766126a8a12Smrg 4767126a8a12Smrg compile_var= 4768126a8a12Smrg finalize_var= 4769126a8a12Smrg if test -n "$runpath_var"; then 4770126a8a12Smrg if test -n "$perm_rpath"; then 4771126a8a12Smrg # We should set the runpath_var. 4772126a8a12Smrg rpath= 4773126a8a12Smrg for dir in $perm_rpath; do 4774126a8a12Smrg rpath="$rpath$dir:" 4775126a8a12Smrg done 4776126a8a12Smrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 4777126a8a12Smrg fi 4778126a8a12Smrg if test -n "$finalize_perm_rpath"; then 4779126a8a12Smrg # We should set the runpath_var. 4780126a8a12Smrg rpath= 4781126a8a12Smrg for dir in $finalize_perm_rpath; do 4782126a8a12Smrg rpath="$rpath$dir:" 4783126a8a12Smrg done 4784126a8a12Smrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 4785126a8a12Smrg fi 4786126a8a12Smrg fi 4787126a8a12Smrg 4788126a8a12Smrg if test "$no_install" = yes; then 4789126a8a12Smrg # We don't need to create a wrapper script. 4790126a8a12Smrg link_command="$compile_var$compile_command$compile_rpath" 4791126a8a12Smrg # Replace the output file specification. 4792126a8a12Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4793126a8a12Smrg # Delete the old output file. 4794126a8a12Smrg $run $rm $output 4795126a8a12Smrg # Link the executable and exit 4796126a8a12Smrg $show "$link_command" 4797126a8a12Smrg $run eval "$link_command" || exit $? 4798126a8a12Smrg exit $EXIT_SUCCESS 4799126a8a12Smrg fi 4800126a8a12Smrg 4801126a8a12Smrg if test "$hardcode_action" = relink; then 4802126a8a12Smrg # Fast installation is not supported 4803126a8a12Smrg link_command="$compile_var$compile_command$compile_rpath" 4804126a8a12Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 4805126a8a12Smrg 4806126a8a12Smrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 4807126a8a12Smrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 4808126a8a12Smrg else 4809126a8a12Smrg if test "$fast_install" != no; then 4810126a8a12Smrg link_command="$finalize_var$compile_command$finalize_rpath" 4811126a8a12Smrg if test "$fast_install" = yes; then 4812126a8a12Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 4813126a8a12Smrg else 4814126a8a12Smrg # fast_install is set to needless 4815126a8a12Smrg relink_command= 4816126a8a12Smrg fi 4817126a8a12Smrg else 4818126a8a12Smrg link_command="$compile_var$compile_command$compile_rpath" 4819126a8a12Smrg relink_command="$finalize_var$finalize_command$finalize_rpath" 4820126a8a12Smrg fi 4821126a8a12Smrg fi 4822126a8a12Smrg 4823126a8a12Smrg # Replace the output file specification. 4824126a8a12Smrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 4825126a8a12Smrg 4826126a8a12Smrg # Delete the old output files. 4827126a8a12Smrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 4828126a8a12Smrg 4829126a8a12Smrg $show "$link_command" 4830126a8a12Smrg $run eval "$link_command" || exit $? 4831126a8a12Smrg 4832126a8a12Smrg # Now create the wrapper script. 4833126a8a12Smrg $show "creating $output" 4834126a8a12Smrg 4835126a8a12Smrg # Quote the relink command for shipping. 4836126a8a12Smrg if test -n "$relink_command"; then 4837126a8a12Smrg # Preserve any variables that may affect compiler behavior 4838126a8a12Smrg for var in $variables_saved_for_relink; do 4839126a8a12Smrg if eval test -z \"\${$var+set}\"; then 4840126a8a12Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4841126a8a12Smrg elif eval var_value=\$$var; test -z "$var_value"; then 4842126a8a12Smrg relink_command="$var=; export $var; $relink_command" 4843126a8a12Smrg else 4844126a8a12Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4845126a8a12Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 4846126a8a12Smrg fi 4847126a8a12Smrg done 4848126a8a12Smrg relink_command="(cd `pwd`; $relink_command)" 4849126a8a12Smrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 4850126a8a12Smrg fi 4851126a8a12Smrg 4852126a8a12Smrg # Quote $echo for shipping. 4853126a8a12Smrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 4854126a8a12Smrg case $progpath in 4855126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 4856126a8a12Smrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 4857126a8a12Smrg esac 4858126a8a12Smrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 4859126a8a12Smrg else 4860126a8a12Smrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 4861126a8a12Smrg fi 4862126a8a12Smrg 4863126a8a12Smrg # Only actually do things if our run command is non-null. 4864126a8a12Smrg if test -z "$run"; then 4865126a8a12Smrg # win32 will think the script is a binary if it has 4866126a8a12Smrg # a .exe suffix, so we strip it off here. 4867126a8a12Smrg case $output in 4868126a8a12Smrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 4869126a8a12Smrg esac 4870126a8a12Smrg # test for cygwin because mv fails w/o .exe extensions 4871126a8a12Smrg case $host in 4872126a8a12Smrg *cygwin*) 4873126a8a12Smrg exeext=.exe 4874126a8a12Smrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4875126a8a12Smrg *) exeext= ;; 4876126a8a12Smrg esac 4877126a8a12Smrg case $host in 4878126a8a12Smrg *cygwin* | *mingw* ) 4879126a8a12Smrg output_name=`basename $output` 4880126a8a12Smrg output_path=`dirname $output` 4881126a8a12Smrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 4882126a8a12Smrg cwrapper="$output_path/$output_name.exe" 4883126a8a12Smrg $rm $cwrappersource $cwrapper 4884126a8a12Smrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4885126a8a12Smrg 4886126a8a12Smrg cat > $cwrappersource <<EOF 4887126a8a12Smrg 4888126a8a12Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4889126a8a12Smrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4890126a8a12Smrg 4891126a8a12Smrg The $output program cannot be directly executed until all the libtool 4892126a8a12Smrg libraries that it depends on are installed. 4893126a8a12Smrg 4894126a8a12Smrg This wrapper executable should never be moved out of the build directory. 4895126a8a12Smrg If it is, it will not operate correctly. 4896126a8a12Smrg 4897126a8a12Smrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 4898126a8a12Smrg but could eventually absorb all of the scripts functionality and 4899126a8a12Smrg exec $objdir/$outputname directly. 4900126a8a12Smrg*/ 4901126a8a12SmrgEOF 4902126a8a12Smrg cat >> $cwrappersource<<"EOF" 4903126a8a12Smrg#include <stdio.h> 4904126a8a12Smrg#include <stdlib.h> 4905126a8a12Smrg#include <unistd.h> 4906126a8a12Smrg#include <malloc.h> 4907126a8a12Smrg#include <stdarg.h> 4908126a8a12Smrg#include <assert.h> 4909126a8a12Smrg#include <string.h> 4910126a8a12Smrg#include <ctype.h> 4911126a8a12Smrg#include <sys/stat.h> 4912126a8a12Smrg 4913126a8a12Smrg#if defined(PATH_MAX) 4914126a8a12Smrg# define LT_PATHMAX PATH_MAX 4915126a8a12Smrg#elif defined(MAXPATHLEN) 4916126a8a12Smrg# define LT_PATHMAX MAXPATHLEN 4917126a8a12Smrg#else 4918126a8a12Smrg# define LT_PATHMAX 1024 4919126a8a12Smrg#endif 4920126a8a12Smrg 4921126a8a12Smrg#ifndef DIR_SEPARATOR 4922126a8a12Smrg# define DIR_SEPARATOR '/' 4923126a8a12Smrg# define PATH_SEPARATOR ':' 4924126a8a12Smrg#endif 4925126a8a12Smrg 4926126a8a12Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4927126a8a12Smrg defined (__OS2__) 4928126a8a12Smrg# define HAVE_DOS_BASED_FILE_SYSTEM 4929126a8a12Smrg# ifndef DIR_SEPARATOR_2 4930126a8a12Smrg# define DIR_SEPARATOR_2 '\\' 4931126a8a12Smrg# endif 4932126a8a12Smrg# ifndef PATH_SEPARATOR_2 4933126a8a12Smrg# define PATH_SEPARATOR_2 ';' 4934126a8a12Smrg# endif 4935126a8a12Smrg#endif 4936126a8a12Smrg 4937126a8a12Smrg#ifndef DIR_SEPARATOR_2 4938126a8a12Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4939126a8a12Smrg#else /* DIR_SEPARATOR_2 */ 4940126a8a12Smrg# define IS_DIR_SEPARATOR(ch) \ 4941126a8a12Smrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4942126a8a12Smrg#endif /* DIR_SEPARATOR_2 */ 4943126a8a12Smrg 4944126a8a12Smrg#ifndef PATH_SEPARATOR_2 4945126a8a12Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 4946126a8a12Smrg#else /* PATH_SEPARATOR_2 */ 4947126a8a12Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 4948126a8a12Smrg#endif /* PATH_SEPARATOR_2 */ 4949126a8a12Smrg 4950126a8a12Smrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4951126a8a12Smrg#define XFREE(stale) do { \ 4952126a8a12Smrg if (stale) { free ((void *) stale); stale = 0; } \ 4953126a8a12Smrg} while (0) 4954126a8a12Smrg 4955126a8a12Smrg/* -DDEBUG is fairly common in CFLAGS. */ 4956126a8a12Smrg#undef DEBUG 4957126a8a12Smrg#if defined DEBUGWRAPPER 4958126a8a12Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 4959126a8a12Smrg#else 4960126a8a12Smrg# define DEBUG(format, ...) 4961126a8a12Smrg#endif 4962126a8a12Smrg 4963126a8a12Smrgconst char *program_name = NULL; 4964126a8a12Smrg 4965126a8a12Smrgvoid * xmalloc (size_t num); 4966126a8a12Smrgchar * xstrdup (const char *string); 4967126a8a12Smrgconst char * base_name (const char *name); 4968126a8a12Smrgchar * find_executable(const char *wrapper); 4969126a8a12Smrgint check_executable(const char *path); 4970126a8a12Smrgchar * strendzap(char *str, const char *pat); 4971126a8a12Smrgvoid lt_fatal (const char *message, ...); 4972126a8a12Smrg 4973126a8a12Smrgint 4974126a8a12Smrgmain (int argc, char *argv[]) 4975126a8a12Smrg{ 4976126a8a12Smrg char **newargz; 4977126a8a12Smrg int i; 4978126a8a12Smrg 4979126a8a12Smrg program_name = (char *) xstrdup (base_name (argv[0])); 4980126a8a12Smrg DEBUG("(main) argv[0] : %s\n",argv[0]); 4981126a8a12Smrg DEBUG("(main) program_name : %s\n",program_name); 4982126a8a12Smrg newargz = XMALLOC(char *, argc+2); 4983126a8a12SmrgEOF 4984126a8a12Smrg 4985126a8a12Smrg cat >> $cwrappersource <<EOF 4986126a8a12Smrg newargz[0] = (char *) xstrdup("$SHELL"); 4987126a8a12SmrgEOF 4988126a8a12Smrg 4989126a8a12Smrg cat >> $cwrappersource <<"EOF" 4990126a8a12Smrg newargz[1] = find_executable(argv[0]); 4991126a8a12Smrg if (newargz[1] == NULL) 4992126a8a12Smrg lt_fatal("Couldn't find %s", argv[0]); 4993126a8a12Smrg DEBUG("(main) found exe at : %s\n",newargz[1]); 4994126a8a12Smrg /* we know the script has the same name, without the .exe */ 4995126a8a12Smrg /* so make sure newargz[1] doesn't end in .exe */ 4996126a8a12Smrg strendzap(newargz[1],".exe"); 4997126a8a12Smrg for (i = 1; i < argc; i++) 4998126a8a12Smrg newargz[i+1] = xstrdup(argv[i]); 4999126a8a12Smrg newargz[argc+1] = NULL; 5000126a8a12Smrg 5001126a8a12Smrg for (i=0; i<argc+1; i++) 5002126a8a12Smrg { 5003126a8a12Smrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 5004126a8a12Smrg ; 5005126a8a12Smrg } 5006126a8a12Smrg 5007126a8a12SmrgEOF 5008126a8a12Smrg 5009126a8a12Smrg case $host_os in 5010126a8a12Smrg mingw*) 5011126a8a12Smrg cat >> $cwrappersource <<EOF 5012126a8a12Smrg execv("$SHELL",(char const **)newargz); 5013126a8a12SmrgEOF 5014126a8a12Smrg ;; 5015126a8a12Smrg *) 5016126a8a12Smrg cat >> $cwrappersource <<EOF 5017126a8a12Smrg execv("$SHELL",newargz); 5018126a8a12SmrgEOF 5019126a8a12Smrg ;; 5020126a8a12Smrg esac 5021126a8a12Smrg 5022126a8a12Smrg cat >> $cwrappersource <<"EOF" 5023126a8a12Smrg return 127; 5024126a8a12Smrg} 5025126a8a12Smrg 5026126a8a12Smrgvoid * 5027126a8a12Smrgxmalloc (size_t num) 5028126a8a12Smrg{ 5029126a8a12Smrg void * p = (void *) malloc (num); 5030126a8a12Smrg if (!p) 5031126a8a12Smrg lt_fatal ("Memory exhausted"); 5032126a8a12Smrg 5033126a8a12Smrg return p; 5034126a8a12Smrg} 5035126a8a12Smrg 5036126a8a12Smrgchar * 5037126a8a12Smrgxstrdup (const char *string) 5038126a8a12Smrg{ 5039126a8a12Smrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5040126a8a12Smrg; 5041126a8a12Smrg} 5042126a8a12Smrg 5043126a8a12Smrgconst char * 5044126a8a12Smrgbase_name (const char *name) 5045126a8a12Smrg{ 5046126a8a12Smrg const char *base; 5047126a8a12Smrg 5048126a8a12Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5049126a8a12Smrg /* Skip over the disk name in MSDOS pathnames. */ 5050126a8a12Smrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 5051126a8a12Smrg name += 2; 5052126a8a12Smrg#endif 5053126a8a12Smrg 5054126a8a12Smrg for (base = name; *name; name++) 5055126a8a12Smrg if (IS_DIR_SEPARATOR (*name)) 5056126a8a12Smrg base = name + 1; 5057126a8a12Smrg return base; 5058126a8a12Smrg} 5059126a8a12Smrg 5060126a8a12Smrgint 5061126a8a12Smrgcheck_executable(const char * path) 5062126a8a12Smrg{ 5063126a8a12Smrg struct stat st; 5064126a8a12Smrg 5065126a8a12Smrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 5066126a8a12Smrg if ((!path) || (!*path)) 5067126a8a12Smrg return 0; 5068126a8a12Smrg 5069126a8a12Smrg if ((stat (path, &st) >= 0) && 5070126a8a12Smrg ( 5071126a8a12Smrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 5072126a8a12Smrg#if defined (S_IXOTH) 5073126a8a12Smrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 5074126a8a12Smrg#endif 5075126a8a12Smrg#if defined (S_IXGRP) 5076126a8a12Smrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 5077126a8a12Smrg#endif 5078126a8a12Smrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 5079126a8a12Smrg ) 5080126a8a12Smrg return 1; 5081126a8a12Smrg else 5082126a8a12Smrg return 0; 5083126a8a12Smrg} 5084126a8a12Smrg 5085126a8a12Smrg/* Searches for the full path of the wrapper. Returns 5086126a8a12Smrg newly allocated full path name if found, NULL otherwise */ 5087126a8a12Smrgchar * 5088126a8a12Smrgfind_executable (const char* wrapper) 5089126a8a12Smrg{ 5090126a8a12Smrg int has_slash = 0; 5091126a8a12Smrg const char* p; 5092126a8a12Smrg const char* p_next; 5093126a8a12Smrg /* static buffer for getcwd */ 5094126a8a12Smrg char tmp[LT_PATHMAX + 1]; 5095126a8a12Smrg int tmp_len; 5096126a8a12Smrg char* concat_name; 5097126a8a12Smrg 5098126a8a12Smrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 5099126a8a12Smrg 5100126a8a12Smrg if ((wrapper == NULL) || (*wrapper == '\0')) 5101126a8a12Smrg return NULL; 5102126a8a12Smrg 5103126a8a12Smrg /* Absolute path? */ 5104126a8a12Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5105126a8a12Smrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 5106126a8a12Smrg { 5107126a8a12Smrg concat_name = xstrdup (wrapper); 5108126a8a12Smrg if (check_executable(concat_name)) 5109126a8a12Smrg return concat_name; 5110126a8a12Smrg XFREE(concat_name); 5111126a8a12Smrg } 5112126a8a12Smrg else 5113126a8a12Smrg { 5114126a8a12Smrg#endif 5115126a8a12Smrg if (IS_DIR_SEPARATOR (wrapper[0])) 5116126a8a12Smrg { 5117126a8a12Smrg concat_name = xstrdup (wrapper); 5118126a8a12Smrg if (check_executable(concat_name)) 5119126a8a12Smrg return concat_name; 5120126a8a12Smrg XFREE(concat_name); 5121126a8a12Smrg } 5122126a8a12Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5123126a8a12Smrg } 5124126a8a12Smrg#endif 5125126a8a12Smrg 5126126a8a12Smrg for (p = wrapper; *p; p++) 5127126a8a12Smrg if (*p == '/') 5128126a8a12Smrg { 5129126a8a12Smrg has_slash = 1; 5130126a8a12Smrg break; 5131126a8a12Smrg } 5132126a8a12Smrg if (!has_slash) 5133126a8a12Smrg { 5134126a8a12Smrg /* no slashes; search PATH */ 5135126a8a12Smrg const char* path = getenv ("PATH"); 5136126a8a12Smrg if (path != NULL) 5137126a8a12Smrg { 5138126a8a12Smrg for (p = path; *p; p = p_next) 5139126a8a12Smrg { 5140126a8a12Smrg const char* q; 5141126a8a12Smrg size_t p_len; 5142126a8a12Smrg for (q = p; *q; q++) 5143126a8a12Smrg if (IS_PATH_SEPARATOR(*q)) 5144126a8a12Smrg break; 5145126a8a12Smrg p_len = q - p; 5146126a8a12Smrg p_next = (*q == '\0' ? q : q + 1); 5147126a8a12Smrg if (p_len == 0) 5148126a8a12Smrg { 5149126a8a12Smrg /* empty path: current directory */ 5150126a8a12Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 5151126a8a12Smrg lt_fatal ("getcwd failed"); 5152126a8a12Smrg tmp_len = strlen(tmp); 5153126a8a12Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5154126a8a12Smrg memcpy (concat_name, tmp, tmp_len); 5155126a8a12Smrg concat_name[tmp_len] = '/'; 5156126a8a12Smrg strcpy (concat_name + tmp_len + 1, wrapper); 5157126a8a12Smrg } 5158126a8a12Smrg else 5159126a8a12Smrg { 5160126a8a12Smrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 5161126a8a12Smrg memcpy (concat_name, p, p_len); 5162126a8a12Smrg concat_name[p_len] = '/'; 5163126a8a12Smrg strcpy (concat_name + p_len + 1, wrapper); 5164126a8a12Smrg } 5165126a8a12Smrg if (check_executable(concat_name)) 5166126a8a12Smrg return concat_name; 5167126a8a12Smrg XFREE(concat_name); 5168126a8a12Smrg } 5169126a8a12Smrg } 5170126a8a12Smrg /* not found in PATH; assume curdir */ 5171126a8a12Smrg } 5172126a8a12Smrg /* Relative path | not found in path: prepend cwd */ 5173126a8a12Smrg if (getcwd (tmp, LT_PATHMAX) == NULL) 5174126a8a12Smrg lt_fatal ("getcwd failed"); 5175126a8a12Smrg tmp_len = strlen(tmp); 5176126a8a12Smrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5177126a8a12Smrg memcpy (concat_name, tmp, tmp_len); 5178126a8a12Smrg concat_name[tmp_len] = '/'; 5179126a8a12Smrg strcpy (concat_name + tmp_len + 1, wrapper); 5180126a8a12Smrg 5181126a8a12Smrg if (check_executable(concat_name)) 5182126a8a12Smrg return concat_name; 5183126a8a12Smrg XFREE(concat_name); 5184126a8a12Smrg return NULL; 5185126a8a12Smrg} 5186126a8a12Smrg 5187126a8a12Smrgchar * 5188126a8a12Smrgstrendzap(char *str, const char *pat) 5189126a8a12Smrg{ 5190126a8a12Smrg size_t len, patlen; 5191126a8a12Smrg 5192126a8a12Smrg assert(str != NULL); 5193126a8a12Smrg assert(pat != NULL); 5194126a8a12Smrg 5195126a8a12Smrg len = strlen(str); 5196126a8a12Smrg patlen = strlen(pat); 5197126a8a12Smrg 5198126a8a12Smrg if (patlen <= len) 5199126a8a12Smrg { 5200126a8a12Smrg str += len - patlen; 5201126a8a12Smrg if (strcmp(str, pat) == 0) 5202126a8a12Smrg *str = '\0'; 5203126a8a12Smrg } 5204126a8a12Smrg return str; 5205126a8a12Smrg} 5206126a8a12Smrg 5207126a8a12Smrgstatic void 5208126a8a12Smrglt_error_core (int exit_status, const char * mode, 5209126a8a12Smrg const char * message, va_list ap) 5210126a8a12Smrg{ 5211126a8a12Smrg fprintf (stderr, "%s: %s: ", program_name, mode); 5212126a8a12Smrg vfprintf (stderr, message, ap); 5213126a8a12Smrg fprintf (stderr, ".\n"); 5214126a8a12Smrg 5215126a8a12Smrg if (exit_status >= 0) 5216126a8a12Smrg exit (exit_status); 5217126a8a12Smrg} 5218126a8a12Smrg 5219126a8a12Smrgvoid 5220126a8a12Smrglt_fatal (const char *message, ...) 5221126a8a12Smrg{ 5222126a8a12Smrg va_list ap; 5223126a8a12Smrg va_start (ap, message); 5224126a8a12Smrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5225126a8a12Smrg va_end (ap); 5226126a8a12Smrg} 5227126a8a12SmrgEOF 5228126a8a12Smrg # we should really use a build-platform specific compiler 5229126a8a12Smrg # here, but OTOH, the wrappers (shell script and this C one) 5230126a8a12Smrg # are only useful if you want to execute the "real" binary. 5231126a8a12Smrg # Since the "real" binary is built for $host, then this 5232126a8a12Smrg # wrapper might as well be built for $host, too. 5233126a8a12Smrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 5234126a8a12Smrg ;; 5235126a8a12Smrg esac 5236126a8a12Smrg $rm $output 5237126a8a12Smrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5238126a8a12Smrg 5239126a8a12Smrg $echo > $output "\ 5240126a8a12Smrg#! $SHELL 5241126a8a12Smrg 5242126a8a12Smrg# $output - temporary wrapper script for $objdir/$outputname 5243126a8a12Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5244126a8a12Smrg# 5245126a8a12Smrg# The $output program cannot be directly executed until all the libtool 5246126a8a12Smrg# libraries that it depends on are installed. 5247126a8a12Smrg# 5248126a8a12Smrg# This wrapper script should never be moved out of the build directory. 5249126a8a12Smrg# If it is, it will not operate correctly. 5250126a8a12Smrg 5251126a8a12Smrg# Sed substitution that helps us do robust quoting. It backslashifies 5252126a8a12Smrg# metacharacters that are still active within double-quoted strings. 5253126a8a12SmrgXsed='${SED} -e 1s/^X//' 5254126a8a12Smrgsed_quote_subst='$sed_quote_subst' 5255126a8a12Smrg 5256126a8a12Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout 5257126a8a12Smrg# if CDPATH is set. 5258126a8a12Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5259126a8a12Smrg 5260126a8a12Smrgrelink_command=\"$relink_command\" 5261126a8a12Smrg 5262126a8a12Smrg# This environment variable determines our operation mode. 5263126a8a12Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then 5264126a8a12Smrg # install mode needs the following variable: 5265126a8a12Smrg notinst_deplibs='$notinst_deplibs' 5266126a8a12Smrgelse 5267126a8a12Smrg # When we are sourced in execute mode, \$file and \$echo are already set. 5268126a8a12Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 5269126a8a12Smrg echo=\"$qecho\" 5270126a8a12Smrg file=\"\$0\" 5271126a8a12Smrg # Make sure echo works. 5272126a8a12Smrg if test \"X\$1\" = X--no-reexec; then 5273126a8a12Smrg # Discard the --no-reexec flag, and continue. 5274126a8a12Smrg shift 5275126a8a12Smrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 5276126a8a12Smrg # Yippee, \$echo works! 5277126a8a12Smrg : 5278126a8a12Smrg else 5279126a8a12Smrg # Restart under the correct shell, and then maybe \$echo will work. 5280126a8a12Smrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 5281126a8a12Smrg fi 5282126a8a12Smrg fi\ 5283126a8a12Smrg" 5284126a8a12Smrg $echo >> $output "\ 5285126a8a12Smrg 5286126a8a12Smrg # Find the directory that this script lives in. 5287126a8a12Smrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 5288126a8a12Smrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 5289126a8a12Smrg 5290126a8a12Smrg # Follow symbolic links until we get to the real thisdir. 5291126a8a12Smrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 5292126a8a12Smrg while test -n \"\$file\"; do 5293126a8a12Smrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 5294126a8a12Smrg 5295126a8a12Smrg # If there was a directory component, then change thisdir. 5296126a8a12Smrg if test \"x\$destdir\" != \"x\$file\"; then 5297126a8a12Smrg case \"\$destdir\" in 5298126a8a12Smrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5299126a8a12Smrg *) thisdir=\"\$thisdir/\$destdir\" ;; 5300126a8a12Smrg esac 5301126a8a12Smrg fi 5302126a8a12Smrg 5303126a8a12Smrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 5304126a8a12Smrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 5305126a8a12Smrg done 5306126a8a12Smrg 5307126a8a12Smrg # Try to get the absolute directory name. 5308126a8a12Smrg absdir=\`cd \"\$thisdir\" && pwd\` 5309126a8a12Smrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 5310126a8a12Smrg" 5311126a8a12Smrg 5312126a8a12Smrg if test "$fast_install" = yes; then 5313126a8a12Smrg $echo >> $output "\ 5314126a8a12Smrg program=lt-'$outputname'$exeext 5315126a8a12Smrg progdir=\"\$thisdir/$objdir\" 5316126a8a12Smrg 5317126a8a12Smrg if test ! -f \"\$progdir/\$program\" || \\ 5318126a8a12Smrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 5319126a8a12Smrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 5320126a8a12Smrg 5321126a8a12Smrg file=\"\$\$-\$program\" 5322126a8a12Smrg 5323126a8a12Smrg if test ! -d \"\$progdir\"; then 5324126a8a12Smrg $mkdir \"\$progdir\" 5325126a8a12Smrg else 5326126a8a12Smrg $rm \"\$progdir/\$file\" 5327126a8a12Smrg fi" 5328126a8a12Smrg 5329126a8a12Smrg $echo >> $output "\ 5330126a8a12Smrg 5331126a8a12Smrg # relink executable if necessary 5332126a8a12Smrg if test -n \"\$relink_command\"; then 5333126a8a12Smrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5334126a8a12Smrg else 5335126a8a12Smrg $echo \"\$relink_command_output\" >&2 5336126a8a12Smrg $rm \"\$progdir/\$file\" 5337126a8a12Smrg exit $EXIT_FAILURE 5338126a8a12Smrg fi 5339126a8a12Smrg fi 5340126a8a12Smrg 5341126a8a12Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5342126a8a12Smrg { $rm \"\$progdir/\$program\"; 5343126a8a12Smrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5344126a8a12Smrg $rm \"\$progdir/\$file\" 5345126a8a12Smrg fi" 5346126a8a12Smrg else 5347126a8a12Smrg $echo >> $output "\ 5348126a8a12Smrg program='$outputname' 5349126a8a12Smrg progdir=\"\$thisdir/$objdir\" 5350126a8a12Smrg" 5351126a8a12Smrg fi 5352126a8a12Smrg 5353126a8a12Smrg $echo >> $output "\ 5354126a8a12Smrg 5355126a8a12Smrg if test -f \"\$progdir/\$program\"; then" 5356126a8a12Smrg 5357126a8a12Smrg # Export our shlibpath_var if we have one. 5358126a8a12Smrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5359126a8a12Smrg $echo >> $output "\ 5360126a8a12Smrg # Add our own library path to $shlibpath_var 5361126a8a12Smrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 5362126a8a12Smrg 5363126a8a12Smrg # Some systems cannot cope with colon-terminated $shlibpath_var 5364126a8a12Smrg # The second colon is a workaround for a bug in BeOS R4 sed 5365126a8a12Smrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 5366126a8a12Smrg 5367126a8a12Smrg export $shlibpath_var 5368126a8a12Smrg" 5369126a8a12Smrg fi 5370126a8a12Smrg 5371126a8a12Smrg # fixup the dll searchpath if we need to. 5372126a8a12Smrg if test -n "$dllsearchpath"; then 5373126a8a12Smrg $echo >> $output "\ 5374126a8a12Smrg # Add the dll search path components to the executable PATH 5375126a8a12Smrg PATH=$dllsearchpath:\$PATH 5376126a8a12Smrg" 5377126a8a12Smrg fi 5378126a8a12Smrg 5379126a8a12Smrg $echo >> $output "\ 5380126a8a12Smrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 5381126a8a12Smrg # Run the actual program with our arguments. 5382126a8a12Smrg" 5383126a8a12Smrg case $host in 5384126a8a12Smrg # Backslashes separate directories on plain windows 5385126a8a12Smrg *-*-mingw | *-*-os2*) 5386126a8a12Smrg $echo >> $output "\ 5387126a8a12Smrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5388126a8a12Smrg" 5389126a8a12Smrg ;; 5390126a8a12Smrg 5391126a8a12Smrg *) 5392126a8a12Smrg $echo >> $output "\ 5393126a8a12Smrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 5394126a8a12Smrg" 5395126a8a12Smrg ;; 5396126a8a12Smrg esac 5397126a8a12Smrg $echo >> $output "\ 5398126a8a12Smrg \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 5399126a8a12Smrg exit $EXIT_FAILURE 5400126a8a12Smrg fi 5401126a8a12Smrg else 5402126a8a12Smrg # The program doesn't exist. 5403126a8a12Smrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 5404126a8a12Smrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 5405126a8a12Smrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5406126a8a12Smrg exit $EXIT_FAILURE 5407126a8a12Smrg fi 5408126a8a12Smrgfi\ 5409126a8a12Smrg" 5410126a8a12Smrg chmod +x $output 5411126a8a12Smrg fi 5412126a8a12Smrg exit $EXIT_SUCCESS 5413126a8a12Smrg ;; 5414126a8a12Smrg esac 5415126a8a12Smrg 5416126a8a12Smrg # See if we need to build an old-fashioned archive. 5417126a8a12Smrg for oldlib in $oldlibs; do 5418126a8a12Smrg 5419126a8a12Smrg if test "$build_libtool_libs" = convenience; then 5420126a8a12Smrg oldobjs="$libobjs_save" 5421126a8a12Smrg addlibs="$convenience" 5422126a8a12Smrg build_libtool_libs=no 5423126a8a12Smrg else 5424126a8a12Smrg if test "$build_libtool_libs" = module; then 5425126a8a12Smrg oldobjs="$libobjs_save" 5426126a8a12Smrg build_libtool_libs=no 5427126a8a12Smrg else 5428126a8a12Smrg oldobjs="$old_deplibs $non_pic_objects" 5429126a8a12Smrg fi 5430126a8a12Smrg addlibs="$old_convenience" 5431126a8a12Smrg fi 5432126a8a12Smrg 5433126a8a12Smrg if test -n "$addlibs"; then 5434126a8a12Smrg gentop="$output_objdir/${outputname}x" 5435126a8a12Smrg generated="$generated $gentop" 5436126a8a12Smrg 5437126a8a12Smrg func_extract_archives $gentop $addlibs 5438126a8a12Smrg oldobjs="$oldobjs $func_extract_archives_result" 5439126a8a12Smrg fi 5440126a8a12Smrg 5441126a8a12Smrg # Do each command in the archive commands. 5442126a8a12Smrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5443126a8a12Smrg cmds=$old_archive_from_new_cmds 5444126a8a12Smrg else 5445126a8a12Smrg # POSIX demands no paths to be encoded in archives. We have 5446126a8a12Smrg # to avoid creating archives with duplicate basenames if we 5447126a8a12Smrg # might have to extract them afterwards, e.g., when creating a 5448126a8a12Smrg # static archive out of a convenience library, or when linking 5449126a8a12Smrg # the entirety of a libtool archive into another (currently 5450126a8a12Smrg # not supported by libtool). 5451126a8a12Smrg if (for obj in $oldobjs 5452126a8a12Smrg do 5453126a8a12Smrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 5454126a8a12Smrg done | sort | sort -uc >/dev/null 2>&1); then 5455126a8a12Smrg : 5456126a8a12Smrg else 5457126a8a12Smrg $echo "copying selected object files to avoid basename conflicts..." 5458126a8a12Smrg 5459126a8a12Smrg if test -z "$gentop"; then 5460126a8a12Smrg gentop="$output_objdir/${outputname}x" 5461126a8a12Smrg generated="$generated $gentop" 5462126a8a12Smrg 5463126a8a12Smrg $show "${rm}r $gentop" 5464126a8a12Smrg $run ${rm}r "$gentop" 5465126a8a12Smrg $show "$mkdir $gentop" 5466126a8a12Smrg $run $mkdir "$gentop" 5467126a8a12Smrg exit_status=$? 5468126a8a12Smrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 5469126a8a12Smrg exit $exit_status 5470126a8a12Smrg fi 5471126a8a12Smrg fi 5472126a8a12Smrg 5473126a8a12Smrg save_oldobjs=$oldobjs 5474126a8a12Smrg oldobjs= 5475126a8a12Smrg counter=1 5476126a8a12Smrg for obj in $save_oldobjs 5477126a8a12Smrg do 5478126a8a12Smrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 5479126a8a12Smrg case " $oldobjs " in 5480126a8a12Smrg " ") oldobjs=$obj ;; 5481126a8a12Smrg *[\ /]"$objbase "*) 5482126a8a12Smrg while :; do 5483126a8a12Smrg # Make sure we don't pick an alternate name that also 5484126a8a12Smrg # overlaps. 5485126a8a12Smrg newobj=lt$counter-$objbase 5486126a8a12Smrg counter=`expr $counter + 1` 5487126a8a12Smrg case " $oldobjs " in 5488126a8a12Smrg *[\ /]"$newobj "*) ;; 5489126a8a12Smrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 5490126a8a12Smrg esac 5491126a8a12Smrg done 5492126a8a12Smrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 5493126a8a12Smrg $run ln "$obj" "$gentop/$newobj" || 5494126a8a12Smrg $run cp "$obj" "$gentop/$newobj" 5495126a8a12Smrg oldobjs="$oldobjs $gentop/$newobj" 5496126a8a12Smrg ;; 5497126a8a12Smrg *) oldobjs="$oldobjs $obj" ;; 5498126a8a12Smrg esac 5499126a8a12Smrg done 5500126a8a12Smrg fi 5501126a8a12Smrg 5502126a8a12Smrg eval cmds=\"$old_archive_cmds\" 5503126a8a12Smrg 5504126a8a12Smrg if len=`expr "X$cmds" : ".*"` && 5505126a8a12Smrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5506126a8a12Smrg cmds=$old_archive_cmds 5507126a8a12Smrg else 5508126a8a12Smrg # the command line is too long to link in one step, link in parts 5509126a8a12Smrg $echo "using piecewise archive linking..." 5510126a8a12Smrg save_RANLIB=$RANLIB 5511126a8a12Smrg RANLIB=: 5512126a8a12Smrg objlist= 5513126a8a12Smrg concat_cmds= 5514126a8a12Smrg save_oldobjs=$oldobjs 5515126a8a12Smrg 5516126a8a12Smrg # Is there a better way of finding the last object in the list? 5517126a8a12Smrg for obj in $save_oldobjs 5518126a8a12Smrg do 5519126a8a12Smrg last_oldobj=$obj 5520126a8a12Smrg done 5521126a8a12Smrg for obj in $save_oldobjs 5522126a8a12Smrg do 5523126a8a12Smrg oldobjs="$objlist $obj" 5524126a8a12Smrg objlist="$objlist $obj" 5525126a8a12Smrg eval test_cmds=\"$old_archive_cmds\" 5526126a8a12Smrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5527126a8a12Smrg test "$len" -le "$max_cmd_len"; then 5528126a8a12Smrg : 5529126a8a12Smrg else 5530126a8a12Smrg # the above command should be used before it gets too long 5531126a8a12Smrg oldobjs=$objlist 5532126a8a12Smrg if test "$obj" = "$last_oldobj" ; then 5533126a8a12Smrg RANLIB=$save_RANLIB 5534126a8a12Smrg fi 5535126a8a12Smrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5536126a8a12Smrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 5537126a8a12Smrg objlist= 5538126a8a12Smrg fi 5539126a8a12Smrg done 5540126a8a12Smrg RANLIB=$save_RANLIB 5541126a8a12Smrg oldobjs=$objlist 5542126a8a12Smrg if test "X$oldobjs" = "X" ; then 5543126a8a12Smrg eval cmds=\"\$concat_cmds\" 5544126a8a12Smrg else 5545126a8a12Smrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 5546126a8a12Smrg fi 5547126a8a12Smrg fi 5548126a8a12Smrg fi 5549126a8a12Smrg save_ifs="$IFS"; IFS='~' 5550126a8a12Smrg for cmd in $cmds; do 5551126a8a12Smrg eval cmd=\"$cmd\" 5552126a8a12Smrg IFS="$save_ifs" 5553126a8a12Smrg $show "$cmd" 5554126a8a12Smrg $run eval "$cmd" || exit $? 5555126a8a12Smrg done 5556126a8a12Smrg IFS="$save_ifs" 5557126a8a12Smrg done 5558126a8a12Smrg 5559126a8a12Smrg if test -n "$generated"; then 5560126a8a12Smrg $show "${rm}r$generated" 5561126a8a12Smrg $run ${rm}r$generated 5562126a8a12Smrg fi 5563126a8a12Smrg 5564126a8a12Smrg # Now create the libtool archive. 5565126a8a12Smrg case $output in 5566126a8a12Smrg *.la) 5567126a8a12Smrg old_library= 5568126a8a12Smrg test "$build_old_libs" = yes && old_library="$libname.$libext" 5569126a8a12Smrg $show "creating $output" 5570126a8a12Smrg 5571126a8a12Smrg # Preserve any variables that may affect compiler behavior 5572126a8a12Smrg for var in $variables_saved_for_relink; do 5573126a8a12Smrg if eval test -z \"\${$var+set}\"; then 5574126a8a12Smrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 5575126a8a12Smrg elif eval var_value=\$$var; test -z "$var_value"; then 5576126a8a12Smrg relink_command="$var=; export $var; $relink_command" 5577126a8a12Smrg else 5578126a8a12Smrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 5579126a8a12Smrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 5580126a8a12Smrg fi 5581126a8a12Smrg done 5582126a8a12Smrg # Quote the link command for shipping. 5583126a8a12Smrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 5584126a8a12Smrg relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 5585126a8a12Smrg if test "$hardcode_automatic" = yes ; then 5586126a8a12Smrg relink_command= 5587126a8a12Smrg fi 5588126a8a12Smrg 5589126a8a12Smrg 5590126a8a12Smrg # Only create the output if not a dry run. 5591126a8a12Smrg if test -z "$run"; then 5592126a8a12Smrg for installed in no yes; do 5593126a8a12Smrg if test "$installed" = yes; then 5594126a8a12Smrg if test -z "$install_libdir"; then 5595126a8a12Smrg break 5596126a8a12Smrg fi 5597126a8a12Smrg output="$output_objdir/$outputname"i 5598126a8a12Smrg # Replace all uninstalled libtool libraries with the installed ones 5599126a8a12Smrg newdependency_libs= 5600126a8a12Smrg for deplib in $dependency_libs; do 5601126a8a12Smrg case $deplib in 5602126a8a12Smrg *.la) 5603126a8a12Smrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 5604126a8a12Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5605126a8a12Smrg if test -z "$libdir"; then 5606126a8a12Smrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 5607126a8a12Smrg exit $EXIT_FAILURE 5608126a8a12Smrg fi 5609126a8a12Smrg newdependency_libs="$newdependency_libs $libdir/$name" 5610126a8a12Smrg ;; 5611126a8a12Smrg *) newdependency_libs="$newdependency_libs $deplib" ;; 5612126a8a12Smrg esac 5613126a8a12Smrg done 5614126a8a12Smrg dependency_libs="$newdependency_libs" 5615126a8a12Smrg newdlfiles= 5616126a8a12Smrg for lib in $dlfiles; do 5617126a8a12Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5618126a8a12Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5619126a8a12Smrg if test -z "$libdir"; then 5620126a8a12Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5621126a8a12Smrg exit $EXIT_FAILURE 5622126a8a12Smrg fi 5623126a8a12Smrg newdlfiles="$newdlfiles $libdir/$name" 5624126a8a12Smrg done 5625126a8a12Smrg dlfiles="$newdlfiles" 5626126a8a12Smrg newdlprefiles= 5627126a8a12Smrg for lib in $dlprefiles; do 5628126a8a12Smrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5629126a8a12Smrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5630126a8a12Smrg if test -z "$libdir"; then 5631126a8a12Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5632126a8a12Smrg exit $EXIT_FAILURE 5633126a8a12Smrg fi 5634126a8a12Smrg newdlprefiles="$newdlprefiles $libdir/$name" 5635126a8a12Smrg done 5636126a8a12Smrg dlprefiles="$newdlprefiles" 5637126a8a12Smrg else 5638126a8a12Smrg newdlfiles= 5639126a8a12Smrg for lib in $dlfiles; do 5640126a8a12Smrg case $lib in 5641126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5642126a8a12Smrg *) abs=`pwd`"/$lib" ;; 5643126a8a12Smrg esac 5644126a8a12Smrg newdlfiles="$newdlfiles $abs" 5645126a8a12Smrg done 5646126a8a12Smrg dlfiles="$newdlfiles" 5647126a8a12Smrg newdlprefiles= 5648126a8a12Smrg for lib in $dlprefiles; do 5649126a8a12Smrg case $lib in 5650126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5651126a8a12Smrg *) abs=`pwd`"/$lib" ;; 5652126a8a12Smrg esac 5653126a8a12Smrg newdlprefiles="$newdlprefiles $abs" 5654126a8a12Smrg done 5655126a8a12Smrg dlprefiles="$newdlprefiles" 5656126a8a12Smrg fi 5657126a8a12Smrg $rm $output 5658126a8a12Smrg # place dlname in correct position for cygwin 5659126a8a12Smrg tdlname=$dlname 5660126a8a12Smrg case $host,$output,$installed,$module,$dlname in 5661126a8a12Smrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 5662126a8a12Smrg esac 5663126a8a12Smrg $echo > $output "\ 5664126a8a12Smrg# $outputname - a libtool library file 5665126a8a12Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5666126a8a12Smrg# 5667126a8a12Smrg# Please DO NOT delete this file! 5668126a8a12Smrg# It is necessary for linking the library. 5669126a8a12Smrg 5670126a8a12Smrg# The name that we can dlopen(3). 5671126a8a12Smrgdlname='$tdlname' 5672126a8a12Smrg 5673126a8a12Smrg# Names of this library. 5674126a8a12Smrglibrary_names='$library_names' 5675126a8a12Smrg 5676126a8a12Smrg# The name of the static archive. 5677126a8a12Smrgold_library='$old_library' 5678126a8a12Smrg 5679126a8a12Smrg# Libraries that this one depends upon. 5680126a8a12Smrgdependency_libs='$dependency_libs' 5681126a8a12Smrg 5682126a8a12Smrg# Version information for $libname. 5683126a8a12Smrgcurrent=$current 5684126a8a12Smrgage=$age 5685126a8a12Smrgrevision=$revision 5686126a8a12Smrg 5687126a8a12Smrg# Is this an already installed library? 5688126a8a12Smrginstalled=$installed 5689126a8a12Smrg 5690126a8a12Smrg# Should we warn about portability when linking against -modules? 5691126a8a12Smrgshouldnotlink=$module 5692126a8a12Smrg 5693126a8a12Smrg# Files to dlopen/dlpreopen 5694126a8a12Smrgdlopen='$dlfiles' 5695126a8a12Smrgdlpreopen='$dlprefiles' 5696126a8a12Smrg 5697126a8a12Smrg# Directory that this library needs to be installed in: 5698126a8a12Smrglibdir='$install_libdir'" 5699126a8a12Smrg if test "$installed" = no && test "$need_relink" = yes; then 5700126a8a12Smrg $echo >> $output "\ 5701126a8a12Smrgrelink_command=\"$relink_command\"" 5702126a8a12Smrg fi 5703126a8a12Smrg done 5704126a8a12Smrg fi 5705126a8a12Smrg 5706126a8a12Smrg # Do a symbolic link so that the libtool archive can be found in 5707126a8a12Smrg # LD_LIBRARY_PATH before the program is installed. 5708126a8a12Smrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 5709126a8a12Smrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 5710126a8a12Smrg ;; 5711126a8a12Smrg esac 5712126a8a12Smrg exit $EXIT_SUCCESS 5713126a8a12Smrg ;; 5714126a8a12Smrg 5715126a8a12Smrg # libtool install mode 5716126a8a12Smrg install) 5717126a8a12Smrg modename="$modename: install" 5718126a8a12Smrg 5719126a8a12Smrg # There may be an optional sh(1) argument at the beginning of 5720126a8a12Smrg # install_prog (especially on Windows NT). 5721126a8a12Smrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5722126a8a12Smrg # Allow the use of GNU shtool's install command. 5723126a8a12Smrg $echo "X$nonopt" | grep shtool > /dev/null; then 5724126a8a12Smrg # Aesthetically quote it. 5725126a8a12Smrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5726126a8a12Smrg case $arg in 5727126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5728126a8a12Smrg arg="\"$arg\"" 5729126a8a12Smrg ;; 5730126a8a12Smrg esac 5731126a8a12Smrg install_prog="$arg " 5732126a8a12Smrg arg="$1" 5733126a8a12Smrg shift 5734126a8a12Smrg else 5735126a8a12Smrg install_prog= 5736126a8a12Smrg arg=$nonopt 5737126a8a12Smrg fi 5738126a8a12Smrg 5739126a8a12Smrg # The real first argument should be the name of the installation program. 5740126a8a12Smrg # Aesthetically quote it. 5741126a8a12Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5742126a8a12Smrg case $arg in 5743126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5744126a8a12Smrg arg="\"$arg\"" 5745126a8a12Smrg ;; 5746126a8a12Smrg esac 5747126a8a12Smrg install_prog="$install_prog$arg" 5748126a8a12Smrg 5749126a8a12Smrg # We need to accept at least all the BSD install flags. 5750126a8a12Smrg dest= 5751126a8a12Smrg files= 5752126a8a12Smrg opts= 5753126a8a12Smrg prev= 5754126a8a12Smrg install_type= 5755126a8a12Smrg isdir=no 5756126a8a12Smrg stripme= 5757126a8a12Smrg for arg 5758126a8a12Smrg do 5759126a8a12Smrg if test -n "$dest"; then 5760126a8a12Smrg files="$files $dest" 5761126a8a12Smrg dest=$arg 5762126a8a12Smrg continue 5763126a8a12Smrg fi 5764126a8a12Smrg 5765126a8a12Smrg case $arg in 5766126a8a12Smrg -d) isdir=yes ;; 5767126a8a12Smrg -f) 5768126a8a12Smrg case " $install_prog " in 5769126a8a12Smrg *[\\\ /]cp\ *) ;; 5770126a8a12Smrg *) prev=$arg ;; 5771126a8a12Smrg esac 5772126a8a12Smrg ;; 5773126a8a12Smrg -g | -m | -o) prev=$arg ;; 5774126a8a12Smrg -s) 5775126a8a12Smrg stripme=" -s" 5776126a8a12Smrg continue 5777126a8a12Smrg ;; 5778126a8a12Smrg -*) 5779126a8a12Smrg ;; 5780126a8a12Smrg *) 5781126a8a12Smrg # If the previous option needed an argument, then skip it. 5782126a8a12Smrg if test -n "$prev"; then 5783126a8a12Smrg prev= 5784126a8a12Smrg else 5785126a8a12Smrg dest=$arg 5786126a8a12Smrg continue 5787126a8a12Smrg fi 5788126a8a12Smrg ;; 5789126a8a12Smrg esac 5790126a8a12Smrg 5791126a8a12Smrg # Aesthetically quote the argument. 5792126a8a12Smrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5793126a8a12Smrg case $arg in 5794126a8a12Smrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5795126a8a12Smrg arg="\"$arg\"" 5796126a8a12Smrg ;; 5797126a8a12Smrg esac 5798126a8a12Smrg install_prog="$install_prog $arg" 5799126a8a12Smrg done 5800126a8a12Smrg 5801126a8a12Smrg if test -z "$install_prog"; then 5802126a8a12Smrg $echo "$modename: you must specify an install program" 1>&2 5803126a8a12Smrg $echo "$help" 1>&2 5804126a8a12Smrg exit $EXIT_FAILURE 5805126a8a12Smrg fi 5806126a8a12Smrg 5807126a8a12Smrg if test -n "$prev"; then 5808126a8a12Smrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 5809126a8a12Smrg $echo "$help" 1>&2 5810126a8a12Smrg exit $EXIT_FAILURE 5811126a8a12Smrg fi 5812126a8a12Smrg 5813126a8a12Smrg if test -z "$files"; then 5814126a8a12Smrg if test -z "$dest"; then 5815126a8a12Smrg $echo "$modename: no file or destination specified" 1>&2 5816126a8a12Smrg else 5817126a8a12Smrg $echo "$modename: you must specify a destination" 1>&2 5818126a8a12Smrg fi 5819126a8a12Smrg $echo "$help" 1>&2 5820126a8a12Smrg exit $EXIT_FAILURE 5821126a8a12Smrg fi 5822126a8a12Smrg 5823126a8a12Smrg # Strip any trailing slash from the destination. 5824126a8a12Smrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 5825126a8a12Smrg 5826126a8a12Smrg # Check to see that the destination is a directory. 5827126a8a12Smrg test -d "$dest" && isdir=yes 5828126a8a12Smrg if test "$isdir" = yes; then 5829126a8a12Smrg destdir="$dest" 5830126a8a12Smrg destname= 5831126a8a12Smrg else 5832126a8a12Smrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 5833126a8a12Smrg test "X$destdir" = "X$dest" && destdir=. 5834126a8a12Smrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 5835126a8a12Smrg 5836126a8a12Smrg # Not a directory, so check to see that there is only one file specified. 5837126a8a12Smrg set dummy $files 5838126a8a12Smrg if test "$#" -gt 2; then 5839126a8a12Smrg $echo "$modename: \`$dest' is not a directory" 1>&2 5840126a8a12Smrg $echo "$help" 1>&2 5841126a8a12Smrg exit $EXIT_FAILURE 5842126a8a12Smrg fi 5843126a8a12Smrg fi 5844126a8a12Smrg case $destdir in 5845126a8a12Smrg [\\/]* | [A-Za-z]:[\\/]*) ;; 5846126a8a12Smrg *) 5847126a8a12Smrg for file in $files; do 5848126a8a12Smrg case $file in 5849126a8a12Smrg *.lo) ;; 5850126a8a12Smrg *) 5851126a8a12Smrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 5852126a8a12Smrg $echo "$help" 1>&2 5853126a8a12Smrg exit $EXIT_FAILURE 5854126a8a12Smrg ;; 5855126a8a12Smrg esac 5856126a8a12Smrg done 5857126a8a12Smrg ;; 5858126a8a12Smrg esac 5859126a8a12Smrg 5860126a8a12Smrg # This variable tells wrapper scripts just to set variables rather 5861126a8a12Smrg # than running their programs. 5862126a8a12Smrg libtool_install_magic="$magic" 5863126a8a12Smrg 5864126a8a12Smrg staticlibs= 5865126a8a12Smrg future_libdirs= 5866126a8a12Smrg current_libdirs= 5867126a8a12Smrg for file in $files; do 5868126a8a12Smrg 5869126a8a12Smrg # Do each installation. 5870126a8a12Smrg case $file in 5871126a8a12Smrg *.$libext) 5872126a8a12Smrg # Do the static libraries later. 5873126a8a12Smrg staticlibs="$staticlibs $file" 5874126a8a12Smrg ;; 5875126a8a12Smrg 5876126a8a12Smrg *.la) 5877126a8a12Smrg # Check to see that this really is a libtool archive. 5878126a8a12Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 5879126a8a12Smrg else 5880126a8a12Smrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 5881126a8a12Smrg $echo "$help" 1>&2 5882126a8a12Smrg exit $EXIT_FAILURE 5883126a8a12Smrg fi 5884126a8a12Smrg 5885126a8a12Smrg library_names= 5886126a8a12Smrg old_library= 5887126a8a12Smrg relink_command= 5888126a8a12Smrg # If there is no directory component, then add one. 5889126a8a12Smrg case $file in 5890126a8a12Smrg */* | *\\*) . $file ;; 5891126a8a12Smrg *) . ./$file ;; 5892126a8a12Smrg esac 5893126a8a12Smrg 5894126a8a12Smrg # Add the libdir to current_libdirs if it is the destination. 5895126a8a12Smrg if test "X$destdir" = "X$libdir"; then 5896126a8a12Smrg case "$current_libdirs " in 5897126a8a12Smrg *" $libdir "*) ;; 5898126a8a12Smrg *) current_libdirs="$current_libdirs $libdir" ;; 5899126a8a12Smrg esac 5900126a8a12Smrg else 5901126a8a12Smrg # Note the libdir as a future libdir. 5902126a8a12Smrg case "$future_libdirs " in 5903126a8a12Smrg *" $libdir "*) ;; 5904126a8a12Smrg *) future_libdirs="$future_libdirs $libdir" ;; 5905126a8a12Smrg esac 5906126a8a12Smrg fi 5907126a8a12Smrg 5908126a8a12Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 5909126a8a12Smrg test "X$dir" = "X$file/" && dir= 5910126a8a12Smrg dir="$dir$objdir" 5911126a8a12Smrg 5912126a8a12Smrg if test -n "$relink_command"; then 5913126a8a12Smrg # Determine the prefix the user has applied to our future dir. 5914126a8a12Smrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 5915126a8a12Smrg 5916126a8a12Smrg # Don't allow the user to place us outside of our expected 5917126a8a12Smrg # location b/c this prevents finding dependent libraries that 5918126a8a12Smrg # are installed to the same prefix. 5919126a8a12Smrg # At present, this check doesn't affect windows .dll's that 5920126a8a12Smrg # are installed into $libdir/../bin (currently, that works fine) 5921126a8a12Smrg # but it's something to keep an eye on. 5922126a8a12Smrg if test "$inst_prefix_dir" = "$destdir"; then 5923126a8a12Smrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 5924126a8a12Smrg exit $EXIT_FAILURE 5925126a8a12Smrg fi 5926126a8a12Smrg 5927126a8a12Smrg if test -n "$inst_prefix_dir"; then 5928126a8a12Smrg # Stick the inst_prefix_dir data into the link command. 5929126a8a12Smrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 5930126a8a12Smrg else 5931126a8a12Smrg relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 5932126a8a12Smrg fi 5933126a8a12Smrg 5934126a8a12Smrg $echo "$modename: warning: relinking \`$file'" 1>&2 5935126a8a12Smrg $show "$relink_command" 5936126a8a12Smrg if $run eval "$relink_command"; then : 5937126a8a12Smrg else 5938126a8a12Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 5939126a8a12Smrg exit $EXIT_FAILURE 5940126a8a12Smrg fi 5941126a8a12Smrg fi 5942126a8a12Smrg 5943126a8a12Smrg # See the names of the shared library. 5944126a8a12Smrg set dummy $library_names 5945126a8a12Smrg if test -n "$2"; then 5946126a8a12Smrg realname="$2" 5947126a8a12Smrg shift 5948126a8a12Smrg shift 5949126a8a12Smrg 5950126a8a12Smrg srcname="$realname" 5951126a8a12Smrg test -n "$relink_command" && srcname="$realname"T 5952126a8a12Smrg 5953126a8a12Smrg # Install the shared library and build the symlinks. 5954126a8a12Smrg $show "$install_prog $dir/$srcname $destdir/$realname" 5955126a8a12Smrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 5956126a8a12Smrg if test -n "$stripme" && test -n "$striplib"; then 5957126a8a12Smrg $show "$striplib $destdir/$realname" 5958126a8a12Smrg $run eval "$striplib $destdir/$realname" || exit $? 5959126a8a12Smrg fi 5960126a8a12Smrg 5961126a8a12Smrg if test "$#" -gt 0; then 5962126a8a12Smrg # Delete the old symlinks, and create new ones. 5963126a8a12Smrg # Try `ln -sf' first, because the `ln' binary might depend on 5964126a8a12Smrg # the symlink we replace! Solaris /bin/ln does not understand -f, 5965126a8a12Smrg # so we also need to try rm && ln -s. 5966126a8a12Smrg for linkname 5967126a8a12Smrg do 5968126a8a12Smrg if test "$linkname" != "$realname"; then 5969126a8a12Smrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 5970126a8a12Smrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 5971126a8a12Smrg fi 5972126a8a12Smrg done 5973126a8a12Smrg fi 5974126a8a12Smrg 5975126a8a12Smrg # Do each command in the postinstall commands. 5976126a8a12Smrg lib="$destdir/$realname" 5977126a8a12Smrg cmds=$postinstall_cmds 5978126a8a12Smrg save_ifs="$IFS"; IFS='~' 5979126a8a12Smrg for cmd in $cmds; do 5980126a8a12Smrg IFS="$save_ifs" 5981126a8a12Smrg eval cmd=\"$cmd\" 5982126a8a12Smrg $show "$cmd" 5983126a8a12Smrg $run eval "$cmd" || { 5984126a8a12Smrg lt_exit=$? 5985126a8a12Smrg 5986126a8a12Smrg # Restore the uninstalled library and exit 5987126a8a12Smrg if test "$mode" = relink; then 5988126a8a12Smrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 5989126a8a12Smrg fi 5990126a8a12Smrg 5991126a8a12Smrg exit $lt_exit 5992126a8a12Smrg } 5993126a8a12Smrg done 5994126a8a12Smrg IFS="$save_ifs" 5995126a8a12Smrg fi 5996126a8a12Smrg 5997126a8a12Smrg # Install the pseudo-library for information purposes. 5998126a8a12Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 5999126a8a12Smrg instname="$dir/$name"i 6000126a8a12Smrg $show "$install_prog $instname $destdir/$name" 6001126a8a12Smrg $run eval "$install_prog $instname $destdir/$name" || exit $? 6002126a8a12Smrg 6003126a8a12Smrg # Maybe install the static library, too. 6004126a8a12Smrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 6005126a8a12Smrg ;; 6006126a8a12Smrg 6007126a8a12Smrg *.lo) 6008126a8a12Smrg # Install (i.e. copy) a libtool object. 6009126a8a12Smrg 6010126a8a12Smrg # Figure out destination file name, if it wasn't already specified. 6011126a8a12Smrg if test -n "$destname"; then 6012126a8a12Smrg destfile="$destdir/$destname" 6013126a8a12Smrg else 6014126a8a12Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6015126a8a12Smrg destfile="$destdir/$destfile" 6016126a8a12Smrg fi 6017126a8a12Smrg 6018126a8a12Smrg # Deduce the name of the destination old-style object file. 6019126a8a12Smrg case $destfile in 6020126a8a12Smrg *.lo) 6021126a8a12Smrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 6022126a8a12Smrg ;; 6023126a8a12Smrg *.$objext) 6024126a8a12Smrg staticdest="$destfile" 6025126a8a12Smrg destfile= 6026126a8a12Smrg ;; 6027126a8a12Smrg *) 6028126a8a12Smrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 6029126a8a12Smrg $echo "$help" 1>&2 6030126a8a12Smrg exit $EXIT_FAILURE 6031126a8a12Smrg ;; 6032126a8a12Smrg esac 6033126a8a12Smrg 6034126a8a12Smrg # Install the libtool object if requested. 6035126a8a12Smrg if test -n "$destfile"; then 6036126a8a12Smrg $show "$install_prog $file $destfile" 6037126a8a12Smrg $run eval "$install_prog $file $destfile" || exit $? 6038126a8a12Smrg fi 6039126a8a12Smrg 6040126a8a12Smrg # Install the old object if enabled. 6041126a8a12Smrg if test "$build_old_libs" = yes; then 6042126a8a12Smrg # Deduce the name of the old-style object file. 6043126a8a12Smrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 6044126a8a12Smrg 6045126a8a12Smrg $show "$install_prog $staticobj $staticdest" 6046126a8a12Smrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 6047126a8a12Smrg fi 6048126a8a12Smrg exit $EXIT_SUCCESS 6049126a8a12Smrg ;; 6050126a8a12Smrg 6051126a8a12Smrg *) 6052126a8a12Smrg # Figure out destination file name, if it wasn't already specified. 6053126a8a12Smrg if test -n "$destname"; then 6054126a8a12Smrg destfile="$destdir/$destname" 6055126a8a12Smrg else 6056126a8a12Smrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6057126a8a12Smrg destfile="$destdir/$destfile" 6058126a8a12Smrg fi 6059126a8a12Smrg 6060126a8a12Smrg # If the file is missing, and there is a .exe on the end, strip it 6061126a8a12Smrg # because it is most likely a libtool script we actually want to 6062126a8a12Smrg # install 6063126a8a12Smrg stripped_ext="" 6064126a8a12Smrg case $file in 6065126a8a12Smrg *.exe) 6066126a8a12Smrg if test ! -f "$file"; then 6067126a8a12Smrg file=`$echo $file|${SED} 's,.exe$,,'` 6068126a8a12Smrg stripped_ext=".exe" 6069126a8a12Smrg fi 6070126a8a12Smrg ;; 6071126a8a12Smrg esac 6072126a8a12Smrg 6073126a8a12Smrg # Do a test to see if this is really a libtool program. 6074126a8a12Smrg case $host in 6075126a8a12Smrg *cygwin*|*mingw*) 6076126a8a12Smrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 6077126a8a12Smrg ;; 6078126a8a12Smrg *) 6079126a8a12Smrg wrapper=$file 6080126a8a12Smrg ;; 6081126a8a12Smrg esac 6082126a8a12Smrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6083126a8a12Smrg notinst_deplibs= 6084126a8a12Smrg relink_command= 6085126a8a12Smrg 6086126a8a12Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 6087126a8a12Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 6088126a8a12Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 6089126a8a12Smrg # `FILE.' does not work on cygwin managed mounts. 6090126a8a12Smrg # 6091126a8a12Smrg # If there is no directory component, then add one. 6092126a8a12Smrg case $wrapper in 6093126a8a12Smrg */* | *\\*) . ${wrapper} ;; 6094126a8a12Smrg *) . ./${wrapper} ;; 6095126a8a12Smrg esac 6096126a8a12Smrg 6097126a8a12Smrg # Check the variables that should have been set. 6098126a8a12Smrg if test -z "$notinst_deplibs"; then 6099126a8a12Smrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6100126a8a12Smrg exit $EXIT_FAILURE 6101126a8a12Smrg fi 6102126a8a12Smrg 6103126a8a12Smrg finalize=yes 6104126a8a12Smrg for lib in $notinst_deplibs; do 6105126a8a12Smrg # Check to see that each library is installed. 6106126a8a12Smrg libdir= 6107126a8a12Smrg if test -f "$lib"; then 6108126a8a12Smrg # If there is no directory component, then add one. 6109126a8a12Smrg case $lib in 6110126a8a12Smrg */* | *\\*) . $lib ;; 6111126a8a12Smrg *) . ./$lib ;; 6112126a8a12Smrg esac 6113126a8a12Smrg fi 6114126a8a12Smrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 6115126a8a12Smrg if test -n "$libdir" && test ! -f "$libfile"; then 6116126a8a12Smrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 6117126a8a12Smrg finalize=no 6118126a8a12Smrg fi 6119126a8a12Smrg done 6120126a8a12Smrg 6121126a8a12Smrg relink_command= 6122126a8a12Smrg # Note that it is not necessary on cygwin/mingw to append a dot to 6123126a8a12Smrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 6124126a8a12Smrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 6125126a8a12Smrg # `FILE.' does not work on cygwin managed mounts. 6126126a8a12Smrg # 6127126a8a12Smrg # If there is no directory component, then add one. 6128126a8a12Smrg case $wrapper in 6129126a8a12Smrg */* | *\\*) . ${wrapper} ;; 6130126a8a12Smrg *) . ./${wrapper} ;; 6131126a8a12Smrg esac 6132126a8a12Smrg 6133126a8a12Smrg outputname= 6134126a8a12Smrg if test "$fast_install" = no && test -n "$relink_command"; then 6135126a8a12Smrg if test "$finalize" = yes && test -z "$run"; then 6136126a8a12Smrg tmpdir=`func_mktempdir` 6137126a8a12Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6138126a8a12Smrg outputname="$tmpdir/$file" 6139126a8a12Smrg # Replace the output file specification. 6140126a8a12Smrg relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 6141126a8a12Smrg 6142126a8a12Smrg $show "$relink_command" 6143126a8a12Smrg if $run eval "$relink_command"; then : 6144126a8a12Smrg else 6145126a8a12Smrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6146126a8a12Smrg ${rm}r "$tmpdir" 6147126a8a12Smrg continue 6148126a8a12Smrg fi 6149126a8a12Smrg file="$outputname" 6150126a8a12Smrg else 6151126a8a12Smrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 6152126a8a12Smrg fi 6153126a8a12Smrg else 6154126a8a12Smrg # Install the binary that we compiled earlier. 6155126a8a12Smrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 6156126a8a12Smrg fi 6157126a8a12Smrg fi 6158126a8a12Smrg 6159126a8a12Smrg # remove .exe since cygwin /usr/bin/install will append another 6160126a8a12Smrg # one anyway 6161126a8a12Smrg case $install_prog,$host in 6162126a8a12Smrg */usr/bin/install*,*cygwin*) 6163126a8a12Smrg case $file:$destfile in 6164126a8a12Smrg *.exe:*.exe) 6165126a8a12Smrg # this is ok 6166126a8a12Smrg ;; 6167126a8a12Smrg *.exe:*) 6168126a8a12Smrg destfile=$destfile.exe 6169126a8a12Smrg ;; 6170126a8a12Smrg *:*.exe) 6171126a8a12Smrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 6172126a8a12Smrg ;; 6173126a8a12Smrg esac 6174126a8a12Smrg ;; 6175126a8a12Smrg esac 6176126a8a12Smrg $show "$install_prog$stripme $file $destfile" 6177126a8a12Smrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 6178126a8a12Smrg test -n "$outputname" && ${rm}r "$tmpdir" 6179126a8a12Smrg ;; 6180126a8a12Smrg esac 6181126a8a12Smrg done 6182126a8a12Smrg 6183126a8a12Smrg for file in $staticlibs; do 6184126a8a12Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6185126a8a12Smrg 6186126a8a12Smrg # Set up the ranlib parameters. 6187126a8a12Smrg oldlib="$destdir/$name" 6188126a8a12Smrg 6189126a8a12Smrg $show "$install_prog $file $oldlib" 6190126a8a12Smrg $run eval "$install_prog \$file \$oldlib" || exit $? 6191126a8a12Smrg 6192126a8a12Smrg if test -n "$stripme" && test -n "$old_striplib"; then 6193126a8a12Smrg $show "$old_striplib $oldlib" 6194126a8a12Smrg $run eval "$old_striplib $oldlib" || exit $? 6195126a8a12Smrg fi 6196126a8a12Smrg 6197126a8a12Smrg # Do each command in the postinstall commands. 6198126a8a12Smrg cmds=$old_postinstall_cmds 6199126a8a12Smrg save_ifs="$IFS"; IFS='~' 6200126a8a12Smrg for cmd in $cmds; do 6201126a8a12Smrg IFS="$save_ifs" 6202126a8a12Smrg eval cmd=\"$cmd\" 6203126a8a12Smrg $show "$cmd" 6204126a8a12Smrg $run eval "$cmd" || exit $? 6205126a8a12Smrg done 6206126a8a12Smrg IFS="$save_ifs" 6207126a8a12Smrg done 6208126a8a12Smrg 6209126a8a12Smrg if test -n "$future_libdirs"; then 6210126a8a12Smrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 6211126a8a12Smrg fi 6212126a8a12Smrg 6213126a8a12Smrg if test -n "$current_libdirs"; then 6214126a8a12Smrg # Maybe just do a dry run. 6215126a8a12Smrg test -n "$run" && current_libdirs=" -n$current_libdirs" 6216126a8a12Smrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 6217126a8a12Smrg else 6218126a8a12Smrg exit $EXIT_SUCCESS 6219126a8a12Smrg fi 6220126a8a12Smrg ;; 6221126a8a12Smrg 6222126a8a12Smrg # libtool finish mode 6223126a8a12Smrg finish) 6224126a8a12Smrg modename="$modename: finish" 6225126a8a12Smrg libdirs="$nonopt" 6226126a8a12Smrg admincmds= 6227126a8a12Smrg 6228126a8a12Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 6229126a8a12Smrg for dir 6230126a8a12Smrg do 6231126a8a12Smrg libdirs="$libdirs $dir" 6232126a8a12Smrg done 6233126a8a12Smrg 6234126a8a12Smrg for libdir in $libdirs; do 6235126a8a12Smrg if test -n "$finish_cmds"; then 6236126a8a12Smrg # Do each command in the finish commands. 6237126a8a12Smrg cmds=$finish_cmds 6238126a8a12Smrg save_ifs="$IFS"; IFS='~' 6239126a8a12Smrg for cmd in $cmds; do 6240126a8a12Smrg IFS="$save_ifs" 6241126a8a12Smrg eval cmd=\"$cmd\" 6242126a8a12Smrg $show "$cmd" 6243126a8a12Smrg $run eval "$cmd" || admincmds="$admincmds 6244126a8a12Smrg $cmd" 6245126a8a12Smrg done 6246126a8a12Smrg IFS="$save_ifs" 6247126a8a12Smrg fi 6248126a8a12Smrg if test -n "$finish_eval"; then 6249126a8a12Smrg # Do the single finish_eval. 6250126a8a12Smrg eval cmds=\"$finish_eval\" 6251126a8a12Smrg $run eval "$cmds" || admincmds="$admincmds 6252126a8a12Smrg $cmds" 6253126a8a12Smrg fi 6254126a8a12Smrg done 6255126a8a12Smrg fi 6256126a8a12Smrg 6257126a8a12Smrg # Exit here if they wanted silent mode. 6258126a8a12Smrg test "$show" = : && exit $EXIT_SUCCESS 6259126a8a12Smrg 6260126a8a12Smrg $echo "X----------------------------------------------------------------------" | $Xsed 6261126a8a12Smrg $echo "Libraries have been installed in:" 6262126a8a12Smrg for libdir in $libdirs; do 6263126a8a12Smrg $echo " $libdir" 6264126a8a12Smrg done 6265126a8a12Smrg $echo 6266126a8a12Smrg $echo "If you ever happen to want to link against installed libraries" 6267126a8a12Smrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 6268126a8a12Smrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 6269126a8a12Smrg $echo "flag during linking and do at least one of the following:" 6270126a8a12Smrg if test -n "$shlibpath_var"; then 6271126a8a12Smrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 6272126a8a12Smrg $echo " during execution" 6273126a8a12Smrg fi 6274126a8a12Smrg if test -n "$runpath_var"; then 6275126a8a12Smrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 6276126a8a12Smrg $echo " during linking" 6277126a8a12Smrg fi 6278126a8a12Smrg if test -n "$hardcode_libdir_flag_spec"; then 6279126a8a12Smrg libdir=LIBDIR 6280126a8a12Smrg eval flag=\"$hardcode_libdir_flag_spec\" 6281126a8a12Smrg 6282126a8a12Smrg $echo " - use the \`$flag' linker flag" 6283126a8a12Smrg fi 6284126a8a12Smrg if test -n "$admincmds"; then 6285126a8a12Smrg $echo " - have your system administrator run these commands:$admincmds" 6286126a8a12Smrg fi 6287126a8a12Smrg if test -f /etc/ld.so.conf; then 6288126a8a12Smrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6289126a8a12Smrg fi 6290126a8a12Smrg $echo 6291126a8a12Smrg $echo "See any operating system documentation about shared libraries for" 6292126a8a12Smrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6293126a8a12Smrg $echo "X----------------------------------------------------------------------" | $Xsed 6294126a8a12Smrg exit $EXIT_SUCCESS 6295126a8a12Smrg ;; 6296126a8a12Smrg 6297126a8a12Smrg # libtool execute mode 6298126a8a12Smrg execute) 6299126a8a12Smrg modename="$modename: execute" 6300126a8a12Smrg 6301126a8a12Smrg # The first argument is the command name. 6302126a8a12Smrg cmd="$nonopt" 6303126a8a12Smrg if test -z "$cmd"; then 6304126a8a12Smrg $echo "$modename: you must specify a COMMAND" 1>&2 6305126a8a12Smrg $echo "$help" 6306126a8a12Smrg exit $EXIT_FAILURE 6307126a8a12Smrg fi 6308126a8a12Smrg 6309126a8a12Smrg # Handle -dlopen flags immediately. 6310126a8a12Smrg for file in $execute_dlfiles; do 6311126a8a12Smrg if test ! -f "$file"; then 6312126a8a12Smrg $echo "$modename: \`$file' is not a file" 1>&2 6313126a8a12Smrg $echo "$help" 1>&2 6314126a8a12Smrg exit $EXIT_FAILURE 6315126a8a12Smrg fi 6316126a8a12Smrg 6317126a8a12Smrg dir= 6318126a8a12Smrg case $file in 6319126a8a12Smrg *.la) 6320126a8a12Smrg # Check to see that this really is a libtool archive. 6321126a8a12Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 6322126a8a12Smrg else 6323126a8a12Smrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 6324126a8a12Smrg $echo "$help" 1>&2 6325126a8a12Smrg exit $EXIT_FAILURE 6326126a8a12Smrg fi 6327126a8a12Smrg 6328126a8a12Smrg # Read the libtool library. 6329126a8a12Smrg dlname= 6330126a8a12Smrg library_names= 6331126a8a12Smrg 6332126a8a12Smrg # If there is no directory component, then add one. 6333126a8a12Smrg case $file in 6334126a8a12Smrg */* | *\\*) . $file ;; 6335126a8a12Smrg *) . ./$file ;; 6336126a8a12Smrg esac 6337126a8a12Smrg 6338126a8a12Smrg # Skip this library if it cannot be dlopened. 6339126a8a12Smrg if test -z "$dlname"; then 6340126a8a12Smrg # Warn if it was a shared library. 6341126a8a12Smrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 6342126a8a12Smrg continue 6343126a8a12Smrg fi 6344126a8a12Smrg 6345126a8a12Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6346126a8a12Smrg test "X$dir" = "X$file" && dir=. 6347126a8a12Smrg 6348126a8a12Smrg if test -f "$dir/$objdir/$dlname"; then 6349126a8a12Smrg dir="$dir/$objdir" 6350126a8a12Smrg else 6351126a8a12Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 6352126a8a12Smrg exit $EXIT_FAILURE 6353126a8a12Smrg fi 6354126a8a12Smrg ;; 6355126a8a12Smrg 6356126a8a12Smrg *.lo) 6357126a8a12Smrg # Just add the directory containing the .lo file. 6358126a8a12Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6359126a8a12Smrg test "X$dir" = "X$file" && dir=. 6360126a8a12Smrg ;; 6361126a8a12Smrg 6362126a8a12Smrg *) 6363126a8a12Smrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 6364126a8a12Smrg continue 6365126a8a12Smrg ;; 6366126a8a12Smrg esac 6367126a8a12Smrg 6368126a8a12Smrg # Get the absolute pathname. 6369126a8a12Smrg absdir=`cd "$dir" && pwd` 6370126a8a12Smrg test -n "$absdir" && dir="$absdir" 6371126a8a12Smrg 6372126a8a12Smrg # Now add the directory to shlibpath_var. 6373126a8a12Smrg if eval "test -z \"\$$shlibpath_var\""; then 6374126a8a12Smrg eval "$shlibpath_var=\"\$dir\"" 6375126a8a12Smrg else 6376126a8a12Smrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 6377126a8a12Smrg fi 6378126a8a12Smrg done 6379126a8a12Smrg 6380126a8a12Smrg # This variable tells wrapper scripts just to set shlibpath_var 6381126a8a12Smrg # rather than running their programs. 6382126a8a12Smrg libtool_execute_magic="$magic" 6383126a8a12Smrg 6384126a8a12Smrg # Check if any of the arguments is a wrapper script. 6385126a8a12Smrg args= 6386126a8a12Smrg for file 6387126a8a12Smrg do 6388126a8a12Smrg case $file in 6389126a8a12Smrg -*) ;; 6390126a8a12Smrg *) 6391126a8a12Smrg # Do a test to see if this is really a libtool program. 6392126a8a12Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6393126a8a12Smrg # If there is no directory component, then add one. 6394126a8a12Smrg case $file in 6395126a8a12Smrg */* | *\\*) . $file ;; 6396126a8a12Smrg *) . ./$file ;; 6397126a8a12Smrg esac 6398126a8a12Smrg 6399126a8a12Smrg # Transform arg to wrapped name. 6400126a8a12Smrg file="$progdir/$program" 6401126a8a12Smrg fi 6402126a8a12Smrg ;; 6403126a8a12Smrg esac 6404126a8a12Smrg # Quote arguments (to preserve shell metacharacters). 6405126a8a12Smrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 6406126a8a12Smrg args="$args \"$file\"" 6407126a8a12Smrg done 6408126a8a12Smrg 6409126a8a12Smrg if test -z "$run"; then 6410126a8a12Smrg if test -n "$shlibpath_var"; then 6411126a8a12Smrg # Export the shlibpath_var. 6412126a8a12Smrg eval "export $shlibpath_var" 6413126a8a12Smrg fi 6414126a8a12Smrg 6415126a8a12Smrg # Restore saved environment variables 6416126a8a12Smrg if test "${save_LC_ALL+set}" = set; then 6417126a8a12Smrg LC_ALL="$save_LC_ALL"; export LC_ALL 6418126a8a12Smrg fi 6419126a8a12Smrg if test "${save_LANG+set}" = set; then 6420126a8a12Smrg LANG="$save_LANG"; export LANG 6421126a8a12Smrg fi 6422126a8a12Smrg 6423126a8a12Smrg # Now prepare to actually exec the command. 6424126a8a12Smrg exec_cmd="\$cmd$args" 6425126a8a12Smrg else 6426126a8a12Smrg # Display what would be done. 6427126a8a12Smrg if test -n "$shlibpath_var"; then 6428126a8a12Smrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 6429126a8a12Smrg $echo "export $shlibpath_var" 6430126a8a12Smrg fi 6431126a8a12Smrg $echo "$cmd$args" 6432126a8a12Smrg exit $EXIT_SUCCESS 6433126a8a12Smrg fi 6434126a8a12Smrg ;; 6435126a8a12Smrg 6436126a8a12Smrg # libtool clean and uninstall mode 6437126a8a12Smrg clean | uninstall) 6438126a8a12Smrg modename="$modename: $mode" 6439126a8a12Smrg rm="$nonopt" 6440126a8a12Smrg files= 6441126a8a12Smrg rmforce= 6442126a8a12Smrg exit_status=0 6443126a8a12Smrg 6444126a8a12Smrg # This variable tells wrapper scripts just to set variables rather 6445126a8a12Smrg # than running their programs. 6446126a8a12Smrg libtool_install_magic="$magic" 6447126a8a12Smrg 6448126a8a12Smrg for arg 6449126a8a12Smrg do 6450126a8a12Smrg case $arg in 6451126a8a12Smrg -f) rm="$rm $arg"; rmforce=yes ;; 6452126a8a12Smrg -*) rm="$rm $arg" ;; 6453126a8a12Smrg *) files="$files $arg" ;; 6454126a8a12Smrg esac 6455126a8a12Smrg done 6456126a8a12Smrg 6457126a8a12Smrg if test -z "$rm"; then 6458126a8a12Smrg $echo "$modename: you must specify an RM program" 1>&2 6459126a8a12Smrg $echo "$help" 1>&2 6460126a8a12Smrg exit $EXIT_FAILURE 6461126a8a12Smrg fi 6462126a8a12Smrg 6463126a8a12Smrg rmdirs= 6464126a8a12Smrg 6465126a8a12Smrg origobjdir="$objdir" 6466126a8a12Smrg for file in $files; do 6467126a8a12Smrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6468126a8a12Smrg if test "X$dir" = "X$file"; then 6469126a8a12Smrg dir=. 6470126a8a12Smrg objdir="$origobjdir" 6471126a8a12Smrg else 6472126a8a12Smrg objdir="$dir/$origobjdir" 6473126a8a12Smrg fi 6474126a8a12Smrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6475126a8a12Smrg test "$mode" = uninstall && objdir="$dir" 6476126a8a12Smrg 6477126a8a12Smrg # Remember objdir for removal later, being careful to avoid duplicates 6478126a8a12Smrg if test "$mode" = clean; then 6479126a8a12Smrg case " $rmdirs " in 6480126a8a12Smrg *" $objdir "*) ;; 6481126a8a12Smrg *) rmdirs="$rmdirs $objdir" ;; 6482126a8a12Smrg esac 6483126a8a12Smrg fi 6484126a8a12Smrg 6485126a8a12Smrg # Don't error if the file doesn't exist and rm -f was used. 6486126a8a12Smrg if (test -L "$file") >/dev/null 2>&1 \ 6487126a8a12Smrg || (test -h "$file") >/dev/null 2>&1 \ 6488126a8a12Smrg || test -f "$file"; then 6489126a8a12Smrg : 6490126a8a12Smrg elif test -d "$file"; then 6491126a8a12Smrg exit_status=1 6492126a8a12Smrg continue 6493126a8a12Smrg elif test "$rmforce" = yes; then 6494126a8a12Smrg continue 6495126a8a12Smrg fi 6496126a8a12Smrg 6497126a8a12Smrg rmfiles="$file" 6498126a8a12Smrg 6499126a8a12Smrg case $name in 6500126a8a12Smrg *.la) 6501126a8a12Smrg # Possibly a libtool archive, so verify it. 6502126a8a12Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6503126a8a12Smrg . $dir/$name 6504126a8a12Smrg 6505126a8a12Smrg # Delete the libtool libraries and symlinks. 6506126a8a12Smrg for n in $library_names; do 6507126a8a12Smrg rmfiles="$rmfiles $objdir/$n" 6508126a8a12Smrg done 6509126a8a12Smrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6510126a8a12Smrg 6511126a8a12Smrg case "$mode" in 6512126a8a12Smrg clean) 6513126a8a12Smrg case " $library_names " in 6514126a8a12Smrg # " " in the beginning catches empty $dlname 6515126a8a12Smrg *" $dlname "*) ;; 6516126a8a12Smrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 6517126a8a12Smrg esac 6518126a8a12Smrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 6519126a8a12Smrg ;; 6520126a8a12Smrg uninstall) 6521126a8a12Smrg if test -n "$library_names"; then 6522126a8a12Smrg # Do each command in the postuninstall commands. 6523126a8a12Smrg cmds=$postuninstall_cmds 6524126a8a12Smrg save_ifs="$IFS"; IFS='~' 6525126a8a12Smrg for cmd in $cmds; do 6526126a8a12Smrg IFS="$save_ifs" 6527126a8a12Smrg eval cmd=\"$cmd\" 6528126a8a12Smrg $show "$cmd" 6529126a8a12Smrg $run eval "$cmd" 6530126a8a12Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 6531126a8a12Smrg exit_status=1 6532126a8a12Smrg fi 6533126a8a12Smrg done 6534126a8a12Smrg IFS="$save_ifs" 6535126a8a12Smrg fi 6536126a8a12Smrg 6537126a8a12Smrg if test -n "$old_library"; then 6538126a8a12Smrg # Do each command in the old_postuninstall commands. 6539126a8a12Smrg cmds=$old_postuninstall_cmds 6540126a8a12Smrg save_ifs="$IFS"; IFS='~' 6541126a8a12Smrg for cmd in $cmds; do 6542126a8a12Smrg IFS="$save_ifs" 6543126a8a12Smrg eval cmd=\"$cmd\" 6544126a8a12Smrg $show "$cmd" 6545126a8a12Smrg $run eval "$cmd" 6546126a8a12Smrg if test "$?" -ne 0 && test "$rmforce" != yes; then 6547126a8a12Smrg exit_status=1 6548126a8a12Smrg fi 6549126a8a12Smrg done 6550126a8a12Smrg IFS="$save_ifs" 6551126a8a12Smrg fi 6552126a8a12Smrg # FIXME: should reinstall the best remaining shared library. 6553126a8a12Smrg ;; 6554126a8a12Smrg esac 6555126a8a12Smrg fi 6556126a8a12Smrg ;; 6557126a8a12Smrg 6558126a8a12Smrg *.lo) 6559126a8a12Smrg # Possibly a libtool object, so verify it. 6560126a8a12Smrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6561126a8a12Smrg 6562126a8a12Smrg # Read the .lo file 6563126a8a12Smrg . $dir/$name 6564126a8a12Smrg 6565126a8a12Smrg # Add PIC object to the list of files to remove. 6566126a8a12Smrg if test -n "$pic_object" \ 6567126a8a12Smrg && test "$pic_object" != none; then 6568126a8a12Smrg rmfiles="$rmfiles $dir/$pic_object" 6569126a8a12Smrg fi 6570126a8a12Smrg 6571126a8a12Smrg # Add non-PIC object to the list of files to remove. 6572126a8a12Smrg if test -n "$non_pic_object" \ 6573126a8a12Smrg && test "$non_pic_object" != none; then 6574126a8a12Smrg rmfiles="$rmfiles $dir/$non_pic_object" 6575126a8a12Smrg fi 6576126a8a12Smrg fi 6577126a8a12Smrg ;; 6578126a8a12Smrg 6579126a8a12Smrg *) 6580126a8a12Smrg if test "$mode" = clean ; then 6581126a8a12Smrg noexename=$name 6582126a8a12Smrg case $file in 6583126a8a12Smrg *.exe) 6584126a8a12Smrg file=`$echo $file|${SED} 's,.exe$,,'` 6585126a8a12Smrg noexename=`$echo $name|${SED} 's,.exe$,,'` 6586126a8a12Smrg # $file with .exe has already been added to rmfiles, 6587126a8a12Smrg # add $file without .exe 6588126a8a12Smrg rmfiles="$rmfiles $file" 6589126a8a12Smrg ;; 6590126a8a12Smrg esac 6591126a8a12Smrg # Do a test to see if this is a libtool program. 6592126a8a12Smrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6593126a8a12Smrg relink_command= 6594126a8a12Smrg . $dir/$noexename 6595126a8a12Smrg 6596126a8a12Smrg # note $name still contains .exe if it was in $file originally 6597126a8a12Smrg # as does the version of $file that was added into $rmfiles 6598126a8a12Smrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 6599126a8a12Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 6600126a8a12Smrg rmfiles="$rmfiles $objdir/lt-$name" 6601126a8a12Smrg fi 6602126a8a12Smrg if test "X$noexename" != "X$name" ; then 6603126a8a12Smrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 6604126a8a12Smrg fi 6605126a8a12Smrg fi 6606126a8a12Smrg fi 6607126a8a12Smrg ;; 6608126a8a12Smrg esac 6609126a8a12Smrg $show "$rm $rmfiles" 6610126a8a12Smrg $run $rm $rmfiles || exit_status=1 6611126a8a12Smrg done 6612126a8a12Smrg objdir="$origobjdir" 6613126a8a12Smrg 6614126a8a12Smrg # Try to remove the ${objdir}s in the directories where we deleted files 6615126a8a12Smrg for dir in $rmdirs; do 6616126a8a12Smrg if test -d "$dir"; then 6617126a8a12Smrg $show "rmdir $dir" 6618126a8a12Smrg $run rmdir $dir >/dev/null 2>&1 6619126a8a12Smrg fi 6620126a8a12Smrg done 6621126a8a12Smrg 6622126a8a12Smrg exit $exit_status 6623126a8a12Smrg ;; 6624126a8a12Smrg 6625126a8a12Smrg "") 6626126a8a12Smrg $echo "$modename: you must specify a MODE" 1>&2 6627126a8a12Smrg $echo "$generic_help" 1>&2 6628126a8a12Smrg exit $EXIT_FAILURE 6629126a8a12Smrg ;; 6630126a8a12Smrg esac 6631126a8a12Smrg 6632126a8a12Smrg if test -z "$exec_cmd"; then 6633126a8a12Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 6634126a8a12Smrg $echo "$generic_help" 1>&2 6635126a8a12Smrg exit $EXIT_FAILURE 6636126a8a12Smrg fi 6637126a8a12Smrgfi # test -z "$show_help" 6638126a8a12Smrg 6639126a8a12Smrgif test -n "$exec_cmd"; then 6640126a8a12Smrg eval exec $exec_cmd 6641126a8a12Smrg exit $EXIT_FAILURE 6642126a8a12Smrgfi 6643126a8a12Smrg 6644126a8a12Smrg# We need to display help for each of the modes. 6645126a8a12Smrgcase $mode in 6646126a8a12Smrg"") $echo \ 6647126a8a12Smrg"Usage: $modename [OPTION]... [MODE-ARG]... 6648126a8a12Smrg 6649126a8a12SmrgProvide generalized library-building support services. 6650126a8a12Smrg 6651126a8a12Smrg --config show all configuration variables 6652126a8a12Smrg --debug enable verbose shell tracing 6653126a8a12Smrg-n, --dry-run display commands without modifying any files 6654126a8a12Smrg --features display basic configuration information and exit 6655126a8a12Smrg --finish same as \`--mode=finish' 6656126a8a12Smrg --help display this help message and exit 6657126a8a12Smrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 6658126a8a12Smrg --quiet same as \`--silent' 6659126a8a12Smrg --silent don't print informational messages 6660126a8a12Smrg --tag=TAG use configuration variables from tag TAG 6661126a8a12Smrg --version print version information 6662126a8a12Smrg 6663126a8a12SmrgMODE must be one of the following: 6664126a8a12Smrg 6665126a8a12Smrg clean remove files from the build directory 6666126a8a12Smrg compile compile a source file into a libtool object 6667126a8a12Smrg execute automatically set library path, then run a program 6668126a8a12Smrg finish complete the installation of libtool libraries 6669126a8a12Smrg install install libraries or executables 6670126a8a12Smrg link create a library or an executable 6671126a8a12Smrg uninstall remove libraries from an installed directory 6672126a8a12Smrg 6673126a8a12SmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 6674126a8a12Smrga more detailed description of MODE. 6675126a8a12Smrg 6676126a8a12SmrgReport bugs to <bug-libtool@gnu.org>." 6677126a8a12Smrg exit $EXIT_SUCCESS 6678126a8a12Smrg ;; 6679126a8a12Smrg 6680126a8a12Smrgclean) 6681126a8a12Smrg $echo \ 6682126a8a12Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 6683126a8a12Smrg 6684126a8a12SmrgRemove files from the build directory. 6685126a8a12Smrg 6686126a8a12SmrgRM is the name of the program to use to delete files associated with each FILE 6687126a8a12Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6688126a8a12Smrgto RM. 6689126a8a12Smrg 6690126a8a12SmrgIf FILE is a libtool library, object or program, all the files associated 6691126a8a12Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 6692126a8a12Smrg ;; 6693126a8a12Smrg 6694126a8a12Smrgcompile) 6695126a8a12Smrg $echo \ 6696126a8a12Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 6697126a8a12Smrg 6698126a8a12SmrgCompile a source file into a libtool library object. 6699126a8a12Smrg 6700126a8a12SmrgThis mode accepts the following additional options: 6701126a8a12Smrg 6702126a8a12Smrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 6703126a8a12Smrg -prefer-pic try to building PIC objects only 6704126a8a12Smrg -prefer-non-pic try to building non-PIC objects only 6705126a8a12Smrg -static always build a \`.o' file suitable for static linking 6706126a8a12Smrg 6707126a8a12SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 6708126a8a12Smrgfrom the given SOURCEFILE. 6709126a8a12Smrg 6710126a8a12SmrgThe output file name is determined by removing the directory component from 6711126a8a12SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 6712126a8a12Smrglibrary object suffix, \`.lo'." 6713126a8a12Smrg ;; 6714126a8a12Smrg 6715126a8a12Smrgexecute) 6716126a8a12Smrg $echo \ 6717126a8a12Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 6718126a8a12Smrg 6719126a8a12SmrgAutomatically set library path, then run a program. 6720126a8a12Smrg 6721126a8a12SmrgThis mode accepts the following additional options: 6722126a8a12Smrg 6723126a8a12Smrg -dlopen FILE add the directory containing FILE to the library path 6724126a8a12Smrg 6725126a8a12SmrgThis mode sets the library path environment variable according to \`-dlopen' 6726126a8a12Smrgflags. 6727126a8a12Smrg 6728126a8a12SmrgIf any of the ARGS are libtool executable wrappers, then they are translated 6729126a8a12Smrginto their corresponding uninstalled binary, and any of their required library 6730126a8a12Smrgdirectories are added to the library path. 6731126a8a12Smrg 6732126a8a12SmrgThen, COMMAND is executed, with ARGS as arguments." 6733126a8a12Smrg ;; 6734126a8a12Smrg 6735126a8a12Smrgfinish) 6736126a8a12Smrg $echo \ 6737126a8a12Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 6738126a8a12Smrg 6739126a8a12SmrgComplete the installation of libtool libraries. 6740126a8a12Smrg 6741126a8a12SmrgEach LIBDIR is a directory that contains libtool libraries. 6742126a8a12Smrg 6743126a8a12SmrgThe commands that this mode executes may require superuser privileges. Use 6744126a8a12Smrgthe \`--dry-run' option if you just want to see what would be executed." 6745126a8a12Smrg ;; 6746126a8a12Smrg 6747126a8a12Smrginstall) 6748126a8a12Smrg $echo \ 6749126a8a12Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 6750126a8a12Smrg 6751126a8a12SmrgInstall executables or libraries. 6752126a8a12Smrg 6753126a8a12SmrgINSTALL-COMMAND is the installation command. The first component should be 6754126a8a12Smrgeither the \`install' or \`cp' program. 6755126a8a12Smrg 6756126a8a12SmrgThe rest of the components are interpreted as arguments to that command (only 6757126a8a12SmrgBSD-compatible install options are recognized)." 6758126a8a12Smrg ;; 6759126a8a12Smrg 6760126a8a12Smrglink) 6761126a8a12Smrg $echo \ 6762126a8a12Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 6763126a8a12Smrg 6764126a8a12SmrgLink object files or libraries together to form another library, or to 6765126a8a12Smrgcreate an executable program. 6766126a8a12Smrg 6767126a8a12SmrgLINK-COMMAND is a command using the C compiler that you would use to create 6768126a8a12Smrga program from several object files. 6769126a8a12Smrg 6770126a8a12SmrgThe following components of LINK-COMMAND are treated specially: 6771126a8a12Smrg 6772126a8a12Smrg -all-static do not do any dynamic linking at all 6773126a8a12Smrg -avoid-version do not add a version suffix if possible 6774126a8a12Smrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 6775126a8a12Smrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 6776126a8a12Smrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 6777126a8a12Smrg -export-symbols SYMFILE 6778126a8a12Smrg try to export only the symbols listed in SYMFILE 6779126a8a12Smrg -export-symbols-regex REGEX 6780126a8a12Smrg try to export only the symbols matching REGEX 6781126a8a12Smrg -LLIBDIR search LIBDIR for required installed libraries 6782126a8a12Smrg -lNAME OUTPUT-FILE requires the installed library libNAME 6783126a8a12Smrg -module build a library that can dlopened 6784126a8a12Smrg -no-fast-install disable the fast-install mode 6785126a8a12Smrg -no-install link a not-installable executable 6786126a8a12Smrg -no-undefined declare that a library does not refer to external symbols 6787126a8a12Smrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 6788126a8a12Smrg -objectlist FILE Use a list of object files found in FILE to specify objects 6789126a8a12Smrg -precious-files-regex REGEX 6790126a8a12Smrg don't remove output files matching REGEX 6791126a8a12Smrg -release RELEASE specify package release information 6792126a8a12Smrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 6793126a8a12Smrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 6794126a8a12Smrg -static do not do any dynamic linking of libtool libraries 6795126a8a12Smrg -version-info CURRENT[:REVISION[:AGE]] 6796126a8a12Smrg specify library version info [each variable defaults to 0] 6797126a8a12Smrg 6798126a8a12SmrgAll other options (arguments beginning with \`-') are ignored. 6799126a8a12Smrg 6800126a8a12SmrgEvery other argument is treated as a filename. Files ending in \`.la' are 6801126a8a12Smrgtreated as uninstalled libtool libraries, other files are standard or library 6802126a8a12Smrgobject files. 6803126a8a12Smrg 6804126a8a12SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 6805126a8a12Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 6806126a8a12Smrgrequired, except when creating a convenience library. 6807126a8a12Smrg 6808126a8a12SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 6809126a8a12Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 6810126a8a12Smrg 6811126a8a12SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 6812126a8a12Smrgis created, otherwise an executable program is created." 6813126a8a12Smrg ;; 6814126a8a12Smrg 6815126a8a12Smrguninstall) 6816126a8a12Smrg $echo \ 6817126a8a12Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 6818126a8a12Smrg 6819126a8a12SmrgRemove libraries from an installation directory. 6820126a8a12Smrg 6821126a8a12SmrgRM is the name of the program to use to delete files associated with each FILE 6822126a8a12Smrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6823126a8a12Smrgto RM. 6824126a8a12Smrg 6825126a8a12SmrgIf FILE is a libtool library, all the files associated with it are deleted. 6826126a8a12SmrgOtherwise, only FILE itself is deleted using RM." 6827126a8a12Smrg ;; 6828126a8a12Smrg 6829126a8a12Smrg*) 6830126a8a12Smrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 6831126a8a12Smrg $echo "$help" 1>&2 6832126a8a12Smrg exit $EXIT_FAILURE 6833126a8a12Smrg ;; 6834126a8a12Smrgesac 6835126a8a12Smrg 6836126a8a12Smrg$echo 6837126a8a12Smrg$echo "Try \`$modename --help' for more information about other modes." 6838126a8a12Smrg 6839126a8a12Smrgexit $? 6840126a8a12Smrg 6841126a8a12Smrg# The TAGs below are defined such that we never get into a situation 6842126a8a12Smrg# in which we disable both kinds of libraries. Given conflicting 6843126a8a12Smrg# choices, we go for a static library, that is the most portable, 6844126a8a12Smrg# since we can't tell whether shared libraries were disabled because 6845126a8a12Smrg# the user asked for that or because the platform doesn't support 6846126a8a12Smrg# them. This is particularly important on AIX, because we don't 6847126a8a12Smrg# support having both static and shared libraries enabled at the same 6848126a8a12Smrg# time on that platform, so we default to a shared-only configuration. 6849126a8a12Smrg# If a disable-shared tag is given, we'll fallback to a static-only 6850126a8a12Smrg# configuration. But we'll never go from static-only to shared-only. 6851126a8a12Smrg 6852126a8a12Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6853126a8a12Smrgdisable_libs=shared 6854126a8a12Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 6855126a8a12Smrg 6856126a8a12Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6857126a8a12Smrgdisable_libs=static 6858126a8a12Smrg# ### END LIBTOOL TAG CONFIG: disable-static 6859126a8a12Smrg 6860126a8a12Smrg# Local Variables: 6861126a8a12Smrg# mode:shell-script 6862126a8a12Smrg# sh-indentation:2 6863126a8a12Smrg# End: 6864