1219820Sjeff# ltmain.sh - Provide generalized library-building support services. 2219820Sjeff# NOTE: Changing this file will not affect anything until you rerun configure. 3219820Sjeff# 4219820Sjeff# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 5219820Sjeff# Free Software Foundation, Inc. 6219820Sjeff# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7219820Sjeff# 8219820Sjeff# This program is free software; you can redistribute it and/or modify 9219820Sjeff# it under the terms of the GNU General Public License as published by 10219820Sjeff# the Free Software Foundation; either version 2 of the License, or 11219820Sjeff# (at your option) any later version. 12219820Sjeff# 13219820Sjeff# This program is distributed in the hope that it will be useful, but 14219820Sjeff# WITHOUT ANY WARRANTY; without even the implied warranty of 15219820Sjeff# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16219820Sjeff# General Public License for more details. 17219820Sjeff# 18219820Sjeff# You should have received a copy of the GNU General Public License 19219820Sjeff# along with this program; if not, write to the Free Software 20219820Sjeff# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21219820Sjeff# 22219820Sjeff# As a special exception to the GNU General Public License, if you 23219820Sjeff# distribute this file as part of a program that contains a 24219820Sjeff# configuration script generated by Autoconf, you may include it under 25219820Sjeff# the same distribution terms that you use for the rest of that program. 26219820Sjeff 27219820Sjeffbasename="s,^.*/,,g" 28219820Sjeff 29219820Sjeff# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 30219820Sjeff# is ksh but when the shell is invoked as "sh" and the current value of 31219820Sjeff# the _XPG environment variable is not equal to 1 (one), the special 32219820Sjeff# positional parameter $0, within a function call, is the name of the 33219820Sjeff# function. 34219820Sjeffprogpath="$0" 35219820Sjeff 36219820Sjeff# The name of this program: 37219820Sjeffprogname=`echo "$progpath" | $SED $basename` 38219820Sjeffmodename="$progname" 39219820Sjeff 40219820Sjeff# Global variables: 41219820SjeffEXIT_SUCCESS=0 42219820SjeffEXIT_FAILURE=1 43219820Sjeff 44219820SjeffPROGRAM=ltmain.sh 45219820SjeffPACKAGE=libtool 46219820SjeffVERSION="1.5.22 Debian 1.5.22-2" 47219820SjeffTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" 48219820Sjeff 49219820Sjeff# See if we are running on zsh, and set the options which allow our 50219820Sjeff# commands through without removal of \ escapes. 51219820Sjeffif test -n "${ZSH_VERSION+set}" ; then 52219820Sjeff setopt NO_GLOB_SUBST 53219820Sjefffi 54219820Sjeff 55219820Sjeff# Check that we have a working $echo. 56219820Sjeffif test "X$1" = X--no-reexec; then 57219820Sjeff # Discard the --no-reexec flag, and continue. 58219820Sjeff shift 59219820Sjeffelif test "X$1" = X--fallback-echo; then 60219820Sjeff # Avoid inline document here, it may be left over 61219820Sjeff : 62219820Sjeffelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 63219820Sjeff # Yippee, $echo works! 64219820Sjeff : 65219820Sjeffelse 66219820Sjeff # Restart under the correct shell, and then maybe $echo will work. 67219820Sjeff exec $SHELL "$progpath" --no-reexec ${1+"$@"} 68219820Sjefffi 69219820Sjeff 70219820Sjeffif test "X$1" = X--fallback-echo; then 71219820Sjeff # used as fallback echo 72219820Sjeff shift 73219820Sjeff cat <<EOF 74219820Sjeff$* 75219820SjeffEOF 76219820Sjeff exit $EXIT_SUCCESS 77219820Sjefffi 78219820Sjeff 79219820Sjeffdefault_mode= 80219820Sjeffhelp="Try \`$progname --help' for more information." 81219820Sjeffmagic="%%%MAGIC variable%%%" 82219820Sjeffmkdir="mkdir" 83219820Sjeffmv="mv -f" 84219820Sjeffrm="rm -f" 85219820Sjeff 86219820Sjeff# Sed substitution that helps us do robust quoting. It backslashifies 87219820Sjeff# metacharacters that are still active within double-quoted strings. 88219820SjeffXsed="${SED}"' -e 1s/^X//' 89219820Sjeffsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 90219820Sjeff# test EBCDIC or ASCII 91219820Sjeffcase `echo X|tr X '\101'` in 92219820Sjeff A) # ASCII based system 93219820Sjeff # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 94219820Sjeff SP2NL='tr \040 \012' 95219820Sjeff NL2SP='tr \015\012 \040\040' 96219820Sjeff ;; 97219820Sjeff *) # EBCDIC based system 98219820Sjeff SP2NL='tr \100 \n' 99219820Sjeff NL2SP='tr \r\n \100\100' 100219820Sjeff ;; 101219820Sjeffesac 102219820Sjeff 103219820Sjeff# NLS nuisances. 104219820Sjeff# Only set LANG and LC_ALL to C if already set. 105219820Sjeff# These must not be set unconditionally because not all systems understand 106219820Sjeff# e.g. LANG=C (notably SCO). 107219820Sjeff# We save the old values to restore during execute mode. 108219820Sjeffif test "${LC_ALL+set}" = set; then 109219820Sjeff save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL 110219820Sjefffi 111219820Sjeffif test "${LANG+set}" = set; then 112219820Sjeff save_LANG="$LANG"; LANG=C; export LANG 113219820Sjefffi 114219820Sjeff 115219820Sjeff# Make sure IFS has a sensible default 116219820Sjefflt_nl=' 117219820Sjeff' 118219820SjeffIFS=" $lt_nl" 119219820Sjeff 120219820Sjeffif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 121219820Sjeff $echo "$modename: not configured to build any kind of library" 1>&2 122219820Sjeff $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 123219820Sjeff exit $EXIT_FAILURE 124219820Sjefffi 125219820Sjeff 126219820Sjeff# Global variables. 127219820Sjeffmode=$default_mode 128219820Sjeffnonopt= 129219820Sjeffprev= 130219820Sjeffprevopt= 131219820Sjeffrun= 132219820Sjeffshow="$echo" 133219820Sjeffshow_help= 134219820Sjeffexecute_dlfiles= 135219820Sjeffduplicate_deps=no 136219820Sjeffpreserve_args= 137219820Sjefflo2o="s/\\.lo\$/.${objext}/" 138219820Sjeffo2lo="s/\\.${objext}\$/.lo/" 139219820Sjeff 140219820Sjeff##################################### 141219820Sjeff# Shell function definitions: 142219820Sjeff# This seems to be the best place for them 143219820Sjeff 144219820Sjeff# func_mktempdir [string] 145219820Sjeff# Make a temporary directory that won't clash with other running 146219820Sjeff# libtool processes, and avoids race conditions if possible. If 147219820Sjeff# given, STRING is the basename for that directory. 148219820Sjefffunc_mktempdir () 149219820Sjeff{ 150219820Sjeff my_template="${TMPDIR-/tmp}/${1-$progname}" 151219820Sjeff 152219820Sjeff if test "$run" = ":"; then 153219820Sjeff # Return a directory name, but don't create it in dry-run mode 154219820Sjeff my_tmpdir="${my_template}-$$" 155219820Sjeff else 156219820Sjeff 157219820Sjeff # If mktemp works, use that first and foremost 158219820Sjeff my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 159219820Sjeff 160219820Sjeff if test ! -d "$my_tmpdir"; then 161219820Sjeff # Failing that, at least try and use $RANDOM to avoid a race 162219820Sjeff my_tmpdir="${my_template}-${RANDOM-0}$$" 163219820Sjeff 164219820Sjeff save_mktempdir_umask=`umask` 165219820Sjeff umask 0077 166219820Sjeff $mkdir "$my_tmpdir" 167219820Sjeff umask $save_mktempdir_umask 168219820Sjeff fi 169219820Sjeff 170219820Sjeff # If we're not in dry-run mode, bomb out on failure 171219820Sjeff test -d "$my_tmpdir" || { 172219820Sjeff $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 173219820Sjeff exit $EXIT_FAILURE 174219820Sjeff } 175219820Sjeff fi 176219820Sjeff 177219820Sjeff $echo "X$my_tmpdir" | $Xsed 178219820Sjeff} 179219820Sjeff 180219820Sjeff 181219820Sjeff# func_win32_libid arg 182219820Sjeff# return the library type of file 'arg' 183219820Sjeff# 184219820Sjeff# Need a lot of goo to handle *both* DLLs and import libs 185219820Sjeff# Has to be a shell function in order to 'eat' the argument 186219820Sjeff# that is supplied when $file_magic_command is called. 187219820Sjefffunc_win32_libid () 188219820Sjeff{ 189219820Sjeff win32_libid_type="unknown" 190219820Sjeff win32_fileres=`file -L $1 2>/dev/null` 191219820Sjeff case $win32_fileres in 192219820Sjeff *ar\ archive\ import\ library*) # definitely import 193219820Sjeff win32_libid_type="x86 archive import" 194219820Sjeff ;; 195219820Sjeff *ar\ archive*) # could be an import, or static 196219820Sjeff if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 197219820Sjeff $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 198219820Sjeff win32_nmres=`eval $NM -f posix -A $1 | \ 199219820Sjeff $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` 200219820Sjeff case $win32_nmres in 201219820Sjeff import*) win32_libid_type="x86 archive import";; 202219820Sjeff *) win32_libid_type="x86 archive static";; 203219820Sjeff esac 204219820Sjeff fi 205219820Sjeff ;; 206219820Sjeff *DLL*) 207219820Sjeff win32_libid_type="x86 DLL" 208219820Sjeff ;; 209219820Sjeff *executable*) # but shell scripts are "executable" too... 210219820Sjeff case $win32_fileres in 211219820Sjeff *MS\ Windows\ PE\ Intel*) 212219820Sjeff win32_libid_type="x86 DLL" 213219820Sjeff ;; 214219820Sjeff esac 215219820Sjeff ;; 216219820Sjeff esac 217219820Sjeff $echo $win32_libid_type 218219820Sjeff} 219219820Sjeff 220219820Sjeff 221219820Sjeff# func_infer_tag arg 222219820Sjeff# Infer tagged configuration to use if any are available and 223219820Sjeff# if one wasn't chosen via the "--tag" command line option. 224219820Sjeff# Only attempt this if the compiler in the base compile 225219820Sjeff# command doesn't match the default compiler. 226219820Sjeff# arg is usually of the form 'gcc ...' 227219820Sjefffunc_infer_tag () 228219820Sjeff{ 229219820Sjeff if test -n "$available_tags" && test -z "$tagname"; then 230219820Sjeff CC_quoted= 231219820Sjeff for arg in $CC; do 232219820Sjeff case $arg in 233219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 234219820Sjeff arg="\"$arg\"" 235219820Sjeff ;; 236219820Sjeff esac 237219820Sjeff CC_quoted="$CC_quoted $arg" 238219820Sjeff done 239219820Sjeff case $@ in 240219820Sjeff # Blanks in the command may have been stripped by the calling shell, 241219820Sjeff # but not from the CC environment variable when configure was run. 242219820Sjeff " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 243219820Sjeff # Blanks at the start of $base_compile will cause this to fail 244219820Sjeff # if we don't check for them as well. 245219820Sjeff *) 246219820Sjeff for z in $available_tags; do 247219820Sjeff if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 248219820Sjeff # Evaluate the configuration. 249219820Sjeff eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 250219820Sjeff CC_quoted= 251219820Sjeff for arg in $CC; do 252219820Sjeff # Double-quote args containing other shell metacharacters. 253219820Sjeff case $arg in 254219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 255219820Sjeff arg="\"$arg\"" 256219820Sjeff ;; 257219820Sjeff esac 258219820Sjeff CC_quoted="$CC_quoted $arg" 259219820Sjeff done 260219820Sjeff case "$@ " in 261219820Sjeff " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 262219820Sjeff # The compiler in the base compile command matches 263219820Sjeff # the one in the tagged configuration. 264219820Sjeff # Assume this is the tagged configuration we want. 265219820Sjeff tagname=$z 266219820Sjeff break 267219820Sjeff ;; 268219820Sjeff esac 269219820Sjeff fi 270219820Sjeff done 271219820Sjeff # If $tagname still isn't set, then no tagged configuration 272219820Sjeff # was found and let the user know that the "--tag" command 273219820Sjeff # line option must be used. 274219820Sjeff if test -z "$tagname"; then 275219820Sjeff $echo "$modename: unable to infer tagged configuration" 276219820Sjeff $echo "$modename: specify a tag with \`--tag'" 1>&2 277219820Sjeff exit $EXIT_FAILURE 278219820Sjeff# else 279219820Sjeff# $echo "$modename: using $tagname tagged configuration" 280219820Sjeff fi 281219820Sjeff ;; 282219820Sjeff esac 283219820Sjeff fi 284219820Sjeff} 285219820Sjeff 286219820Sjeff 287219820Sjeff# func_extract_an_archive dir oldlib 288219820Sjefffunc_extract_an_archive () 289219820Sjeff{ 290219820Sjeff f_ex_an_ar_dir="$1"; shift 291219820Sjeff f_ex_an_ar_oldlib="$1" 292219820Sjeff 293219820Sjeff $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 294219820Sjeff $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 295219820Sjeff if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 296219820Sjeff : 297219820Sjeff else 298219820Sjeff $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 299219820Sjeff exit $EXIT_FAILURE 300219820Sjeff fi 301219820Sjeff} 302219820Sjeff 303219820Sjeff# func_extract_archives gentop oldlib ... 304219820Sjefffunc_extract_archives () 305219820Sjeff{ 306219820Sjeff my_gentop="$1"; shift 307219820Sjeff my_oldlibs=${1+"$@"} 308219820Sjeff my_oldobjs="" 309219820Sjeff my_xlib="" 310219820Sjeff my_xabs="" 311219820Sjeff my_xdir="" 312219820Sjeff my_status="" 313219820Sjeff 314219820Sjeff $show "${rm}r $my_gentop" 315219820Sjeff $run ${rm}r "$my_gentop" 316219820Sjeff $show "$mkdir $my_gentop" 317219820Sjeff $run $mkdir "$my_gentop" 318219820Sjeff my_status=$? 319219820Sjeff if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 320219820Sjeff exit $my_status 321219820Sjeff fi 322219820Sjeff 323219820Sjeff for my_xlib in $my_oldlibs; do 324219820Sjeff # Extract the objects. 325219820Sjeff case $my_xlib in 326219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 327219820Sjeff *) my_xabs=`pwd`"/$my_xlib" ;; 328219820Sjeff esac 329219820Sjeff my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 330219820Sjeff my_xdir="$my_gentop/$my_xlib" 331219820Sjeff 332219820Sjeff $show "${rm}r $my_xdir" 333219820Sjeff $run ${rm}r "$my_xdir" 334219820Sjeff $show "$mkdir $my_xdir" 335219820Sjeff $run $mkdir "$my_xdir" 336219820Sjeff exit_status=$? 337219820Sjeff if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 338219820Sjeff exit $exit_status 339219820Sjeff fi 340219820Sjeff case $host in 341219820Sjeff *-darwin*) 342219820Sjeff $show "Extracting $my_xabs" 343219820Sjeff # Do not bother doing anything if just a dry run 344219820Sjeff if test -z "$run"; then 345219820Sjeff darwin_orig_dir=`pwd` 346219820Sjeff cd $my_xdir || exit $? 347219820Sjeff darwin_archive=$my_xabs 348219820Sjeff darwin_curdir=`pwd` 349219820Sjeff darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 350219820Sjeff darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 351219820Sjeff if test -n "$darwin_arches"; then 352219820Sjeff darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 353219820Sjeff darwin_arch= 354219820Sjeff $show "$darwin_base_archive has multiple architectures $darwin_arches" 355219820Sjeff for darwin_arch in $darwin_arches ; do 356219820Sjeff mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 357219820Sjeff lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 358219820Sjeff cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 359219820Sjeff func_extract_an_archive "`pwd`" "${darwin_base_archive}" 360219820Sjeff cd "$darwin_curdir" 361219820Sjeff $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 362219820Sjeff done # $darwin_arches 363219820Sjeff ## Okay now we have a bunch of thin objects, gotta fatten them up :) 364219820Sjeff darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 365219820Sjeff darwin_file= 366219820Sjeff darwin_files= 367219820Sjeff for darwin_file in $darwin_filelist; do 368219820Sjeff darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 369219820Sjeff lipo -create -output "$darwin_file" $darwin_files 370219820Sjeff done # $darwin_filelist 371219820Sjeff ${rm}r unfat-$$ 372219820Sjeff cd "$darwin_orig_dir" 373219820Sjeff else 374219820Sjeff cd "$darwin_orig_dir" 375219820Sjeff func_extract_an_archive "$my_xdir" "$my_xabs" 376219820Sjeff fi # $darwin_arches 377219820Sjeff fi # $run 378219820Sjeff ;; 379219820Sjeff *) 380219820Sjeff func_extract_an_archive "$my_xdir" "$my_xabs" 381219820Sjeff ;; 382219820Sjeff esac 383219820Sjeff my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 384219820Sjeff done 385219820Sjeff func_extract_archives_result="$my_oldobjs" 386219820Sjeff} 387219820Sjeff# End of Shell function definitions 388219820Sjeff##################################### 389219820Sjeff 390219820Sjeff# Darwin sucks 391219820Sjeffeval std_shrext=\"$shrext_cmds\" 392219820Sjeff 393219820Sjeffdisable_libs=no 394219820Sjeff 395219820Sjeff# Parse our command line options once, thoroughly. 396219820Sjeffwhile test "$#" -gt 0 397219820Sjeffdo 398219820Sjeff arg="$1" 399219820Sjeff shift 400219820Sjeff 401219820Sjeff case $arg in 402219820Sjeff -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 403219820Sjeff *) optarg= ;; 404219820Sjeff esac 405219820Sjeff 406219820Sjeff # If the previous option needs an argument, assign it. 407219820Sjeff if test -n "$prev"; then 408219820Sjeff case $prev in 409219820Sjeff execute_dlfiles) 410219820Sjeff execute_dlfiles="$execute_dlfiles $arg" 411219820Sjeff ;; 412219820Sjeff tag) 413219820Sjeff tagname="$arg" 414219820Sjeff preserve_args="${preserve_args}=$arg" 415219820Sjeff 416219820Sjeff # Check whether tagname contains only valid characters 417219820Sjeff case $tagname in 418219820Sjeff *[!-_A-Za-z0-9,/]*) 419219820Sjeff $echo "$progname: invalid tag name: $tagname" 1>&2 420219820Sjeff exit $EXIT_FAILURE 421219820Sjeff ;; 422219820Sjeff esac 423219820Sjeff 424219820Sjeff case $tagname in 425219820Sjeff CC) 426219820Sjeff # Don't test for the "default" C tag, as we know, it's there, but 427219820Sjeff # not specially marked. 428219820Sjeff ;; 429219820Sjeff *) 430219820Sjeff if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 431219820Sjeff taglist="$taglist $tagname" 432219820Sjeff # Evaluate the configuration. 433219820Sjeff eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 434219820Sjeff else 435219820Sjeff $echo "$progname: ignoring unknown tag $tagname" 1>&2 436219820Sjeff fi 437219820Sjeff ;; 438219820Sjeff esac 439219820Sjeff ;; 440219820Sjeff *) 441219820Sjeff eval "$prev=\$arg" 442219820Sjeff ;; 443219820Sjeff esac 444219820Sjeff 445219820Sjeff prev= 446219820Sjeff prevopt= 447219820Sjeff continue 448219820Sjeff fi 449219820Sjeff 450219820Sjeff # Have we seen a non-optional argument yet? 451219820Sjeff case $arg in 452219820Sjeff --help) 453219820Sjeff show_help=yes 454219820Sjeff ;; 455219820Sjeff 456219820Sjeff --version) 457219820Sjeff $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 458219820Sjeff $echo 459219820Sjeff $echo "Copyright (C) 2005 Free Software Foundation, Inc." 460219820Sjeff $echo "This is free software; see the source for copying conditions. There is NO" 461219820Sjeff $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 462219820Sjeff exit $? 463219820Sjeff ;; 464219820Sjeff 465219820Sjeff --config) 466219820Sjeff ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 467219820Sjeff # Now print the configurations for the tags. 468219820Sjeff for tagname in $taglist; do 469219820Sjeff ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 470219820Sjeff done 471219820Sjeff exit $? 472219820Sjeff ;; 473219820Sjeff 474219820Sjeff --debug) 475219820Sjeff $echo "$progname: enabling shell trace mode" 476219820Sjeff set -x 477219820Sjeff preserve_args="$preserve_args $arg" 478219820Sjeff ;; 479219820Sjeff 480219820Sjeff --dry-run | -n) 481219820Sjeff run=: 482219820Sjeff ;; 483219820Sjeff 484219820Sjeff --features) 485219820Sjeff $echo "host: $host" 486219820Sjeff if test "$build_libtool_libs" = yes; then 487219820Sjeff $echo "enable shared libraries" 488219820Sjeff else 489219820Sjeff $echo "disable shared libraries" 490219820Sjeff fi 491219820Sjeff if test "$build_old_libs" = yes; then 492219820Sjeff $echo "enable static libraries" 493219820Sjeff else 494219820Sjeff $echo "disable static libraries" 495219820Sjeff fi 496219820Sjeff exit $? 497219820Sjeff ;; 498219820Sjeff 499219820Sjeff --finish) mode="finish" ;; 500219820Sjeff 501219820Sjeff --mode) prevopt="--mode" prev=mode ;; 502219820Sjeff --mode=*) mode="$optarg" ;; 503219820Sjeff 504219820Sjeff --preserve-dup-deps) duplicate_deps="yes" ;; 505219820Sjeff 506219820Sjeff --quiet | --silent) 507219820Sjeff show=: 508219820Sjeff preserve_args="$preserve_args $arg" 509219820Sjeff ;; 510219820Sjeff 511219820Sjeff --tag) 512219820Sjeff prevopt="--tag" 513219820Sjeff prev=tag 514219820Sjeff preserve_args="$preserve_args --tag" 515219820Sjeff ;; 516219820Sjeff --tag=*) 517219820Sjeff set tag "$optarg" ${1+"$@"} 518219820Sjeff shift 519219820Sjeff prev=tag 520219820Sjeff preserve_args="$preserve_args --tag" 521219820Sjeff ;; 522219820Sjeff 523219820Sjeff -dlopen) 524219820Sjeff prevopt="-dlopen" 525219820Sjeff prev=execute_dlfiles 526219820Sjeff ;; 527219820Sjeff 528219820Sjeff -*) 529219820Sjeff $echo "$modename: unrecognized option \`$arg'" 1>&2 530219820Sjeff $echo "$help" 1>&2 531219820Sjeff exit $EXIT_FAILURE 532219820Sjeff ;; 533219820Sjeff 534219820Sjeff *) 535219820Sjeff nonopt="$arg" 536219820Sjeff break 537219820Sjeff ;; 538219820Sjeff esac 539219820Sjeffdone 540219820Sjeff 541219820Sjeffif test -n "$prevopt"; then 542219820Sjeff $echo "$modename: option \`$prevopt' requires an argument" 1>&2 543219820Sjeff $echo "$help" 1>&2 544219820Sjeff exit $EXIT_FAILURE 545219820Sjefffi 546219820Sjeff 547219820Sjeffcase $disable_libs in 548219820Sjeffno) 549219820Sjeff ;; 550219820Sjeffshared) 551219820Sjeff build_libtool_libs=no 552219820Sjeff build_old_libs=yes 553219820Sjeff ;; 554219820Sjeffstatic) 555219820Sjeff build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 556219820Sjeff ;; 557219820Sjeffesac 558219820Sjeff 559219820Sjeff# If this variable is set in any of the actions, the command in it 560219820Sjeff# will be execed at the end. This prevents here-documents from being 561219820Sjeff# left over by shells. 562219820Sjeffexec_cmd= 563219820Sjeff 564219820Sjeffif test -z "$show_help"; then 565219820Sjeff 566219820Sjeff # Infer the operation mode. 567219820Sjeff if test -z "$mode"; then 568219820Sjeff $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 569219820Sjeff $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 570219820Sjeff case $nonopt in 571219820Sjeff *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 572219820Sjeff mode=link 573219820Sjeff for arg 574219820Sjeff do 575219820Sjeff case $arg in 576219820Sjeff -c) 577219820Sjeff mode=compile 578219820Sjeff break 579219820Sjeff ;; 580219820Sjeff esac 581219820Sjeff done 582219820Sjeff ;; 583219820Sjeff *db | *dbx | *strace | *truss) 584219820Sjeff mode=execute 585219820Sjeff ;; 586219820Sjeff *install*|cp|mv) 587219820Sjeff mode=install 588219820Sjeff ;; 589219820Sjeff *rm) 590219820Sjeff mode=uninstall 591219820Sjeff ;; 592219820Sjeff *) 593219820Sjeff # If we have no mode, but dlfiles were specified, then do execute mode. 594219820Sjeff test -n "$execute_dlfiles" && mode=execute 595219820Sjeff 596219820Sjeff # Just use the default operation mode. 597219820Sjeff if test -z "$mode"; then 598219820Sjeff if test -n "$nonopt"; then 599219820Sjeff $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 600219820Sjeff else 601219820Sjeff $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 602219820Sjeff fi 603219820Sjeff fi 604219820Sjeff ;; 605219820Sjeff esac 606219820Sjeff fi 607219820Sjeff 608219820Sjeff # Only execute mode is allowed to have -dlopen flags. 609219820Sjeff if test -n "$execute_dlfiles" && test "$mode" != execute; then 610219820Sjeff $echo "$modename: unrecognized option \`-dlopen'" 1>&2 611219820Sjeff $echo "$help" 1>&2 612219820Sjeff exit $EXIT_FAILURE 613219820Sjeff fi 614219820Sjeff 615219820Sjeff # Change the help message to a mode-specific one. 616219820Sjeff generic_help="$help" 617219820Sjeff help="Try \`$modename --help --mode=$mode' for more information." 618219820Sjeff 619219820Sjeff # These modes are in order of execution frequency so that they run quickly. 620219820Sjeff case $mode in 621219820Sjeff # libtool compile mode 622219820Sjeff compile) 623219820Sjeff modename="$modename: compile" 624219820Sjeff # Get the compilation command and the source file. 625219820Sjeff base_compile= 626219820Sjeff srcfile="$nonopt" # always keep a non-empty value in "srcfile" 627219820Sjeff suppress_opt=yes 628219820Sjeff suppress_output= 629219820Sjeff arg_mode=normal 630219820Sjeff libobj= 631219820Sjeff later= 632219820Sjeff 633219820Sjeff for arg 634219820Sjeff do 635219820Sjeff case $arg_mode in 636219820Sjeff arg ) 637219820Sjeff # do not "continue". Instead, add this to base_compile 638219820Sjeff lastarg="$arg" 639219820Sjeff arg_mode=normal 640219820Sjeff ;; 641219820Sjeff 642219820Sjeff target ) 643219820Sjeff libobj="$arg" 644219820Sjeff arg_mode=normal 645219820Sjeff continue 646219820Sjeff ;; 647219820Sjeff 648219820Sjeff normal ) 649219820Sjeff # Accept any command-line options. 650219820Sjeff case $arg in 651219820Sjeff -o) 652219820Sjeff if test -n "$libobj" ; then 653219820Sjeff $echo "$modename: you cannot specify \`-o' more than once" 1>&2 654219820Sjeff exit $EXIT_FAILURE 655219820Sjeff fi 656219820Sjeff arg_mode=target 657219820Sjeff continue 658219820Sjeff ;; 659219820Sjeff 660219820Sjeff -static | -prefer-pic | -prefer-non-pic) 661219820Sjeff later="$later $arg" 662219820Sjeff continue 663219820Sjeff ;; 664219820Sjeff 665219820Sjeff -no-suppress) 666219820Sjeff suppress_opt=no 667219820Sjeff continue 668219820Sjeff ;; 669219820Sjeff 670219820Sjeff -Xcompiler) 671219820Sjeff arg_mode=arg # the next one goes into the "base_compile" arg list 672219820Sjeff continue # The current "srcfile" will either be retained or 673219820Sjeff ;; # replaced later. I would guess that would be a bug. 674219820Sjeff 675219820Sjeff -Wc,*) 676219820Sjeff args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 677219820Sjeff lastarg= 678219820Sjeff save_ifs="$IFS"; IFS=',' 679219820Sjeff for arg in $args; do 680219820Sjeff IFS="$save_ifs" 681219820Sjeff 682219820Sjeff # Double-quote args containing other shell metacharacters. 683219820Sjeff # Many Bourne shells cannot handle close brackets correctly 684219820Sjeff # in scan sets, so we specify it separately. 685219820Sjeff case $arg in 686219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 687219820Sjeff arg="\"$arg\"" 688219820Sjeff ;; 689219820Sjeff esac 690219820Sjeff lastarg="$lastarg $arg" 691219820Sjeff done 692219820Sjeff IFS="$save_ifs" 693219820Sjeff lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 694219820Sjeff 695219820Sjeff # Add the arguments to base_compile. 696219820Sjeff base_compile="$base_compile $lastarg" 697219820Sjeff continue 698219820Sjeff ;; 699219820Sjeff 700219820Sjeff * ) 701219820Sjeff # Accept the current argument as the source file. 702219820Sjeff # The previous "srcfile" becomes the current argument. 703219820Sjeff # 704219820Sjeff lastarg="$srcfile" 705219820Sjeff srcfile="$arg" 706219820Sjeff ;; 707219820Sjeff esac # case $arg 708219820Sjeff ;; 709219820Sjeff esac # case $arg_mode 710219820Sjeff 711219820Sjeff # Aesthetically quote the previous argument. 712219820Sjeff lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 713219820Sjeff 714219820Sjeff case $lastarg in 715219820Sjeff # Double-quote args containing other shell metacharacters. 716219820Sjeff # Many Bourne shells cannot handle close brackets correctly 717219820Sjeff # in scan sets, and some SunOS ksh mistreat backslash-escaping 718219820Sjeff # in scan sets (worked around with variable expansion), 719219820Sjeff # and furthermore cannot handle '|' '&' '(' ')' in scan sets 720219820Sjeff # at all, so we specify them separately. 721219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 722219820Sjeff lastarg="\"$lastarg\"" 723219820Sjeff ;; 724219820Sjeff esac 725219820Sjeff 726219820Sjeff base_compile="$base_compile $lastarg" 727219820Sjeff done # for arg 728219820Sjeff 729219820Sjeff case $arg_mode in 730219820Sjeff arg) 731219820Sjeff $echo "$modename: you must specify an argument for -Xcompile" 732219820Sjeff exit $EXIT_FAILURE 733219820Sjeff ;; 734219820Sjeff target) 735219820Sjeff $echo "$modename: you must specify a target with \`-o'" 1>&2 736219820Sjeff exit $EXIT_FAILURE 737219820Sjeff ;; 738219820Sjeff *) 739219820Sjeff # Get the name of the library object. 740219820Sjeff [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 741219820Sjeff ;; 742219820Sjeff esac 743219820Sjeff 744219820Sjeff # Recognize several different file suffixes. 745219820Sjeff # If the user specifies -o file.o, it is replaced with file.lo 746219820Sjeff xform='[cCFSifmso]' 747219820Sjeff case $libobj in 748219820Sjeff *.ada) xform=ada ;; 749219820Sjeff *.adb) xform=adb ;; 750219820Sjeff *.ads) xform=ads ;; 751219820Sjeff *.asm) xform=asm ;; 752219820Sjeff *.c++) xform=c++ ;; 753219820Sjeff *.cc) xform=cc ;; 754219820Sjeff *.ii) xform=ii ;; 755219820Sjeff *.class) xform=class ;; 756219820Sjeff *.cpp) xform=cpp ;; 757219820Sjeff *.cxx) xform=cxx ;; 758219820Sjeff *.f90) xform=f90 ;; 759219820Sjeff *.for) xform=for ;; 760219820Sjeff *.java) xform=java ;; 761219820Sjeff esac 762219820Sjeff 763219820Sjeff libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 764219820Sjeff 765219820Sjeff case $libobj in 766219820Sjeff *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 767219820Sjeff *) 768219820Sjeff $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 769219820Sjeff exit $EXIT_FAILURE 770219820Sjeff ;; 771219820Sjeff esac 772219820Sjeff 773219820Sjeff func_infer_tag $base_compile 774219820Sjeff 775219820Sjeff for arg in $later; do 776219820Sjeff case $arg in 777219820Sjeff -static) 778219820Sjeff build_old_libs=yes 779219820Sjeff continue 780219820Sjeff ;; 781219820Sjeff 782219820Sjeff -prefer-pic) 783219820Sjeff pic_mode=yes 784219820Sjeff continue 785219820Sjeff ;; 786219820Sjeff 787219820Sjeff -prefer-non-pic) 788219820Sjeff pic_mode=no 789219820Sjeff continue 790219820Sjeff ;; 791219820Sjeff esac 792219820Sjeff done 793219820Sjeff 794219820Sjeff qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 795219820Sjeff case $qlibobj in 796219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 797219820Sjeff qlibobj="\"$qlibobj\"" ;; 798219820Sjeff esac 799219820Sjeff test "X$libobj" != "X$qlibobj" \ 800219820Sjeff && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 801219820Sjeff && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 802219820Sjeff objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 803219820Sjeff xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 804219820Sjeff if test "X$xdir" = "X$obj"; then 805219820Sjeff xdir= 806219820Sjeff else 807219820Sjeff xdir=$xdir/ 808219820Sjeff fi 809219820Sjeff lobj=${xdir}$objdir/$objname 810219820Sjeff 811219820Sjeff if test -z "$base_compile"; then 812219820Sjeff $echo "$modename: you must specify a compilation command" 1>&2 813219820Sjeff $echo "$help" 1>&2 814219820Sjeff exit $EXIT_FAILURE 815219820Sjeff fi 816219820Sjeff 817219820Sjeff # Delete any leftover library objects. 818219820Sjeff if test "$build_old_libs" = yes; then 819219820Sjeff removelist="$obj $lobj $libobj ${libobj}T" 820219820Sjeff else 821219820Sjeff removelist="$lobj $libobj ${libobj}T" 822219820Sjeff fi 823219820Sjeff 824219820Sjeff $run $rm $removelist 825219820Sjeff trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 826219820Sjeff 827219820Sjeff # On Cygwin there's no "real" PIC flag so we must build both object types 828219820Sjeff case $host_os in 829219820Sjeff cygwin* | mingw* | pw32* | os2*) 830219820Sjeff pic_mode=default 831219820Sjeff ;; 832219820Sjeff esac 833219820Sjeff if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 834219820Sjeff # non-PIC code in shared libraries is not supported 835219820Sjeff pic_mode=default 836219820Sjeff fi 837219820Sjeff 838219820Sjeff # Calculate the filename of the output object if compiler does 839219820Sjeff # not support -o with -c 840219820Sjeff if test "$compiler_c_o" = no; then 841219820Sjeff output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 842219820Sjeff lockfile="$output_obj.lock" 843219820Sjeff removelist="$removelist $output_obj $lockfile" 844219820Sjeff trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 845219820Sjeff else 846219820Sjeff output_obj= 847219820Sjeff need_locks=no 848219820Sjeff lockfile= 849219820Sjeff fi 850219820Sjeff 851219820Sjeff # Lock this critical section if it is needed 852219820Sjeff # We use this script file to make the link, it avoids creating a new file 853219820Sjeff if test "$need_locks" = yes; then 854219820Sjeff until $run ln "$progpath" "$lockfile" 2>/dev/null; do 855219820Sjeff $show "Waiting for $lockfile to be removed" 856219820Sjeff sleep 2 857219820Sjeff done 858219820Sjeff elif test "$need_locks" = warn; then 859219820Sjeff if test -f "$lockfile"; then 860219820Sjeff $echo "\ 861219820Sjeff*** ERROR, $lockfile exists and contains: 862219820Sjeff`cat $lockfile 2>/dev/null` 863219820Sjeff 864219820SjeffThis indicates that another process is trying to use the same 865219820Sjefftemporary object file, and libtool could not work around it because 866219820Sjeffyour compiler does not support \`-c' and \`-o' together. If you 867219820Sjeffrepeat this compilation, it may succeed, by chance, but you had better 868219820Sjeffavoid parallel builds (make -j) in this platform, or get a better 869219820Sjeffcompiler." 870219820Sjeff 871219820Sjeff $run $rm $removelist 872219820Sjeff exit $EXIT_FAILURE 873219820Sjeff fi 874219820Sjeff $echo "$srcfile" > "$lockfile" 875219820Sjeff fi 876219820Sjeff 877219820Sjeff if test -n "$fix_srcfile_path"; then 878219820Sjeff eval srcfile=\"$fix_srcfile_path\" 879219820Sjeff fi 880219820Sjeff qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 881219820Sjeff case $qsrcfile in 882219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 883219820Sjeff qsrcfile="\"$qsrcfile\"" ;; 884219820Sjeff esac 885219820Sjeff 886219820Sjeff $run $rm "$libobj" "${libobj}T" 887219820Sjeff 888219820Sjeff # Create a libtool object file (analogous to a ".la" file), 889219820Sjeff # but don't create it if we're doing a dry run. 890219820Sjeff test -z "$run" && cat > ${libobj}T <<EOF 891219820Sjeff# $libobj - a libtool object file 892219820Sjeff# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 893219820Sjeff# 894219820Sjeff# Please DO NOT delete this file! 895219820Sjeff# It is necessary for linking the library. 896219820Sjeff 897219820Sjeff# Name of the PIC object. 898219820SjeffEOF 899219820Sjeff 900219820Sjeff # Only build a PIC object if we are building libtool libraries. 901219820Sjeff if test "$build_libtool_libs" = yes; then 902219820Sjeff # Without this assignment, base_compile gets emptied. 903219820Sjeff fbsd_hideous_sh_bug=$base_compile 904219820Sjeff 905219820Sjeff if test "$pic_mode" != no; then 906219820Sjeff command="$base_compile $qsrcfile $pic_flag" 907219820Sjeff else 908219820Sjeff # Don't build PIC code 909219820Sjeff command="$base_compile $qsrcfile" 910219820Sjeff fi 911219820Sjeff 912219820Sjeff if test ! -d "${xdir}$objdir"; then 913219820Sjeff $show "$mkdir ${xdir}$objdir" 914219820Sjeff $run $mkdir ${xdir}$objdir 915219820Sjeff exit_status=$? 916219820Sjeff if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 917219820Sjeff exit $exit_status 918219820Sjeff fi 919219820Sjeff fi 920219820Sjeff 921219820Sjeff if test -z "$output_obj"; then 922219820Sjeff # Place PIC objects in $objdir 923219820Sjeff command="$command -o $lobj" 924219820Sjeff fi 925219820Sjeff 926219820Sjeff $run $rm "$lobj" "$output_obj" 927219820Sjeff 928219820Sjeff $show "$command" 929219820Sjeff if $run eval "$command"; then : 930219820Sjeff else 931219820Sjeff test -n "$output_obj" && $run $rm $removelist 932219820Sjeff exit $EXIT_FAILURE 933219820Sjeff fi 934219820Sjeff 935219820Sjeff if test "$need_locks" = warn && 936219820Sjeff test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 937219820Sjeff $echo "\ 938219820Sjeff*** ERROR, $lockfile contains: 939219820Sjeff`cat $lockfile 2>/dev/null` 940219820Sjeff 941219820Sjeffbut it should contain: 942219820Sjeff$srcfile 943219820Sjeff 944219820SjeffThis indicates that another process is trying to use the same 945219820Sjefftemporary object file, and libtool could not work around it because 946219820Sjeffyour compiler does not support \`-c' and \`-o' together. If you 947219820Sjeffrepeat this compilation, it may succeed, by chance, but you had better 948219820Sjeffavoid parallel builds (make -j) in this platform, or get a better 949219820Sjeffcompiler." 950219820Sjeff 951219820Sjeff $run $rm $removelist 952219820Sjeff exit $EXIT_FAILURE 953219820Sjeff fi 954219820Sjeff 955219820Sjeff # Just move the object if needed, then go on to compile the next one 956219820Sjeff if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 957219820Sjeff $show "$mv $output_obj $lobj" 958219820Sjeff if $run $mv $output_obj $lobj; then : 959219820Sjeff else 960219820Sjeff error=$? 961219820Sjeff $run $rm $removelist 962219820Sjeff exit $error 963219820Sjeff fi 964219820Sjeff fi 965219820Sjeff 966219820Sjeff # Append the name of the PIC object to the libtool object file. 967219820Sjeff test -z "$run" && cat >> ${libobj}T <<EOF 968219820Sjeffpic_object='$objdir/$objname' 969219820Sjeff 970219820SjeffEOF 971219820Sjeff 972219820Sjeff # Allow error messages only from the first compilation. 973219820Sjeff if test "$suppress_opt" = yes; then 974219820Sjeff suppress_output=' >/dev/null 2>&1' 975219820Sjeff fi 976219820Sjeff else 977219820Sjeff # No PIC object so indicate it doesn't exist in the libtool 978219820Sjeff # object file. 979219820Sjeff test -z "$run" && cat >> ${libobj}T <<EOF 980219820Sjeffpic_object=none 981219820Sjeff 982219820SjeffEOF 983219820Sjeff fi 984219820Sjeff 985219820Sjeff # Only build a position-dependent object if we build old libraries. 986219820Sjeff if test "$build_old_libs" = yes; then 987219820Sjeff if test "$pic_mode" != yes; then 988219820Sjeff # Don't build PIC code 989219820Sjeff command="$base_compile $qsrcfile" 990219820Sjeff else 991219820Sjeff command="$base_compile $qsrcfile $pic_flag" 992219820Sjeff fi 993219820Sjeff if test "$compiler_c_o" = yes; then 994219820Sjeff command="$command -o $obj" 995219820Sjeff fi 996219820Sjeff 997219820Sjeff # Suppress compiler output if we already did a PIC compilation. 998219820Sjeff command="$command$suppress_output" 999219820Sjeff $run $rm "$obj" "$output_obj" 1000219820Sjeff $show "$command" 1001219820Sjeff if $run eval "$command"; then : 1002219820Sjeff else 1003219820Sjeff $run $rm $removelist 1004219820Sjeff exit $EXIT_FAILURE 1005219820Sjeff fi 1006219820Sjeff 1007219820Sjeff if test "$need_locks" = warn && 1008219820Sjeff test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1009219820Sjeff $echo "\ 1010219820Sjeff*** ERROR, $lockfile contains: 1011219820Sjeff`cat $lockfile 2>/dev/null` 1012219820Sjeff 1013219820Sjeffbut it should contain: 1014219820Sjeff$srcfile 1015219820Sjeff 1016219820SjeffThis indicates that another process is trying to use the same 1017219820Sjefftemporary object file, and libtool could not work around it because 1018219820Sjeffyour compiler does not support \`-c' and \`-o' together. If you 1019219820Sjeffrepeat this compilation, it may succeed, by chance, but you had better 1020219820Sjeffavoid parallel builds (make -j) in this platform, or get a better 1021219820Sjeffcompiler." 1022219820Sjeff 1023219820Sjeff $run $rm $removelist 1024219820Sjeff exit $EXIT_FAILURE 1025219820Sjeff fi 1026219820Sjeff 1027219820Sjeff # Just move the object if needed 1028219820Sjeff if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1029219820Sjeff $show "$mv $output_obj $obj" 1030219820Sjeff if $run $mv $output_obj $obj; then : 1031219820Sjeff else 1032219820Sjeff error=$? 1033219820Sjeff $run $rm $removelist 1034219820Sjeff exit $error 1035219820Sjeff fi 1036219820Sjeff fi 1037219820Sjeff 1038219820Sjeff # Append the name of the non-PIC object the libtool object file. 1039219820Sjeff # Only append if the libtool object file exists. 1040219820Sjeff test -z "$run" && cat >> ${libobj}T <<EOF 1041219820Sjeff# Name of the non-PIC object. 1042219820Sjeffnon_pic_object='$objname' 1043219820Sjeff 1044219820SjeffEOF 1045219820Sjeff else 1046219820Sjeff # Append the name of the non-PIC object the libtool object file. 1047219820Sjeff # Only append if the libtool object file exists. 1048219820Sjeff test -z "$run" && cat >> ${libobj}T <<EOF 1049219820Sjeff# Name of the non-PIC object. 1050219820Sjeffnon_pic_object=none 1051219820Sjeff 1052219820SjeffEOF 1053219820Sjeff fi 1054219820Sjeff 1055219820Sjeff $run $mv "${libobj}T" "${libobj}" 1056219820Sjeff 1057219820Sjeff # Unlock the critical section if it was locked 1058219820Sjeff if test "$need_locks" != no; then 1059219820Sjeff $run $rm "$lockfile" 1060219820Sjeff fi 1061219820Sjeff 1062219820Sjeff exit $EXIT_SUCCESS 1063219820Sjeff ;; 1064219820Sjeff 1065219820Sjeff # libtool link mode 1066219820Sjeff link | relink) 1067219820Sjeff modename="$modename: link" 1068219820Sjeff case $host in 1069219820Sjeff *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1070219820Sjeff # It is impossible to link a dll without this setting, and 1071219820Sjeff # we shouldn't force the makefile maintainer to figure out 1072219820Sjeff # which system we are compiling for in order to pass an extra 1073219820Sjeff # flag for every libtool invocation. 1074219820Sjeff # allow_undefined=no 1075219820Sjeff 1076219820Sjeff # FIXME: Unfortunately, there are problems with the above when trying 1077219820Sjeff # to make a dll which has undefined symbols, in which case not 1078219820Sjeff # even a static library is built. For now, we need to specify 1079219820Sjeff # -no-undefined on the libtool link line when we can be certain 1080219820Sjeff # that all symbols are satisfied, otherwise we get a static library. 1081219820Sjeff allow_undefined=yes 1082219820Sjeff ;; 1083219820Sjeff *) 1084219820Sjeff allow_undefined=yes 1085219820Sjeff ;; 1086219820Sjeff esac 1087219820Sjeff libtool_args="$nonopt" 1088219820Sjeff base_compile="$nonopt $@" 1089219820Sjeff compile_command="$nonopt" 1090219820Sjeff finalize_command="$nonopt" 1091219820Sjeff 1092219820Sjeff compile_rpath= 1093219820Sjeff finalize_rpath= 1094219820Sjeff compile_shlibpath= 1095219820Sjeff finalize_shlibpath= 1096219820Sjeff convenience= 1097219820Sjeff old_convenience= 1098219820Sjeff deplibs= 1099219820Sjeff old_deplibs= 1100219820Sjeff compiler_flags= 1101219820Sjeff linker_flags= 1102219820Sjeff dllsearchpath= 1103219820Sjeff lib_search_path=`pwd` 1104219820Sjeff inst_prefix_dir= 1105219820Sjeff 1106219820Sjeff avoid_version=no 1107219820Sjeff dlfiles= 1108219820Sjeff dlprefiles= 1109219820Sjeff dlself=no 1110219820Sjeff export_dynamic=no 1111219820Sjeff export_symbols= 1112219820Sjeff export_symbols_regex= 1113219820Sjeff generated= 1114219820Sjeff libobjs= 1115219820Sjeff ltlibs= 1116219820Sjeff module=no 1117219820Sjeff no_install=no 1118219820Sjeff objs= 1119219820Sjeff non_pic_objects= 1120219820Sjeff notinst_path= # paths that contain not-installed libtool libraries 1121219820Sjeff precious_files_regex= 1122219820Sjeff prefer_static_libs=no 1123219820Sjeff preload=no 1124219820Sjeff prev= 1125219820Sjeff prevarg= 1126219820Sjeff release= 1127219820Sjeff rpath= 1128219820Sjeff xrpath= 1129219820Sjeff perm_rpath= 1130219820Sjeff temp_rpath= 1131219820Sjeff thread_safe=no 1132219820Sjeff vinfo= 1133219820Sjeff vinfo_number=no 1134219820Sjeff 1135219820Sjeff func_infer_tag $base_compile 1136219820Sjeff 1137219820Sjeff # We need to know -static, to get the right output filenames. 1138219820Sjeff for arg 1139219820Sjeff do 1140219820Sjeff case $arg in 1141219820Sjeff -all-static | -static) 1142219820Sjeff if test "X$arg" = "X-all-static"; then 1143219820Sjeff if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 1144219820Sjeff $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1145219820Sjeff fi 1146219820Sjeff if test -n "$link_static_flag"; then 1147219820Sjeff dlopen_self=$dlopen_self_static 1148219820Sjeff fi 1149219820Sjeff prefer_static_libs=yes 1150219820Sjeff else 1151219820Sjeff if test -z "$pic_flag" && test -n "$link_static_flag"; then 1152219820Sjeff dlopen_self=$dlopen_self_static 1153219820Sjeff fi 1154219820Sjeff prefer_static_libs=built 1155219820Sjeff fi 1156219820Sjeff build_libtool_libs=no 1157219820Sjeff build_old_libs=yes 1158219820Sjeff break 1159219820Sjeff ;; 1160219820Sjeff esac 1161219820Sjeff done 1162219820Sjeff 1163219820Sjeff # See if our shared archives depend on static archives. 1164219820Sjeff test -n "$old_archive_from_new_cmds" && build_old_libs=yes 1165219820Sjeff 1166219820Sjeff # Go through the arguments, transforming them on the way. 1167219820Sjeff while test "$#" -gt 0; do 1168219820Sjeff arg="$1" 1169219820Sjeff shift 1170219820Sjeff case $arg in 1171219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1172219820Sjeff qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 1173219820Sjeff ;; 1174219820Sjeff *) qarg=$arg ;; 1175219820Sjeff esac 1176219820Sjeff libtool_args="$libtool_args $qarg" 1177219820Sjeff 1178219820Sjeff # If the previous option needs an argument, assign it. 1179219820Sjeff if test -n "$prev"; then 1180219820Sjeff case $prev in 1181219820Sjeff output) 1182219820Sjeff compile_command="$compile_command @OUTPUT@" 1183219820Sjeff finalize_command="$finalize_command @OUTPUT@" 1184219820Sjeff ;; 1185219820Sjeff esac 1186219820Sjeff 1187219820Sjeff case $prev in 1188219820Sjeff dlfiles|dlprefiles) 1189219820Sjeff if test "$preload" = no; then 1190219820Sjeff # Add the symbol object into the linking commands. 1191219820Sjeff compile_command="$compile_command @SYMFILE@" 1192219820Sjeff finalize_command="$finalize_command @SYMFILE@" 1193219820Sjeff preload=yes 1194219820Sjeff fi 1195219820Sjeff case $arg in 1196219820Sjeff *.la | *.lo) ;; # We handle these cases below. 1197219820Sjeff force) 1198219820Sjeff if test "$dlself" = no; then 1199219820Sjeff dlself=needless 1200219820Sjeff export_dynamic=yes 1201219820Sjeff fi 1202219820Sjeff prev= 1203219820Sjeff continue 1204219820Sjeff ;; 1205219820Sjeff self) 1206219820Sjeff if test "$prev" = dlprefiles; then 1207219820Sjeff dlself=yes 1208219820Sjeff elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 1209219820Sjeff dlself=yes 1210219820Sjeff else 1211219820Sjeff dlself=needless 1212219820Sjeff export_dynamic=yes 1213219820Sjeff fi 1214219820Sjeff prev= 1215219820Sjeff continue 1216219820Sjeff ;; 1217219820Sjeff *) 1218219820Sjeff if test "$prev" = dlfiles; then 1219219820Sjeff dlfiles="$dlfiles $arg" 1220219820Sjeff else 1221219820Sjeff dlprefiles="$dlprefiles $arg" 1222219820Sjeff fi 1223219820Sjeff prev= 1224219820Sjeff continue 1225219820Sjeff ;; 1226219820Sjeff esac 1227219820Sjeff ;; 1228219820Sjeff expsyms) 1229219820Sjeff export_symbols="$arg" 1230219820Sjeff if test ! -f "$arg"; then 1231219820Sjeff $echo "$modename: symbol file \`$arg' does not exist" 1232219820Sjeff exit $EXIT_FAILURE 1233219820Sjeff fi 1234219820Sjeff prev= 1235219820Sjeff continue 1236219820Sjeff ;; 1237219820Sjeff expsyms_regex) 1238219820Sjeff export_symbols_regex="$arg" 1239219820Sjeff prev= 1240219820Sjeff continue 1241219820Sjeff ;; 1242219820Sjeff inst_prefix) 1243219820Sjeff inst_prefix_dir="$arg" 1244219820Sjeff prev= 1245219820Sjeff continue 1246219820Sjeff ;; 1247219820Sjeff precious_regex) 1248219820Sjeff precious_files_regex="$arg" 1249219820Sjeff prev= 1250219820Sjeff continue 1251219820Sjeff ;; 1252219820Sjeff release) 1253219820Sjeff release="-$arg" 1254219820Sjeff prev= 1255219820Sjeff continue 1256219820Sjeff ;; 1257219820Sjeff objectlist) 1258219820Sjeff if test -f "$arg"; then 1259219820Sjeff save_arg=$arg 1260219820Sjeff moreargs= 1261219820Sjeff for fil in `cat $save_arg` 1262219820Sjeff do 1263219820Sjeff# moreargs="$moreargs $fil" 1264219820Sjeff arg=$fil 1265219820Sjeff # A libtool-controlled object. 1266219820Sjeff 1267219820Sjeff # Check to see that this really is a libtool object. 1268219820Sjeff if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1269219820Sjeff pic_object= 1270219820Sjeff non_pic_object= 1271219820Sjeff 1272219820Sjeff # Read the .lo file 1273219820Sjeff # If there is no directory component, then add one. 1274219820Sjeff case $arg in 1275219820Sjeff */* | *\\*) . $arg ;; 1276219820Sjeff *) . ./$arg ;; 1277219820Sjeff esac 1278219820Sjeff 1279219820Sjeff if test -z "$pic_object" || \ 1280219820Sjeff test -z "$non_pic_object" || 1281219820Sjeff test "$pic_object" = none && \ 1282219820Sjeff test "$non_pic_object" = none; then 1283219820Sjeff $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1284219820Sjeff exit $EXIT_FAILURE 1285219820Sjeff fi 1286219820Sjeff 1287219820Sjeff # Extract subdirectory from the argument. 1288219820Sjeff xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1289219820Sjeff if test "X$xdir" = "X$arg"; then 1290219820Sjeff xdir= 1291219820Sjeff else 1292219820Sjeff xdir="$xdir/" 1293219820Sjeff fi 1294219820Sjeff 1295219820Sjeff if test "$pic_object" != none; then 1296219820Sjeff # Prepend the subdirectory the object is found in. 1297219820Sjeff pic_object="$xdir$pic_object" 1298219820Sjeff 1299219820Sjeff if test "$prev" = dlfiles; then 1300219820Sjeff if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1301219820Sjeff dlfiles="$dlfiles $pic_object" 1302219820Sjeff prev= 1303219820Sjeff continue 1304219820Sjeff else 1305219820Sjeff # If libtool objects are unsupported, then we need to preload. 1306219820Sjeff prev=dlprefiles 1307219820Sjeff fi 1308219820Sjeff fi 1309219820Sjeff 1310219820Sjeff # CHECK ME: I think I busted this. -Ossama 1311219820Sjeff if test "$prev" = dlprefiles; then 1312219820Sjeff # Preload the old-style object. 1313219820Sjeff dlprefiles="$dlprefiles $pic_object" 1314219820Sjeff prev= 1315219820Sjeff fi 1316219820Sjeff 1317219820Sjeff # A PIC object. 1318219820Sjeff libobjs="$libobjs $pic_object" 1319219820Sjeff arg="$pic_object" 1320219820Sjeff fi 1321219820Sjeff 1322219820Sjeff # Non-PIC object. 1323219820Sjeff if test "$non_pic_object" != none; then 1324219820Sjeff # Prepend the subdirectory the object is found in. 1325219820Sjeff non_pic_object="$xdir$non_pic_object" 1326219820Sjeff 1327219820Sjeff # A standard non-PIC object 1328219820Sjeff non_pic_objects="$non_pic_objects $non_pic_object" 1329219820Sjeff if test -z "$pic_object" || test "$pic_object" = none ; then 1330219820Sjeff arg="$non_pic_object" 1331219820Sjeff fi 1332219820Sjeff else 1333219820Sjeff # If the PIC object exists, use it instead. 1334219820Sjeff # $xdir was prepended to $pic_object above. 1335219820Sjeff non_pic_object="$pic_object" 1336219820Sjeff non_pic_objects="$non_pic_objects $non_pic_object" 1337219820Sjeff fi 1338219820Sjeff else 1339219820Sjeff # Only an error if not doing a dry-run. 1340219820Sjeff if test -z "$run"; then 1341219820Sjeff $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1342219820Sjeff exit $EXIT_FAILURE 1343219820Sjeff else 1344219820Sjeff # Dry-run case. 1345219820Sjeff 1346219820Sjeff # Extract subdirectory from the argument. 1347219820Sjeff xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1348219820Sjeff if test "X$xdir" = "X$arg"; then 1349219820Sjeff xdir= 1350219820Sjeff else 1351219820Sjeff xdir="$xdir/" 1352219820Sjeff fi 1353219820Sjeff 1354219820Sjeff pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1355219820Sjeff non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1356219820Sjeff libobjs="$libobjs $pic_object" 1357219820Sjeff non_pic_objects="$non_pic_objects $non_pic_object" 1358219820Sjeff fi 1359219820Sjeff fi 1360219820Sjeff done 1361219820Sjeff else 1362219820Sjeff $echo "$modename: link input file \`$save_arg' does not exist" 1363219820Sjeff exit $EXIT_FAILURE 1364219820Sjeff fi 1365219820Sjeff arg=$save_arg 1366219820Sjeff prev= 1367219820Sjeff continue 1368219820Sjeff ;; 1369219820Sjeff rpath | xrpath) 1370219820Sjeff # We need an absolute path. 1371219820Sjeff case $arg in 1372219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) ;; 1373219820Sjeff *) 1374219820Sjeff $echo "$modename: only absolute run-paths are allowed" 1>&2 1375219820Sjeff exit $EXIT_FAILURE 1376219820Sjeff ;; 1377219820Sjeff esac 1378219820Sjeff if test "$prev" = rpath; then 1379219820Sjeff case "$rpath " in 1380219820Sjeff *" $arg "*) ;; 1381219820Sjeff *) rpath="$rpath $arg" ;; 1382219820Sjeff esac 1383219820Sjeff else 1384219820Sjeff case "$xrpath " in 1385219820Sjeff *" $arg "*) ;; 1386219820Sjeff *) xrpath="$xrpath $arg" ;; 1387219820Sjeff esac 1388219820Sjeff fi 1389219820Sjeff prev= 1390219820Sjeff continue 1391219820Sjeff ;; 1392219820Sjeff xcompiler) 1393219820Sjeff compiler_flags="$compiler_flags $qarg" 1394219820Sjeff prev= 1395219820Sjeff compile_command="$compile_command $qarg" 1396219820Sjeff finalize_command="$finalize_command $qarg" 1397219820Sjeff continue 1398219820Sjeff ;; 1399219820Sjeff xlinker) 1400219820Sjeff linker_flags="$linker_flags $qarg" 1401219820Sjeff compiler_flags="$compiler_flags $wl$qarg" 1402219820Sjeff prev= 1403219820Sjeff compile_command="$compile_command $wl$qarg" 1404219820Sjeff finalize_command="$finalize_command $wl$qarg" 1405219820Sjeff continue 1406219820Sjeff ;; 1407219820Sjeff xcclinker) 1408219820Sjeff linker_flags="$linker_flags $qarg" 1409219820Sjeff compiler_flags="$compiler_flags $qarg" 1410219820Sjeff prev= 1411219820Sjeff compile_command="$compile_command $qarg" 1412219820Sjeff finalize_command="$finalize_command $qarg" 1413219820Sjeff continue 1414219820Sjeff ;; 1415219820Sjeff shrext) 1416219820Sjeff shrext_cmds="$arg" 1417219820Sjeff prev= 1418219820Sjeff continue 1419219820Sjeff ;; 1420219820Sjeff darwin_framework|darwin_framework_skip) 1421219820Sjeff test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 1422219820Sjeff compile_command="$compile_command $arg" 1423219820Sjeff finalize_command="$finalize_command $arg" 1424219820Sjeff prev= 1425219820Sjeff continue 1426219820Sjeff ;; 1427219820Sjeff *) 1428219820Sjeff eval "$prev=\"\$arg\"" 1429219820Sjeff prev= 1430219820Sjeff continue 1431219820Sjeff ;; 1432219820Sjeff esac 1433219820Sjeff fi # test -n "$prev" 1434219820Sjeff 1435219820Sjeff prevarg="$arg" 1436219820Sjeff 1437219820Sjeff case $arg in 1438219820Sjeff -all-static) 1439219820Sjeff if test -n "$link_static_flag"; then 1440219820Sjeff compile_command="$compile_command $link_static_flag" 1441219820Sjeff finalize_command="$finalize_command $link_static_flag" 1442219820Sjeff fi 1443219820Sjeff continue 1444219820Sjeff ;; 1445219820Sjeff 1446219820Sjeff -allow-undefined) 1447219820Sjeff # FIXME: remove this flag sometime in the future. 1448219820Sjeff $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1449219820Sjeff continue 1450219820Sjeff ;; 1451219820Sjeff 1452219820Sjeff -avoid-version) 1453219820Sjeff avoid_version=yes 1454219820Sjeff continue 1455219820Sjeff ;; 1456219820Sjeff 1457219820Sjeff -dlopen) 1458219820Sjeff prev=dlfiles 1459219820Sjeff continue 1460219820Sjeff ;; 1461219820Sjeff 1462219820Sjeff -dlpreopen) 1463219820Sjeff prev=dlprefiles 1464219820Sjeff continue 1465219820Sjeff ;; 1466219820Sjeff 1467219820Sjeff -export-dynamic) 1468219820Sjeff export_dynamic=yes 1469219820Sjeff continue 1470219820Sjeff ;; 1471219820Sjeff 1472219820Sjeff -export-symbols | -export-symbols-regex) 1473219820Sjeff if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1474219820Sjeff $echo "$modename: more than one -exported-symbols argument is not allowed" 1475219820Sjeff exit $EXIT_FAILURE 1476219820Sjeff fi 1477219820Sjeff if test "X$arg" = "X-export-symbols"; then 1478219820Sjeff prev=expsyms 1479219820Sjeff else 1480219820Sjeff prev=expsyms_regex 1481219820Sjeff fi 1482219820Sjeff continue 1483219820Sjeff ;; 1484219820Sjeff 1485219820Sjeff -framework|-arch|-isysroot) 1486219820Sjeff case " $CC " in 1487219820Sjeff *" ${arg} ${1} "* | *" ${arg} ${1} "*) 1488219820Sjeff prev=darwin_framework_skip ;; 1489219820Sjeff *) compiler_flags="$compiler_flags $arg" 1490219820Sjeff prev=darwin_framework ;; 1491219820Sjeff esac 1492219820Sjeff compile_command="$compile_command $arg" 1493219820Sjeff finalize_command="$finalize_command $arg" 1494219820Sjeff continue 1495219820Sjeff ;; 1496219820Sjeff 1497219820Sjeff -inst-prefix-dir) 1498219820Sjeff prev=inst_prefix 1499219820Sjeff continue 1500219820Sjeff ;; 1501219820Sjeff 1502219820Sjeff # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1503219820Sjeff # so, if we see these flags be careful not to treat them like -L 1504219820Sjeff -L[A-Z][A-Z]*:*) 1505219820Sjeff case $with_gcc/$host in 1506219820Sjeff no/*-*-irix* | /*-*-irix*) 1507219820Sjeff compile_command="$compile_command $arg" 1508219820Sjeff finalize_command="$finalize_command $arg" 1509219820Sjeff ;; 1510219820Sjeff esac 1511219820Sjeff continue 1512219820Sjeff ;; 1513219820Sjeff 1514219820Sjeff -L*) 1515219820Sjeff dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1516219820Sjeff # We need an absolute path. 1517219820Sjeff case $dir in 1518219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) ;; 1519219820Sjeff *) 1520219820Sjeff absdir=`cd "$dir" && pwd` 1521219820Sjeff if test -z "$absdir"; then 1522219820Sjeff $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1523219820Sjeff absdir="$dir" 1524219820Sjeff notinst_path="$notinst_path $dir" 1525219820Sjeff fi 1526219820Sjeff dir="$absdir" 1527219820Sjeff ;; 1528219820Sjeff esac 1529219820Sjeff case "$deplibs " in 1530219820Sjeff *" -L$dir "*) ;; 1531219820Sjeff *) 1532219820Sjeff deplibs="$deplibs -L$dir" 1533219820Sjeff lib_search_path="$lib_search_path $dir" 1534219820Sjeff ;; 1535219820Sjeff esac 1536219820Sjeff case $host in 1537219820Sjeff *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1538219820Sjeff testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 1539219820Sjeff case :$dllsearchpath: in 1540219820Sjeff *":$dir:"*) ;; 1541219820Sjeff *) dllsearchpath="$dllsearchpath:$dir";; 1542219820Sjeff esac 1543219820Sjeff case :$dllsearchpath: in 1544219820Sjeff *":$testbindir:"*) ;; 1545219820Sjeff *) dllsearchpath="$dllsearchpath:$testbindir";; 1546219820Sjeff esac 1547219820Sjeff ;; 1548219820Sjeff esac 1549219820Sjeff continue 1550219820Sjeff ;; 1551219820Sjeff 1552219820Sjeff -l*) 1553219820Sjeff if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1554219820Sjeff case $host in 1555219820Sjeff *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 1556219820Sjeff # These systems don't actually have a C or math library (as such) 1557219820Sjeff continue 1558219820Sjeff ;; 1559219820Sjeff *-*-os2*) 1560219820Sjeff # These systems don't actually have a C library (as such) 1561219820Sjeff test "X$arg" = "X-lc" && continue 1562219820Sjeff ;; 1563219820Sjeff *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1564219820Sjeff # Do not include libc due to us having libc/libc_r. 1565219820Sjeff test "X$arg" = "X-lc" && continue 1566219820Sjeff ;; 1567219820Sjeff *-*-rhapsody* | *-*-darwin1.[012]) 1568219820Sjeff # Rhapsody C and math libraries are in the System framework 1569219820Sjeff deplibs="$deplibs -framework System" 1570219820Sjeff continue 1571219820Sjeff ;; 1572219820Sjeff *-*-sco3.2v5* | *-*-sco5v6*) 1573219820Sjeff # Causes problems with __ctype 1574219820Sjeff test "X$arg" = "X-lc" && continue 1575219820Sjeff ;; 1576219820Sjeff *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 1577219820Sjeff # Compiler inserts libc in the correct place for threads to work 1578219820Sjeff test "X$arg" = "X-lc" && continue 1579219820Sjeff ;; 1580219820Sjeff esac 1581219820Sjeff elif test "X$arg" = "X-lc_r"; then 1582219820Sjeff case $host in 1583219820Sjeff *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1584219820Sjeff # Do not include libc_r directly, use -pthread flag. 1585219820Sjeff continue 1586219820Sjeff ;; 1587219820Sjeff esac 1588219820Sjeff fi 1589219820Sjeff deplibs="$deplibs $arg" 1590219820Sjeff continue 1591219820Sjeff ;; 1592219820Sjeff 1593219820Sjeff # Tru64 UNIX uses -model [arg] to determine the layout of C++ 1594219820Sjeff # classes, name mangling, and exception handling. 1595219820Sjeff -model) 1596219820Sjeff compile_command="$compile_command $arg" 1597219820Sjeff compiler_flags="$compiler_flags $arg" 1598219820Sjeff finalize_command="$finalize_command $arg" 1599219820Sjeff prev=xcompiler 1600219820Sjeff continue 1601219820Sjeff ;; 1602219820Sjeff 1603219820Sjeff -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 1604219820Sjeff compiler_flags="$compiler_flags $arg" 1605219820Sjeff compile_command="$compile_command $arg" 1606219820Sjeff finalize_command="$finalize_command $arg" 1607219820Sjeff continue 1608219820Sjeff ;; 1609219820Sjeff 1610219820Sjeff -module) 1611219820Sjeff module=yes 1612219820Sjeff continue 1613219820Sjeff ;; 1614219820Sjeff 1615219820Sjeff # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 1616219820Sjeff # -r[0-9][0-9]* specifies the processor on the SGI compiler 1617219820Sjeff # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 1618219820Sjeff # +DA*, +DD* enable 64-bit mode on the HP compiler 1619219820Sjeff # -q* pass through compiler args for the IBM compiler 1620219820Sjeff # -m* pass through architecture-specific compiler args for GCC 1621219820Sjeff # -m*, -t[45]*, -txscale* pass through architecture-specific 1622219820Sjeff # compiler args for GCC 1623219820Sjeff # -pg pass through profiling flag for GCC 1624219820Sjeff # @file GCC response files 1625219820Sjeff -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ 1626219820Sjeff -t[45]*|-txscale*|@*) 1627219820Sjeff 1628219820Sjeff # Unknown arguments in both finalize_command and compile_command need 1629219820Sjeff # to be aesthetically quoted because they are evaled later. 1630219820Sjeff arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1631219820Sjeff case $arg in 1632219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1633219820Sjeff arg="\"$arg\"" 1634219820Sjeff ;; 1635219820Sjeff esac 1636219820Sjeff compile_command="$compile_command $arg" 1637219820Sjeff finalize_command="$finalize_command $arg" 1638219820Sjeff compiler_flags="$compiler_flags $arg" 1639219820Sjeff continue 1640219820Sjeff ;; 1641219820Sjeff 1642219820Sjeff -shrext) 1643219820Sjeff prev=shrext 1644219820Sjeff continue 1645219820Sjeff ;; 1646219820Sjeff 1647219820Sjeff -no-fast-install) 1648219820Sjeff fast_install=no 1649219820Sjeff continue 1650219820Sjeff ;; 1651219820Sjeff 1652219820Sjeff -no-install) 1653219820Sjeff case $host in 1654219820Sjeff *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1655219820Sjeff # The PATH hackery in wrapper scripts is required on Windows 1656219820Sjeff # in order for the loader to find any dlls it needs. 1657219820Sjeff $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1658219820Sjeff $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1659219820Sjeff fast_install=no 1660219820Sjeff ;; 1661219820Sjeff *) no_install=yes ;; 1662219820Sjeff esac 1663219820Sjeff continue 1664219820Sjeff ;; 1665219820Sjeff 1666219820Sjeff -no-undefined) 1667219820Sjeff allow_undefined=no 1668219820Sjeff continue 1669219820Sjeff ;; 1670219820Sjeff 1671219820Sjeff -objectlist) 1672219820Sjeff prev=objectlist 1673219820Sjeff continue 1674219820Sjeff ;; 1675219820Sjeff 1676219820Sjeff -o) prev=output ;; 1677219820Sjeff 1678219820Sjeff -precious-files-regex) 1679219820Sjeff prev=precious_regex 1680219820Sjeff continue 1681219820Sjeff ;; 1682219820Sjeff 1683219820Sjeff -release) 1684219820Sjeff prev=release 1685219820Sjeff continue 1686219820Sjeff ;; 1687219820Sjeff 1688219820Sjeff -rpath) 1689219820Sjeff prev=rpath 1690219820Sjeff continue 1691219820Sjeff ;; 1692219820Sjeff 1693219820Sjeff -R) 1694219820Sjeff prev=xrpath 1695219820Sjeff continue 1696219820Sjeff ;; 1697219820Sjeff 1698219820Sjeff -R*) 1699219820Sjeff dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1700219820Sjeff # We need an absolute path. 1701219820Sjeff case $dir in 1702219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) ;; 1703219820Sjeff *) 1704219820Sjeff $echo "$modename: only absolute run-paths are allowed" 1>&2 1705219820Sjeff exit $EXIT_FAILURE 1706219820Sjeff ;; 1707219820Sjeff esac 1708219820Sjeff case "$xrpath " in 1709219820Sjeff *" $dir "*) ;; 1710219820Sjeff *) xrpath="$xrpath $dir" ;; 1711219820Sjeff esac 1712219820Sjeff continue 1713219820Sjeff ;; 1714219820Sjeff 1715219820Sjeff -static) 1716219820Sjeff # The effects of -static are defined in a previous loop. 1717219820Sjeff # We used to do the same as -all-static on platforms that 1718219820Sjeff # didn't have a PIC flag, but the assumption that the effects 1719219820Sjeff # would be equivalent was wrong. It would break on at least 1720219820Sjeff # Digital Unix and AIX. 1721219820Sjeff continue 1722219820Sjeff ;; 1723219820Sjeff 1724219820Sjeff -thread-safe) 1725219820Sjeff thread_safe=yes 1726219820Sjeff continue 1727219820Sjeff ;; 1728219820Sjeff 1729219820Sjeff -version-info) 1730219820Sjeff prev=vinfo 1731219820Sjeff continue 1732219820Sjeff ;; 1733219820Sjeff -version-number) 1734219820Sjeff prev=vinfo 1735219820Sjeff vinfo_number=yes 1736219820Sjeff continue 1737219820Sjeff ;; 1738219820Sjeff 1739219820Sjeff -Wc,*) 1740219820Sjeff args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1741219820Sjeff arg= 1742219820Sjeff save_ifs="$IFS"; IFS=',' 1743219820Sjeff for flag in $args; do 1744219820Sjeff IFS="$save_ifs" 1745219820Sjeff case $flag in 1746219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1747219820Sjeff flag="\"$flag\"" 1748219820Sjeff ;; 1749219820Sjeff esac 1750219820Sjeff arg="$arg $wl$flag" 1751219820Sjeff compiler_flags="$compiler_flags $flag" 1752219820Sjeff done 1753219820Sjeff IFS="$save_ifs" 1754219820Sjeff arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1755219820Sjeff ;; 1756219820Sjeff 1757219820Sjeff -Wl,*) 1758219820Sjeff args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1759219820Sjeff arg= 1760219820Sjeff save_ifs="$IFS"; IFS=',' 1761219820Sjeff for flag in $args; do 1762219820Sjeff IFS="$save_ifs" 1763219820Sjeff case $flag in 1764219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1765219820Sjeff flag="\"$flag\"" 1766219820Sjeff ;; 1767219820Sjeff esac 1768219820Sjeff arg="$arg $wl$flag" 1769219820Sjeff compiler_flags="$compiler_flags $wl$flag" 1770219820Sjeff linker_flags="$linker_flags $flag" 1771219820Sjeff done 1772219820Sjeff IFS="$save_ifs" 1773219820Sjeff arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1774219820Sjeff ;; 1775219820Sjeff 1776219820Sjeff -Xcompiler) 1777219820Sjeff prev=xcompiler 1778219820Sjeff continue 1779219820Sjeff ;; 1780219820Sjeff 1781219820Sjeff -Xlinker) 1782219820Sjeff prev=xlinker 1783219820Sjeff continue 1784219820Sjeff ;; 1785219820Sjeff 1786219820Sjeff -XCClinker) 1787219820Sjeff prev=xcclinker 1788219820Sjeff continue 1789219820Sjeff ;; 1790219820Sjeff 1791219820Sjeff # Some other compiler flag. 1792219820Sjeff -* | +*) 1793219820Sjeff # Unknown arguments in both finalize_command and compile_command need 1794219820Sjeff # to be aesthetically quoted because they are evaled later. 1795219820Sjeff arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1796219820Sjeff case $arg in 1797219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1798219820Sjeff arg="\"$arg\"" 1799219820Sjeff ;; 1800219820Sjeff esac 1801219820Sjeff ;; 1802219820Sjeff 1803219820Sjeff *.$objext) 1804219820Sjeff # A standard object. 1805219820Sjeff objs="$objs $arg" 1806219820Sjeff ;; 1807219820Sjeff 1808219820Sjeff *.lo) 1809219820Sjeff # A libtool-controlled object. 1810219820Sjeff 1811219820Sjeff # Check to see that this really is a libtool object. 1812219820Sjeff if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1813219820Sjeff pic_object= 1814219820Sjeff non_pic_object= 1815219820Sjeff 1816219820Sjeff # Read the .lo file 1817219820Sjeff # If there is no directory component, then add one. 1818219820Sjeff case $arg in 1819219820Sjeff */* | *\\*) . $arg ;; 1820219820Sjeff *) . ./$arg ;; 1821219820Sjeff esac 1822219820Sjeff 1823219820Sjeff if test -z "$pic_object" || \ 1824219820Sjeff test -z "$non_pic_object" || 1825219820Sjeff test "$pic_object" = none && \ 1826219820Sjeff test "$non_pic_object" = none; then 1827219820Sjeff $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1828219820Sjeff exit $EXIT_FAILURE 1829219820Sjeff fi 1830219820Sjeff 1831219820Sjeff # Extract subdirectory from the argument. 1832219820Sjeff xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1833219820Sjeff if test "X$xdir" = "X$arg"; then 1834219820Sjeff xdir= 1835219820Sjeff else 1836219820Sjeff xdir="$xdir/" 1837219820Sjeff fi 1838219820Sjeff 1839219820Sjeff if test "$pic_object" != none; then 1840219820Sjeff # Prepend the subdirectory the object is found in. 1841219820Sjeff pic_object="$xdir$pic_object" 1842219820Sjeff 1843219820Sjeff if test "$prev" = dlfiles; then 1844219820Sjeff if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1845219820Sjeff dlfiles="$dlfiles $pic_object" 1846219820Sjeff prev= 1847219820Sjeff continue 1848219820Sjeff else 1849219820Sjeff # If libtool objects are unsupported, then we need to preload. 1850219820Sjeff prev=dlprefiles 1851219820Sjeff fi 1852219820Sjeff fi 1853219820Sjeff 1854219820Sjeff # CHECK ME: I think I busted this. -Ossama 1855219820Sjeff if test "$prev" = dlprefiles; then 1856219820Sjeff # Preload the old-style object. 1857219820Sjeff dlprefiles="$dlprefiles $pic_object" 1858219820Sjeff prev= 1859219820Sjeff fi 1860219820Sjeff 1861219820Sjeff # A PIC object. 1862219820Sjeff libobjs="$libobjs $pic_object" 1863219820Sjeff arg="$pic_object" 1864219820Sjeff fi 1865219820Sjeff 1866219820Sjeff # Non-PIC object. 1867219820Sjeff if test "$non_pic_object" != none; then 1868219820Sjeff # Prepend the subdirectory the object is found in. 1869219820Sjeff non_pic_object="$xdir$non_pic_object" 1870219820Sjeff 1871219820Sjeff # A standard non-PIC object 1872219820Sjeff non_pic_objects="$non_pic_objects $non_pic_object" 1873219820Sjeff if test -z "$pic_object" || test "$pic_object" = none ; then 1874219820Sjeff arg="$non_pic_object" 1875219820Sjeff fi 1876219820Sjeff else 1877219820Sjeff # If the PIC object exists, use it instead. 1878219820Sjeff # $xdir was prepended to $pic_object above. 1879219820Sjeff non_pic_object="$pic_object" 1880219820Sjeff non_pic_objects="$non_pic_objects $non_pic_object" 1881219820Sjeff fi 1882219820Sjeff else 1883219820Sjeff # Only an error if not doing a dry-run. 1884219820Sjeff if test -z "$run"; then 1885219820Sjeff $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1886219820Sjeff exit $EXIT_FAILURE 1887219820Sjeff else 1888219820Sjeff # Dry-run case. 1889219820Sjeff 1890219820Sjeff # Extract subdirectory from the argument. 1891219820Sjeff xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1892219820Sjeff if test "X$xdir" = "X$arg"; then 1893219820Sjeff xdir= 1894219820Sjeff else 1895219820Sjeff xdir="$xdir/" 1896219820Sjeff fi 1897219820Sjeff 1898219820Sjeff pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1899219820Sjeff non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1900219820Sjeff libobjs="$libobjs $pic_object" 1901219820Sjeff non_pic_objects="$non_pic_objects $non_pic_object" 1902219820Sjeff fi 1903219820Sjeff fi 1904219820Sjeff ;; 1905219820Sjeff 1906219820Sjeff *.$libext) 1907219820Sjeff # An archive. 1908219820Sjeff deplibs="$deplibs $arg" 1909219820Sjeff old_deplibs="$old_deplibs $arg" 1910219820Sjeff continue 1911219820Sjeff ;; 1912219820Sjeff 1913219820Sjeff *.la) 1914219820Sjeff # A libtool-controlled library. 1915219820Sjeff 1916219820Sjeff if test "$prev" = dlfiles; then 1917219820Sjeff # This library was specified with -dlopen. 1918219820Sjeff dlfiles="$dlfiles $arg" 1919219820Sjeff prev= 1920219820Sjeff elif test "$prev" = dlprefiles; then 1921219820Sjeff # The library was specified with -dlpreopen. 1922219820Sjeff dlprefiles="$dlprefiles $arg" 1923219820Sjeff prev= 1924219820Sjeff else 1925219820Sjeff deplibs="$deplibs $arg" 1926219820Sjeff fi 1927219820Sjeff continue 1928219820Sjeff ;; 1929219820Sjeff 1930219820Sjeff # Some other compiler argument. 1931219820Sjeff *) 1932219820Sjeff # Unknown arguments in both finalize_command and compile_command need 1933219820Sjeff # to be aesthetically quoted because they are evaled later. 1934219820Sjeff arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1935219820Sjeff case $arg in 1936219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1937219820Sjeff arg="\"$arg\"" 1938219820Sjeff ;; 1939219820Sjeff esac 1940219820Sjeff ;; 1941219820Sjeff esac # arg 1942219820Sjeff 1943219820Sjeff # Now actually substitute the argument into the commands. 1944219820Sjeff if test -n "$arg"; then 1945219820Sjeff compile_command="$compile_command $arg" 1946219820Sjeff finalize_command="$finalize_command $arg" 1947219820Sjeff fi 1948219820Sjeff done # argument parsing loop 1949219820Sjeff 1950219820Sjeff if test -n "$prev"; then 1951219820Sjeff $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 1952219820Sjeff $echo "$help" 1>&2 1953219820Sjeff exit $EXIT_FAILURE 1954219820Sjeff fi 1955219820Sjeff 1956219820Sjeff if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 1957219820Sjeff eval arg=\"$export_dynamic_flag_spec\" 1958219820Sjeff compile_command="$compile_command $arg" 1959219820Sjeff finalize_command="$finalize_command $arg" 1960219820Sjeff fi 1961219820Sjeff 1962219820Sjeff oldlibs= 1963219820Sjeff # calculate the name of the file, without its directory 1964219820Sjeff outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 1965219820Sjeff libobjs_save="$libobjs" 1966219820Sjeff 1967219820Sjeff if test -n "$shlibpath_var"; then 1968219820Sjeff # get the directories listed in $shlibpath_var 1969219820Sjeff eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 1970219820Sjeff else 1971219820Sjeff shlib_search_path= 1972219820Sjeff fi 1973219820Sjeff eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 1974219820Sjeff eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 1975219820Sjeff 1976219820Sjeff output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 1977219820Sjeff if test "X$output_objdir" = "X$output"; then 1978219820Sjeff output_objdir="$objdir" 1979219820Sjeff else 1980219820Sjeff output_objdir="$output_objdir/$objdir" 1981219820Sjeff fi 1982219820Sjeff # Create the object directory. 1983219820Sjeff if test ! -d "$output_objdir"; then 1984219820Sjeff $show "$mkdir $output_objdir" 1985219820Sjeff $run $mkdir $output_objdir 1986219820Sjeff exit_status=$? 1987219820Sjeff if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 1988219820Sjeff exit $exit_status 1989219820Sjeff fi 1990219820Sjeff fi 1991219820Sjeff 1992219820Sjeff # Determine the type of output 1993219820Sjeff case $output in 1994219820Sjeff "") 1995219820Sjeff $echo "$modename: you must specify an output file" 1>&2 1996219820Sjeff $echo "$help" 1>&2 1997219820Sjeff exit $EXIT_FAILURE 1998219820Sjeff ;; 1999219820Sjeff *.$libext) linkmode=oldlib ;; 2000219820Sjeff *.lo | *.$objext) linkmode=obj ;; 2001219820Sjeff *.la) linkmode=lib ;; 2002219820Sjeff *) linkmode=prog ;; # Anything else should be a program. 2003219820Sjeff esac 2004219820Sjeff 2005219820Sjeff case $host in 2006219820Sjeff *cygwin* | *mingw* | *pw32*) 2007219820Sjeff # don't eliminate duplications in $postdeps and $predeps 2008219820Sjeff duplicate_compiler_generated_deps=yes 2009219820Sjeff ;; 2010219820Sjeff *) 2011219820Sjeff duplicate_compiler_generated_deps=$duplicate_deps 2012219820Sjeff ;; 2013219820Sjeff esac 2014219820Sjeff specialdeplibs= 2015219820Sjeff 2016219820Sjeff libs= 2017219820Sjeff # Find all interdependent deplibs by searching for libraries 2018219820Sjeff # that are linked more than once (e.g. -la -lb -la) 2019219820Sjeff for deplib in $deplibs; do 2020219820Sjeff if test "X$duplicate_deps" = "Xyes" ; then 2021219820Sjeff case "$libs " in 2022219820Sjeff *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2023219820Sjeff esac 2024219820Sjeff fi 2025219820Sjeff libs="$libs $deplib" 2026219820Sjeff done 2027219820Sjeff 2028219820Sjeff if test "$linkmode" = lib; then 2029219820Sjeff libs="$predeps $libs $compiler_lib_search_path $postdeps" 2030219820Sjeff 2031219820Sjeff # Compute libraries that are listed more than once in $predeps 2032219820Sjeff # $postdeps and mark them as special (i.e., whose duplicates are 2033219820Sjeff # not to be eliminated). 2034219820Sjeff pre_post_deps= 2035219820Sjeff if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 2036219820Sjeff for pre_post_dep in $predeps $postdeps; do 2037219820Sjeff case "$pre_post_deps " in 2038219820Sjeff *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 2039219820Sjeff esac 2040219820Sjeff pre_post_deps="$pre_post_deps $pre_post_dep" 2041219820Sjeff done 2042219820Sjeff fi 2043219820Sjeff pre_post_deps= 2044219820Sjeff fi 2045219820Sjeff 2046219820Sjeff deplibs= 2047219820Sjeff newdependency_libs= 2048219820Sjeff newlib_search_path= 2049219820Sjeff need_relink=no # whether we're linking any uninstalled libtool libraries 2050219820Sjeff notinst_deplibs= # not-installed libtool libraries 2051219820Sjeff case $linkmode in 2052219820Sjeff lib) 2053219820Sjeff passes="conv link" 2054219820Sjeff for file in $dlfiles $dlprefiles; do 2055219820Sjeff case $file in 2056219820Sjeff *.la) ;; 2057219820Sjeff *) 2058219820Sjeff $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 2059219820Sjeff exit $EXIT_FAILURE 2060219820Sjeff ;; 2061219820Sjeff esac 2062219820Sjeff done 2063219820Sjeff ;; 2064219820Sjeff prog) 2065219820Sjeff compile_deplibs= 2066219820Sjeff finalize_deplibs= 2067219820Sjeff alldeplibs=no 2068219820Sjeff newdlfiles= 2069219820Sjeff newdlprefiles= 2070219820Sjeff passes="conv scan dlopen dlpreopen link" 2071219820Sjeff ;; 2072219820Sjeff *) passes="conv" 2073219820Sjeff ;; 2074219820Sjeff esac 2075219820Sjeff for pass in $passes; do 2076219820Sjeff if test "$linkmode,$pass" = "lib,link" || 2077219820Sjeff test "$linkmode,$pass" = "prog,scan"; then 2078219820Sjeff libs="$deplibs" 2079219820Sjeff deplibs= 2080219820Sjeff fi 2081219820Sjeff if test "$linkmode" = prog; then 2082219820Sjeff case $pass in 2083219820Sjeff dlopen) libs="$dlfiles" ;; 2084219820Sjeff dlpreopen) libs="$dlprefiles" ;; 2085219820Sjeff link) 2086219820Sjeff libs="$deplibs %DEPLIBS%" 2087219820Sjeff test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" 2088219820Sjeff ;; 2089219820Sjeff esac 2090219820Sjeff fi 2091219820Sjeff if test "$pass" = dlopen; then 2092219820Sjeff # Collect dlpreopened libraries 2093219820Sjeff save_deplibs="$deplibs" 2094219820Sjeff deplibs= 2095219820Sjeff fi 2096219820Sjeff for deplib in $libs; do 2097219820Sjeff lib= 2098219820Sjeff found=no 2099219820Sjeff case $deplib in 2100219820Sjeff -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 2101219820Sjeff if test "$linkmode,$pass" = "prog,link"; then 2102219820Sjeff compile_deplibs="$deplib $compile_deplibs" 2103219820Sjeff finalize_deplibs="$deplib $finalize_deplibs" 2104219820Sjeff else 2105219820Sjeff compiler_flags="$compiler_flags $deplib" 2106219820Sjeff fi 2107219820Sjeff continue 2108219820Sjeff ;; 2109219820Sjeff -l*) 2110219820Sjeff if test "$linkmode" != lib && test "$linkmode" != prog; then 2111219820Sjeff $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2112219820Sjeff continue 2113219820Sjeff fi 2114219820Sjeff name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 2115219820Sjeff for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 2116219820Sjeff for search_ext in .la $std_shrext .so .a; do 2117219820Sjeff # Search the libtool library 2118219820Sjeff lib="$searchdir/lib${name}${search_ext}" 2119219820Sjeff if test -f "$lib"; then 2120219820Sjeff if test "$search_ext" = ".la"; then 2121219820Sjeff found=yes 2122219820Sjeff else 2123219820Sjeff found=no 2124219820Sjeff fi 2125219820Sjeff break 2 2126219820Sjeff fi 2127219820Sjeff done 2128219820Sjeff done 2129219820Sjeff if test "$found" != yes; then 2130219820Sjeff # deplib doesn't seem to be a libtool library 2131219820Sjeff if test "$linkmode,$pass" = "prog,link"; then 2132219820Sjeff compile_deplibs="$deplib $compile_deplibs" 2133219820Sjeff finalize_deplibs="$deplib $finalize_deplibs" 2134219820Sjeff else 2135219820Sjeff deplibs="$deplib $deplibs" 2136219820Sjeff test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2137219820Sjeff fi 2138219820Sjeff continue 2139219820Sjeff else # deplib is a libtool library 2140219820Sjeff # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 2141219820Sjeff # We need to do some special things here, and not later. 2142219820Sjeff if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 2143219820Sjeff case " $predeps $postdeps " in 2144219820Sjeff *" $deplib "*) 2145219820Sjeff if (${SED} -e '2q' $lib | 2146219820Sjeff grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 2147219820Sjeff library_names= 2148219820Sjeff old_library= 2149219820Sjeff case $lib in 2150219820Sjeff */* | *\\*) . $lib ;; 2151219820Sjeff *) . ./$lib ;; 2152219820Sjeff esac 2153219820Sjeff for l in $old_library $library_names; do 2154219820Sjeff ll="$l" 2155219820Sjeff done 2156219820Sjeff if test "X$ll" = "X$old_library" ; then # only static version available 2157219820Sjeff found=no 2158219820Sjeff ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2159219820Sjeff test "X$ladir" = "X$lib" && ladir="." 2160219820Sjeff lib=$ladir/$old_library 2161219820Sjeff if test "$linkmode,$pass" = "prog,link"; then 2162219820Sjeff compile_deplibs="$deplib $compile_deplibs" 2163219820Sjeff finalize_deplibs="$deplib $finalize_deplibs" 2164219820Sjeff else 2165219820Sjeff deplibs="$deplib $deplibs" 2166219820Sjeff test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2167219820Sjeff fi 2168219820Sjeff continue 2169219820Sjeff fi 2170219820Sjeff fi 2171219820Sjeff ;; 2172219820Sjeff *) ;; 2173219820Sjeff esac 2174219820Sjeff fi 2175219820Sjeff fi 2176219820Sjeff ;; # -l 2177219820Sjeff -L*) 2178219820Sjeff case $linkmode in 2179219820Sjeff lib) 2180219820Sjeff deplibs="$deplib $deplibs" 2181219820Sjeff test "$pass" = conv && continue 2182219820Sjeff newdependency_libs="$deplib $newdependency_libs" 2183219820Sjeff newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2184219820Sjeff ;; 2185219820Sjeff prog) 2186219820Sjeff if test "$pass" = conv; then 2187219820Sjeff deplibs="$deplib $deplibs" 2188219820Sjeff continue 2189219820Sjeff fi 2190219820Sjeff if test "$pass" = scan; then 2191219820Sjeff deplibs="$deplib $deplibs" 2192219820Sjeff else 2193219820Sjeff compile_deplibs="$deplib $compile_deplibs" 2194219820Sjeff finalize_deplibs="$deplib $finalize_deplibs" 2195219820Sjeff fi 2196219820Sjeff newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2197219820Sjeff ;; 2198219820Sjeff *) 2199219820Sjeff $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 2200219820Sjeff ;; 2201219820Sjeff esac # linkmode 2202219820Sjeff continue 2203219820Sjeff ;; # -L 2204219820Sjeff -R*) 2205219820Sjeff if test "$pass" = link; then 2206219820Sjeff dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 2207219820Sjeff # Make sure the xrpath contains only unique directories. 2208219820Sjeff case "$xrpath " in 2209219820Sjeff *" $dir "*) ;; 2210219820Sjeff *) xrpath="$xrpath $dir" ;; 2211219820Sjeff esac 2212219820Sjeff fi 2213219820Sjeff deplibs="$deplib $deplibs" 2214219820Sjeff continue 2215219820Sjeff ;; 2216219820Sjeff *.la) lib="$deplib" ;; 2217219820Sjeff *.$libext) 2218219820Sjeff if test "$pass" = conv; then 2219219820Sjeff deplibs="$deplib $deplibs" 2220219820Sjeff continue 2221219820Sjeff fi 2222219820Sjeff case $linkmode in 2223219820Sjeff lib) 2224219820Sjeff valid_a_lib=no 2225219820Sjeff case $deplibs_check_method in 2226219820Sjeff match_pattern*) 2227219820Sjeff set dummy $deplibs_check_method 2228219820Sjeff match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2229219820Sjeff if eval $echo \"$deplib\" 2>/dev/null \ 2230219820Sjeff | $SED 10q \ 2231219820Sjeff | $EGREP "$match_pattern_regex" > /dev/null; then 2232219820Sjeff valid_a_lib=yes 2233219820Sjeff fi 2234219820Sjeff ;; 2235219820Sjeff pass_all) 2236219820Sjeff valid_a_lib=yes 2237219820Sjeff ;; 2238219820Sjeff esac 2239219820Sjeff if test "$valid_a_lib" != yes; then 2240219820Sjeff $echo 2241219820Sjeff $echo "*** Warning: Trying to link with static lib archive $deplib." 2242219820Sjeff $echo "*** I have the capability to make that library automatically link in when" 2243219820Sjeff $echo "*** you link to this library. But I can only do this if you have a" 2244219820Sjeff $echo "*** shared version of the library, which you do not appear to have" 2245219820Sjeff $echo "*** because the file extensions .$libext of this argument makes me believe" 2246219820Sjeff $echo "*** that it is just a static archive that I should not used here." 2247219820Sjeff else 2248219820Sjeff $echo 2249219820Sjeff $echo "*** Warning: Linking the shared library $output against the" 2250219820Sjeff $echo "*** static library $deplib is not portable!" 2251219820Sjeff deplibs="$deplib $deplibs" 2252219820Sjeff fi 2253219820Sjeff continue 2254219820Sjeff ;; 2255219820Sjeff prog) 2256219820Sjeff if test "$pass" != link; then 2257219820Sjeff deplibs="$deplib $deplibs" 2258219820Sjeff else 2259219820Sjeff compile_deplibs="$deplib $compile_deplibs" 2260219820Sjeff finalize_deplibs="$deplib $finalize_deplibs" 2261219820Sjeff fi 2262219820Sjeff continue 2263219820Sjeff ;; 2264219820Sjeff esac # linkmode 2265219820Sjeff ;; # *.$libext 2266219820Sjeff *.lo | *.$objext) 2267219820Sjeff if test "$pass" = conv; then 2268219820Sjeff deplibs="$deplib $deplibs" 2269219820Sjeff elif test "$linkmode" = prog; then 2270219820Sjeff if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 2271219820Sjeff # If there is no dlopen support or we're linking statically, 2272219820Sjeff # we need to preload. 2273219820Sjeff newdlprefiles="$newdlprefiles $deplib" 2274219820Sjeff compile_deplibs="$deplib $compile_deplibs" 2275219820Sjeff finalize_deplibs="$deplib $finalize_deplibs" 2276219820Sjeff else 2277219820Sjeff newdlfiles="$newdlfiles $deplib" 2278219820Sjeff fi 2279219820Sjeff fi 2280219820Sjeff continue 2281219820Sjeff ;; 2282219820Sjeff %DEPLIBS%) 2283219820Sjeff alldeplibs=yes 2284219820Sjeff continue 2285219820Sjeff ;; 2286219820Sjeff esac # case $deplib 2287219820Sjeff if test "$found" = yes || test -f "$lib"; then : 2288219820Sjeff else 2289219820Sjeff $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 2290219820Sjeff exit $EXIT_FAILURE 2291219820Sjeff fi 2292219820Sjeff 2293219820Sjeff # Check to see that this really is a libtool archive. 2294219820Sjeff if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2295219820Sjeff else 2296219820Sjeff $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 2297219820Sjeff exit $EXIT_FAILURE 2298219820Sjeff fi 2299219820Sjeff 2300219820Sjeff ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2301219820Sjeff test "X$ladir" = "X$lib" && ladir="." 2302219820Sjeff 2303219820Sjeff dlname= 2304219820Sjeff dlopen= 2305219820Sjeff dlpreopen= 2306219820Sjeff libdir= 2307219820Sjeff library_names= 2308219820Sjeff old_library= 2309219820Sjeff # If the library was installed with an old release of libtool, 2310219820Sjeff # it will not redefine variables installed, or shouldnotlink 2311219820Sjeff installed=yes 2312219820Sjeff shouldnotlink=no 2313219820Sjeff avoidtemprpath= 2314219820Sjeff 2315219820Sjeff 2316219820Sjeff # Read the .la file 2317219820Sjeff case $lib in 2318219820Sjeff */* | *\\*) . $lib ;; 2319219820Sjeff *) . ./$lib ;; 2320219820Sjeff esac 2321219820Sjeff 2322219820Sjeff if test "$linkmode,$pass" = "lib,link" || 2323219820Sjeff test "$linkmode,$pass" = "prog,scan" || 2324219820Sjeff { test "$linkmode" != prog && test "$linkmode" != lib; }; then 2325219820Sjeff test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 2326219820Sjeff test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 2327219820Sjeff fi 2328219820Sjeff 2329219820Sjeff if test "$pass" = conv; then 2330219820Sjeff # Only check for convenience libraries 2331219820Sjeff deplibs="$lib $deplibs" 2332219820Sjeff if test -z "$libdir"; then 2333219820Sjeff if test -z "$old_library"; then 2334219820Sjeff $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2335219820Sjeff exit $EXIT_FAILURE 2336219820Sjeff fi 2337219820Sjeff # It is a libtool convenience library, so add in its objects. 2338219820Sjeff convenience="$convenience $ladir/$objdir/$old_library" 2339219820Sjeff old_convenience="$old_convenience $ladir/$objdir/$old_library" 2340219820Sjeff tmp_libs= 2341219820Sjeff for deplib in $dependency_libs; do 2342219820Sjeff deplibs="$deplib $deplibs" 2343219820Sjeff if test "X$duplicate_deps" = "Xyes" ; then 2344219820Sjeff case "$tmp_libs " in 2345219820Sjeff *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2346219820Sjeff esac 2347219820Sjeff fi 2348219820Sjeff tmp_libs="$tmp_libs $deplib" 2349219820Sjeff done 2350219820Sjeff elif test "$linkmode" != prog && test "$linkmode" != lib; then 2351219820Sjeff $echo "$modename: \`$lib' is not a convenience library" 1>&2 2352219820Sjeff exit $EXIT_FAILURE 2353219820Sjeff fi 2354219820Sjeff continue 2355219820Sjeff fi # $pass = conv 2356219820Sjeff 2357219820Sjeff 2358219820Sjeff # Get the name of the library we link against. 2359219820Sjeff linklib= 2360219820Sjeff for l in $old_library $library_names; do 2361219820Sjeff linklib="$l" 2362219820Sjeff done 2363219820Sjeff if test -z "$linklib"; then 2364219820Sjeff $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2365219820Sjeff exit $EXIT_FAILURE 2366219820Sjeff fi 2367219820Sjeff 2368219820Sjeff # This library was specified with -dlopen. 2369219820Sjeff if test "$pass" = dlopen; then 2370219820Sjeff if test -z "$libdir"; then 2371219820Sjeff $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 2372219820Sjeff exit $EXIT_FAILURE 2373219820Sjeff fi 2374219820Sjeff if test -z "$dlname" || 2375219820Sjeff test "$dlopen_support" != yes || 2376219820Sjeff test "$build_libtool_libs" = no; then 2377219820Sjeff # If there is no dlname, no dlopen support or we're linking 2378219820Sjeff # statically, we need to preload. We also need to preload any 2379219820Sjeff # dependent libraries so libltdl's deplib preloader doesn't 2380219820Sjeff # bomb out in the load deplibs phase. 2381219820Sjeff dlprefiles="$dlprefiles $lib $dependency_libs" 2382219820Sjeff else 2383219820Sjeff newdlfiles="$newdlfiles $lib" 2384219820Sjeff fi 2385219820Sjeff continue 2386219820Sjeff fi # $pass = dlopen 2387219820Sjeff 2388219820Sjeff # We need an absolute path. 2389219820Sjeff case $ladir in 2390219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 2391219820Sjeff *) 2392219820Sjeff abs_ladir=`cd "$ladir" && pwd` 2393219820Sjeff if test -z "$abs_ladir"; then 2394219820Sjeff $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 2395219820Sjeff $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 2396219820Sjeff abs_ladir="$ladir" 2397219820Sjeff fi 2398219820Sjeff ;; 2399219820Sjeff esac 2400219820Sjeff laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 2401219820Sjeff 2402219820Sjeff # Find the relevant object directory and library name. 2403219820Sjeff if test "X$installed" = Xyes; then 2404219820Sjeff if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2405219820Sjeff $echo "$modename: warning: library \`$lib' was moved." 1>&2 2406219820Sjeff dir="$ladir" 2407219820Sjeff absdir="$abs_ladir" 2408219820Sjeff libdir="$abs_ladir" 2409219820Sjeff else 2410219820Sjeff dir="$libdir" 2411219820Sjeff absdir="$libdir" 2412219820Sjeff fi 2413219820Sjeff test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 2414219820Sjeff else 2415219820Sjeff if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2416219820Sjeff dir="$ladir" 2417219820Sjeff absdir="$abs_ladir" 2418219820Sjeff # Remove this search path later 2419219820Sjeff notinst_path="$notinst_path $abs_ladir" 2420219820Sjeff else 2421219820Sjeff dir="$ladir/$objdir" 2422219820Sjeff absdir="$abs_ladir/$objdir" 2423219820Sjeff # Remove this search path later 2424219820Sjeff notinst_path="$notinst_path $abs_ladir" 2425219820Sjeff fi 2426219820Sjeff fi # $installed = yes 2427219820Sjeff name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2428219820Sjeff 2429219820Sjeff # This library was specified with -dlpreopen. 2430219820Sjeff if test "$pass" = dlpreopen; then 2431219820Sjeff if test -z "$libdir"; then 2432219820Sjeff $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 2433219820Sjeff exit $EXIT_FAILURE 2434219820Sjeff fi 2435219820Sjeff # Prefer using a static library (so that no silly _DYNAMIC symbols 2436219820Sjeff # are required to link). 2437219820Sjeff if test -n "$old_library"; then 2438219820Sjeff newdlprefiles="$newdlprefiles $dir/$old_library" 2439219820Sjeff # Otherwise, use the dlname, so that lt_dlopen finds it. 2440219820Sjeff elif test -n "$dlname"; then 2441219820Sjeff newdlprefiles="$newdlprefiles $dir/$dlname" 2442219820Sjeff else 2443219820Sjeff newdlprefiles="$newdlprefiles $dir/$linklib" 2444219820Sjeff fi 2445219820Sjeff fi # $pass = dlpreopen 2446219820Sjeff 2447219820Sjeff if test -z "$libdir"; then 2448219820Sjeff # Link the convenience library 2449219820Sjeff if test "$linkmode" = lib; then 2450219820Sjeff deplibs="$dir/$old_library $deplibs" 2451219820Sjeff elif test "$linkmode,$pass" = "prog,link"; then 2452219820Sjeff compile_deplibs="$dir/$old_library $compile_deplibs" 2453219820Sjeff finalize_deplibs="$dir/$old_library $finalize_deplibs" 2454219820Sjeff else 2455219820Sjeff deplibs="$lib $deplibs" # used for prog,scan pass 2456219820Sjeff fi 2457219820Sjeff continue 2458219820Sjeff fi 2459219820Sjeff 2460219820Sjeff 2461219820Sjeff if test "$linkmode" = prog && test "$pass" != link; then 2462219820Sjeff newlib_search_path="$newlib_search_path $ladir" 2463219820Sjeff deplibs="$lib $deplibs" 2464219820Sjeff 2465219820Sjeff linkalldeplibs=no 2466219820Sjeff if test "$link_all_deplibs" != no || test -z "$library_names" || 2467219820Sjeff test "$build_libtool_libs" = no; then 2468219820Sjeff linkalldeplibs=yes 2469219820Sjeff fi 2470219820Sjeff 2471219820Sjeff tmp_libs= 2472219820Sjeff for deplib in $dependency_libs; do 2473219820Sjeff case $deplib in 2474219820Sjeff -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 2475219820Sjeff esac 2476219820Sjeff # Need to link against all dependency_libs? 2477219820Sjeff if test "$linkalldeplibs" = yes; then 2478219820Sjeff deplibs="$deplib $deplibs" 2479219820Sjeff else 2480219820Sjeff # Need to hardcode shared library paths 2481219820Sjeff # or/and link against static libraries 2482219820Sjeff newdependency_libs="$deplib $newdependency_libs" 2483219820Sjeff fi 2484219820Sjeff if test "X$duplicate_deps" = "Xyes" ; then 2485219820Sjeff case "$tmp_libs " in 2486219820Sjeff *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2487219820Sjeff esac 2488219820Sjeff fi 2489219820Sjeff tmp_libs="$tmp_libs $deplib" 2490219820Sjeff done # for deplib 2491219820Sjeff continue 2492219820Sjeff fi # $linkmode = prog... 2493219820Sjeff 2494219820Sjeff if test "$linkmode,$pass" = "prog,link"; then 2495219820Sjeff if test -n "$library_names" && 2496219820Sjeff { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2497219820Sjeff # We need to hardcode the library path 2498219820Sjeff if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 2499219820Sjeff # Make sure the rpath contains only unique directories. 2500219820Sjeff case "$temp_rpath " in 2501219820Sjeff *" $dir "*) ;; 2502219820Sjeff *" $absdir "*) ;; 2503219820Sjeff *) temp_rpath="$temp_rpath $absdir" ;; 2504219820Sjeff esac 2505219820Sjeff fi 2506219820Sjeff 2507219820Sjeff # Hardcode the library path. 2508219820Sjeff # Skip directories that are in the system default run-time 2509219820Sjeff # search path. 2510219820Sjeff case " $sys_lib_dlsearch_path " in 2511219820Sjeff *" $absdir "*) ;; 2512219820Sjeff *) 2513219820Sjeff case "$compile_rpath " in 2514219820Sjeff *" $absdir "*) ;; 2515219820Sjeff *) compile_rpath="$compile_rpath $absdir" 2516219820Sjeff esac 2517219820Sjeff ;; 2518219820Sjeff esac 2519219820Sjeff case " $sys_lib_dlsearch_path " in 2520219820Sjeff *" $libdir "*) ;; 2521219820Sjeff *) 2522219820Sjeff case "$finalize_rpath " in 2523219820Sjeff *" $libdir "*) ;; 2524219820Sjeff *) finalize_rpath="$finalize_rpath $libdir" 2525219820Sjeff esac 2526219820Sjeff ;; 2527219820Sjeff esac 2528219820Sjeff fi # $linkmode,$pass = prog,link... 2529219820Sjeff 2530219820Sjeff if test "$alldeplibs" = yes && 2531219820Sjeff { test "$deplibs_check_method" = pass_all || 2532219820Sjeff { test "$build_libtool_libs" = yes && 2533219820Sjeff test -n "$library_names"; }; }; then 2534219820Sjeff # We only need to search for static libraries 2535219820Sjeff continue 2536219820Sjeff fi 2537219820Sjeff fi 2538219820Sjeff 2539219820Sjeff link_static=no # Whether the deplib will be linked statically 2540219820Sjeff use_static_libs=$prefer_static_libs 2541219820Sjeff if test "$use_static_libs" = built && test "$installed" = yes ; then 2542219820Sjeff use_static_libs=no 2543219820Sjeff fi 2544219820Sjeff if test -n "$library_names" && 2545219820Sjeff { test "$use_static_libs" = no || test -z "$old_library"; }; then 2546219820Sjeff if test "$installed" = no; then 2547219820Sjeff notinst_deplibs="$notinst_deplibs $lib" 2548219820Sjeff need_relink=yes 2549219820Sjeff fi 2550219820Sjeff # This is a shared library 2551219820Sjeff 2552219820Sjeff # Warn about portability, can't link against -module's on 2553219820Sjeff # some systems (darwin) 2554219820Sjeff if test "$shouldnotlink" = yes && test "$pass" = link ; then 2555219820Sjeff $echo 2556219820Sjeff if test "$linkmode" = prog; then 2557219820Sjeff $echo "*** Warning: Linking the executable $output against the loadable module" 2558219820Sjeff else 2559219820Sjeff $echo "*** Warning: Linking the shared library $output against the loadable module" 2560219820Sjeff fi 2561219820Sjeff $echo "*** $linklib is not portable!" 2562219820Sjeff fi 2563219820Sjeff if test "$linkmode" = lib && 2564219820Sjeff test "$hardcode_into_libs" = yes; then 2565219820Sjeff # Hardcode the library path. 2566219820Sjeff # Skip directories that are in the system default run-time 2567219820Sjeff # search path. 2568219820Sjeff case " $sys_lib_dlsearch_path " in 2569219820Sjeff *" $absdir "*) ;; 2570219820Sjeff *) 2571219820Sjeff case "$compile_rpath " in 2572219820Sjeff *" $absdir "*) ;; 2573219820Sjeff *) compile_rpath="$compile_rpath $absdir" 2574219820Sjeff esac 2575219820Sjeff ;; 2576219820Sjeff esac 2577219820Sjeff case " $sys_lib_dlsearch_path " in 2578219820Sjeff *" $libdir "*) ;; 2579219820Sjeff *) 2580219820Sjeff case "$finalize_rpath " in 2581219820Sjeff *" $libdir "*) ;; 2582219820Sjeff *) finalize_rpath="$finalize_rpath $libdir" 2583219820Sjeff esac 2584219820Sjeff ;; 2585219820Sjeff esac 2586219820Sjeff fi 2587219820Sjeff 2588219820Sjeff if test -n "$old_archive_from_expsyms_cmds"; then 2589219820Sjeff # figure out the soname 2590219820Sjeff set dummy $library_names 2591219820Sjeff realname="$2" 2592219820Sjeff shift; shift 2593219820Sjeff libname=`eval \\$echo \"$libname_spec\"` 2594219820Sjeff # use dlname if we got it. it's perfectly good, no? 2595219820Sjeff if test -n "$dlname"; then 2596219820Sjeff soname="$dlname" 2597219820Sjeff elif test -n "$soname_spec"; then 2598219820Sjeff # bleh windows 2599219820Sjeff case $host in 2600219820Sjeff *cygwin* | mingw*) 2601219820Sjeff major=`expr $current - $age` 2602219820Sjeff versuffix="-$major" 2603219820Sjeff ;; 2604219820Sjeff esac 2605219820Sjeff eval soname=\"$soname_spec\" 2606219820Sjeff else 2607219820Sjeff soname="$realname" 2608219820Sjeff fi 2609219820Sjeff 2610219820Sjeff # Make a new name for the extract_expsyms_cmds to use 2611219820Sjeff soroot="$soname" 2612219820Sjeff soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 2613219820Sjeff newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 2614219820Sjeff 2615219820Sjeff # If the library has no export list, then create one now 2616219820Sjeff if test -f "$output_objdir/$soname-def"; then : 2617219820Sjeff else 2618219820Sjeff $show "extracting exported symbol list from \`$soname'" 2619219820Sjeff save_ifs="$IFS"; IFS='~' 2620219820Sjeff cmds=$extract_expsyms_cmds 2621219820Sjeff for cmd in $cmds; do 2622219820Sjeff IFS="$save_ifs" 2623219820Sjeff eval cmd=\"$cmd\" 2624219820Sjeff $show "$cmd" 2625219820Sjeff $run eval "$cmd" || exit $? 2626219820Sjeff done 2627219820Sjeff IFS="$save_ifs" 2628219820Sjeff fi 2629219820Sjeff 2630219820Sjeff # Create $newlib 2631219820Sjeff if test -f "$output_objdir/$newlib"; then :; else 2632219820Sjeff $show "generating import library for \`$soname'" 2633219820Sjeff save_ifs="$IFS"; IFS='~' 2634219820Sjeff cmds=$old_archive_from_expsyms_cmds 2635219820Sjeff for cmd in $cmds; do 2636219820Sjeff IFS="$save_ifs" 2637219820Sjeff eval cmd=\"$cmd\" 2638219820Sjeff $show "$cmd" 2639219820Sjeff $run eval "$cmd" || exit $? 2640219820Sjeff done 2641219820Sjeff IFS="$save_ifs" 2642219820Sjeff fi 2643219820Sjeff # make sure the library variables are pointing to the new library 2644219820Sjeff dir=$output_objdir 2645219820Sjeff linklib=$newlib 2646219820Sjeff fi # test -n "$old_archive_from_expsyms_cmds" 2647219820Sjeff 2648219820Sjeff if test "$linkmode" = prog || test "$mode" != relink; then 2649219820Sjeff add_shlibpath= 2650219820Sjeff add_dir= 2651219820Sjeff add= 2652219820Sjeff lib_linked=yes 2653219820Sjeff case $hardcode_action in 2654219820Sjeff immediate | unsupported) 2655219820Sjeff if test "$hardcode_direct" = no; then 2656219820Sjeff add="$dir/$linklib" 2657219820Sjeff case $host in 2658219820Sjeff *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 2659219820Sjeff *-*-sysv4*uw2*) add_dir="-L$dir" ;; 2660219820Sjeff *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 2661219820Sjeff *-*-unixware7*) add_dir="-L$dir" ;; 2662219820Sjeff *-*-darwin* ) 2663219820Sjeff # if the lib is a module then we can not link against 2664219820Sjeff # it, someone is ignoring the new warnings I added 2665219820Sjeff if /usr/bin/file -L $add 2> /dev/null | 2666219820Sjeff $EGREP ": [^:]* bundle" >/dev/null ; then 2667219820Sjeff $echo "** Warning, lib $linklib is a module, not a shared library" 2668219820Sjeff if test -z "$old_library" ; then 2669219820Sjeff $echo 2670219820Sjeff $echo "** And there doesn't seem to be a static archive available" 2671219820Sjeff $echo "** The link will probably fail, sorry" 2672219820Sjeff else 2673219820Sjeff add="$dir/$old_library" 2674219820Sjeff fi 2675219820Sjeff fi 2676219820Sjeff esac 2677219820Sjeff elif test "$hardcode_minus_L" = no; then 2678219820Sjeff case $host in 2679219820Sjeff *-*-sunos*) add_shlibpath="$dir" ;; 2680219820Sjeff esac 2681219820Sjeff add_dir="-L$dir" 2682219820Sjeff add="-l$name" 2683219820Sjeff elif test "$hardcode_shlibpath_var" = no; then 2684219820Sjeff add_shlibpath="$dir" 2685219820Sjeff add="-l$name" 2686219820Sjeff else 2687219820Sjeff lib_linked=no 2688219820Sjeff fi 2689219820Sjeff ;; 2690219820Sjeff relink) 2691219820Sjeff if test "$hardcode_direct" = yes; then 2692219820Sjeff add="$dir/$linklib" 2693219820Sjeff elif test "$hardcode_minus_L" = yes; then 2694219820Sjeff add_dir="-L$dir" 2695219820Sjeff # Try looking first in the location we're being installed to. 2696219820Sjeff if test -n "$inst_prefix_dir"; then 2697219820Sjeff case $libdir in 2698219820Sjeff [\\/]*) 2699219820Sjeff add_dir="$add_dir -L$inst_prefix_dir$libdir" 2700219820Sjeff ;; 2701219820Sjeff esac 2702219820Sjeff fi 2703219820Sjeff add="-l$name" 2704219820Sjeff elif test "$hardcode_shlibpath_var" = yes; then 2705219820Sjeff add_shlibpath="$dir" 2706219820Sjeff add="-l$name" 2707219820Sjeff else 2708219820Sjeff lib_linked=no 2709219820Sjeff fi 2710219820Sjeff ;; 2711219820Sjeff *) lib_linked=no ;; 2712219820Sjeff esac 2713219820Sjeff 2714219820Sjeff if test "$lib_linked" != yes; then 2715219820Sjeff $echo "$modename: configuration error: unsupported hardcode properties" 2716219820Sjeff exit $EXIT_FAILURE 2717219820Sjeff fi 2718219820Sjeff 2719219820Sjeff if test -n "$add_shlibpath"; then 2720219820Sjeff case :$compile_shlibpath: in 2721219820Sjeff *":$add_shlibpath:"*) ;; 2722219820Sjeff *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2723219820Sjeff esac 2724219820Sjeff fi 2725219820Sjeff if test "$linkmode" = prog; then 2726219820Sjeff test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2727219820Sjeff test -n "$add" && compile_deplibs="$add $compile_deplibs" 2728219820Sjeff else 2729219820Sjeff test -n "$add_dir" && deplibs="$add_dir $deplibs" 2730219820Sjeff test -n "$add" && deplibs="$add $deplibs" 2731219820Sjeff if test "$hardcode_direct" != yes && \ 2732219820Sjeff test "$hardcode_minus_L" != yes && \ 2733219820Sjeff test "$hardcode_shlibpath_var" = yes; then 2734219820Sjeff case :$finalize_shlibpath: in 2735219820Sjeff *":$libdir:"*) ;; 2736219820Sjeff *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2737219820Sjeff esac 2738219820Sjeff fi 2739219820Sjeff fi 2740219820Sjeff fi 2741219820Sjeff 2742219820Sjeff if test "$linkmode" = prog || test "$mode" = relink; then 2743219820Sjeff add_shlibpath= 2744219820Sjeff add_dir= 2745219820Sjeff add= 2746219820Sjeff # Finalize command for both is simple: just hardcode it. 2747219820Sjeff if test "$hardcode_direct" = yes; then 2748219820Sjeff add="$libdir/$linklib" 2749219820Sjeff elif test "$hardcode_minus_L" = yes; then 2750219820Sjeff add_dir="-L$libdir" 2751219820Sjeff add="-l$name" 2752219820Sjeff elif test "$hardcode_shlibpath_var" = yes; then 2753219820Sjeff case :$finalize_shlibpath: in 2754219820Sjeff *":$libdir:"*) ;; 2755219820Sjeff *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2756219820Sjeff esac 2757219820Sjeff add="-l$name" 2758219820Sjeff elif test "$hardcode_automatic" = yes; then 2759219820Sjeff if test -n "$inst_prefix_dir" && 2760219820Sjeff test -f "$inst_prefix_dir$libdir/$linklib" ; then 2761219820Sjeff add="$inst_prefix_dir$libdir/$linklib" 2762219820Sjeff else 2763219820Sjeff add="$libdir/$linklib" 2764219820Sjeff fi 2765219820Sjeff else 2766219820Sjeff # We cannot seem to hardcode it, guess we'll fake it. 2767219820Sjeff add_dir="-L$libdir" 2768219820Sjeff # Try looking first in the location we're being installed to. 2769219820Sjeff if test -n "$inst_prefix_dir"; then 2770219820Sjeff case $libdir in 2771219820Sjeff [\\/]*) 2772219820Sjeff add_dir="$add_dir -L$inst_prefix_dir$libdir" 2773219820Sjeff ;; 2774219820Sjeff esac 2775219820Sjeff fi 2776219820Sjeff add="-l$name" 2777219820Sjeff fi 2778219820Sjeff 2779219820Sjeff if test "$linkmode" = prog; then 2780219820Sjeff test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2781219820Sjeff test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2782219820Sjeff else 2783219820Sjeff test -n "$add_dir" && deplibs="$add_dir $deplibs" 2784219820Sjeff test -n "$add" && deplibs="$add $deplibs" 2785219820Sjeff fi 2786219820Sjeff fi 2787219820Sjeff elif test "$linkmode" = prog; then 2788219820Sjeff # Here we assume that one of hardcode_direct or hardcode_minus_L 2789219820Sjeff # is not unsupported. This is valid on all known static and 2790219820Sjeff # shared platforms. 2791219820Sjeff if test "$hardcode_direct" != unsupported; then 2792219820Sjeff test -n "$old_library" && linklib="$old_library" 2793219820Sjeff compile_deplibs="$dir/$linklib $compile_deplibs" 2794219820Sjeff finalize_deplibs="$dir/$linklib $finalize_deplibs" 2795219820Sjeff else 2796219820Sjeff compile_deplibs="-l$name -L$dir $compile_deplibs" 2797219820Sjeff finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2798219820Sjeff fi 2799219820Sjeff elif test "$build_libtool_libs" = yes; then 2800219820Sjeff # Not a shared library 2801219820Sjeff if test "$deplibs_check_method" != pass_all; then 2802219820Sjeff # We're trying link a shared library against a static one 2803219820Sjeff # but the system doesn't support it. 2804219820Sjeff 2805219820Sjeff # Just print a warning and add the library to dependency_libs so 2806219820Sjeff # that the program can be linked against the static library. 2807219820Sjeff $echo 2808219820Sjeff $echo "*** Warning: This system can not link to static lib archive $lib." 2809219820Sjeff $echo "*** I have the capability to make that library automatically link in when" 2810219820Sjeff $echo "*** you link to this library. But I can only do this if you have a" 2811219820Sjeff $echo "*** shared version of the library, which you do not appear to have." 2812219820Sjeff if test "$module" = yes; then 2813219820Sjeff $echo "*** But as you try to build a module library, libtool will still create " 2814219820Sjeff $echo "*** a static module, that should work as long as the dlopening application" 2815219820Sjeff $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 2816219820Sjeff if test -z "$global_symbol_pipe"; then 2817219820Sjeff $echo 2818219820Sjeff $echo "*** However, this would only work if libtool was able to extract symbol" 2819219820Sjeff $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2820219820Sjeff $echo "*** not find such a program. So, this module is probably useless." 2821219820Sjeff $echo "*** \`nm' from GNU binutils and a full rebuild may help." 2822219820Sjeff fi 2823219820Sjeff if test "$build_old_libs" = no; then 2824219820Sjeff build_libtool_libs=module 2825219820Sjeff build_old_libs=yes 2826219820Sjeff else 2827219820Sjeff build_libtool_libs=no 2828219820Sjeff fi 2829219820Sjeff fi 2830219820Sjeff else 2831219820Sjeff deplibs="$dir/$old_library $deplibs" 2832219820Sjeff link_static=yes 2833219820Sjeff fi 2834219820Sjeff fi # link shared/static library? 2835219820Sjeff 2836219820Sjeff if test "$linkmode" = lib; then 2837219820Sjeff if test -n "$dependency_libs" && 2838219820Sjeff { test "$hardcode_into_libs" != yes || 2839219820Sjeff test "$build_old_libs" = yes || 2840219820Sjeff test "$link_static" = yes; }; then 2841219820Sjeff # Extract -R from dependency_libs 2842219820Sjeff temp_deplibs= 2843219820Sjeff for libdir in $dependency_libs; do 2844219820Sjeff case $libdir in 2845219820Sjeff -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2846219820Sjeff case " $xrpath " in 2847219820Sjeff *" $temp_xrpath "*) ;; 2848219820Sjeff *) xrpath="$xrpath $temp_xrpath";; 2849219820Sjeff esac;; 2850219820Sjeff *) temp_deplibs="$temp_deplibs $libdir";; 2851219820Sjeff esac 2852219820Sjeff done 2853219820Sjeff dependency_libs="$temp_deplibs" 2854219820Sjeff fi 2855219820Sjeff 2856219820Sjeff newlib_search_path="$newlib_search_path $absdir" 2857219820Sjeff # Link against this library 2858219820Sjeff test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2859219820Sjeff # ... and its dependency_libs 2860219820Sjeff tmp_libs= 2861219820Sjeff for deplib in $dependency_libs; do 2862219820Sjeff newdependency_libs="$deplib $newdependency_libs" 2863219820Sjeff if test "X$duplicate_deps" = "Xyes" ; then 2864219820Sjeff case "$tmp_libs " in 2865219820Sjeff *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2866219820Sjeff esac 2867219820Sjeff fi 2868219820Sjeff tmp_libs="$tmp_libs $deplib" 2869219820Sjeff done 2870219820Sjeff 2871219820Sjeff if test "$link_all_deplibs" != no; then 2872219820Sjeff # Add the search paths of all dependency libraries 2873219820Sjeff for deplib in $dependency_libs; do 2874219820Sjeff case $deplib in 2875219820Sjeff -L*) path="$deplib" ;; 2876219820Sjeff *.la) 2877219820Sjeff dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2878219820Sjeff test "X$dir" = "X$deplib" && dir="." 2879219820Sjeff # We need an absolute path. 2880219820Sjeff case $dir in 2881219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2882219820Sjeff *) 2883219820Sjeff absdir=`cd "$dir" && pwd` 2884219820Sjeff if test -z "$absdir"; then 2885219820Sjeff $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2886219820Sjeff absdir="$dir" 2887219820Sjeff fi 2888219820Sjeff ;; 2889219820Sjeff esac 2890219820Sjeff if grep "^installed=no" $deplib > /dev/null; then 2891219820Sjeff path="$absdir/$objdir" 2892219820Sjeff else 2893219820Sjeff eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2894219820Sjeff if test -z "$libdir"; then 2895219820Sjeff $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2896219820Sjeff exit $EXIT_FAILURE 2897219820Sjeff fi 2898219820Sjeff if test "$absdir" != "$libdir"; then 2899219820Sjeff $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2900219820Sjeff fi 2901219820Sjeff path="$absdir" 2902219820Sjeff fi 2903219820Sjeff depdepl= 2904219820Sjeff case $host in 2905219820Sjeff *-*-darwin*) 2906219820Sjeff # we do not want to link against static libs, 2907219820Sjeff # but need to link against shared 2908219820Sjeff eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 2909219820Sjeff if test -n "$deplibrary_names" ; then 2910219820Sjeff for tmp in $deplibrary_names ; do 2911219820Sjeff depdepl=$tmp 2912219820Sjeff done 2913219820Sjeff if test -f "$path/$depdepl" ; then 2914219820Sjeff depdepl="$path/$depdepl" 2915219820Sjeff fi 2916219820Sjeff # do not add paths which are already there 2917219820Sjeff case " $newlib_search_path " in 2918219820Sjeff *" $path "*) ;; 2919219820Sjeff *) newlib_search_path="$newlib_search_path $path";; 2920219820Sjeff esac 2921219820Sjeff fi 2922219820Sjeff path="" 2923219820Sjeff ;; 2924219820Sjeff *) 2925219820Sjeff path="-L$path" 2926219820Sjeff ;; 2927219820Sjeff esac 2928219820Sjeff ;; 2929219820Sjeff -l*) 2930219820Sjeff case $host in 2931219820Sjeff *-*-darwin*) 2932219820Sjeff # Again, we only want to link against shared libraries 2933219820Sjeff eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 2934219820Sjeff for tmp in $newlib_search_path ; do 2935219820Sjeff if test -f "$tmp/lib$tmp_libs.dylib" ; then 2936219820Sjeff eval depdepl="$tmp/lib$tmp_libs.dylib" 2937219820Sjeff break 2938219820Sjeff fi 2939219820Sjeff done 2940219820Sjeff path="" 2941219820Sjeff ;; 2942219820Sjeff *) continue ;; 2943219820Sjeff esac 2944219820Sjeff ;; 2945219820Sjeff *) continue ;; 2946219820Sjeff esac 2947219820Sjeff case " $deplibs " in 2948219820Sjeff *" $path "*) ;; 2949219820Sjeff *) deplibs="$path $deplibs" ;; 2950219820Sjeff esac 2951219820Sjeff case " $deplibs " in 2952219820Sjeff *" $depdepl "*) ;; 2953219820Sjeff *) deplibs="$depdepl $deplibs" ;; 2954219820Sjeff esac 2955219820Sjeff done 2956219820Sjeff fi # link_all_deplibs != no 2957219820Sjeff fi # linkmode = lib 2958219820Sjeff done # for deplib in $libs 2959219820Sjeff dependency_libs="$newdependency_libs" 2960219820Sjeff if test "$pass" = dlpreopen; then 2961219820Sjeff # Link the dlpreopened libraries before other libraries 2962219820Sjeff for deplib in $save_deplibs; do 2963219820Sjeff deplibs="$deplib $deplibs" 2964219820Sjeff done 2965219820Sjeff fi 2966219820Sjeff if test "$pass" != dlopen; then 2967219820Sjeff if test "$pass" != conv; then 2968219820Sjeff # Make sure lib_search_path contains only unique directories. 2969219820Sjeff lib_search_path= 2970219820Sjeff for dir in $newlib_search_path; do 2971219820Sjeff case "$lib_search_path " in 2972219820Sjeff *" $dir "*) ;; 2973219820Sjeff *) lib_search_path="$lib_search_path $dir" ;; 2974219820Sjeff esac 2975219820Sjeff done 2976219820Sjeff newlib_search_path= 2977219820Sjeff fi 2978219820Sjeff 2979219820Sjeff if test "$linkmode,$pass" != "prog,link"; then 2980219820Sjeff vars="deplibs" 2981219820Sjeff else 2982219820Sjeff vars="compile_deplibs finalize_deplibs" 2983219820Sjeff fi 2984219820Sjeff for var in $vars dependency_libs; do 2985219820Sjeff # Add libraries to $var in reverse order 2986219820Sjeff eval tmp_libs=\"\$$var\" 2987219820Sjeff new_libs= 2988219820Sjeff for deplib in $tmp_libs; do 2989219820Sjeff # FIXME: Pedantically, this is the right thing to do, so 2990219820Sjeff # that some nasty dependency loop isn't accidentally 2991219820Sjeff # broken: 2992219820Sjeff #new_libs="$deplib $new_libs" 2993219820Sjeff # Pragmatically, this seems to cause very few problems in 2994219820Sjeff # practice: 2995219820Sjeff case $deplib in 2996219820Sjeff -L*) new_libs="$deplib $new_libs" ;; 2997219820Sjeff -R*) ;; 2998219820Sjeff *) 2999219820Sjeff # And here is the reason: when a library appears more 3000219820Sjeff # than once as an explicit dependence of a library, or 3001219820Sjeff # is implicitly linked in more than once by the 3002219820Sjeff # compiler, it is considered special, and multiple 3003219820Sjeff # occurrences thereof are not removed. Compare this 3004219820Sjeff # with having the same library being listed as a 3005219820Sjeff # dependency of multiple other libraries: in this case, 3006219820Sjeff # we know (pedantically, we assume) the library does not 3007219820Sjeff # need to be listed more than once, so we keep only the 3008219820Sjeff # last copy. This is not always right, but it is rare 3009219820Sjeff # enough that we require users that really mean to play 3010219820Sjeff # such unportable linking tricks to link the library 3011219820Sjeff # using -Wl,-lname, so that libtool does not consider it 3012219820Sjeff # for duplicate removal. 3013219820Sjeff case " $specialdeplibs " in 3014219820Sjeff *" $deplib "*) new_libs="$deplib $new_libs" ;; 3015219820Sjeff *) 3016219820Sjeff case " $new_libs " in 3017219820Sjeff *" $deplib "*) ;; 3018219820Sjeff *) new_libs="$deplib $new_libs" ;; 3019219820Sjeff esac 3020219820Sjeff ;; 3021219820Sjeff esac 3022219820Sjeff ;; 3023219820Sjeff esac 3024219820Sjeff done 3025219820Sjeff tmp_libs= 3026219820Sjeff for deplib in $new_libs; do 3027219820Sjeff case $deplib in 3028219820Sjeff -L*) 3029219820Sjeff case " $tmp_libs " in 3030219820Sjeff *" $deplib "*) ;; 3031219820Sjeff *) tmp_libs="$tmp_libs $deplib" ;; 3032219820Sjeff esac 3033219820Sjeff ;; 3034219820Sjeff *) tmp_libs="$tmp_libs $deplib" ;; 3035219820Sjeff esac 3036219820Sjeff done 3037219820Sjeff eval $var=\"$tmp_libs\" 3038219820Sjeff done # for var 3039219820Sjeff fi 3040219820Sjeff # Last step: remove runtime libs from dependency_libs 3041219820Sjeff # (they stay in deplibs) 3042219820Sjeff tmp_libs= 3043219820Sjeff for i in $dependency_libs ; do 3044219820Sjeff case " $predeps $postdeps $compiler_lib_search_path " in 3045219820Sjeff *" $i "*) 3046219820Sjeff i="" 3047219820Sjeff ;; 3048219820Sjeff esac 3049219820Sjeff if test -n "$i" ; then 3050219820Sjeff tmp_libs="$tmp_libs $i" 3051219820Sjeff fi 3052219820Sjeff done 3053219820Sjeff dependency_libs=$tmp_libs 3054219820Sjeff done # for pass 3055219820Sjeff if test "$linkmode" = prog; then 3056219820Sjeff dlfiles="$newdlfiles" 3057219820Sjeff dlprefiles="$newdlprefiles" 3058219820Sjeff fi 3059219820Sjeff 3060219820Sjeff case $linkmode in 3061219820Sjeff oldlib) 3062219820Sjeff if test -n "$deplibs"; then 3063219820Sjeff $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 3064219820Sjeff fi 3065219820Sjeff 3066219820Sjeff if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3067219820Sjeff $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 3068219820Sjeff fi 3069219820Sjeff 3070219820Sjeff if test -n "$rpath"; then 3071219820Sjeff $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 3072219820Sjeff fi 3073219820Sjeff 3074219820Sjeff if test -n "$xrpath"; then 3075219820Sjeff $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 3076219820Sjeff fi 3077219820Sjeff 3078219820Sjeff if test -n "$vinfo"; then 3079219820Sjeff $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 3080219820Sjeff fi 3081219820Sjeff 3082219820Sjeff if test -n "$release"; then 3083219820Sjeff $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 3084219820Sjeff fi 3085219820Sjeff 3086219820Sjeff if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3087219820Sjeff $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 3088219820Sjeff fi 3089219820Sjeff 3090219820Sjeff # Now set the variables for building old libraries. 3091219820Sjeff build_libtool_libs=no 3092219820Sjeff oldlibs="$output" 3093219820Sjeff objs="$objs$old_deplibs" 3094219820Sjeff ;; 3095219820Sjeff 3096219820Sjeff lib) 3097219820Sjeff # Make sure we only generate libraries of the form `libNAME.la'. 3098219820Sjeff case $outputname in 3099219820Sjeff lib*) 3100219820Sjeff name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 3101219820Sjeff eval shared_ext=\"$shrext_cmds\" 3102219820Sjeff eval libname=\"$libname_spec\" 3103219820Sjeff ;; 3104219820Sjeff *) 3105219820Sjeff if test "$module" = no; then 3106219820Sjeff $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 3107219820Sjeff $echo "$help" 1>&2 3108219820Sjeff exit $EXIT_FAILURE 3109219820Sjeff fi 3110219820Sjeff if test "$need_lib_prefix" != no; then 3111219820Sjeff # Add the "lib" prefix for modules if required 3112219820Sjeff name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3113219820Sjeff eval shared_ext=\"$shrext_cmds\" 3114219820Sjeff eval libname=\"$libname_spec\" 3115219820Sjeff else 3116219820Sjeff libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3117219820Sjeff fi 3118219820Sjeff ;; 3119219820Sjeff esac 3120219820Sjeff 3121219820Sjeff if test -n "$objs"; then 3122219820Sjeff if test "$deplibs_check_method" != pass_all; then 3123219820Sjeff $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 3124219820Sjeff exit $EXIT_FAILURE 3125219820Sjeff else 3126219820Sjeff $echo 3127219820Sjeff $echo "*** Warning: Linking the shared library $output against the non-libtool" 3128219820Sjeff $echo "*** objects $objs is not portable!" 3129219820Sjeff libobjs="$libobjs $objs" 3130219820Sjeff fi 3131219820Sjeff fi 3132219820Sjeff 3133219820Sjeff if test "$dlself" != no; then 3134219820Sjeff $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 3135219820Sjeff fi 3136219820Sjeff 3137219820Sjeff set dummy $rpath 3138219820Sjeff if test "$#" -gt 2; then 3139219820Sjeff $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 3140219820Sjeff fi 3141219820Sjeff install_libdir="$2" 3142219820Sjeff 3143219820Sjeff oldlibs= 3144219820Sjeff if test -z "$rpath"; then 3145219820Sjeff if test "$build_libtool_libs" = yes; then 3146219820Sjeff # Building a libtool convenience library. 3147219820Sjeff # Some compilers have problems with a `.al' extension so 3148219820Sjeff # convenience libraries should have the same extension an 3149219820Sjeff # archive normally would. 3150219820Sjeff oldlibs="$output_objdir/$libname.$libext $oldlibs" 3151219820Sjeff build_libtool_libs=convenience 3152219820Sjeff build_old_libs=yes 3153219820Sjeff fi 3154219820Sjeff 3155219820Sjeff if test -n "$vinfo"; then 3156219820Sjeff $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 3157219820Sjeff fi 3158219820Sjeff 3159219820Sjeff if test -n "$release"; then 3160219820Sjeff $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 3161219820Sjeff fi 3162219820Sjeff else 3163219820Sjeff 3164219820Sjeff # Parse the version information argument. 3165219820Sjeff save_ifs="$IFS"; IFS=':' 3166219820Sjeff set dummy $vinfo 0 0 0 3167219820Sjeff IFS="$save_ifs" 3168219820Sjeff 3169219820Sjeff if test -n "$8"; then 3170219820Sjeff $echo "$modename: too many parameters to \`-version-info'" 1>&2 3171219820Sjeff $echo "$help" 1>&2 3172219820Sjeff exit $EXIT_FAILURE 3173219820Sjeff fi 3174219820Sjeff 3175219820Sjeff # convert absolute version numbers to libtool ages 3176219820Sjeff # this retains compatibility with .la files and attempts 3177219820Sjeff # to make the code below a bit more comprehensible 3178219820Sjeff 3179219820Sjeff case $vinfo_number in 3180219820Sjeff yes) 3181219820Sjeff number_major="$2" 3182219820Sjeff number_minor="$3" 3183219820Sjeff number_revision="$4" 3184219820Sjeff # 3185219820Sjeff # There are really only two kinds -- those that 3186219820Sjeff # use the current revision as the major version 3187219820Sjeff # and those that subtract age and use age as 3188219820Sjeff # a minor version. But, then there is irix 3189219820Sjeff # which has an extra 1 added just for fun 3190219820Sjeff # 3191219820Sjeff case $version_type in 3192219820Sjeff darwin|linux|osf|windows) 3193219820Sjeff current=`expr $number_major + $number_minor` 3194219820Sjeff age="$number_minor" 3195219820Sjeff revision="$number_revision" 3196219820Sjeff ;; 3197219820Sjeff freebsd-aout|freebsd-elf|sunos) 3198219820Sjeff current="$number_major" 3199219820Sjeff revision="$number_minor" 3200219820Sjeff age="0" 3201219820Sjeff ;; 3202219820Sjeff irix|nonstopux) 3203219820Sjeff current=`expr $number_major + $number_minor - 1` 3204219820Sjeff age="$number_minor" 3205219820Sjeff revision="$number_minor" 3206219820Sjeff ;; 3207219820Sjeff *) 3208219820Sjeff $echo "$modename: unknown library version type \`$version_type'" 1>&2 3209219820Sjeff $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 3210219820Sjeff exit $EXIT_FAILURE 3211219820Sjeff ;; 3212219820Sjeff esac 3213219820Sjeff ;; 3214219820Sjeff no) 3215219820Sjeff current="$2" 3216219820Sjeff revision="$3" 3217219820Sjeff age="$4" 3218219820Sjeff ;; 3219219820Sjeff esac 3220219820Sjeff 3221219820Sjeff # Check that each of the things are valid numbers. 3222219820Sjeff case $current in 3223219820Sjeff 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]) ;; 3224219820Sjeff *) 3225219820Sjeff $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 3226219820Sjeff $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3227219820Sjeff exit $EXIT_FAILURE 3228219820Sjeff ;; 3229219820Sjeff esac 3230219820Sjeff 3231219820Sjeff case $revision in 3232219820Sjeff 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]) ;; 3233219820Sjeff *) 3234219820Sjeff $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 3235219820Sjeff $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3236219820Sjeff exit $EXIT_FAILURE 3237219820Sjeff ;; 3238219820Sjeff esac 3239219820Sjeff 3240219820Sjeff case $age in 3241219820Sjeff 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]) ;; 3242219820Sjeff *) 3243219820Sjeff $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 3244219820Sjeff $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3245219820Sjeff exit $EXIT_FAILURE 3246219820Sjeff ;; 3247219820Sjeff esac 3248219820Sjeff 3249219820Sjeff if test "$age" -gt "$current"; then 3250219820Sjeff $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 3251219820Sjeff $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3252219820Sjeff exit $EXIT_FAILURE 3253219820Sjeff fi 3254219820Sjeff 3255219820Sjeff # Calculate the version variables. 3256219820Sjeff major= 3257219820Sjeff versuffix= 3258219820Sjeff verstring= 3259219820Sjeff case $version_type in 3260219820Sjeff none) ;; 3261219820Sjeff 3262219820Sjeff darwin) 3263219820Sjeff # Like Linux, but with the current version available in 3264219820Sjeff # verstring for coding it into the library header 3265219820Sjeff major=.`expr $current - $age` 3266219820Sjeff versuffix="$major.$age.$revision" 3267219820Sjeff # Darwin ld doesn't like 0 for these options... 3268219820Sjeff minor_current=`expr $current + 1` 3269219820Sjeff verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 3270219820Sjeff ;; 3271219820Sjeff 3272219820Sjeff freebsd-aout) 3273219820Sjeff major=".$current" 3274219820Sjeff versuffix=".$current.$revision"; 3275219820Sjeff ;; 3276219820Sjeff 3277219820Sjeff freebsd-elf) 3278219820Sjeff major=".$current" 3279219820Sjeff versuffix=".$current"; 3280219820Sjeff ;; 3281219820Sjeff 3282219820Sjeff irix | nonstopux) 3283219820Sjeff major=`expr $current - $age + 1` 3284219820Sjeff 3285219820Sjeff case $version_type in 3286219820Sjeff nonstopux) verstring_prefix=nonstopux ;; 3287219820Sjeff *) verstring_prefix=sgi ;; 3288219820Sjeff esac 3289219820Sjeff verstring="$verstring_prefix$major.$revision" 3290219820Sjeff 3291219820Sjeff # Add in all the interfaces that we are compatible with. 3292219820Sjeff loop=$revision 3293219820Sjeff while test "$loop" -ne 0; do 3294219820Sjeff iface=`expr $revision - $loop` 3295219820Sjeff loop=`expr $loop - 1` 3296219820Sjeff verstring="$verstring_prefix$major.$iface:$verstring" 3297219820Sjeff done 3298219820Sjeff 3299219820Sjeff # Before this point, $major must not contain `.'. 3300219820Sjeff major=.$major 3301219820Sjeff versuffix="$major.$revision" 3302219820Sjeff ;; 3303219820Sjeff 3304219820Sjeff linux) 3305219820Sjeff major=.`expr $current - $age` 3306219820Sjeff versuffix="$major.$age.$revision" 3307219820Sjeff ;; 3308219820Sjeff 3309219820Sjeff osf) 3310219820Sjeff major=.`expr $current - $age` 3311219820Sjeff versuffix=".$current.$age.$revision" 3312219820Sjeff verstring="$current.$age.$revision" 3313219820Sjeff 3314219820Sjeff # Add in all the interfaces that we are compatible with. 3315219820Sjeff loop=$age 3316219820Sjeff while test "$loop" -ne 0; do 3317219820Sjeff iface=`expr $current - $loop` 3318219820Sjeff loop=`expr $loop - 1` 3319219820Sjeff verstring="$verstring:${iface}.0" 3320219820Sjeff done 3321219820Sjeff 3322219820Sjeff # Make executables depend on our current version. 3323219820Sjeff verstring="$verstring:${current}.0" 3324219820Sjeff ;; 3325219820Sjeff 3326219820Sjeff sunos) 3327219820Sjeff major=".$current" 3328219820Sjeff versuffix=".$current.$revision" 3329219820Sjeff ;; 3330219820Sjeff 3331219820Sjeff windows) 3332219820Sjeff # Use '-' rather than '.', since we only want one 3333219820Sjeff # extension on DOS 8.3 filesystems. 3334219820Sjeff major=`expr $current - $age` 3335219820Sjeff versuffix="-$major" 3336219820Sjeff ;; 3337219820Sjeff 3338219820Sjeff *) 3339219820Sjeff $echo "$modename: unknown library version type \`$version_type'" 1>&2 3340219820Sjeff $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 3341219820Sjeff exit $EXIT_FAILURE 3342219820Sjeff ;; 3343219820Sjeff esac 3344219820Sjeff 3345219820Sjeff # Clear the version info if we defaulted, and they specified a release. 3346219820Sjeff if test -z "$vinfo" && test -n "$release"; then 3347219820Sjeff major= 3348219820Sjeff case $version_type in 3349219820Sjeff darwin) 3350219820Sjeff # we can't check for "0.0" in archive_cmds due to quoting 3351219820Sjeff # problems, so we reset it completely 3352219820Sjeff verstring= 3353219820Sjeff ;; 3354219820Sjeff *) 3355219820Sjeff verstring="0.0" 3356219820Sjeff ;; 3357219820Sjeff esac 3358219820Sjeff if test "$need_version" = no; then 3359219820Sjeff versuffix= 3360219820Sjeff else 3361219820Sjeff versuffix=".0.0" 3362219820Sjeff fi 3363219820Sjeff fi 3364219820Sjeff 3365219820Sjeff # Remove version info from name if versioning should be avoided 3366219820Sjeff if test "$avoid_version" = yes && test "$need_version" = no; then 3367219820Sjeff major= 3368219820Sjeff versuffix= 3369219820Sjeff verstring="" 3370219820Sjeff fi 3371219820Sjeff 3372219820Sjeff # Check to see if the archive will have undefined symbols. 3373219820Sjeff if test "$allow_undefined" = yes; then 3374219820Sjeff if test "$allow_undefined_flag" = unsupported; then 3375219820Sjeff $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 3376219820Sjeff build_libtool_libs=no 3377219820Sjeff build_old_libs=yes 3378219820Sjeff fi 3379219820Sjeff else 3380219820Sjeff # Don't allow undefined symbols. 3381219820Sjeff allow_undefined_flag="$no_undefined_flag" 3382219820Sjeff fi 3383219820Sjeff fi 3384219820Sjeff 3385219820Sjeff if test "$mode" != relink; then 3386219820Sjeff # Remove our outputs, but don't remove object files since they 3387219820Sjeff # may have been created when compiling PIC objects. 3388219820Sjeff removelist= 3389219820Sjeff tempremovelist=`$echo "$output_objdir/*"` 3390219820Sjeff for p in $tempremovelist; do 3391219820Sjeff case $p in 3392219820Sjeff *.$objext) 3393219820Sjeff ;; 3394219820Sjeff $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 3395219820Sjeff if test "X$precious_files_regex" != "X"; then 3396219820Sjeff if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 3397219820Sjeff then 3398219820Sjeff continue 3399219820Sjeff fi 3400219820Sjeff fi 3401219820Sjeff removelist="$removelist $p" 3402219820Sjeff ;; 3403219820Sjeff *) ;; 3404219820Sjeff esac 3405219820Sjeff done 3406219820Sjeff if test -n "$removelist"; then 3407219820Sjeff $show "${rm}r $removelist" 3408219820Sjeff $run ${rm}r $removelist 3409219820Sjeff fi 3410219820Sjeff fi 3411219820Sjeff 3412219820Sjeff # Now set the variables for building old libraries. 3413219820Sjeff if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 3414219820Sjeff oldlibs="$oldlibs $output_objdir/$libname.$libext" 3415219820Sjeff 3416219820Sjeff # Transform .lo files to .o files. 3417219820Sjeff oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3418219820Sjeff fi 3419219820Sjeff 3420219820Sjeff # Eliminate all temporary directories. 3421219820Sjeff for path in $notinst_path; do 3422219820Sjeff lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 3423219820Sjeff deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 3424219820Sjeff dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 3425219820Sjeff done 3426219820Sjeff 3427219820Sjeff if test -n "$xrpath"; then 3428219820Sjeff # If the user specified any rpath flags, then add them. 3429219820Sjeff temp_xrpath= 3430219820Sjeff for libdir in $xrpath; do 3431219820Sjeff temp_xrpath="$temp_xrpath -R$libdir" 3432219820Sjeff case "$finalize_rpath " in 3433219820Sjeff *" $libdir "*) ;; 3434219820Sjeff *) finalize_rpath="$finalize_rpath $libdir" ;; 3435219820Sjeff esac 3436219820Sjeff done 3437219820Sjeff if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 3438219820Sjeff dependency_libs="$temp_xrpath $dependency_libs" 3439219820Sjeff fi 3440219820Sjeff fi 3441219820Sjeff 3442219820Sjeff # Make sure dlfiles contains only unique files that won't be dlpreopened 3443219820Sjeff old_dlfiles="$dlfiles" 3444219820Sjeff dlfiles= 3445219820Sjeff for lib in $old_dlfiles; do 3446219820Sjeff case " $dlprefiles $dlfiles " in 3447219820Sjeff *" $lib "*) ;; 3448219820Sjeff *) dlfiles="$dlfiles $lib" ;; 3449219820Sjeff esac 3450219820Sjeff done 3451219820Sjeff 3452219820Sjeff # Make sure dlprefiles contains only unique files 3453219820Sjeff old_dlprefiles="$dlprefiles" 3454219820Sjeff dlprefiles= 3455219820Sjeff for lib in $old_dlprefiles; do 3456219820Sjeff case "$dlprefiles " in 3457219820Sjeff *" $lib "*) ;; 3458219820Sjeff *) dlprefiles="$dlprefiles $lib" ;; 3459219820Sjeff esac 3460219820Sjeff done 3461219820Sjeff 3462219820Sjeff if test "$build_libtool_libs" = yes; then 3463219820Sjeff if test -n "$rpath"; then 3464219820Sjeff case $host in 3465219820Sjeff *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 3466219820Sjeff # these systems don't actually have a c library (as such)! 3467219820Sjeff ;; 3468219820Sjeff *-*-rhapsody* | *-*-darwin1.[012]) 3469219820Sjeff # Rhapsody C library is in the System framework 3470219820Sjeff deplibs="$deplibs -framework System" 3471219820Sjeff ;; 3472219820Sjeff *-*-netbsd*) 3473219820Sjeff # Don't link with libc until the a.out ld.so is fixed. 3474219820Sjeff ;; 3475219820Sjeff *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3476219820Sjeff # Do not include libc due to us having libc/libc_r. 3477219820Sjeff ;; 3478219820Sjeff *-*-sco3.2v5* | *-*-sco5v6*) 3479219820Sjeff # Causes problems with __ctype 3480219820Sjeff ;; 3481219820Sjeff *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 3482219820Sjeff # Compiler inserts libc in the correct place for threads to work 3483219820Sjeff ;; 3484219820Sjeff *) 3485219820Sjeff # Add libc to deplibs on all other systems if necessary. 3486219820Sjeff if test "$build_libtool_need_lc" = "yes"; then 3487219820Sjeff deplibs="$deplibs -lc" 3488219820Sjeff fi 3489219820Sjeff ;; 3490219820Sjeff esac 3491219820Sjeff fi 3492219820Sjeff 3493219820Sjeff # Transform deplibs into only deplibs that can be linked in shared. 3494219820Sjeff name_save=$name 3495219820Sjeff libname_save=$libname 3496219820Sjeff release_save=$release 3497219820Sjeff versuffix_save=$versuffix 3498219820Sjeff major_save=$major 3499219820Sjeff # I'm not sure if I'm treating the release correctly. I think 3500219820Sjeff # release should show up in the -l (ie -lgmp5) so we don't want to 3501219820Sjeff # add it in twice. Is that correct? 3502219820Sjeff release="" 3503219820Sjeff versuffix="" 3504219820Sjeff major="" 3505219820Sjeff newdeplibs= 3506219820Sjeff droppeddeps=no 3507219820Sjeff case $deplibs_check_method in 3508219820Sjeff pass_all) 3509219820Sjeff # Don't check for shared/static. Everything works. 3510219820Sjeff # This might be a little naive. We might want to check 3511219820Sjeff # whether the library exists or not. But this is on 3512219820Sjeff # osf3 & osf4 and I'm not really sure... Just 3513219820Sjeff # implementing what was already the behavior. 3514219820Sjeff newdeplibs=$deplibs 3515219820Sjeff ;; 3516219820Sjeff test_compile) 3517219820Sjeff # This code stresses the "libraries are programs" paradigm to its 3518219820Sjeff # limits. Maybe even breaks it. We compile a program, linking it 3519219820Sjeff # against the deplibs as a proxy for the library. Then we can check 3520219820Sjeff # whether they linked in statically or dynamically with ldd. 3521219820Sjeff $rm conftest.c 3522219820Sjeff cat > conftest.c <<EOF 3523219820Sjeff int main() { return 0; } 3524219820SjeffEOF 3525219820Sjeff $rm conftest 3526219820Sjeff $LTCC $LTCFLAGS -o conftest conftest.c $deplibs 3527219820Sjeff if test "$?" -eq 0 ; then 3528219820Sjeff ldd_output=`ldd conftest` 3529219820Sjeff for i in $deplibs; do 3530219820Sjeff name=`expr $i : '-l\(.*\)'` 3531219820Sjeff # If $name is empty we are operating on a -L argument. 3532219820Sjeff if test "$name" != "" && test "$name" -ne "0"; then 3533219820Sjeff if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3534219820Sjeff case " $predeps $postdeps " in 3535219820Sjeff *" $i "*) 3536219820Sjeff newdeplibs="$newdeplibs $i" 3537219820Sjeff i="" 3538219820Sjeff ;; 3539219820Sjeff esac 3540219820Sjeff fi 3541219820Sjeff if test -n "$i" ; then 3542219820Sjeff libname=`eval \\$echo \"$libname_spec\"` 3543219820Sjeff deplib_matches=`eval \\$echo \"$library_names_spec\"` 3544219820Sjeff set dummy $deplib_matches 3545219820Sjeff deplib_match=$2 3546219820Sjeff if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3547219820Sjeff newdeplibs="$newdeplibs $i" 3548219820Sjeff else 3549219820Sjeff droppeddeps=yes 3550219820Sjeff $echo 3551219820Sjeff $echo "*** Warning: dynamic linker does not accept needed library $i." 3552219820Sjeff $echo "*** I have the capability to make that library automatically link in when" 3553219820Sjeff $echo "*** you link to this library. But I can only do this if you have a" 3554219820Sjeff $echo "*** shared version of the library, which I believe you do not have" 3555219820Sjeff $echo "*** because a test_compile did reveal that the linker did not use it for" 3556219820Sjeff $echo "*** its dynamic dependency list that programs get resolved with at runtime." 3557219820Sjeff fi 3558219820Sjeff fi 3559219820Sjeff else 3560219820Sjeff newdeplibs="$newdeplibs $i" 3561219820Sjeff fi 3562219820Sjeff done 3563219820Sjeff else 3564219820Sjeff # Error occurred in the first compile. Let's try to salvage 3565219820Sjeff # the situation: Compile a separate program for each library. 3566219820Sjeff for i in $deplibs; do 3567219820Sjeff name=`expr $i : '-l\(.*\)'` 3568219820Sjeff # If $name is empty we are operating on a -L argument. 3569219820Sjeff if test "$name" != "" && test "$name" != "0"; then 3570219820Sjeff $rm conftest 3571219820Sjeff $LTCC $LTCFLAGS -o conftest conftest.c $i 3572219820Sjeff # Did it work? 3573219820Sjeff if test "$?" -eq 0 ; then 3574219820Sjeff ldd_output=`ldd conftest` 3575219820Sjeff if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3576219820Sjeff case " $predeps $postdeps " in 3577219820Sjeff *" $i "*) 3578219820Sjeff newdeplibs="$newdeplibs $i" 3579219820Sjeff i="" 3580219820Sjeff ;; 3581219820Sjeff esac 3582219820Sjeff fi 3583219820Sjeff if test -n "$i" ; then 3584219820Sjeff libname=`eval \\$echo \"$libname_spec\"` 3585219820Sjeff deplib_matches=`eval \\$echo \"$library_names_spec\"` 3586219820Sjeff set dummy $deplib_matches 3587219820Sjeff deplib_match=$2 3588219820Sjeff if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3589219820Sjeff newdeplibs="$newdeplibs $i" 3590219820Sjeff else 3591219820Sjeff droppeddeps=yes 3592219820Sjeff $echo 3593219820Sjeff $echo "*** Warning: dynamic linker does not accept needed library $i." 3594219820Sjeff $echo "*** I have the capability to make that library automatically link in when" 3595219820Sjeff $echo "*** you link to this library. But I can only do this if you have a" 3596219820Sjeff $echo "*** shared version of the library, which you do not appear to have" 3597219820Sjeff $echo "*** because a test_compile did reveal that the linker did not use this one" 3598219820Sjeff $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 3599219820Sjeff fi 3600219820Sjeff fi 3601219820Sjeff else 3602219820Sjeff droppeddeps=yes 3603219820Sjeff $echo 3604219820Sjeff $echo "*** Warning! Library $i is needed by this library but I was not able to" 3605219820Sjeff $echo "*** make it link in! You will probably need to install it or some" 3606219820Sjeff $echo "*** library that it depends on before this library will be fully" 3607219820Sjeff $echo "*** functional. Installing it before continuing would be even better." 3608219820Sjeff fi 3609219820Sjeff else 3610219820Sjeff newdeplibs="$newdeplibs $i" 3611219820Sjeff fi 3612219820Sjeff done 3613219820Sjeff fi 3614219820Sjeff ;; 3615219820Sjeff file_magic*) 3616219820Sjeff set dummy $deplibs_check_method 3617219820Sjeff file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3618219820Sjeff for a_deplib in $deplibs; do 3619219820Sjeff name=`expr $a_deplib : '-l\(.*\)'` 3620219820Sjeff # If $name is empty we are operating on a -L argument. 3621219820Sjeff if test "$name" != "" && test "$name" != "0"; then 3622219820Sjeff if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3623219820Sjeff case " $predeps $postdeps " in 3624219820Sjeff *" $a_deplib "*) 3625219820Sjeff newdeplibs="$newdeplibs $a_deplib" 3626219820Sjeff a_deplib="" 3627219820Sjeff ;; 3628219820Sjeff esac 3629219820Sjeff fi 3630219820Sjeff if test -n "$a_deplib" ; then 3631219820Sjeff libname=`eval \\$echo \"$libname_spec\"` 3632219820Sjeff for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3633219820Sjeff potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3634219820Sjeff for potent_lib in $potential_libs; do 3635219820Sjeff # Follow soft links. 3636219820Sjeff if ls -lLd "$potent_lib" 2>/dev/null \ 3637219820Sjeff | grep " -> " >/dev/null; then 3638219820Sjeff continue 3639219820Sjeff fi 3640219820Sjeff # The statement above tries to avoid entering an 3641219820Sjeff # endless loop below, in case of cyclic links. 3642219820Sjeff # We might still enter an endless loop, since a link 3643219820Sjeff # loop can be closed while we follow links, 3644219820Sjeff # but so what? 3645219820Sjeff potlib="$potent_lib" 3646219820Sjeff while test -h "$potlib" 2>/dev/null; do 3647219820Sjeff potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 3648219820Sjeff case $potliblink in 3649219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 3650219820Sjeff *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 3651219820Sjeff esac 3652219820Sjeff done 3653219820Sjeff if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 3654219820Sjeff | ${SED} 10q \ 3655219820Sjeff | $EGREP "$file_magic_regex" > /dev/null; then 3656219820Sjeff newdeplibs="$newdeplibs $a_deplib" 3657219820Sjeff a_deplib="" 3658219820Sjeff break 2 3659219820Sjeff fi 3660219820Sjeff done 3661219820Sjeff done 3662219820Sjeff fi 3663219820Sjeff if test -n "$a_deplib" ; then 3664219820Sjeff droppeddeps=yes 3665219820Sjeff $echo 3666219820Sjeff $echo "*** Warning: linker path does not have real file for library $a_deplib." 3667219820Sjeff $echo "*** I have the capability to make that library automatically link in when" 3668219820Sjeff $echo "*** you link to this library. But I can only do this if you have a" 3669219820Sjeff $echo "*** shared version of the library, which you do not appear to have" 3670219820Sjeff $echo "*** because I did check the linker path looking for a file starting" 3671219820Sjeff if test -z "$potlib" ; then 3672219820Sjeff $echo "*** with $libname but no candidates were found. (...for file magic test)" 3673219820Sjeff else 3674219820Sjeff $echo "*** with $libname and none of the candidates passed a file format test" 3675219820Sjeff $echo "*** using a file magic. Last file checked: $potlib" 3676219820Sjeff fi 3677219820Sjeff fi 3678219820Sjeff else 3679219820Sjeff # Add a -L argument. 3680219820Sjeff newdeplibs="$newdeplibs $a_deplib" 3681219820Sjeff fi 3682219820Sjeff done # Gone through all deplibs. 3683219820Sjeff ;; 3684219820Sjeff match_pattern*) 3685219820Sjeff set dummy $deplibs_check_method 3686219820Sjeff match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3687219820Sjeff for a_deplib in $deplibs; do 3688219820Sjeff name=`expr $a_deplib : '-l\(.*\)'` 3689219820Sjeff # If $name is empty we are operating on a -L argument. 3690219820Sjeff if test -n "$name" && test "$name" != "0"; then 3691219820Sjeff if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3692219820Sjeff case " $predeps $postdeps " in 3693219820Sjeff *" $a_deplib "*) 3694219820Sjeff newdeplibs="$newdeplibs $a_deplib" 3695219820Sjeff a_deplib="" 3696219820Sjeff ;; 3697219820Sjeff esac 3698219820Sjeff fi 3699219820Sjeff if test -n "$a_deplib" ; then 3700219820Sjeff libname=`eval \\$echo \"$libname_spec\"` 3701219820Sjeff for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3702219820Sjeff potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3703219820Sjeff for potent_lib in $potential_libs; do 3704219820Sjeff potlib="$potent_lib" # see symlink-check above in file_magic test 3705219820Sjeff if eval $echo \"$potent_lib\" 2>/dev/null \ 3706219820Sjeff | ${SED} 10q \ 3707219820Sjeff | $EGREP "$match_pattern_regex" > /dev/null; then 3708219820Sjeff newdeplibs="$newdeplibs $a_deplib" 3709219820Sjeff a_deplib="" 3710219820Sjeff break 2 3711219820Sjeff fi 3712219820Sjeff done 3713219820Sjeff done 3714219820Sjeff fi 3715219820Sjeff if test -n "$a_deplib" ; then 3716219820Sjeff droppeddeps=yes 3717219820Sjeff $echo 3718219820Sjeff $echo "*** Warning: linker path does not have real file for library $a_deplib." 3719219820Sjeff $echo "*** I have the capability to make that library automatically link in when" 3720219820Sjeff $echo "*** you link to this library. But I can only do this if you have a" 3721219820Sjeff $echo "*** shared version of the library, which you do not appear to have" 3722219820Sjeff $echo "*** because I did check the linker path looking for a file starting" 3723219820Sjeff if test -z "$potlib" ; then 3724219820Sjeff $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 3725219820Sjeff else 3726219820Sjeff $echo "*** with $libname and none of the candidates passed a file format test" 3727219820Sjeff $echo "*** using a regex pattern. Last file checked: $potlib" 3728219820Sjeff fi 3729219820Sjeff fi 3730219820Sjeff else 3731219820Sjeff # Add a -L argument. 3732219820Sjeff newdeplibs="$newdeplibs $a_deplib" 3733219820Sjeff fi 3734219820Sjeff done # Gone through all deplibs. 3735219820Sjeff ;; 3736219820Sjeff none | unknown | *) 3737219820Sjeff newdeplibs="" 3738219820Sjeff tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 3739219820Sjeff -e 's/ -[LR][^ ]*//g'` 3740219820Sjeff if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3741219820Sjeff for i in $predeps $postdeps ; do 3742219820Sjeff # can't use Xsed below, because $i might contain '/' 3743219820Sjeff tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 3744219820Sjeff done 3745219820Sjeff fi 3746219820Sjeff if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 3747219820Sjeff | grep . >/dev/null; then 3748219820Sjeff $echo 3749219820Sjeff if test "X$deplibs_check_method" = "Xnone"; then 3750219820Sjeff $echo "*** Warning: inter-library dependencies are not supported in this platform." 3751219820Sjeff else 3752219820Sjeff $echo "*** Warning: inter-library dependencies are not known to be supported." 3753219820Sjeff fi 3754219820Sjeff $echo "*** All declared inter-library dependencies are being dropped." 3755219820Sjeff droppeddeps=yes 3756219820Sjeff fi 3757219820Sjeff ;; 3758219820Sjeff esac 3759219820Sjeff versuffix=$versuffix_save 3760219820Sjeff major=$major_save 3761219820Sjeff release=$release_save 3762219820Sjeff libname=$libname_save 3763219820Sjeff name=$name_save 3764219820Sjeff 3765219820Sjeff case $host in 3766219820Sjeff *-*-rhapsody* | *-*-darwin1.[012]) 3767219820Sjeff # On Rhapsody replace the C library is the System framework 3768219820Sjeff newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 3769219820Sjeff ;; 3770219820Sjeff esac 3771219820Sjeff 3772219820Sjeff if test "$droppeddeps" = yes; then 3773219820Sjeff if test "$module" = yes; then 3774219820Sjeff $echo 3775219820Sjeff $echo "*** Warning: libtool could not satisfy all declared inter-library" 3776219820Sjeff $echo "*** dependencies of module $libname. Therefore, libtool will create" 3777219820Sjeff $echo "*** a static module, that should work as long as the dlopening" 3778219820Sjeff $echo "*** application is linked with the -dlopen flag." 3779219820Sjeff if test -z "$global_symbol_pipe"; then 3780219820Sjeff $echo 3781219820Sjeff $echo "*** However, this would only work if libtool was able to extract symbol" 3782219820Sjeff $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 3783219820Sjeff $echo "*** not find such a program. So, this module is probably useless." 3784219820Sjeff $echo "*** \`nm' from GNU binutils and a full rebuild may help." 3785219820Sjeff fi 3786219820Sjeff if test "$build_old_libs" = no; then 3787219820Sjeff oldlibs="$output_objdir/$libname.$libext" 3788219820Sjeff build_libtool_libs=module 3789219820Sjeff build_old_libs=yes 3790219820Sjeff else 3791219820Sjeff build_libtool_libs=no 3792219820Sjeff fi 3793219820Sjeff else 3794219820Sjeff $echo "*** The inter-library dependencies that have been dropped here will be" 3795219820Sjeff $echo "*** automatically added whenever a program is linked with this library" 3796219820Sjeff $echo "*** or is declared to -dlopen it." 3797219820Sjeff 3798219820Sjeff if test "$allow_undefined" = no; then 3799219820Sjeff $echo 3800219820Sjeff $echo "*** Since this library must not contain undefined symbols," 3801219820Sjeff $echo "*** because either the platform does not support them or" 3802219820Sjeff $echo "*** it was explicitly requested with -no-undefined," 3803219820Sjeff $echo "*** libtool will only create a static version of it." 3804219820Sjeff if test "$build_old_libs" = no; then 3805219820Sjeff oldlibs="$output_objdir/$libname.$libext" 3806219820Sjeff build_libtool_libs=module 3807219820Sjeff build_old_libs=yes 3808219820Sjeff else 3809219820Sjeff build_libtool_libs=no 3810219820Sjeff fi 3811219820Sjeff fi 3812219820Sjeff fi 3813219820Sjeff fi 3814219820Sjeff # Done checking deplibs! 3815219820Sjeff deplibs=$newdeplibs 3816219820Sjeff fi 3817219820Sjeff 3818219820Sjeff 3819219820Sjeff # move library search paths that coincide with paths to not yet 3820219820Sjeff # installed libraries to the beginning of the library search list 3821219820Sjeff new_libs= 3822219820Sjeff for path in $notinst_path; do 3823219820Sjeff case " $new_libs " in 3824219820Sjeff *" -L$path/$objdir "*) ;; 3825219820Sjeff *) 3826219820Sjeff case " $deplibs " in 3827219820Sjeff *" -L$path/$objdir "*) 3828219820Sjeff new_libs="$new_libs -L$path/$objdir" ;; 3829219820Sjeff esac 3830219820Sjeff ;; 3831219820Sjeff esac 3832219820Sjeff done 3833219820Sjeff for deplib in $deplibs; do 3834219820Sjeff case $deplib in 3835219820Sjeff -L*) 3836219820Sjeff case " $new_libs " in 3837219820Sjeff *" $deplib "*) ;; 3838219820Sjeff *) new_libs="$new_libs $deplib" ;; 3839219820Sjeff esac 3840219820Sjeff ;; 3841219820Sjeff *) new_libs="$new_libs $deplib" ;; 3842219820Sjeff esac 3843219820Sjeff done 3844219820Sjeff deplibs="$new_libs" 3845219820Sjeff 3846219820Sjeff 3847219820Sjeff # All the library-specific variables (install_libdir is set above). 3848219820Sjeff library_names= 3849219820Sjeff old_library= 3850219820Sjeff dlname= 3851219820Sjeff 3852219820Sjeff # Test again, we may have decided not to build it any more 3853219820Sjeff if test "$build_libtool_libs" = yes; then 3854219820Sjeff if test "$hardcode_into_libs" = yes; then 3855219820Sjeff # Hardcode the library paths 3856219820Sjeff hardcode_libdirs= 3857219820Sjeff dep_rpath= 3858219820Sjeff rpath="$finalize_rpath" 3859219820Sjeff test "$mode" != relink && rpath="$compile_rpath$rpath" 3860219820Sjeff for libdir in $rpath; do 3861219820Sjeff if test -n "$hardcode_libdir_flag_spec"; then 3862219820Sjeff if test -n "$hardcode_libdir_separator"; then 3863219820Sjeff if test -z "$hardcode_libdirs"; then 3864219820Sjeff hardcode_libdirs="$libdir" 3865219820Sjeff else 3866219820Sjeff # Just accumulate the unique libdirs. 3867219820Sjeff case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3868219820Sjeff *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3869219820Sjeff ;; 3870219820Sjeff *) 3871219820Sjeff hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3872219820Sjeff ;; 3873219820Sjeff esac 3874219820Sjeff fi 3875219820Sjeff else 3876219820Sjeff eval flag=\"$hardcode_libdir_flag_spec\" 3877219820Sjeff dep_rpath="$dep_rpath $flag" 3878219820Sjeff fi 3879219820Sjeff elif test -n "$runpath_var"; then 3880219820Sjeff case "$perm_rpath " in 3881219820Sjeff *" $libdir "*) ;; 3882219820Sjeff *) perm_rpath="$perm_rpath $libdir" ;; 3883219820Sjeff esac 3884219820Sjeff fi 3885219820Sjeff done 3886219820Sjeff # Substitute the hardcoded libdirs into the rpath. 3887219820Sjeff if test -n "$hardcode_libdir_separator" && 3888219820Sjeff test -n "$hardcode_libdirs"; then 3889219820Sjeff libdir="$hardcode_libdirs" 3890219820Sjeff if test -n "$hardcode_libdir_flag_spec_ld"; then 3891219820Sjeff eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 3892219820Sjeff else 3893219820Sjeff eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3894219820Sjeff fi 3895219820Sjeff fi 3896219820Sjeff if test -n "$runpath_var" && test -n "$perm_rpath"; then 3897219820Sjeff # We should set the runpath_var. 3898219820Sjeff rpath= 3899219820Sjeff for dir in $perm_rpath; do 3900219820Sjeff rpath="$rpath$dir:" 3901219820Sjeff done 3902219820Sjeff eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3903219820Sjeff fi 3904219820Sjeff test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3905219820Sjeff fi 3906219820Sjeff 3907219820Sjeff shlibpath="$finalize_shlibpath" 3908219820Sjeff test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 3909219820Sjeff if test -n "$shlibpath"; then 3910219820Sjeff eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 3911219820Sjeff fi 3912219820Sjeff 3913219820Sjeff # Get the real and link names of the library. 3914219820Sjeff eval shared_ext=\"$shrext_cmds\" 3915219820Sjeff eval library_names=\"$library_names_spec\" 3916219820Sjeff set dummy $library_names 3917219820Sjeff realname="$2" 3918219820Sjeff shift; shift 3919219820Sjeff 3920219820Sjeff if test -n "$soname_spec"; then 3921219820Sjeff eval soname=\"$soname_spec\" 3922219820Sjeff else 3923219820Sjeff soname="$realname" 3924219820Sjeff fi 3925219820Sjeff if test -z "$dlname"; then 3926219820Sjeff dlname=$soname 3927219820Sjeff fi 3928219820Sjeff 3929219820Sjeff lib="$output_objdir/$realname" 3930219820Sjeff linknames= 3931219820Sjeff for link 3932219820Sjeff do 3933219820Sjeff linknames="$linknames $link" 3934219820Sjeff done 3935219820Sjeff 3936219820Sjeff # Use standard objects if they are pic 3937219820Sjeff test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 3938219820Sjeff 3939219820Sjeff # Prepare the list of exported symbols 3940219820Sjeff if test -z "$export_symbols"; then 3941219820Sjeff if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 3942219820Sjeff $show "generating symbol list for \`$libname.la'" 3943219820Sjeff export_symbols="$output_objdir/$libname.exp" 3944219820Sjeff $run $rm $export_symbols 3945219820Sjeff cmds=$export_symbols_cmds 3946219820Sjeff save_ifs="$IFS"; IFS='~' 3947219820Sjeff for cmd in $cmds; do 3948219820Sjeff IFS="$save_ifs" 3949219820Sjeff eval cmd=\"$cmd\" 3950219820Sjeff if len=`expr "X$cmd" : ".*"` && 3951219820Sjeff test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 3952219820Sjeff $show "$cmd" 3953219820Sjeff $run eval "$cmd" || exit $? 3954219820Sjeff skipped_export=false 3955219820Sjeff else 3956219820Sjeff # The command line is too long to execute in one step. 3957219820Sjeff $show "using reloadable object file for export list..." 3958219820Sjeff skipped_export=: 3959219820Sjeff # Break out early, otherwise skipped_export may be 3960219820Sjeff # set to false by a later but shorter cmd. 3961219820Sjeff break 3962219820Sjeff fi 3963219820Sjeff done 3964219820Sjeff IFS="$save_ifs" 3965219820Sjeff if test -n "$export_symbols_regex"; then 3966219820Sjeff $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 3967219820Sjeff $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 3968219820Sjeff $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 3969219820Sjeff $run eval '$mv "${export_symbols}T" "$export_symbols"' 3970219820Sjeff fi 3971219820Sjeff fi 3972219820Sjeff fi 3973219820Sjeff 3974219820Sjeff if test -n "$export_symbols" && test -n "$include_expsyms"; then 3975219820Sjeff $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 3976219820Sjeff fi 3977219820Sjeff 3978219820Sjeff tmp_deplibs= 3979219820Sjeff for test_deplib in $deplibs; do 3980219820Sjeff case " $convenience " in 3981219820Sjeff *" $test_deplib "*) ;; 3982219820Sjeff *) 3983219820Sjeff tmp_deplibs="$tmp_deplibs $test_deplib" 3984219820Sjeff ;; 3985219820Sjeff esac 3986219820Sjeff done 3987219820Sjeff deplibs="$tmp_deplibs" 3988219820Sjeff 3989219820Sjeff if test -n "$convenience"; then 3990219820Sjeff if test -n "$whole_archive_flag_spec"; then 3991219820Sjeff save_libobjs=$libobjs 3992219820Sjeff eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3993219820Sjeff else 3994219820Sjeff gentop="$output_objdir/${outputname}x" 3995219820Sjeff generated="$generated $gentop" 3996219820Sjeff 3997219820Sjeff func_extract_archives $gentop $convenience 3998219820Sjeff libobjs="$libobjs $func_extract_archives_result" 3999219820Sjeff fi 4000219820Sjeff fi 4001219820Sjeff 4002219820Sjeff if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 4003219820Sjeff eval flag=\"$thread_safe_flag_spec\" 4004219820Sjeff linker_flags="$linker_flags $flag" 4005219820Sjeff fi 4006219820Sjeff 4007219820Sjeff # Make a backup of the uninstalled library when relinking 4008219820Sjeff if test "$mode" = relink; then 4009219820Sjeff $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 4010219820Sjeff fi 4011219820Sjeff 4012219820Sjeff # Do each of the archive commands. 4013219820Sjeff if test "$module" = yes && test -n "$module_cmds" ; then 4014219820Sjeff if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4015219820Sjeff eval test_cmds=\"$module_expsym_cmds\" 4016219820Sjeff cmds=$module_expsym_cmds 4017219820Sjeff else 4018219820Sjeff eval test_cmds=\"$module_cmds\" 4019219820Sjeff cmds=$module_cmds 4020219820Sjeff fi 4021219820Sjeff else 4022219820Sjeff if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4023219820Sjeff eval test_cmds=\"$archive_expsym_cmds\" 4024219820Sjeff cmds=$archive_expsym_cmds 4025219820Sjeff else 4026219820Sjeff eval test_cmds=\"$archive_cmds\" 4027219820Sjeff cmds=$archive_cmds 4028219820Sjeff fi 4029219820Sjeff fi 4030219820Sjeff 4031219820Sjeff if test "X$skipped_export" != "X:" && 4032219820Sjeff len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4033219820Sjeff test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4034219820Sjeff : 4035219820Sjeff else 4036219820Sjeff # The command line is too long to link in one step, link piecewise. 4037219820Sjeff $echo "creating reloadable object files..." 4038219820Sjeff 4039219820Sjeff # Save the value of $output and $libobjs because we want to 4040219820Sjeff # use them later. If we have whole_archive_flag_spec, we 4041219820Sjeff # want to use save_libobjs as it was before 4042219820Sjeff # whole_archive_flag_spec was expanded, because we can't 4043219820Sjeff # assume the linker understands whole_archive_flag_spec. 4044219820Sjeff # This may have to be revisited, in case too many 4045219820Sjeff # convenience libraries get linked in and end up exceeding 4046219820Sjeff # the spec. 4047219820Sjeff if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4048219820Sjeff save_libobjs=$libobjs 4049219820Sjeff fi 4050219820Sjeff save_output=$output 4051219820Sjeff output_la=`$echo "X$output" | $Xsed -e "$basename"` 4052219820Sjeff 4053219820Sjeff # Clear the reloadable object creation command queue and 4054219820Sjeff # initialize k to one. 4055219820Sjeff test_cmds= 4056219820Sjeff concat_cmds= 4057219820Sjeff objlist= 4058219820Sjeff delfiles= 4059219820Sjeff last_robj= 4060219820Sjeff k=1 4061219820Sjeff output=$output_objdir/$output_la-${k}.$objext 4062219820Sjeff # Loop over the list of objects to be linked. 4063219820Sjeff for obj in $save_libobjs 4064219820Sjeff do 4065219820Sjeff eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4066219820Sjeff if test "X$objlist" = X || 4067219820Sjeff { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4068219820Sjeff test "$len" -le "$max_cmd_len"; }; then 4069219820Sjeff objlist="$objlist $obj" 4070219820Sjeff else 4071219820Sjeff # The command $test_cmds is almost too long, add a 4072219820Sjeff # command to the queue. 4073219820Sjeff if test "$k" -eq 1 ; then 4074219820Sjeff # The first file doesn't have a previous command to add. 4075219820Sjeff eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 4076219820Sjeff else 4077219820Sjeff # All subsequent reloadable object files will link in 4078219820Sjeff # the last one created. 4079219820Sjeff eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4080219820Sjeff fi 4081219820Sjeff last_robj=$output_objdir/$output_la-${k}.$objext 4082219820Sjeff k=`expr $k + 1` 4083219820Sjeff output=$output_objdir/$output_la-${k}.$objext 4084219820Sjeff objlist=$obj 4085219820Sjeff len=1 4086219820Sjeff fi 4087219820Sjeff done 4088219820Sjeff # Handle the remaining objects by creating one last 4089219820Sjeff # reloadable object file. All subsequent reloadable object 4090219820Sjeff # files will link in the last one created. 4091219820Sjeff test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4092219820Sjeff eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 4093219820Sjeff 4094219820Sjeff if ${skipped_export-false}; then 4095219820Sjeff $show "generating symbol list for \`$libname.la'" 4096219820Sjeff export_symbols="$output_objdir/$libname.exp" 4097219820Sjeff $run $rm $export_symbols 4098219820Sjeff libobjs=$output 4099219820Sjeff # Append the command to create the export file. 4100219820Sjeff eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4101219820Sjeff fi 4102219820Sjeff 4103219820Sjeff # Set up a command to remove the reloadable object files 4104219820Sjeff # after they are used. 4105219820Sjeff i=0 4106219820Sjeff while test "$i" -lt "$k" 4107219820Sjeff do 4108219820Sjeff i=`expr $i + 1` 4109219820Sjeff delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 4110219820Sjeff done 4111219820Sjeff 4112219820Sjeff $echo "creating a temporary reloadable object file: $output" 4113219820Sjeff 4114219820Sjeff # Loop through the commands generated above and execute them. 4115219820Sjeff save_ifs="$IFS"; IFS='~' 4116219820Sjeff for cmd in $concat_cmds; do 4117219820Sjeff IFS="$save_ifs" 4118219820Sjeff $show "$cmd" 4119219820Sjeff $run eval "$cmd" || exit $? 4120219820Sjeff done 4121219820Sjeff IFS="$save_ifs" 4122219820Sjeff 4123219820Sjeff libobjs=$output 4124219820Sjeff # Restore the value of output. 4125219820Sjeff output=$save_output 4126219820Sjeff 4127219820Sjeff if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 4128219820Sjeff eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4129219820Sjeff fi 4130219820Sjeff # Expand the library linking commands again to reset the 4131219820Sjeff # value of $libobjs for piecewise linking. 4132219820Sjeff 4133219820Sjeff # Do each of the archive commands. 4134219820Sjeff if test "$module" = yes && test -n "$module_cmds" ; then 4135219820Sjeff if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4136219820Sjeff cmds=$module_expsym_cmds 4137219820Sjeff else 4138219820Sjeff cmds=$module_cmds 4139219820Sjeff fi 4140219820Sjeff else 4141219820Sjeff if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4142219820Sjeff cmds=$archive_expsym_cmds 4143219820Sjeff else 4144219820Sjeff cmds=$archive_cmds 4145219820Sjeff fi 4146219820Sjeff fi 4147219820Sjeff 4148219820Sjeff # Append the command to remove the reloadable object files 4149219820Sjeff # to the just-reset $cmds. 4150219820Sjeff eval cmds=\"\$cmds~\$rm $delfiles\" 4151219820Sjeff fi 4152219820Sjeff save_ifs="$IFS"; IFS='~' 4153219820Sjeff for cmd in $cmds; do 4154219820Sjeff IFS="$save_ifs" 4155219820Sjeff eval cmd=\"$cmd\" 4156219820Sjeff $show "$cmd" 4157219820Sjeff $run eval "$cmd" || { 4158219820Sjeff lt_exit=$? 4159219820Sjeff 4160219820Sjeff # Restore the uninstalled library and exit 4161219820Sjeff if test "$mode" = relink; then 4162219820Sjeff $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 4163219820Sjeff fi 4164219820Sjeff 4165219820Sjeff exit $lt_exit 4166219820Sjeff } 4167219820Sjeff done 4168219820Sjeff IFS="$save_ifs" 4169219820Sjeff 4170219820Sjeff # Restore the uninstalled library and exit 4171219820Sjeff if test "$mode" = relink; then 4172219820Sjeff $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4173219820Sjeff 4174219820Sjeff if test -n "$convenience"; then 4175219820Sjeff if test -z "$whole_archive_flag_spec"; then 4176219820Sjeff $show "${rm}r $gentop" 4177219820Sjeff $run ${rm}r "$gentop" 4178219820Sjeff fi 4179219820Sjeff fi 4180219820Sjeff 4181219820Sjeff exit $EXIT_SUCCESS 4182219820Sjeff fi 4183219820Sjeff 4184219820Sjeff # Create links to the real library. 4185219820Sjeff for linkname in $linknames; do 4186219820Sjeff if test "$realname" != "$linkname"; then 4187219820Sjeff $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 4188219820Sjeff $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 4189219820Sjeff fi 4190219820Sjeff done 4191219820Sjeff 4192219820Sjeff # If -module or -export-dynamic was specified, set the dlname. 4193219820Sjeff if test "$module" = yes || test "$export_dynamic" = yes; then 4194219820Sjeff # On all known operating systems, these are identical. 4195219820Sjeff dlname="$soname" 4196219820Sjeff fi 4197219820Sjeff fi 4198219820Sjeff ;; 4199219820Sjeff 4200219820Sjeff obj) 4201219820Sjeff if test -n "$deplibs"; then 4202219820Sjeff $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 4203219820Sjeff fi 4204219820Sjeff 4205219820Sjeff if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4206219820Sjeff $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 4207219820Sjeff fi 4208219820Sjeff 4209219820Sjeff if test -n "$rpath"; then 4210219820Sjeff $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 4211219820Sjeff fi 4212219820Sjeff 4213219820Sjeff if test -n "$xrpath"; then 4214219820Sjeff $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 4215219820Sjeff fi 4216219820Sjeff 4217219820Sjeff if test -n "$vinfo"; then 4218219820Sjeff $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 4219219820Sjeff fi 4220219820Sjeff 4221219820Sjeff if test -n "$release"; then 4222219820Sjeff $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 4223219820Sjeff fi 4224219820Sjeff 4225219820Sjeff case $output in 4226219820Sjeff *.lo) 4227219820Sjeff if test -n "$objs$old_deplibs"; then 4228219820Sjeff $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 4229219820Sjeff exit $EXIT_FAILURE 4230219820Sjeff fi 4231219820Sjeff libobj="$output" 4232219820Sjeff obj=`$echo "X$output" | $Xsed -e "$lo2o"` 4233219820Sjeff ;; 4234219820Sjeff *) 4235219820Sjeff libobj= 4236219820Sjeff obj="$output" 4237219820Sjeff ;; 4238219820Sjeff esac 4239219820Sjeff 4240219820Sjeff # Delete the old objects. 4241219820Sjeff $run $rm $obj $libobj 4242219820Sjeff 4243219820Sjeff # Objects from convenience libraries. This assumes 4244219820Sjeff # single-version convenience libraries. Whenever we create 4245219820Sjeff # different ones for PIC/non-PIC, this we'll have to duplicate 4246219820Sjeff # the extraction. 4247219820Sjeff reload_conv_objs= 4248219820Sjeff gentop= 4249219820Sjeff # reload_cmds runs $LD directly, so let us get rid of 4250219820Sjeff # -Wl from whole_archive_flag_spec 4251219820Sjeff wl= 4252219820Sjeff 4253219820Sjeff if test -n "$convenience"; then 4254219820Sjeff if test -n "$whole_archive_flag_spec"; then 4255219820Sjeff eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 4256219820Sjeff else 4257219820Sjeff gentop="$output_objdir/${obj}x" 4258219820Sjeff generated="$generated $gentop" 4259219820Sjeff 4260219820Sjeff func_extract_archives $gentop $convenience 4261219820Sjeff reload_conv_objs="$reload_objs $func_extract_archives_result" 4262219820Sjeff fi 4263219820Sjeff fi 4264219820Sjeff 4265219820Sjeff # Create the old-style object. 4266219820Sjeff 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 4267219820Sjeff 4268219820Sjeff output="$obj" 4269219820Sjeff cmds=$reload_cmds 4270219820Sjeff save_ifs="$IFS"; IFS='~' 4271219820Sjeff for cmd in $cmds; do 4272219820Sjeff IFS="$save_ifs" 4273219820Sjeff eval cmd=\"$cmd\" 4274219820Sjeff $show "$cmd" 4275219820Sjeff $run eval "$cmd" || exit $? 4276219820Sjeff done 4277219820Sjeff IFS="$save_ifs" 4278219820Sjeff 4279219820Sjeff # Exit if we aren't doing a library object file. 4280219820Sjeff if test -z "$libobj"; then 4281219820Sjeff if test -n "$gentop"; then 4282219820Sjeff $show "${rm}r $gentop" 4283219820Sjeff $run ${rm}r $gentop 4284219820Sjeff fi 4285219820Sjeff 4286219820Sjeff exit $EXIT_SUCCESS 4287219820Sjeff fi 4288219820Sjeff 4289219820Sjeff if test "$build_libtool_libs" != yes; then 4290219820Sjeff if test -n "$gentop"; then 4291219820Sjeff $show "${rm}r $gentop" 4292219820Sjeff $run ${rm}r $gentop 4293219820Sjeff fi 4294219820Sjeff 4295219820Sjeff # Create an invalid libtool object if no PIC, so that we don't 4296219820Sjeff # accidentally link it into a program. 4297219820Sjeff # $show "echo timestamp > $libobj" 4298219820Sjeff # $run eval "echo timestamp > $libobj" || exit $? 4299219820Sjeff exit $EXIT_SUCCESS 4300219820Sjeff fi 4301219820Sjeff 4302219820Sjeff if test -n "$pic_flag" || test "$pic_mode" != default; then 4303219820Sjeff # Only do commands if we really have different PIC objects. 4304219820Sjeff reload_objs="$libobjs $reload_conv_objs" 4305219820Sjeff output="$libobj" 4306219820Sjeff cmds=$reload_cmds 4307219820Sjeff save_ifs="$IFS"; IFS='~' 4308219820Sjeff for cmd in $cmds; do 4309219820Sjeff IFS="$save_ifs" 4310219820Sjeff eval cmd=\"$cmd\" 4311219820Sjeff $show "$cmd" 4312219820Sjeff $run eval "$cmd" || exit $? 4313219820Sjeff done 4314219820Sjeff IFS="$save_ifs" 4315219820Sjeff fi 4316219820Sjeff 4317219820Sjeff if test -n "$gentop"; then 4318219820Sjeff $show "${rm}r $gentop" 4319219820Sjeff $run ${rm}r $gentop 4320219820Sjeff fi 4321219820Sjeff 4322219820Sjeff exit $EXIT_SUCCESS 4323219820Sjeff ;; 4324219820Sjeff 4325219820Sjeff prog) 4326219820Sjeff case $host in 4327219820Sjeff *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 4328219820Sjeff esac 4329219820Sjeff if test -n "$vinfo"; then 4330219820Sjeff $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 4331219820Sjeff fi 4332219820Sjeff 4333219820Sjeff if test -n "$release"; then 4334219820Sjeff $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 4335219820Sjeff fi 4336219820Sjeff 4337219820Sjeff if test "$preload" = yes; then 4338219820Sjeff if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 4339219820Sjeff test "$dlopen_self_static" = unknown; then 4340219820Sjeff $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 4341219820Sjeff fi 4342219820Sjeff fi 4343219820Sjeff 4344219820Sjeff case $host in 4345219820Sjeff *-*-rhapsody* | *-*-darwin1.[012]) 4346219820Sjeff # On Rhapsody replace the C library is the System framework 4347219820Sjeff compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4348219820Sjeff finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4349219820Sjeff ;; 4350219820Sjeff esac 4351219820Sjeff 4352219820Sjeff case $host in 4353219820Sjeff *darwin*) 4354219820Sjeff # Don't allow lazy linking, it breaks C++ global constructors 4355219820Sjeff if test "$tagname" = CXX ; then 4356219820Sjeff compile_command="$compile_command ${wl}-bind_at_load" 4357219820Sjeff finalize_command="$finalize_command ${wl}-bind_at_load" 4358219820Sjeff fi 4359219820Sjeff ;; 4360219820Sjeff esac 4361219820Sjeff 4362219820Sjeff 4363219820Sjeff # move library search paths that coincide with paths to not yet 4364219820Sjeff # installed libraries to the beginning of the library search list 4365219820Sjeff new_libs= 4366219820Sjeff for path in $notinst_path; do 4367219820Sjeff case " $new_libs " in 4368219820Sjeff *" -L$path/$objdir "*) ;; 4369219820Sjeff *) 4370219820Sjeff case " $compile_deplibs " in 4371219820Sjeff *" -L$path/$objdir "*) 4372219820Sjeff new_libs="$new_libs -L$path/$objdir" ;; 4373219820Sjeff esac 4374219820Sjeff ;; 4375219820Sjeff esac 4376219820Sjeff done 4377219820Sjeff for deplib in $compile_deplibs; do 4378219820Sjeff case $deplib in 4379219820Sjeff -L*) 4380219820Sjeff case " $new_libs " in 4381219820Sjeff *" $deplib "*) ;; 4382219820Sjeff *) new_libs="$new_libs $deplib" ;; 4383219820Sjeff esac 4384219820Sjeff ;; 4385219820Sjeff *) new_libs="$new_libs $deplib" ;; 4386219820Sjeff esac 4387219820Sjeff done 4388219820Sjeff compile_deplibs="$new_libs" 4389219820Sjeff 4390219820Sjeff 4391219820Sjeff compile_command="$compile_command $compile_deplibs" 4392219820Sjeff finalize_command="$finalize_command $finalize_deplibs" 4393219820Sjeff 4394219820Sjeff if test -n "$rpath$xrpath"; then 4395219820Sjeff # If the user specified any rpath flags, then add them. 4396219820Sjeff for libdir in $rpath $xrpath; do 4397219820Sjeff # This is the magic to use -rpath. 4398219820Sjeff case "$finalize_rpath " in 4399219820Sjeff *" $libdir "*) ;; 4400219820Sjeff *) finalize_rpath="$finalize_rpath $libdir" ;; 4401219820Sjeff esac 4402219820Sjeff done 4403219820Sjeff fi 4404219820Sjeff 4405219820Sjeff # Now hardcode the library paths 4406219820Sjeff rpath= 4407219820Sjeff hardcode_libdirs= 4408219820Sjeff for libdir in $compile_rpath $finalize_rpath; do 4409219820Sjeff if test -n "$hardcode_libdir_flag_spec"; then 4410219820Sjeff if test -n "$hardcode_libdir_separator"; then 4411219820Sjeff if test -z "$hardcode_libdirs"; then 4412219820Sjeff hardcode_libdirs="$libdir" 4413219820Sjeff else 4414219820Sjeff # Just accumulate the unique libdirs. 4415219820Sjeff case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4416219820Sjeff *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4417219820Sjeff ;; 4418219820Sjeff *) 4419219820Sjeff hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4420219820Sjeff ;; 4421219820Sjeff esac 4422219820Sjeff fi 4423219820Sjeff else 4424219820Sjeff eval flag=\"$hardcode_libdir_flag_spec\" 4425219820Sjeff rpath="$rpath $flag" 4426219820Sjeff fi 4427219820Sjeff elif test -n "$runpath_var"; then 4428219820Sjeff case "$perm_rpath " in 4429219820Sjeff *" $libdir "*) ;; 4430219820Sjeff *) perm_rpath="$perm_rpath $libdir" ;; 4431219820Sjeff esac 4432219820Sjeff fi 4433219820Sjeff case $host in 4434219820Sjeff *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4435219820Sjeff testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 4436219820Sjeff case :$dllsearchpath: in 4437219820Sjeff *":$libdir:"*) ;; 4438219820Sjeff *) dllsearchpath="$dllsearchpath:$libdir";; 4439219820Sjeff esac 4440219820Sjeff case :$dllsearchpath: in 4441219820Sjeff *":$testbindir:"*) ;; 4442219820Sjeff *) dllsearchpath="$dllsearchpath:$testbindir";; 4443219820Sjeff esac 4444219820Sjeff ;; 4445219820Sjeff esac 4446219820Sjeff done 4447219820Sjeff # Substitute the hardcoded libdirs into the rpath. 4448219820Sjeff if test -n "$hardcode_libdir_separator" && 4449219820Sjeff test -n "$hardcode_libdirs"; then 4450219820Sjeff libdir="$hardcode_libdirs" 4451219820Sjeff eval rpath=\" $hardcode_libdir_flag_spec\" 4452219820Sjeff fi 4453219820Sjeff compile_rpath="$rpath" 4454219820Sjeff 4455219820Sjeff rpath= 4456219820Sjeff hardcode_libdirs= 4457219820Sjeff for libdir in $finalize_rpath; do 4458219820Sjeff if test -n "$hardcode_libdir_flag_spec"; then 4459219820Sjeff if test -n "$hardcode_libdir_separator"; then 4460219820Sjeff if test -z "$hardcode_libdirs"; then 4461219820Sjeff hardcode_libdirs="$libdir" 4462219820Sjeff else 4463219820Sjeff # Just accumulate the unique libdirs. 4464219820Sjeff case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4465219820Sjeff *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4466219820Sjeff ;; 4467219820Sjeff *) 4468219820Sjeff hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4469219820Sjeff ;; 4470219820Sjeff esac 4471219820Sjeff fi 4472219820Sjeff else 4473219820Sjeff eval flag=\"$hardcode_libdir_flag_spec\" 4474219820Sjeff rpath="$rpath $flag" 4475219820Sjeff fi 4476219820Sjeff elif test -n "$runpath_var"; then 4477219820Sjeff case "$finalize_perm_rpath " in 4478219820Sjeff *" $libdir "*) ;; 4479219820Sjeff *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 4480219820Sjeff esac 4481219820Sjeff fi 4482219820Sjeff done 4483219820Sjeff # Substitute the hardcoded libdirs into the rpath. 4484219820Sjeff if test -n "$hardcode_libdir_separator" && 4485219820Sjeff test -n "$hardcode_libdirs"; then 4486219820Sjeff libdir="$hardcode_libdirs" 4487219820Sjeff eval rpath=\" $hardcode_libdir_flag_spec\" 4488219820Sjeff fi 4489219820Sjeff finalize_rpath="$rpath" 4490219820Sjeff 4491219820Sjeff if test -n "$libobjs" && test "$build_old_libs" = yes; then 4492219820Sjeff # Transform all the library objects into standard objects. 4493219820Sjeff compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4494219820Sjeff finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4495219820Sjeff fi 4496219820Sjeff 4497219820Sjeff dlsyms= 4498219820Sjeff if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4499219820Sjeff if test -n "$NM" && test -n "$global_symbol_pipe"; then 4500219820Sjeff dlsyms="${outputname}S.c" 4501219820Sjeff else 4502219820Sjeff $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 4503219820Sjeff fi 4504219820Sjeff fi 4505219820Sjeff 4506219820Sjeff if test -n "$dlsyms"; then 4507219820Sjeff case $dlsyms in 4508219820Sjeff "") ;; 4509219820Sjeff *.c) 4510219820Sjeff # Discover the nlist of each of the dlfiles. 4511219820Sjeff nlist="$output_objdir/${outputname}.nm" 4512219820Sjeff 4513219820Sjeff $show "$rm $nlist ${nlist}S ${nlist}T" 4514219820Sjeff $run $rm "$nlist" "${nlist}S" "${nlist}T" 4515219820Sjeff 4516219820Sjeff # Parse the name list into a source file. 4517219820Sjeff $show "creating $output_objdir/$dlsyms" 4518219820Sjeff 4519219820Sjeff test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 4520219820Sjeff/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 4521219820Sjeff/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 4522219820Sjeff 4523219820Sjeff#ifdef __cplusplus 4524219820Sjeffextern \"C\" { 4525219820Sjeff#endif 4526219820Sjeff 4527219820Sjeff/* Prevent the only kind of declaration conflicts we can make. */ 4528219820Sjeff#define lt_preloaded_symbols some_other_symbol 4529219820Sjeff 4530219820Sjeff/* External symbol declarations for the compiler. */\ 4531219820Sjeff" 4532219820Sjeff 4533219820Sjeff if test "$dlself" = yes; then 4534219820Sjeff $show "generating symbol list for \`$output'" 4535219820Sjeff 4536219820Sjeff test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 4537219820Sjeff 4538219820Sjeff # Add our own program objects to the symbol list. 4539219820Sjeff progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4540219820Sjeff for arg in $progfiles; do 4541219820Sjeff $show "extracting global C symbols from \`$arg'" 4542219820Sjeff $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4543219820Sjeff done 4544219820Sjeff 4545219820Sjeff if test -n "$exclude_expsyms"; then 4546219820Sjeff $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4547219820Sjeff $run eval '$mv "$nlist"T "$nlist"' 4548219820Sjeff fi 4549219820Sjeff 4550219820Sjeff if test -n "$export_symbols_regex"; then 4551219820Sjeff $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4552219820Sjeff $run eval '$mv "$nlist"T "$nlist"' 4553219820Sjeff fi 4554219820Sjeff 4555219820Sjeff # Prepare the list of exported symbols 4556219820Sjeff if test -z "$export_symbols"; then 4557219820Sjeff export_symbols="$output_objdir/$outputname.exp" 4558219820Sjeff $run $rm $export_symbols 4559219820Sjeff $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4560219820Sjeff case $host in 4561219820Sjeff *cygwin* | *mingw* ) 4562219820Sjeff $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4563219820Sjeff $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4564219820Sjeff ;; 4565219820Sjeff esac 4566219820Sjeff else 4567219820Sjeff $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4568219820Sjeff $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4569219820Sjeff $run eval 'mv "$nlist"T "$nlist"' 4570219820Sjeff case $host in 4571219820Sjeff *cygwin* | *mingw* ) 4572219820Sjeff $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4573219820Sjeff $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4574219820Sjeff ;; 4575219820Sjeff esac 4576219820Sjeff fi 4577219820Sjeff fi 4578219820Sjeff 4579219820Sjeff for arg in $dlprefiles; do 4580219820Sjeff $show "extracting global C symbols from \`$arg'" 4581219820Sjeff name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 4582219820Sjeff $run eval '$echo ": $name " >> "$nlist"' 4583219820Sjeff $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4584219820Sjeff done 4585219820Sjeff 4586219820Sjeff if test -z "$run"; then 4587219820Sjeff # Make sure we have at least an empty file. 4588219820Sjeff test -f "$nlist" || : > "$nlist" 4589219820Sjeff 4590219820Sjeff if test -n "$exclude_expsyms"; then 4591219820Sjeff $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4592219820Sjeff $mv "$nlist"T "$nlist" 4593219820Sjeff fi 4594219820Sjeff 4595219820Sjeff # Try sorting and uniquifying the output. 4596219820Sjeff if grep -v "^: " < "$nlist" | 4597219820Sjeff if sort -k 3 </dev/null >/dev/null 2>&1; then 4598219820Sjeff sort -k 3 4599219820Sjeff else 4600219820Sjeff sort +2 4601219820Sjeff fi | 4602219820Sjeff uniq > "$nlist"S; then 4603219820Sjeff : 4604219820Sjeff else 4605219820Sjeff grep -v "^: " < "$nlist" > "$nlist"S 4606219820Sjeff fi 4607219820Sjeff 4608219820Sjeff if test -f "$nlist"S; then 4609219820Sjeff eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 4610219820Sjeff else 4611219820Sjeff $echo '/* NONE */' >> "$output_objdir/$dlsyms" 4612219820Sjeff fi 4613219820Sjeff 4614219820Sjeff $echo >> "$output_objdir/$dlsyms" "\ 4615219820Sjeff 4616219820Sjeff#undef lt_preloaded_symbols 4617219820Sjeff 4618219820Sjeff#if defined (__STDC__) && __STDC__ 4619219820Sjeff# define lt_ptr void * 4620219820Sjeff#else 4621219820Sjeff# define lt_ptr char * 4622219820Sjeff# define const 4623219820Sjeff#endif 4624219820Sjeff 4625219820Sjeff/* The mapping between symbol names and symbols. */ 4626219820Sjeff" 4627219820Sjeff 4628219820Sjeff case $host in 4629219820Sjeff *cygwin* | *mingw* ) 4630219820Sjeff $echo >> "$output_objdir/$dlsyms" "\ 4631219820Sjeff/* DATA imports from DLLs on WIN32 can't be const, because 4632219820Sjeff runtime relocations are performed -- see ld's documentation 4633219820Sjeff on pseudo-relocs */ 4634219820Sjeffstruct { 4635219820Sjeff" 4636219820Sjeff ;; 4637219820Sjeff * ) 4638219820Sjeff $echo >> "$output_objdir/$dlsyms" "\ 4639219820Sjeffconst struct { 4640219820Sjeff" 4641219820Sjeff ;; 4642219820Sjeff esac 4643219820Sjeff 4644219820Sjeff 4645219820Sjeff $echo >> "$output_objdir/$dlsyms" "\ 4646219820Sjeff const char *name; 4647219820Sjeff lt_ptr address; 4648219820Sjeff} 4649219820Sjefflt_preloaded_symbols[] = 4650219820Sjeff{\ 4651219820Sjeff" 4652219820Sjeff 4653219820Sjeff eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 4654219820Sjeff 4655219820Sjeff $echo >> "$output_objdir/$dlsyms" "\ 4656219820Sjeff {0, (lt_ptr) 0} 4657219820Sjeff}; 4658219820Sjeff 4659219820Sjeff/* This works around a problem in FreeBSD linker */ 4660219820Sjeff#ifdef FREEBSD_WORKAROUND 4661219820Sjeffstatic const void *lt_preloaded_setup() { 4662219820Sjeff return lt_preloaded_symbols; 4663219820Sjeff} 4664219820Sjeff#endif 4665219820Sjeff 4666219820Sjeff#ifdef __cplusplus 4667219820Sjeff} 4668219820Sjeff#endif\ 4669219820Sjeff" 4670219820Sjeff fi 4671219820Sjeff 4672219820Sjeff pic_flag_for_symtable= 4673219820Sjeff case $host in 4674219820Sjeff # compiling the symbol table file with pic_flag works around 4675219820Sjeff # a FreeBSD bug that causes programs to crash when -lm is 4676219820Sjeff # linked before any other PIC object. But we must not use 4677219820Sjeff # pic_flag when linking with -static. The problem exists in 4678219820Sjeff # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 4679219820Sjeff *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 4680219820Sjeff case "$compile_command " in 4681219820Sjeff *" -static "*) ;; 4682219820Sjeff *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 4683219820Sjeff esac;; 4684219820Sjeff *-*-hpux*) 4685219820Sjeff case "$compile_command " in 4686219820Sjeff *" -static "*) ;; 4687219820Sjeff *) pic_flag_for_symtable=" $pic_flag";; 4688219820Sjeff esac 4689219820Sjeff esac 4690219820Sjeff 4691219820Sjeff # Now compile the dynamic symbol file. 4692219820Sjeff $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4693219820Sjeff $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 4694219820Sjeff 4695219820Sjeff # Clean up the generated files. 4696219820Sjeff $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4697219820Sjeff $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4698219820Sjeff 4699219820Sjeff # Transform the symbol file into the correct name. 4700219820Sjeff case $host in 4701219820Sjeff *cygwin* | *mingw* ) 4702219820Sjeff if test -f "$output_objdir/${outputname}.def" ; then 4703219820Sjeff compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 4704219820Sjeff finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` 4705219820Sjeff else 4706219820Sjeff compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4707219820Sjeff finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4708219820Sjeff fi 4709219820Sjeff ;; 4710219820Sjeff * ) 4711219820Sjeff compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4712219820Sjeff finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4713219820Sjeff ;; 4714219820Sjeff esac 4715219820Sjeff ;; 4716219820Sjeff *) 4717219820Sjeff $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4718219820Sjeff exit $EXIT_FAILURE 4719219820Sjeff ;; 4720219820Sjeff esac 4721219820Sjeff else 4722219820Sjeff # We keep going just in case the user didn't refer to 4723219820Sjeff # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 4724219820Sjeff # really was required. 4725219820Sjeff 4726219820Sjeff # Nullify the symbol file. 4727219820Sjeff compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 4728219820Sjeff finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 4729219820Sjeff fi 4730219820Sjeff 4731219820Sjeff if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 4732219820Sjeff # Replace the output file specification. 4733219820Sjeff compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4734219820Sjeff link_command="$compile_command$compile_rpath" 4735219820Sjeff 4736219820Sjeff # We have no uninstalled library dependencies, so finalize right now. 4737219820Sjeff $show "$link_command" 4738219820Sjeff $run eval "$link_command" 4739219820Sjeff exit_status=$? 4740219820Sjeff 4741219820Sjeff # Delete the generated files. 4742219820Sjeff if test -n "$dlsyms"; then 4743219820Sjeff $show "$rm $output_objdir/${outputname}S.${objext}" 4744219820Sjeff $run $rm "$output_objdir/${outputname}S.${objext}" 4745219820Sjeff fi 4746219820Sjeff 4747219820Sjeff exit $exit_status 4748219820Sjeff fi 4749219820Sjeff 4750219820Sjeff if test -n "$shlibpath_var"; then 4751219820Sjeff # We should set the shlibpath_var 4752219820Sjeff rpath= 4753219820Sjeff for dir in $temp_rpath; do 4754219820Sjeff case $dir in 4755219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) 4756219820Sjeff # Absolute path. 4757219820Sjeff rpath="$rpath$dir:" 4758219820Sjeff ;; 4759219820Sjeff *) 4760219820Sjeff # Relative path: add a thisdir entry. 4761219820Sjeff rpath="$rpath\$thisdir/$dir:" 4762219820Sjeff ;; 4763219820Sjeff esac 4764219820Sjeff done 4765219820Sjeff temp_rpath="$rpath" 4766219820Sjeff fi 4767219820Sjeff 4768219820Sjeff if test -n "$compile_shlibpath$finalize_shlibpath"; then 4769219820Sjeff compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 4770219820Sjeff fi 4771219820Sjeff if test -n "$finalize_shlibpath"; then 4772219820Sjeff finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 4773219820Sjeff fi 4774219820Sjeff 4775219820Sjeff compile_var= 4776219820Sjeff finalize_var= 4777219820Sjeff if test -n "$runpath_var"; then 4778219820Sjeff if test -n "$perm_rpath"; then 4779219820Sjeff # We should set the runpath_var. 4780219820Sjeff rpath= 4781219820Sjeff for dir in $perm_rpath; do 4782219820Sjeff rpath="$rpath$dir:" 4783219820Sjeff done 4784219820Sjeff compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 4785219820Sjeff fi 4786219820Sjeff if test -n "$finalize_perm_rpath"; then 4787219820Sjeff # We should set the runpath_var. 4788219820Sjeff rpath= 4789219820Sjeff for dir in $finalize_perm_rpath; do 4790219820Sjeff rpath="$rpath$dir:" 4791219820Sjeff done 4792219820Sjeff finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 4793219820Sjeff fi 4794219820Sjeff fi 4795219820Sjeff 4796219820Sjeff if test "$no_install" = yes; then 4797219820Sjeff # We don't need to create a wrapper script. 4798219820Sjeff link_command="$compile_var$compile_command$compile_rpath" 4799219820Sjeff # Replace the output file specification. 4800219820Sjeff link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4801219820Sjeff # Delete the old output file. 4802219820Sjeff $run $rm $output 4803219820Sjeff # Link the executable and exit 4804219820Sjeff $show "$link_command" 4805219820Sjeff $run eval "$link_command" || exit $? 4806219820Sjeff exit $EXIT_SUCCESS 4807219820Sjeff fi 4808219820Sjeff 4809219820Sjeff if test "$hardcode_action" = relink; then 4810219820Sjeff # Fast installation is not supported 4811219820Sjeff link_command="$compile_var$compile_command$compile_rpath" 4812219820Sjeff relink_command="$finalize_var$finalize_command$finalize_rpath" 4813219820Sjeff 4814219820Sjeff $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 4815219820Sjeff $echo "$modename: \`$output' will be relinked during installation" 1>&2 4816219820Sjeff else 4817219820Sjeff if test "$fast_install" != no; then 4818219820Sjeff link_command="$finalize_var$compile_command$finalize_rpath" 4819219820Sjeff if test "$fast_install" = yes; then 4820219820Sjeff relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 4821219820Sjeff else 4822219820Sjeff # fast_install is set to needless 4823219820Sjeff relink_command= 4824219820Sjeff fi 4825219820Sjeff else 4826219820Sjeff link_command="$compile_var$compile_command$compile_rpath" 4827219820Sjeff relink_command="$finalize_var$finalize_command$finalize_rpath" 4828219820Sjeff fi 4829219820Sjeff fi 4830219820Sjeff 4831219820Sjeff # Replace the output file specification. 4832219820Sjeff link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 4833219820Sjeff 4834219820Sjeff # Delete the old output files. 4835219820Sjeff $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 4836219820Sjeff 4837219820Sjeff $show "$link_command" 4838219820Sjeff $run eval "$link_command" || exit $? 4839219820Sjeff 4840219820Sjeff # Now create the wrapper script. 4841219820Sjeff $show "creating $output" 4842219820Sjeff 4843219820Sjeff # Quote the relink command for shipping. 4844219820Sjeff if test -n "$relink_command"; then 4845219820Sjeff # Preserve any variables that may affect compiler behavior 4846219820Sjeff for var in $variables_saved_for_relink; do 4847219820Sjeff if eval test -z \"\${$var+set}\"; then 4848219820Sjeff relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4849219820Sjeff elif eval var_value=\$$var; test -z "$var_value"; then 4850219820Sjeff relink_command="$var=; export $var; $relink_command" 4851219820Sjeff else 4852219820Sjeff var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4853219820Sjeff relink_command="$var=\"$var_value\"; export $var; $relink_command" 4854219820Sjeff fi 4855219820Sjeff done 4856219820Sjeff relink_command="(cd `pwd`; $relink_command)" 4857219820Sjeff relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 4858219820Sjeff fi 4859219820Sjeff 4860219820Sjeff # Quote $echo for shipping. 4861219820Sjeff if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 4862219820Sjeff case $progpath in 4863219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 4864219820Sjeff *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 4865219820Sjeff esac 4866219820Sjeff qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 4867219820Sjeff else 4868219820Sjeff qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 4869219820Sjeff fi 4870219820Sjeff 4871219820Sjeff # Only actually do things if our run command is non-null. 4872219820Sjeff if test -z "$run"; then 4873219820Sjeff # win32 will think the script is a binary if it has 4874219820Sjeff # a .exe suffix, so we strip it off here. 4875219820Sjeff case $output in 4876219820Sjeff *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 4877219820Sjeff esac 4878219820Sjeff # test for cygwin because mv fails w/o .exe extensions 4879219820Sjeff case $host in 4880219820Sjeff *cygwin*) 4881219820Sjeff exeext=.exe 4882219820Sjeff outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4883219820Sjeff *) exeext= ;; 4884219820Sjeff esac 4885219820Sjeff case $host in 4886219820Sjeff *cygwin* | *mingw* ) 4887219820Sjeff output_name=`basename $output` 4888219820Sjeff output_path=`dirname $output` 4889219820Sjeff cwrappersource="$output_path/$objdir/lt-$output_name.c" 4890219820Sjeff cwrapper="$output_path/$output_name.exe" 4891219820Sjeff $rm $cwrappersource $cwrapper 4892219820Sjeff trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4893219820Sjeff 4894219820Sjeff cat > $cwrappersource <<EOF 4895219820Sjeff 4896219820Sjeff/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4897219820Sjeff Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4898219820Sjeff 4899219820Sjeff The $output program cannot be directly executed until all the libtool 4900219820Sjeff libraries that it depends on are installed. 4901219820Sjeff 4902219820Sjeff This wrapper executable should never be moved out of the build directory. 4903219820Sjeff If it is, it will not operate correctly. 4904219820Sjeff 4905219820Sjeff Currently, it simply execs the wrapper *script* "/bin/sh $output", 4906219820Sjeff but could eventually absorb all of the scripts functionality and 4907219820Sjeff exec $objdir/$outputname directly. 4908219820Sjeff*/ 4909219820SjeffEOF 4910219820Sjeff cat >> $cwrappersource<<"EOF" 4911219820Sjeff#include <stdio.h> 4912219820Sjeff#include <stdlib.h> 4913219820Sjeff#include <unistd.h> 4914219820Sjeff#include <malloc.h> 4915219820Sjeff#include <stdarg.h> 4916219820Sjeff#include <assert.h> 4917219820Sjeff#include <string.h> 4918219820Sjeff#include <ctype.h> 4919219820Sjeff#include <sys/stat.h> 4920219820Sjeff 4921219820Sjeff#if defined(PATH_MAX) 4922219820Sjeff# define LT_PATHMAX PATH_MAX 4923219820Sjeff#elif defined(MAXPATHLEN) 4924219820Sjeff# define LT_PATHMAX MAXPATHLEN 4925219820Sjeff#else 4926219820Sjeff# define LT_PATHMAX 1024 4927219820Sjeff#endif 4928219820Sjeff 4929219820Sjeff#ifndef DIR_SEPARATOR 4930219820Sjeff# define DIR_SEPARATOR '/' 4931219820Sjeff# define PATH_SEPARATOR ':' 4932219820Sjeff#endif 4933219820Sjeff 4934219820Sjeff#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4935219820Sjeff defined (__OS2__) 4936219820Sjeff# define HAVE_DOS_BASED_FILE_SYSTEM 4937219820Sjeff# ifndef DIR_SEPARATOR_2 4938219820Sjeff# define DIR_SEPARATOR_2 '\\' 4939219820Sjeff# endif 4940219820Sjeff# ifndef PATH_SEPARATOR_2 4941219820Sjeff# define PATH_SEPARATOR_2 ';' 4942219820Sjeff# endif 4943219820Sjeff#endif 4944219820Sjeff 4945219820Sjeff#ifndef DIR_SEPARATOR_2 4946219820Sjeff# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4947219820Sjeff#else /* DIR_SEPARATOR_2 */ 4948219820Sjeff# define IS_DIR_SEPARATOR(ch) \ 4949219820Sjeff (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4950219820Sjeff#endif /* DIR_SEPARATOR_2 */ 4951219820Sjeff 4952219820Sjeff#ifndef PATH_SEPARATOR_2 4953219820Sjeff# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 4954219820Sjeff#else /* PATH_SEPARATOR_2 */ 4955219820Sjeff# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 4956219820Sjeff#endif /* PATH_SEPARATOR_2 */ 4957219820Sjeff 4958219820Sjeff#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4959219820Sjeff#define XFREE(stale) do { \ 4960219820Sjeff if (stale) { free ((void *) stale); stale = 0; } \ 4961219820Sjeff} while (0) 4962219820Sjeff 4963219820Sjeff/* -DDEBUG is fairly common in CFLAGS. */ 4964219820Sjeff#undef DEBUG 4965219820Sjeff#if defined DEBUGWRAPPER 4966219820Sjeff# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 4967219820Sjeff#else 4968219820Sjeff# define DEBUG(format, ...) 4969219820Sjeff#endif 4970219820Sjeff 4971219820Sjeffconst char *program_name = NULL; 4972219820Sjeff 4973219820Sjeffvoid * xmalloc (size_t num); 4974219820Sjeffchar * xstrdup (const char *string); 4975219820Sjeffconst char * base_name (const char *name); 4976219820Sjeffchar * find_executable(const char *wrapper); 4977219820Sjeffint check_executable(const char *path); 4978219820Sjeffchar * strendzap(char *str, const char *pat); 4979219820Sjeffvoid lt_fatal (const char *message, ...); 4980219820Sjeff 4981219820Sjeffint 4982219820Sjeffmain (int argc, char *argv[]) 4983219820Sjeff{ 4984219820Sjeff char **newargz; 4985219820Sjeff int i; 4986219820Sjeff 4987219820Sjeff program_name = (char *) xstrdup (base_name (argv[0])); 4988219820Sjeff DEBUG("(main) argv[0] : %s\n",argv[0]); 4989219820Sjeff DEBUG("(main) program_name : %s\n",program_name); 4990219820Sjeff newargz = XMALLOC(char *, argc+2); 4991219820SjeffEOF 4992219820Sjeff 4993219820Sjeff cat >> $cwrappersource <<EOF 4994219820Sjeff newargz[0] = (char *) xstrdup("$SHELL"); 4995219820SjeffEOF 4996219820Sjeff 4997219820Sjeff cat >> $cwrappersource <<"EOF" 4998219820Sjeff newargz[1] = find_executable(argv[0]); 4999219820Sjeff if (newargz[1] == NULL) 5000219820Sjeff lt_fatal("Couldn't find %s", argv[0]); 5001219820Sjeff DEBUG("(main) found exe at : %s\n",newargz[1]); 5002219820Sjeff /* we know the script has the same name, without the .exe */ 5003219820Sjeff /* so make sure newargz[1] doesn't end in .exe */ 5004219820Sjeff strendzap(newargz[1],".exe"); 5005219820Sjeff for (i = 1; i < argc; i++) 5006219820Sjeff newargz[i+1] = xstrdup(argv[i]); 5007219820Sjeff newargz[argc+1] = NULL; 5008219820Sjeff 5009219820Sjeff for (i=0; i<argc+1; i++) 5010219820Sjeff { 5011219820Sjeff DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 5012219820Sjeff ; 5013219820Sjeff } 5014219820Sjeff 5015219820SjeffEOF 5016219820Sjeff 5017219820Sjeff case $host_os in 5018219820Sjeff mingw*) 5019219820Sjeff cat >> $cwrappersource <<EOF 5020219820Sjeff execv("$SHELL",(char const **)newargz); 5021219820SjeffEOF 5022219820Sjeff ;; 5023219820Sjeff *) 5024219820Sjeff cat >> $cwrappersource <<EOF 5025219820Sjeff execv("$SHELL",newargz); 5026219820SjeffEOF 5027219820Sjeff ;; 5028219820Sjeff esac 5029219820Sjeff 5030219820Sjeff cat >> $cwrappersource <<"EOF" 5031219820Sjeff return 127; 5032219820Sjeff} 5033219820Sjeff 5034219820Sjeffvoid * 5035219820Sjeffxmalloc (size_t num) 5036219820Sjeff{ 5037219820Sjeff void * p = (void *) malloc (num); 5038219820Sjeff if (!p) 5039219820Sjeff lt_fatal ("Memory exhausted"); 5040219820Sjeff 5041219820Sjeff return p; 5042219820Sjeff} 5043219820Sjeff 5044219820Sjeffchar * 5045219820Sjeffxstrdup (const char *string) 5046219820Sjeff{ 5047219820Sjeff return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5048219820Sjeff; 5049219820Sjeff} 5050219820Sjeff 5051219820Sjeffconst char * 5052219820Sjeffbase_name (const char *name) 5053219820Sjeff{ 5054219820Sjeff const char *base; 5055219820Sjeff 5056219820Sjeff#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5057219820Sjeff /* Skip over the disk name in MSDOS pathnames. */ 5058219820Sjeff if (isalpha ((unsigned char)name[0]) && name[1] == ':') 5059219820Sjeff name += 2; 5060219820Sjeff#endif 5061219820Sjeff 5062219820Sjeff for (base = name; *name; name++) 5063219820Sjeff if (IS_DIR_SEPARATOR (*name)) 5064219820Sjeff base = name + 1; 5065219820Sjeff return base; 5066219820Sjeff} 5067219820Sjeff 5068219820Sjeffint 5069219820Sjeffcheck_executable(const char * path) 5070219820Sjeff{ 5071219820Sjeff struct stat st; 5072219820Sjeff 5073219820Sjeff DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 5074219820Sjeff if ((!path) || (!*path)) 5075219820Sjeff return 0; 5076219820Sjeff 5077219820Sjeff if ((stat (path, &st) >= 0) && 5078219820Sjeff ( 5079219820Sjeff /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 5080219820Sjeff#if defined (S_IXOTH) 5081219820Sjeff ((st.st_mode & S_IXOTH) == S_IXOTH) || 5082219820Sjeff#endif 5083219820Sjeff#if defined (S_IXGRP) 5084219820Sjeff ((st.st_mode & S_IXGRP) == S_IXGRP) || 5085219820Sjeff#endif 5086219820Sjeff ((st.st_mode & S_IXUSR) == S_IXUSR)) 5087219820Sjeff ) 5088219820Sjeff return 1; 5089219820Sjeff else 5090219820Sjeff return 0; 5091219820Sjeff} 5092219820Sjeff 5093219820Sjeff/* Searches for the full path of the wrapper. Returns 5094219820Sjeff newly allocated full path name if found, NULL otherwise */ 5095219820Sjeffchar * 5096219820Sjefffind_executable (const char* wrapper) 5097219820Sjeff{ 5098219820Sjeff int has_slash = 0; 5099219820Sjeff const char* p; 5100219820Sjeff const char* p_next; 5101219820Sjeff /* static buffer for getcwd */ 5102219820Sjeff char tmp[LT_PATHMAX + 1]; 5103219820Sjeff int tmp_len; 5104219820Sjeff char* concat_name; 5105219820Sjeff 5106219820Sjeff DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 5107219820Sjeff 5108219820Sjeff if ((wrapper == NULL) || (*wrapper == '\0')) 5109219820Sjeff return NULL; 5110219820Sjeff 5111219820Sjeff /* Absolute path? */ 5112219820Sjeff#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5113219820Sjeff if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 5114219820Sjeff { 5115219820Sjeff concat_name = xstrdup (wrapper); 5116219820Sjeff if (check_executable(concat_name)) 5117219820Sjeff return concat_name; 5118219820Sjeff XFREE(concat_name); 5119219820Sjeff } 5120219820Sjeff else 5121219820Sjeff { 5122219820Sjeff#endif 5123219820Sjeff if (IS_DIR_SEPARATOR (wrapper[0])) 5124219820Sjeff { 5125219820Sjeff concat_name = xstrdup (wrapper); 5126219820Sjeff if (check_executable(concat_name)) 5127219820Sjeff return concat_name; 5128219820Sjeff XFREE(concat_name); 5129219820Sjeff } 5130219820Sjeff#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5131219820Sjeff } 5132219820Sjeff#endif 5133219820Sjeff 5134219820Sjeff for (p = wrapper; *p; p++) 5135219820Sjeff if (*p == '/') 5136219820Sjeff { 5137219820Sjeff has_slash = 1; 5138219820Sjeff break; 5139219820Sjeff } 5140219820Sjeff if (!has_slash) 5141219820Sjeff { 5142219820Sjeff /* no slashes; search PATH */ 5143219820Sjeff const char* path = getenv ("PATH"); 5144219820Sjeff if (path != NULL) 5145219820Sjeff { 5146219820Sjeff for (p = path; *p; p = p_next) 5147219820Sjeff { 5148219820Sjeff const char* q; 5149219820Sjeff size_t p_len; 5150219820Sjeff for (q = p; *q; q++) 5151219820Sjeff if (IS_PATH_SEPARATOR(*q)) 5152219820Sjeff break; 5153219820Sjeff p_len = q - p; 5154219820Sjeff p_next = (*q == '\0' ? q : q + 1); 5155219820Sjeff if (p_len == 0) 5156219820Sjeff { 5157219820Sjeff /* empty path: current directory */ 5158219820Sjeff if (getcwd (tmp, LT_PATHMAX) == NULL) 5159219820Sjeff lt_fatal ("getcwd failed"); 5160219820Sjeff tmp_len = strlen(tmp); 5161219820Sjeff concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5162219820Sjeff memcpy (concat_name, tmp, tmp_len); 5163219820Sjeff concat_name[tmp_len] = '/'; 5164219820Sjeff strcpy (concat_name + tmp_len + 1, wrapper); 5165219820Sjeff } 5166219820Sjeff else 5167219820Sjeff { 5168219820Sjeff concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 5169219820Sjeff memcpy (concat_name, p, p_len); 5170219820Sjeff concat_name[p_len] = '/'; 5171219820Sjeff strcpy (concat_name + p_len + 1, wrapper); 5172219820Sjeff } 5173219820Sjeff if (check_executable(concat_name)) 5174219820Sjeff return concat_name; 5175219820Sjeff XFREE(concat_name); 5176219820Sjeff } 5177219820Sjeff } 5178219820Sjeff /* not found in PATH; assume curdir */ 5179219820Sjeff } 5180219820Sjeff /* Relative path | not found in path: prepend cwd */ 5181219820Sjeff if (getcwd (tmp, LT_PATHMAX) == NULL) 5182219820Sjeff lt_fatal ("getcwd failed"); 5183219820Sjeff tmp_len = strlen(tmp); 5184219820Sjeff concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5185219820Sjeff memcpy (concat_name, tmp, tmp_len); 5186219820Sjeff concat_name[tmp_len] = '/'; 5187219820Sjeff strcpy (concat_name + tmp_len + 1, wrapper); 5188219820Sjeff 5189219820Sjeff if (check_executable(concat_name)) 5190219820Sjeff return concat_name; 5191219820Sjeff XFREE(concat_name); 5192219820Sjeff return NULL; 5193219820Sjeff} 5194219820Sjeff 5195219820Sjeffchar * 5196219820Sjeffstrendzap(char *str, const char *pat) 5197219820Sjeff{ 5198219820Sjeff size_t len, patlen; 5199219820Sjeff 5200219820Sjeff assert(str != NULL); 5201219820Sjeff assert(pat != NULL); 5202219820Sjeff 5203219820Sjeff len = strlen(str); 5204219820Sjeff patlen = strlen(pat); 5205219820Sjeff 5206219820Sjeff if (patlen <= len) 5207219820Sjeff { 5208219820Sjeff str += len - patlen; 5209219820Sjeff if (strcmp(str, pat) == 0) 5210219820Sjeff *str = '\0'; 5211219820Sjeff } 5212219820Sjeff return str; 5213219820Sjeff} 5214219820Sjeff 5215219820Sjeffstatic void 5216219820Sjefflt_error_core (int exit_status, const char * mode, 5217219820Sjeff const char * message, va_list ap) 5218219820Sjeff{ 5219219820Sjeff fprintf (stderr, "%s: %s: ", program_name, mode); 5220219820Sjeff vfprintf (stderr, message, ap); 5221219820Sjeff fprintf (stderr, ".\n"); 5222219820Sjeff 5223219820Sjeff if (exit_status >= 0) 5224219820Sjeff exit (exit_status); 5225219820Sjeff} 5226219820Sjeff 5227219820Sjeffvoid 5228219820Sjefflt_fatal (const char *message, ...) 5229219820Sjeff{ 5230219820Sjeff va_list ap; 5231219820Sjeff va_start (ap, message); 5232219820Sjeff lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5233219820Sjeff va_end (ap); 5234219820Sjeff} 5235219820SjeffEOF 5236219820Sjeff # we should really use a build-platform specific compiler 5237219820Sjeff # here, but OTOH, the wrappers (shell script and this C one) 5238219820Sjeff # are only useful if you want to execute the "real" binary. 5239219820Sjeff # Since the "real" binary is built for $host, then this 5240219820Sjeff # wrapper might as well be built for $host, too. 5241219820Sjeff $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 5242219820Sjeff ;; 5243219820Sjeff esac 5244219820Sjeff $rm $output 5245219820Sjeff trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5246219820Sjeff 5247219820Sjeff $echo > $output "\ 5248219820Sjeff#! $SHELL 5249219820Sjeff 5250219820Sjeff# $output - temporary wrapper script for $objdir/$outputname 5251219820Sjeff# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5252219820Sjeff# 5253219820Sjeff# The $output program cannot be directly executed until all the libtool 5254219820Sjeff# libraries that it depends on are installed. 5255219820Sjeff# 5256219820Sjeff# This wrapper script should never be moved out of the build directory. 5257219820Sjeff# If it is, it will not operate correctly. 5258219820Sjeff 5259219820Sjeff# Sed substitution that helps us do robust quoting. It backslashifies 5260219820Sjeff# metacharacters that are still active within double-quoted strings. 5261219820SjeffXsed='${SED} -e 1s/^X//' 5262219820Sjeffsed_quote_subst='$sed_quote_subst' 5263219820Sjeff 5264219820Sjeff# The HP-UX ksh and POSIX shell print the target directory to stdout 5265219820Sjeff# if CDPATH is set. 5266219820Sjeff(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5267219820Sjeff 5268219820Sjeffrelink_command=\"$relink_command\" 5269219820Sjeff 5270219820Sjeff# This environment variable determines our operation mode. 5271219820Sjeffif test \"\$libtool_install_magic\" = \"$magic\"; then 5272219820Sjeff # install mode needs the following variable: 5273219820Sjeff notinst_deplibs='$notinst_deplibs' 5274219820Sjeffelse 5275219820Sjeff # When we are sourced in execute mode, \$file and \$echo are already set. 5276219820Sjeff if test \"\$libtool_execute_magic\" != \"$magic\"; then 5277219820Sjeff echo=\"$qecho\" 5278219820Sjeff file=\"\$0\" 5279219820Sjeff # Make sure echo works. 5280219820Sjeff if test \"X\$1\" = X--no-reexec; then 5281219820Sjeff # Discard the --no-reexec flag, and continue. 5282219820Sjeff shift 5283219820Sjeff elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 5284219820Sjeff # Yippee, \$echo works! 5285219820Sjeff : 5286219820Sjeff else 5287219820Sjeff # Restart under the correct shell, and then maybe \$echo will work. 5288219820Sjeff exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 5289219820Sjeff fi 5290219820Sjeff fi\ 5291219820Sjeff" 5292219820Sjeff $echo >> $output "\ 5293219820Sjeff 5294219820Sjeff # Find the directory that this script lives in. 5295219820Sjeff thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 5296219820Sjeff test \"x\$thisdir\" = \"x\$file\" && thisdir=. 5297219820Sjeff 5298219820Sjeff # Follow symbolic links until we get to the real thisdir. 5299219820Sjeff file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 5300219820Sjeff while test -n \"\$file\"; do 5301219820Sjeff destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 5302219820Sjeff 5303219820Sjeff # If there was a directory component, then change thisdir. 5304219820Sjeff if test \"x\$destdir\" != \"x\$file\"; then 5305219820Sjeff case \"\$destdir\" in 5306219820Sjeff [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5307219820Sjeff *) thisdir=\"\$thisdir/\$destdir\" ;; 5308219820Sjeff esac 5309219820Sjeff fi 5310219820Sjeff 5311219820Sjeff file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 5312219820Sjeff file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 5313219820Sjeff done 5314219820Sjeff 5315219820Sjeff # Try to get the absolute directory name. 5316219820Sjeff absdir=\`cd \"\$thisdir\" && pwd\` 5317219820Sjeff test -n \"\$absdir\" && thisdir=\"\$absdir\" 5318219820Sjeff" 5319219820Sjeff 5320219820Sjeff if test "$fast_install" = yes; then 5321219820Sjeff $echo >> $output "\ 5322219820Sjeff program=lt-'$outputname'$exeext 5323219820Sjeff progdir=\"\$thisdir/$objdir\" 5324219820Sjeff 5325219820Sjeff if test ! -f \"\$progdir/\$program\" || \\ 5326219820Sjeff { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 5327219820Sjeff test \"X\$file\" != \"X\$progdir/\$program\"; }; then 5328219820Sjeff 5329219820Sjeff file=\"\$\$-\$program\" 5330219820Sjeff 5331219820Sjeff if test ! -d \"\$progdir\"; then 5332219820Sjeff $mkdir \"\$progdir\" 5333219820Sjeff else 5334219820Sjeff $rm \"\$progdir/\$file\" 5335219820Sjeff fi" 5336219820Sjeff 5337219820Sjeff $echo >> $output "\ 5338219820Sjeff 5339219820Sjeff # relink executable if necessary 5340219820Sjeff if test -n \"\$relink_command\"; then 5341219820Sjeff if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5342219820Sjeff else 5343219820Sjeff $echo \"\$relink_command_output\" >&2 5344219820Sjeff $rm \"\$progdir/\$file\" 5345219820Sjeff exit $EXIT_FAILURE 5346219820Sjeff fi 5347219820Sjeff fi 5348219820Sjeff 5349219820Sjeff $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5350219820Sjeff { $rm \"\$progdir/\$program\"; 5351219820Sjeff $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5352219820Sjeff $rm \"\$progdir/\$file\" 5353219820Sjeff fi" 5354219820Sjeff else 5355219820Sjeff $echo >> $output "\ 5356219820Sjeff program='$outputname' 5357219820Sjeff progdir=\"\$thisdir/$objdir\" 5358219820Sjeff" 5359219820Sjeff fi 5360219820Sjeff 5361219820Sjeff $echo >> $output "\ 5362219820Sjeff 5363219820Sjeff if test -f \"\$progdir/\$program\"; then" 5364219820Sjeff 5365219820Sjeff # Export our shlibpath_var if we have one. 5366219820Sjeff if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5367219820Sjeff $echo >> $output "\ 5368219820Sjeff # Add our own library path to $shlibpath_var 5369219820Sjeff $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 5370219820Sjeff 5371219820Sjeff # Some systems cannot cope with colon-terminated $shlibpath_var 5372219820Sjeff # The second colon is a workaround for a bug in BeOS R4 sed 5373219820Sjeff $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 5374219820Sjeff 5375219820Sjeff export $shlibpath_var 5376219820Sjeff" 5377219820Sjeff fi 5378219820Sjeff 5379219820Sjeff # fixup the dll searchpath if we need to. 5380219820Sjeff if test -n "$dllsearchpath"; then 5381219820Sjeff $echo >> $output "\ 5382219820Sjeff # Add the dll search path components to the executable PATH 5383219820Sjeff PATH=$dllsearchpath:\$PATH 5384219820Sjeff" 5385219820Sjeff fi 5386219820Sjeff 5387219820Sjeff $echo >> $output "\ 5388219820Sjeff if test \"\$libtool_execute_magic\" != \"$magic\"; then 5389219820Sjeff # Run the actual program with our arguments. 5390219820Sjeff" 5391219820Sjeff case $host in 5392219820Sjeff # Backslashes separate directories on plain windows 5393219820Sjeff *-*-mingw | *-*-os2*) 5394219820Sjeff $echo >> $output "\ 5395219820Sjeff exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5396219820Sjeff" 5397219820Sjeff ;; 5398219820Sjeff 5399219820Sjeff *) 5400219820Sjeff $echo >> $output "\ 5401219820Sjeff exec \"\$progdir/\$program\" \${1+\"\$@\"} 5402219820Sjeff" 5403219820Sjeff ;; 5404219820Sjeff esac 5405219820Sjeff $echo >> $output "\ 5406219820Sjeff \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 5407219820Sjeff exit $EXIT_FAILURE 5408219820Sjeff fi 5409219820Sjeff else 5410219820Sjeff # The program doesn't exist. 5411219820Sjeff \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 5412219820Sjeff \$echo \"This script is just a wrapper for \$program.\" 1>&2 5413219820Sjeff $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5414219820Sjeff exit $EXIT_FAILURE 5415219820Sjeff fi 5416219820Sjefffi\ 5417219820Sjeff" 5418219820Sjeff chmod +x $output 5419219820Sjeff fi 5420219820Sjeff exit $EXIT_SUCCESS 5421219820Sjeff ;; 5422219820Sjeff esac 5423219820Sjeff 5424219820Sjeff # See if we need to build an old-fashioned archive. 5425219820Sjeff for oldlib in $oldlibs; do 5426219820Sjeff 5427219820Sjeff if test "$build_libtool_libs" = convenience; then 5428219820Sjeff oldobjs="$libobjs_save" 5429219820Sjeff addlibs="$convenience" 5430219820Sjeff build_libtool_libs=no 5431219820Sjeff else 5432219820Sjeff if test "$build_libtool_libs" = module; then 5433219820Sjeff oldobjs="$libobjs_save" 5434219820Sjeff build_libtool_libs=no 5435219820Sjeff else 5436219820Sjeff oldobjs="$old_deplibs $non_pic_objects" 5437219820Sjeff fi 5438219820Sjeff addlibs="$old_convenience" 5439219820Sjeff fi 5440219820Sjeff 5441219820Sjeff if test -n "$addlibs"; then 5442219820Sjeff gentop="$output_objdir/${outputname}x" 5443219820Sjeff generated="$generated $gentop" 5444219820Sjeff 5445219820Sjeff func_extract_archives $gentop $addlibs 5446219820Sjeff oldobjs="$oldobjs $func_extract_archives_result" 5447219820Sjeff fi 5448219820Sjeff 5449219820Sjeff # Do each command in the archive commands. 5450219820Sjeff if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5451219820Sjeff cmds=$old_archive_from_new_cmds 5452219820Sjeff else 5453219820Sjeff # POSIX demands no paths to be encoded in archives. We have 5454219820Sjeff # to avoid creating archives with duplicate basenames if we 5455219820Sjeff # might have to extract them afterwards, e.g., when creating a 5456219820Sjeff # static archive out of a convenience library, or when linking 5457219820Sjeff # the entirety of a libtool archive into another (currently 5458219820Sjeff # not supported by libtool). 5459219820Sjeff if (for obj in $oldobjs 5460219820Sjeff do 5461219820Sjeff $echo "X$obj" | $Xsed -e 's%^.*/%%' 5462219820Sjeff done | sort | sort -uc >/dev/null 2>&1); then 5463219820Sjeff : 5464219820Sjeff else 5465219820Sjeff $echo "copying selected object files to avoid basename conflicts..." 5466219820Sjeff 5467219820Sjeff if test -z "$gentop"; then 5468219820Sjeff gentop="$output_objdir/${outputname}x" 5469219820Sjeff generated="$generated $gentop" 5470219820Sjeff 5471219820Sjeff $show "${rm}r $gentop" 5472219820Sjeff $run ${rm}r "$gentop" 5473219820Sjeff $show "$mkdir $gentop" 5474219820Sjeff $run $mkdir "$gentop" 5475219820Sjeff exit_status=$? 5476219820Sjeff if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 5477219820Sjeff exit $exit_status 5478219820Sjeff fi 5479219820Sjeff fi 5480219820Sjeff 5481219820Sjeff save_oldobjs=$oldobjs 5482219820Sjeff oldobjs= 5483219820Sjeff counter=1 5484219820Sjeff for obj in $save_oldobjs 5485219820Sjeff do 5486219820Sjeff objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 5487219820Sjeff case " $oldobjs " in 5488219820Sjeff " ") oldobjs=$obj ;; 5489219820Sjeff *[\ /]"$objbase "*) 5490219820Sjeff while :; do 5491219820Sjeff # Make sure we don't pick an alternate name that also 5492219820Sjeff # overlaps. 5493219820Sjeff newobj=lt$counter-$objbase 5494219820Sjeff counter=`expr $counter + 1` 5495219820Sjeff case " $oldobjs " in 5496219820Sjeff *[\ /]"$newobj "*) ;; 5497219820Sjeff *) if test ! -f "$gentop/$newobj"; then break; fi ;; 5498219820Sjeff esac 5499219820Sjeff done 5500219820Sjeff $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 5501219820Sjeff $run ln "$obj" "$gentop/$newobj" || 5502219820Sjeff $run cp "$obj" "$gentop/$newobj" 5503219820Sjeff oldobjs="$oldobjs $gentop/$newobj" 5504219820Sjeff ;; 5505219820Sjeff *) oldobjs="$oldobjs $obj" ;; 5506219820Sjeff esac 5507219820Sjeff done 5508219820Sjeff fi 5509219820Sjeff 5510219820Sjeff eval cmds=\"$old_archive_cmds\" 5511219820Sjeff 5512219820Sjeff if len=`expr "X$cmds" : ".*"` && 5513219820Sjeff test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5514219820Sjeff cmds=$old_archive_cmds 5515219820Sjeff else 5516219820Sjeff # the command line is too long to link in one step, link in parts 5517219820Sjeff $echo "using piecewise archive linking..." 5518219820Sjeff save_RANLIB=$RANLIB 5519219820Sjeff RANLIB=: 5520219820Sjeff objlist= 5521219820Sjeff concat_cmds= 5522219820Sjeff save_oldobjs=$oldobjs 5523219820Sjeff 5524219820Sjeff # Is there a better way of finding the last object in the list? 5525219820Sjeff for obj in $save_oldobjs 5526219820Sjeff do 5527219820Sjeff last_oldobj=$obj 5528219820Sjeff done 5529219820Sjeff for obj in $save_oldobjs 5530219820Sjeff do 5531219820Sjeff oldobjs="$objlist $obj" 5532219820Sjeff objlist="$objlist $obj" 5533219820Sjeff eval test_cmds=\"$old_archive_cmds\" 5534219820Sjeff if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5535219820Sjeff test "$len" -le "$max_cmd_len"; then 5536219820Sjeff : 5537219820Sjeff else 5538219820Sjeff # the above command should be used before it gets too long 5539219820Sjeff oldobjs=$objlist 5540219820Sjeff if test "$obj" = "$last_oldobj" ; then 5541219820Sjeff RANLIB=$save_RANLIB 5542219820Sjeff fi 5543219820Sjeff test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5544219820Sjeff eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 5545219820Sjeff objlist= 5546219820Sjeff fi 5547219820Sjeff done 5548219820Sjeff RANLIB=$save_RANLIB 5549219820Sjeff oldobjs=$objlist 5550219820Sjeff if test "X$oldobjs" = "X" ; then 5551219820Sjeff eval cmds=\"\$concat_cmds\" 5552219820Sjeff else 5553219820Sjeff eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 5554219820Sjeff fi 5555219820Sjeff fi 5556219820Sjeff fi 5557219820Sjeff save_ifs="$IFS"; IFS='~' 5558219820Sjeff for cmd in $cmds; do 5559219820Sjeff eval cmd=\"$cmd\" 5560219820Sjeff IFS="$save_ifs" 5561219820Sjeff $show "$cmd" 5562219820Sjeff $run eval "$cmd" || exit $? 5563219820Sjeff done 5564219820Sjeff IFS="$save_ifs" 5565219820Sjeff done 5566219820Sjeff 5567219820Sjeff if test -n "$generated"; then 5568219820Sjeff $show "${rm}r$generated" 5569219820Sjeff $run ${rm}r$generated 5570219820Sjeff fi 5571219820Sjeff 5572219820Sjeff # Now create the libtool archive. 5573219820Sjeff case $output in 5574219820Sjeff *.la) 5575219820Sjeff old_library= 5576219820Sjeff test "$build_old_libs" = yes && old_library="$libname.$libext" 5577219820Sjeff $show "creating $output" 5578219820Sjeff 5579219820Sjeff # Preserve any variables that may affect compiler behavior 5580219820Sjeff for var in $variables_saved_for_relink; do 5581219820Sjeff if eval test -z \"\${$var+set}\"; then 5582219820Sjeff relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 5583219820Sjeff elif eval var_value=\$$var; test -z "$var_value"; then 5584219820Sjeff relink_command="$var=; export $var; $relink_command" 5585219820Sjeff else 5586219820Sjeff var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 5587219820Sjeff relink_command="$var=\"$var_value\"; export $var; $relink_command" 5588219820Sjeff fi 5589219820Sjeff done 5590219820Sjeff # Quote the link command for shipping. 5591219820Sjeff relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 5592219820Sjeff relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 5593219820Sjeff if test "$hardcode_automatic" = yes ; then 5594219820Sjeff relink_command= 5595219820Sjeff fi 5596219820Sjeff 5597219820Sjeff 5598219820Sjeff # Only create the output if not a dry run. 5599219820Sjeff if test -z "$run"; then 5600219820Sjeff for installed in no yes; do 5601219820Sjeff if test "$installed" = yes; then 5602219820Sjeff if test -z "$install_libdir"; then 5603219820Sjeff break 5604219820Sjeff fi 5605219820Sjeff output="$output_objdir/$outputname"i 5606219820Sjeff # Replace all uninstalled libtool libraries with the installed ones 5607219820Sjeff newdependency_libs= 5608219820Sjeff for deplib in $dependency_libs; do 5609219820Sjeff case $deplib in 5610219820Sjeff *.la) 5611219820Sjeff name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 5612219820Sjeff eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5613219820Sjeff if test -z "$libdir"; then 5614219820Sjeff $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 5615219820Sjeff exit $EXIT_FAILURE 5616219820Sjeff fi 5617219820Sjeff newdependency_libs="$newdependency_libs $libdir/$name" 5618219820Sjeff ;; 5619219820Sjeff *) newdependency_libs="$newdependency_libs $deplib" ;; 5620219820Sjeff esac 5621219820Sjeff done 5622219820Sjeff dependency_libs="$newdependency_libs" 5623219820Sjeff newdlfiles= 5624219820Sjeff for lib in $dlfiles; do 5625219820Sjeff name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5626219820Sjeff eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5627219820Sjeff if test -z "$libdir"; then 5628219820Sjeff $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5629219820Sjeff exit $EXIT_FAILURE 5630219820Sjeff fi 5631219820Sjeff newdlfiles="$newdlfiles $libdir/$name" 5632219820Sjeff done 5633219820Sjeff dlfiles="$newdlfiles" 5634219820Sjeff newdlprefiles= 5635219820Sjeff for lib in $dlprefiles; do 5636219820Sjeff name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5637219820Sjeff eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5638219820Sjeff if test -z "$libdir"; then 5639219820Sjeff $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5640219820Sjeff exit $EXIT_FAILURE 5641219820Sjeff fi 5642219820Sjeff newdlprefiles="$newdlprefiles $libdir/$name" 5643219820Sjeff done 5644219820Sjeff dlprefiles="$newdlprefiles" 5645219820Sjeff else 5646219820Sjeff newdlfiles= 5647219820Sjeff for lib in $dlfiles; do 5648219820Sjeff case $lib in 5649219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5650219820Sjeff *) abs=`pwd`"/$lib" ;; 5651219820Sjeff esac 5652219820Sjeff newdlfiles="$newdlfiles $abs" 5653219820Sjeff done 5654219820Sjeff dlfiles="$newdlfiles" 5655219820Sjeff newdlprefiles= 5656219820Sjeff for lib in $dlprefiles; do 5657219820Sjeff case $lib in 5658219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5659219820Sjeff *) abs=`pwd`"/$lib" ;; 5660219820Sjeff esac 5661219820Sjeff newdlprefiles="$newdlprefiles $abs" 5662219820Sjeff done 5663219820Sjeff dlprefiles="$newdlprefiles" 5664219820Sjeff fi 5665219820Sjeff $rm $output 5666219820Sjeff # place dlname in correct position for cygwin 5667219820Sjeff tdlname=$dlname 5668219820Sjeff case $host,$output,$installed,$module,$dlname in 5669219820Sjeff *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 5670219820Sjeff esac 5671219820Sjeff $echo > $output "\ 5672219820Sjeff# $outputname - a libtool library file 5673219820Sjeff# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5674219820Sjeff# 5675219820Sjeff# Please DO NOT delete this file! 5676219820Sjeff# It is necessary for linking the library. 5677219820Sjeff 5678219820Sjeff# The name that we can dlopen(3). 5679219820Sjeffdlname='$tdlname' 5680219820Sjeff 5681219820Sjeff# Names of this library. 5682219820Sjefflibrary_names='$library_names' 5683219820Sjeff 5684219820Sjeff# The name of the static archive. 5685219820Sjeffold_library='$old_library' 5686219820Sjeff 5687219820Sjeff# Libraries that this one depends upon. 5688219820Sjeffdependency_libs='$dependency_libs' 5689219820Sjeff 5690219820Sjeff# Version information for $libname. 5691219820Sjeffcurrent=$current 5692219820Sjeffage=$age 5693219820Sjeffrevision=$revision 5694219820Sjeff 5695219820Sjeff# Is this an already installed library? 5696219820Sjeffinstalled=$installed 5697219820Sjeff 5698219820Sjeff# Should we warn about portability when linking against -modules? 5699219820Sjeffshouldnotlink=$module 5700219820Sjeff 5701219820Sjeff# Files to dlopen/dlpreopen 5702219820Sjeffdlopen='$dlfiles' 5703219820Sjeffdlpreopen='$dlprefiles' 5704219820Sjeff 5705219820Sjeff# Directory that this library needs to be installed in: 5706219820Sjefflibdir='$install_libdir'" 5707219820Sjeff if test "$installed" = no && test "$need_relink" = yes; then 5708219820Sjeff $echo >> $output "\ 5709219820Sjeffrelink_command=\"$relink_command\"" 5710219820Sjeff fi 5711219820Sjeff done 5712219820Sjeff fi 5713219820Sjeff 5714219820Sjeff # Do a symbolic link so that the libtool archive can be found in 5715219820Sjeff # LD_LIBRARY_PATH before the program is installed. 5716219820Sjeff $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 5717219820Sjeff $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 5718219820Sjeff ;; 5719219820Sjeff esac 5720219820Sjeff exit $EXIT_SUCCESS 5721219820Sjeff ;; 5722219820Sjeff 5723219820Sjeff # libtool install mode 5724219820Sjeff install) 5725219820Sjeff modename="$modename: install" 5726219820Sjeff 5727219820Sjeff # There may be an optional sh(1) argument at the beginning of 5728219820Sjeff # install_prog (especially on Windows NT). 5729219820Sjeff if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5730219820Sjeff # Allow the use of GNU shtool's install command. 5731219820Sjeff $echo "X$nonopt" | grep shtool > /dev/null; then 5732219820Sjeff # Aesthetically quote it. 5733219820Sjeff arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5734219820Sjeff case $arg in 5735219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5736219820Sjeff arg="\"$arg\"" 5737219820Sjeff ;; 5738219820Sjeff esac 5739219820Sjeff install_prog="$arg " 5740219820Sjeff arg="$1" 5741219820Sjeff shift 5742219820Sjeff else 5743219820Sjeff install_prog= 5744219820Sjeff arg=$nonopt 5745219820Sjeff fi 5746219820Sjeff 5747219820Sjeff # The real first argument should be the name of the installation program. 5748219820Sjeff # Aesthetically quote it. 5749219820Sjeff arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5750219820Sjeff case $arg in 5751219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5752219820Sjeff arg="\"$arg\"" 5753219820Sjeff ;; 5754219820Sjeff esac 5755219820Sjeff install_prog="$install_prog$arg" 5756219820Sjeff 5757219820Sjeff # We need to accept at least all the BSD install flags. 5758219820Sjeff dest= 5759219820Sjeff files= 5760219820Sjeff opts= 5761219820Sjeff prev= 5762219820Sjeff install_type= 5763219820Sjeff isdir=no 5764219820Sjeff stripme= 5765219820Sjeff for arg 5766219820Sjeff do 5767219820Sjeff if test -n "$dest"; then 5768219820Sjeff files="$files $dest" 5769219820Sjeff dest=$arg 5770219820Sjeff continue 5771219820Sjeff fi 5772219820Sjeff 5773219820Sjeff case $arg in 5774219820Sjeff -d) isdir=yes ;; 5775219820Sjeff -f) 5776219820Sjeff case " $install_prog " in 5777219820Sjeff *[\\\ /]cp\ *) ;; 5778219820Sjeff *) prev=$arg ;; 5779219820Sjeff esac 5780219820Sjeff ;; 5781219820Sjeff -g | -m | -o) prev=$arg ;; 5782219820Sjeff -s) 5783219820Sjeff stripme=" -s" 5784219820Sjeff continue 5785219820Sjeff ;; 5786219820Sjeff -*) 5787219820Sjeff ;; 5788219820Sjeff *) 5789219820Sjeff # If the previous option needed an argument, then skip it. 5790219820Sjeff if test -n "$prev"; then 5791219820Sjeff prev= 5792219820Sjeff else 5793219820Sjeff dest=$arg 5794219820Sjeff continue 5795219820Sjeff fi 5796219820Sjeff ;; 5797219820Sjeff esac 5798219820Sjeff 5799219820Sjeff # Aesthetically quote the argument. 5800219820Sjeff arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5801219820Sjeff case $arg in 5802219820Sjeff *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5803219820Sjeff arg="\"$arg\"" 5804219820Sjeff ;; 5805219820Sjeff esac 5806219820Sjeff install_prog="$install_prog $arg" 5807219820Sjeff done 5808219820Sjeff 5809219820Sjeff if test -z "$install_prog"; then 5810219820Sjeff $echo "$modename: you must specify an install program" 1>&2 5811219820Sjeff $echo "$help" 1>&2 5812219820Sjeff exit $EXIT_FAILURE 5813219820Sjeff fi 5814219820Sjeff 5815219820Sjeff if test -n "$prev"; then 5816219820Sjeff $echo "$modename: the \`$prev' option requires an argument" 1>&2 5817219820Sjeff $echo "$help" 1>&2 5818219820Sjeff exit $EXIT_FAILURE 5819219820Sjeff fi 5820219820Sjeff 5821219820Sjeff if test -z "$files"; then 5822219820Sjeff if test -z "$dest"; then 5823219820Sjeff $echo "$modename: no file or destination specified" 1>&2 5824219820Sjeff else 5825219820Sjeff $echo "$modename: you must specify a destination" 1>&2 5826219820Sjeff fi 5827219820Sjeff $echo "$help" 1>&2 5828219820Sjeff exit $EXIT_FAILURE 5829219820Sjeff fi 5830219820Sjeff 5831219820Sjeff # Strip any trailing slash from the destination. 5832219820Sjeff dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 5833219820Sjeff 5834219820Sjeff # Check to see that the destination is a directory. 5835219820Sjeff test -d "$dest" && isdir=yes 5836219820Sjeff if test "$isdir" = yes; then 5837219820Sjeff destdir="$dest" 5838219820Sjeff destname= 5839219820Sjeff else 5840219820Sjeff destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 5841219820Sjeff test "X$destdir" = "X$dest" && destdir=. 5842219820Sjeff destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 5843219820Sjeff 5844219820Sjeff # Not a directory, so check to see that there is only one file specified. 5845219820Sjeff set dummy $files 5846219820Sjeff if test "$#" -gt 2; then 5847219820Sjeff $echo "$modename: \`$dest' is not a directory" 1>&2 5848219820Sjeff $echo "$help" 1>&2 5849219820Sjeff exit $EXIT_FAILURE 5850219820Sjeff fi 5851219820Sjeff fi 5852219820Sjeff case $destdir in 5853219820Sjeff [\\/]* | [A-Za-z]:[\\/]*) ;; 5854219820Sjeff *) 5855219820Sjeff for file in $files; do 5856219820Sjeff case $file in 5857219820Sjeff *.lo) ;; 5858219820Sjeff *) 5859219820Sjeff $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 5860219820Sjeff $echo "$help" 1>&2 5861219820Sjeff exit $EXIT_FAILURE 5862219820Sjeff ;; 5863219820Sjeff esac 5864219820Sjeff done 5865219820Sjeff ;; 5866219820Sjeff esac 5867219820Sjeff 5868219820Sjeff # This variable tells wrapper scripts just to set variables rather 5869219820Sjeff # than running their programs. 5870219820Sjeff libtool_install_magic="$magic" 5871219820Sjeff 5872219820Sjeff staticlibs= 5873219820Sjeff future_libdirs= 5874219820Sjeff current_libdirs= 5875219820Sjeff for file in $files; do 5876219820Sjeff 5877219820Sjeff # Do each installation. 5878219820Sjeff case $file in 5879219820Sjeff *.$libext) 5880219820Sjeff # Do the static libraries later. 5881219820Sjeff staticlibs="$staticlibs $file" 5882219820Sjeff ;; 5883219820Sjeff 5884219820Sjeff *.la) 5885219820Sjeff # Check to see that this really is a libtool archive. 5886219820Sjeff if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 5887219820Sjeff else 5888219820Sjeff $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 5889219820Sjeff $echo "$help" 1>&2 5890219820Sjeff exit $EXIT_FAILURE 5891219820Sjeff fi 5892219820Sjeff 5893219820Sjeff library_names= 5894219820Sjeff old_library= 5895219820Sjeff relink_command= 5896219820Sjeff # If there is no directory component, then add one. 5897219820Sjeff case $file in 5898219820Sjeff */* | *\\*) . $file ;; 5899219820Sjeff *) . ./$file ;; 5900219820Sjeff esac 5901219820Sjeff 5902219820Sjeff # Add the libdir to current_libdirs if it is the destination. 5903219820Sjeff if test "X$destdir" = "X$libdir"; then 5904219820Sjeff case "$current_libdirs " in 5905219820Sjeff *" $libdir "*) ;; 5906219820Sjeff *) current_libdirs="$current_libdirs $libdir" ;; 5907219820Sjeff esac 5908219820Sjeff else 5909219820Sjeff # Note the libdir as a future libdir. 5910219820Sjeff case "$future_libdirs " in 5911219820Sjeff *" $libdir "*) ;; 5912219820Sjeff *) future_libdirs="$future_libdirs $libdir" ;; 5913219820Sjeff esac 5914219820Sjeff fi 5915219820Sjeff 5916219820Sjeff dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 5917219820Sjeff test "X$dir" = "X$file/" && dir= 5918219820Sjeff dir="$dir$objdir" 5919219820Sjeff 5920219820Sjeff if test -n "$relink_command"; then 5921219820Sjeff # Determine the prefix the user has applied to our future dir. 5922219820Sjeff inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 5923219820Sjeff 5924219820Sjeff # Don't allow the user to place us outside of our expected 5925219820Sjeff # location b/c this prevents finding dependent libraries that 5926219820Sjeff # are installed to the same prefix. 5927219820Sjeff # At present, this check doesn't affect windows .dll's that 5928219820Sjeff # are installed into $libdir/../bin (currently, that works fine) 5929219820Sjeff # but it's something to keep an eye on. 5930219820Sjeff if test "$inst_prefix_dir" = "$destdir"; then 5931219820Sjeff $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 5932219820Sjeff exit $EXIT_FAILURE 5933219820Sjeff fi 5934219820Sjeff 5935219820Sjeff if test -n "$inst_prefix_dir"; then 5936219820Sjeff # Stick the inst_prefix_dir data into the link command. 5937219820Sjeff relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 5938219820Sjeff else 5939219820Sjeff relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 5940219820Sjeff fi 5941219820Sjeff 5942219820Sjeff $echo "$modename: warning: relinking \`$file'" 1>&2 5943219820Sjeff $show "$relink_command" 5944219820Sjeff if $run eval "$relink_command"; then : 5945219820Sjeff else 5946219820Sjeff $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 5947219820Sjeff exit $EXIT_FAILURE 5948219820Sjeff fi 5949219820Sjeff fi 5950219820Sjeff 5951219820Sjeff # See the names of the shared library. 5952219820Sjeff set dummy $library_names 5953219820Sjeff if test -n "$2"; then 5954219820Sjeff realname="$2" 5955219820Sjeff shift 5956219820Sjeff shift 5957219820Sjeff 5958219820Sjeff srcname="$realname" 5959219820Sjeff test -n "$relink_command" && srcname="$realname"T 5960219820Sjeff 5961219820Sjeff # Install the shared library and build the symlinks. 5962219820Sjeff $show "$install_prog $dir/$srcname $destdir/$realname" 5963219820Sjeff $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 5964219820Sjeff if test -n "$stripme" && test -n "$striplib"; then 5965219820Sjeff $show "$striplib $destdir/$realname" 5966219820Sjeff $run eval "$striplib $destdir/$realname" || exit $? 5967219820Sjeff fi 5968219820Sjeff 5969219820Sjeff if test "$#" -gt 0; then 5970219820Sjeff # Delete the old symlinks, and create new ones. 5971219820Sjeff # Try `ln -sf' first, because the `ln' binary might depend on 5972219820Sjeff # the symlink we replace! Solaris /bin/ln does not understand -f, 5973219820Sjeff # so we also need to try rm && ln -s. 5974219820Sjeff for linkname 5975219820Sjeff do 5976219820Sjeff if test "$linkname" != "$realname"; then 5977219820Sjeff $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 5978219820Sjeff $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 5979219820Sjeff fi 5980219820Sjeff done 5981219820Sjeff fi 5982219820Sjeff 5983219820Sjeff # Do each command in the postinstall commands. 5984219820Sjeff lib="$destdir/$realname" 5985219820Sjeff cmds=$postinstall_cmds 5986219820Sjeff save_ifs="$IFS"; IFS='~' 5987219820Sjeff for cmd in $cmds; do 5988219820Sjeff IFS="$save_ifs" 5989219820Sjeff eval cmd=\"$cmd\" 5990219820Sjeff $show "$cmd" 5991219820Sjeff $run eval "$cmd" || { 5992219820Sjeff lt_exit=$? 5993219820Sjeff 5994219820Sjeff # Restore the uninstalled library and exit 5995219820Sjeff if test "$mode" = relink; then 5996219820Sjeff $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 5997219820Sjeff fi 5998219820Sjeff 5999219820Sjeff exit $lt_exit 6000219820Sjeff } 6001219820Sjeff done 6002219820Sjeff IFS="$save_ifs" 6003219820Sjeff fi 6004219820Sjeff 6005219820Sjeff # Install the pseudo-library for information purposes. 6006219820Sjeff name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6007219820Sjeff instname="$dir/$name"i 6008219820Sjeff $show "$install_prog $instname $destdir/$name" 6009219820Sjeff $run eval "$install_prog $instname $destdir/$name" || exit $? 6010219820Sjeff 6011219820Sjeff # Maybe install the static library, too. 6012219820Sjeff test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 6013219820Sjeff ;; 6014219820Sjeff 6015219820Sjeff *.lo) 6016219820Sjeff # Install (i.e. copy) a libtool object. 6017219820Sjeff 6018219820Sjeff # Figure out destination file name, if it wasn't already specified. 6019219820Sjeff if test -n "$destname"; then 6020219820Sjeff destfile="$destdir/$destname" 6021219820Sjeff else 6022219820Sjeff destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6023219820Sjeff destfile="$destdir/$destfile" 6024219820Sjeff fi 6025219820Sjeff 6026219820Sjeff # Deduce the name of the destination old-style object file. 6027219820Sjeff case $destfile in 6028219820Sjeff *.lo) 6029219820Sjeff staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 6030219820Sjeff ;; 6031219820Sjeff *.$objext) 6032219820Sjeff staticdest="$destfile" 6033219820Sjeff destfile= 6034219820Sjeff ;; 6035219820Sjeff *) 6036219820Sjeff $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 6037219820Sjeff $echo "$help" 1>&2 6038219820Sjeff exit $EXIT_FAILURE 6039219820Sjeff ;; 6040219820Sjeff esac 6041219820Sjeff 6042219820Sjeff # Install the libtool object if requested. 6043219820Sjeff if test -n "$destfile"; then 6044219820Sjeff $show "$install_prog $file $destfile" 6045219820Sjeff $run eval "$install_prog $file $destfile" || exit $? 6046219820Sjeff fi 6047219820Sjeff 6048219820Sjeff # Install the old object if enabled. 6049219820Sjeff if test "$build_old_libs" = yes; then 6050219820Sjeff # Deduce the name of the old-style object file. 6051219820Sjeff staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 6052219820Sjeff 6053219820Sjeff $show "$install_prog $staticobj $staticdest" 6054219820Sjeff $run eval "$install_prog \$staticobj \$staticdest" || exit $? 6055219820Sjeff fi 6056219820Sjeff exit $EXIT_SUCCESS 6057219820Sjeff ;; 6058219820Sjeff 6059219820Sjeff *) 6060219820Sjeff # Figure out destination file name, if it wasn't already specified. 6061219820Sjeff if test -n "$destname"; then 6062219820Sjeff destfile="$destdir/$destname" 6063219820Sjeff else 6064219820Sjeff destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6065219820Sjeff destfile="$destdir/$destfile" 6066219820Sjeff fi 6067219820Sjeff 6068219820Sjeff # If the file is missing, and there is a .exe on the end, strip it 6069219820Sjeff # because it is most likely a libtool script we actually want to 6070219820Sjeff # install 6071219820Sjeff stripped_ext="" 6072219820Sjeff case $file in 6073219820Sjeff *.exe) 6074219820Sjeff if test ! -f "$file"; then 6075219820Sjeff file=`$echo $file|${SED} 's,.exe$,,'` 6076219820Sjeff stripped_ext=".exe" 6077219820Sjeff fi 6078219820Sjeff ;; 6079219820Sjeff esac 6080219820Sjeff 6081219820Sjeff # Do a test to see if this is really a libtool program. 6082219820Sjeff case $host in 6083219820Sjeff *cygwin*|*mingw*) 6084219820Sjeff wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 6085219820Sjeff ;; 6086219820Sjeff *) 6087219820Sjeff wrapper=$file 6088219820Sjeff ;; 6089219820Sjeff esac 6090219820Sjeff if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6091219820Sjeff notinst_deplibs= 6092219820Sjeff relink_command= 6093219820Sjeff 6094219820Sjeff # Note that it is not necessary on cygwin/mingw to append a dot to 6095219820Sjeff # foo even if both foo and FILE.exe exist: automatic-append-.exe 6096219820Sjeff # behavior happens only for exec(3), not for open(2)! Also, sourcing 6097219820Sjeff # `FILE.' does not work on cygwin managed mounts. 6098219820Sjeff # 6099219820Sjeff # If there is no directory component, then add one. 6100219820Sjeff case $wrapper in 6101219820Sjeff */* | *\\*) . ${wrapper} ;; 6102219820Sjeff *) . ./${wrapper} ;; 6103219820Sjeff esac 6104219820Sjeff 6105219820Sjeff # Check the variables that should have been set. 6106219820Sjeff if test -z "$notinst_deplibs"; then 6107219820Sjeff $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6108219820Sjeff exit $EXIT_FAILURE 6109219820Sjeff fi 6110219820Sjeff 6111219820Sjeff finalize=yes 6112219820Sjeff for lib in $notinst_deplibs; do 6113219820Sjeff # Check to see that each library is installed. 6114219820Sjeff libdir= 6115219820Sjeff if test -f "$lib"; then 6116219820Sjeff # If there is no directory component, then add one. 6117219820Sjeff case $lib in 6118219820Sjeff */* | *\\*) . $lib ;; 6119219820Sjeff *) . ./$lib ;; 6120219820Sjeff esac 6121219820Sjeff fi 6122219820Sjeff libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 6123219820Sjeff if test -n "$libdir" && test ! -f "$libfile"; then 6124219820Sjeff $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 6125219820Sjeff finalize=no 6126219820Sjeff fi 6127219820Sjeff done 6128219820Sjeff 6129219820Sjeff relink_command= 6130219820Sjeff # Note that it is not necessary on cygwin/mingw to append a dot to 6131219820Sjeff # foo even if both foo and FILE.exe exist: automatic-append-.exe 6132219820Sjeff # behavior happens only for exec(3), not for open(2)! Also, sourcing 6133219820Sjeff # `FILE.' does not work on cygwin managed mounts. 6134219820Sjeff # 6135219820Sjeff # If there is no directory component, then add one. 6136219820Sjeff case $wrapper in 6137219820Sjeff */* | *\\*) . ${wrapper} ;; 6138219820Sjeff *) . ./${wrapper} ;; 6139219820Sjeff esac 6140219820Sjeff 6141219820Sjeff outputname= 6142219820Sjeff if test "$fast_install" = no && test -n "$relink_command"; then 6143219820Sjeff if test "$finalize" = yes && test -z "$run"; then 6144219820Sjeff tmpdir=`func_mktempdir` 6145219820Sjeff file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6146219820Sjeff outputname="$tmpdir/$file" 6147219820Sjeff # Replace the output file specification. 6148219820Sjeff relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 6149219820Sjeff 6150219820Sjeff $show "$relink_command" 6151219820Sjeff if $run eval "$relink_command"; then : 6152219820Sjeff else 6153219820Sjeff $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6154219820Sjeff ${rm}r "$tmpdir" 6155219820Sjeff continue 6156219820Sjeff fi 6157219820Sjeff file="$outputname" 6158219820Sjeff else 6159219820Sjeff $echo "$modename: warning: cannot relink \`$file'" 1>&2 6160219820Sjeff fi 6161219820Sjeff else 6162219820Sjeff # Install the binary that we compiled earlier. 6163219820Sjeff file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 6164219820Sjeff fi 6165219820Sjeff fi 6166219820Sjeff 6167219820Sjeff # remove .exe since cygwin /usr/bin/install will append another 6168219820Sjeff # one anyway 6169219820Sjeff case $install_prog,$host in 6170219820Sjeff */usr/bin/install*,*cygwin*) 6171219820Sjeff case $file:$destfile in 6172219820Sjeff *.exe:*.exe) 6173219820Sjeff # this is ok 6174219820Sjeff ;; 6175219820Sjeff *.exe:*) 6176219820Sjeff destfile=$destfile.exe 6177219820Sjeff ;; 6178219820Sjeff *:*.exe) 6179219820Sjeff destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 6180219820Sjeff ;; 6181219820Sjeff esac 6182219820Sjeff ;; 6183219820Sjeff esac 6184219820Sjeff $show "$install_prog$stripme $file $destfile" 6185219820Sjeff $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 6186219820Sjeff test -n "$outputname" && ${rm}r "$tmpdir" 6187219820Sjeff ;; 6188219820Sjeff esac 6189219820Sjeff done 6190219820Sjeff 6191219820Sjeff for file in $staticlibs; do 6192219820Sjeff name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6193219820Sjeff 6194219820Sjeff # Set up the ranlib parameters. 6195219820Sjeff oldlib="$destdir/$name" 6196219820Sjeff 6197219820Sjeff $show "$install_prog $file $oldlib" 6198219820Sjeff $run eval "$install_prog \$file \$oldlib" || exit $? 6199219820Sjeff 6200219820Sjeff if test -n "$stripme" && test -n "$old_striplib"; then 6201219820Sjeff $show "$old_striplib $oldlib" 6202219820Sjeff $run eval "$old_striplib $oldlib" || exit $? 6203219820Sjeff fi 6204219820Sjeff 6205219820Sjeff # Do each command in the postinstall commands. 6206219820Sjeff cmds=$old_postinstall_cmds 6207219820Sjeff save_ifs="$IFS"; IFS='~' 6208219820Sjeff for cmd in $cmds; do 6209219820Sjeff IFS="$save_ifs" 6210219820Sjeff eval cmd=\"$cmd\" 6211219820Sjeff $show "$cmd" 6212219820Sjeff $run eval "$cmd" || exit $? 6213219820Sjeff done 6214219820Sjeff IFS="$save_ifs" 6215219820Sjeff done 6216219820Sjeff 6217219820Sjeff if test -n "$future_libdirs"; then 6218219820Sjeff $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 6219219820Sjeff fi 6220219820Sjeff 6221219820Sjeff if test -n "$current_libdirs"; then 6222219820Sjeff # Maybe just do a dry run. 6223219820Sjeff test -n "$run" && current_libdirs=" -n$current_libdirs" 6224219820Sjeff exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 6225219820Sjeff else 6226219820Sjeff exit $EXIT_SUCCESS 6227219820Sjeff fi 6228219820Sjeff ;; 6229219820Sjeff 6230219820Sjeff # libtool finish mode 6231219820Sjeff finish) 6232219820Sjeff modename="$modename: finish" 6233219820Sjeff libdirs="$nonopt" 6234219820Sjeff admincmds= 6235219820Sjeff 6236219820Sjeff if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 6237219820Sjeff for dir 6238219820Sjeff do 6239219820Sjeff libdirs="$libdirs $dir" 6240219820Sjeff done 6241219820Sjeff 6242219820Sjeff for libdir in $libdirs; do 6243219820Sjeff if test -n "$finish_cmds"; then 6244219820Sjeff # Do each command in the finish commands. 6245219820Sjeff cmds=$finish_cmds 6246219820Sjeff save_ifs="$IFS"; IFS='~' 6247219820Sjeff for cmd in $cmds; do 6248219820Sjeff IFS="$save_ifs" 6249219820Sjeff eval cmd=\"$cmd\" 6250219820Sjeff $show "$cmd" 6251219820Sjeff $run eval "$cmd" || admincmds="$admincmds 6252219820Sjeff $cmd" 6253219820Sjeff done 6254219820Sjeff IFS="$save_ifs" 6255219820Sjeff fi 6256219820Sjeff if test -n "$finish_eval"; then 6257219820Sjeff # Do the single finish_eval. 6258219820Sjeff eval cmds=\"$finish_eval\" 6259219820Sjeff $run eval "$cmds" || admincmds="$admincmds 6260219820Sjeff $cmds" 6261219820Sjeff fi 6262219820Sjeff done 6263219820Sjeff fi 6264219820Sjeff 6265219820Sjeff # Exit here if they wanted silent mode. 6266219820Sjeff test "$show" = : && exit $EXIT_SUCCESS 6267219820Sjeff 6268219820Sjeff $echo "X----------------------------------------------------------------------" | $Xsed 6269219820Sjeff $echo "Libraries have been installed in:" 6270219820Sjeff for libdir in $libdirs; do 6271219820Sjeff $echo " $libdir" 6272219820Sjeff done 6273219820Sjeff $echo 6274219820Sjeff $echo "If you ever happen to want to link against installed libraries" 6275219820Sjeff $echo "in a given directory, LIBDIR, you must either use libtool, and" 6276219820Sjeff $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 6277219820Sjeff $echo "flag during linking and do at least one of the following:" 6278219820Sjeff if test -n "$shlibpath_var"; then 6279219820Sjeff $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 6280219820Sjeff $echo " during execution" 6281219820Sjeff fi 6282219820Sjeff if test -n "$runpath_var"; then 6283219820Sjeff $echo " - add LIBDIR to the \`$runpath_var' environment variable" 6284219820Sjeff $echo " during linking" 6285219820Sjeff fi 6286219820Sjeff if test -n "$hardcode_libdir_flag_spec"; then 6287219820Sjeff libdir=LIBDIR 6288219820Sjeff eval flag=\"$hardcode_libdir_flag_spec\" 6289219820Sjeff 6290219820Sjeff $echo " - use the \`$flag' linker flag" 6291219820Sjeff fi 6292219820Sjeff if test -n "$admincmds"; then 6293219820Sjeff $echo " - have your system administrator run these commands:$admincmds" 6294219820Sjeff fi 6295219820Sjeff if test -f /etc/ld.so.conf; then 6296219820Sjeff $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6297219820Sjeff fi 6298219820Sjeff $echo 6299219820Sjeff $echo "See any operating system documentation about shared libraries for" 6300219820Sjeff $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6301219820Sjeff $echo "X----------------------------------------------------------------------" | $Xsed 6302219820Sjeff exit $EXIT_SUCCESS 6303219820Sjeff ;; 6304219820Sjeff 6305219820Sjeff # libtool execute mode 6306219820Sjeff execute) 6307219820Sjeff modename="$modename: execute" 6308219820Sjeff 6309219820Sjeff # The first argument is the command name. 6310219820Sjeff cmd="$nonopt" 6311219820Sjeff if test -z "$cmd"; then 6312219820Sjeff $echo "$modename: you must specify a COMMAND" 1>&2 6313219820Sjeff $echo "$help" 6314219820Sjeff exit $EXIT_FAILURE 6315219820Sjeff fi 6316219820Sjeff 6317219820Sjeff # Handle -dlopen flags immediately. 6318219820Sjeff for file in $execute_dlfiles; do 6319219820Sjeff if test ! -f "$file"; then 6320219820Sjeff $echo "$modename: \`$file' is not a file" 1>&2 6321219820Sjeff $echo "$help" 1>&2 6322219820Sjeff exit $EXIT_FAILURE 6323219820Sjeff fi 6324219820Sjeff 6325219820Sjeff dir= 6326219820Sjeff case $file in 6327219820Sjeff *.la) 6328219820Sjeff # Check to see that this really is a libtool archive. 6329219820Sjeff if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 6330219820Sjeff else 6331219820Sjeff $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 6332219820Sjeff $echo "$help" 1>&2 6333219820Sjeff exit $EXIT_FAILURE 6334219820Sjeff fi 6335219820Sjeff 6336219820Sjeff # Read the libtool library. 6337219820Sjeff dlname= 6338219820Sjeff library_names= 6339219820Sjeff 6340219820Sjeff # If there is no directory component, then add one. 6341219820Sjeff case $file in 6342219820Sjeff */* | *\\*) . $file ;; 6343219820Sjeff *) . ./$file ;; 6344219820Sjeff esac 6345219820Sjeff 6346219820Sjeff # Skip this library if it cannot be dlopened. 6347219820Sjeff if test -z "$dlname"; then 6348219820Sjeff # Warn if it was a shared library. 6349219820Sjeff test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 6350219820Sjeff continue 6351219820Sjeff fi 6352219820Sjeff 6353219820Sjeff dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6354219820Sjeff test "X$dir" = "X$file" && dir=. 6355219820Sjeff 6356219820Sjeff if test -f "$dir/$objdir/$dlname"; then 6357219820Sjeff dir="$dir/$objdir" 6358219820Sjeff else 6359219820Sjeff $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 6360219820Sjeff exit $EXIT_FAILURE 6361219820Sjeff fi 6362219820Sjeff ;; 6363219820Sjeff 6364219820Sjeff *.lo) 6365219820Sjeff # Just add the directory containing the .lo file. 6366219820Sjeff dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6367219820Sjeff test "X$dir" = "X$file" && dir=. 6368219820Sjeff ;; 6369219820Sjeff 6370219820Sjeff *) 6371219820Sjeff $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 6372219820Sjeff continue 6373219820Sjeff ;; 6374219820Sjeff esac 6375219820Sjeff 6376219820Sjeff # Get the absolute pathname. 6377219820Sjeff absdir=`cd "$dir" && pwd` 6378219820Sjeff test -n "$absdir" && dir="$absdir" 6379219820Sjeff 6380219820Sjeff # Now add the directory to shlibpath_var. 6381219820Sjeff if eval "test -z \"\$$shlibpath_var\""; then 6382219820Sjeff eval "$shlibpath_var=\"\$dir\"" 6383219820Sjeff else 6384219820Sjeff eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 6385219820Sjeff fi 6386219820Sjeff done 6387219820Sjeff 6388219820Sjeff # This variable tells wrapper scripts just to set shlibpath_var 6389219820Sjeff # rather than running their programs. 6390219820Sjeff libtool_execute_magic="$magic" 6391219820Sjeff 6392219820Sjeff # Check if any of the arguments is a wrapper script. 6393219820Sjeff args= 6394219820Sjeff for file 6395219820Sjeff do 6396219820Sjeff case $file in 6397219820Sjeff -*) ;; 6398219820Sjeff *) 6399219820Sjeff # Do a test to see if this is really a libtool program. 6400219820Sjeff if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6401219820Sjeff # If there is no directory component, then add one. 6402219820Sjeff case $file in 6403219820Sjeff */* | *\\*) . $file ;; 6404219820Sjeff *) . ./$file ;; 6405219820Sjeff esac 6406219820Sjeff 6407219820Sjeff # Transform arg to wrapped name. 6408219820Sjeff file="$progdir/$program" 6409219820Sjeff fi 6410219820Sjeff ;; 6411219820Sjeff esac 6412219820Sjeff # Quote arguments (to preserve shell metacharacters). 6413219820Sjeff file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 6414219820Sjeff args="$args \"$file\"" 6415219820Sjeff done 6416219820Sjeff 6417219820Sjeff if test -z "$run"; then 6418219820Sjeff if test -n "$shlibpath_var"; then 6419219820Sjeff # Export the shlibpath_var. 6420219820Sjeff eval "export $shlibpath_var" 6421219820Sjeff fi 6422219820Sjeff 6423219820Sjeff # Restore saved environment variables 6424219820Sjeff if test "${save_LC_ALL+set}" = set; then 6425219820Sjeff LC_ALL="$save_LC_ALL"; export LC_ALL 6426219820Sjeff fi 6427219820Sjeff if test "${save_LANG+set}" = set; then 6428219820Sjeff LANG="$save_LANG"; export LANG 6429219820Sjeff fi 6430219820Sjeff 6431219820Sjeff # Now prepare to actually exec the command. 6432219820Sjeff exec_cmd="\$cmd$args" 6433219820Sjeff else 6434219820Sjeff # Display what would be done. 6435219820Sjeff if test -n "$shlibpath_var"; then 6436219820Sjeff eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 6437219820Sjeff $echo "export $shlibpath_var" 6438219820Sjeff fi 6439219820Sjeff $echo "$cmd$args" 6440219820Sjeff exit $EXIT_SUCCESS 6441219820Sjeff fi 6442219820Sjeff ;; 6443219820Sjeff 6444219820Sjeff # libtool clean and uninstall mode 6445219820Sjeff clean | uninstall) 6446219820Sjeff modename="$modename: $mode" 6447219820Sjeff rm="$nonopt" 6448219820Sjeff files= 6449219820Sjeff rmforce= 6450219820Sjeff exit_status=0 6451219820Sjeff 6452219820Sjeff # This variable tells wrapper scripts just to set variables rather 6453219820Sjeff # than running their programs. 6454219820Sjeff libtool_install_magic="$magic" 6455219820Sjeff 6456219820Sjeff for arg 6457219820Sjeff do 6458219820Sjeff case $arg in 6459219820Sjeff -f) rm="$rm $arg"; rmforce=yes ;; 6460219820Sjeff -*) rm="$rm $arg" ;; 6461219820Sjeff *) files="$files $arg" ;; 6462219820Sjeff esac 6463219820Sjeff done 6464219820Sjeff 6465219820Sjeff if test -z "$rm"; then 6466219820Sjeff $echo "$modename: you must specify an RM program" 1>&2 6467219820Sjeff $echo "$help" 1>&2 6468219820Sjeff exit $EXIT_FAILURE 6469219820Sjeff fi 6470219820Sjeff 6471219820Sjeff rmdirs= 6472219820Sjeff 6473219820Sjeff origobjdir="$objdir" 6474219820Sjeff for file in $files; do 6475219820Sjeff dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6476219820Sjeff if test "X$dir" = "X$file"; then 6477219820Sjeff dir=. 6478219820Sjeff objdir="$origobjdir" 6479219820Sjeff else 6480219820Sjeff objdir="$dir/$origobjdir" 6481219820Sjeff fi 6482219820Sjeff name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6483219820Sjeff test "$mode" = uninstall && objdir="$dir" 6484219820Sjeff 6485219820Sjeff # Remember objdir for removal later, being careful to avoid duplicates 6486219820Sjeff if test "$mode" = clean; then 6487219820Sjeff case " $rmdirs " in 6488219820Sjeff *" $objdir "*) ;; 6489219820Sjeff *) rmdirs="$rmdirs $objdir" ;; 6490219820Sjeff esac 6491219820Sjeff fi 6492219820Sjeff 6493219820Sjeff # Don't error if the file doesn't exist and rm -f was used. 6494219820Sjeff if (test -L "$file") >/dev/null 2>&1 \ 6495219820Sjeff || (test -h "$file") >/dev/null 2>&1 \ 6496219820Sjeff || test -f "$file"; then 6497219820Sjeff : 6498219820Sjeff elif test -d "$file"; then 6499219820Sjeff exit_status=1 6500219820Sjeff continue 6501219820Sjeff elif test "$rmforce" = yes; then 6502219820Sjeff continue 6503219820Sjeff fi 6504219820Sjeff 6505219820Sjeff rmfiles="$file" 6506219820Sjeff 6507219820Sjeff case $name in 6508219820Sjeff *.la) 6509219820Sjeff # Possibly a libtool archive, so verify it. 6510219820Sjeff if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6511219820Sjeff . $dir/$name 6512219820Sjeff 6513219820Sjeff # Delete the libtool libraries and symlinks. 6514219820Sjeff for n in $library_names; do 6515219820Sjeff rmfiles="$rmfiles $objdir/$n" 6516219820Sjeff done 6517219820Sjeff test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6518219820Sjeff 6519219820Sjeff case "$mode" in 6520219820Sjeff clean) 6521219820Sjeff case " $library_names " in 6522219820Sjeff # " " in the beginning catches empty $dlname 6523219820Sjeff *" $dlname "*) ;; 6524219820Sjeff *) rmfiles="$rmfiles $objdir/$dlname" ;; 6525219820Sjeff esac 6526219820Sjeff test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 6527219820Sjeff ;; 6528219820Sjeff uninstall) 6529219820Sjeff if test -n "$library_names"; then 6530219820Sjeff # Do each command in the postuninstall commands. 6531219820Sjeff cmds=$postuninstall_cmds 6532219820Sjeff save_ifs="$IFS"; IFS='~' 6533219820Sjeff for cmd in $cmds; do 6534219820Sjeff IFS="$save_ifs" 6535219820Sjeff eval cmd=\"$cmd\" 6536219820Sjeff $show "$cmd" 6537219820Sjeff $run eval "$cmd" 6538219820Sjeff if test "$?" -ne 0 && test "$rmforce" != yes; then 6539219820Sjeff exit_status=1 6540219820Sjeff fi 6541219820Sjeff done 6542219820Sjeff IFS="$save_ifs" 6543219820Sjeff fi 6544219820Sjeff 6545219820Sjeff if test -n "$old_library"; then 6546219820Sjeff # Do each command in the old_postuninstall commands. 6547219820Sjeff cmds=$old_postuninstall_cmds 6548219820Sjeff save_ifs="$IFS"; IFS='~' 6549219820Sjeff for cmd in $cmds; do 6550219820Sjeff IFS="$save_ifs" 6551219820Sjeff eval cmd=\"$cmd\" 6552219820Sjeff $show "$cmd" 6553219820Sjeff $run eval "$cmd" 6554219820Sjeff if test "$?" -ne 0 && test "$rmforce" != yes; then 6555219820Sjeff exit_status=1 6556219820Sjeff fi 6557219820Sjeff done 6558219820Sjeff IFS="$save_ifs" 6559219820Sjeff fi 6560219820Sjeff # FIXME: should reinstall the best remaining shared library. 6561219820Sjeff ;; 6562219820Sjeff esac 6563219820Sjeff fi 6564219820Sjeff ;; 6565219820Sjeff 6566219820Sjeff *.lo) 6567219820Sjeff # Possibly a libtool object, so verify it. 6568219820Sjeff if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6569219820Sjeff 6570219820Sjeff # Read the .lo file 6571219820Sjeff . $dir/$name 6572219820Sjeff 6573219820Sjeff # Add PIC object to the list of files to remove. 6574219820Sjeff if test -n "$pic_object" \ 6575219820Sjeff && test "$pic_object" != none; then 6576219820Sjeff rmfiles="$rmfiles $dir/$pic_object" 6577219820Sjeff fi 6578219820Sjeff 6579219820Sjeff # Add non-PIC object to the list of files to remove. 6580219820Sjeff if test -n "$non_pic_object" \ 6581219820Sjeff && test "$non_pic_object" != none; then 6582219820Sjeff rmfiles="$rmfiles $dir/$non_pic_object" 6583219820Sjeff fi 6584219820Sjeff fi 6585219820Sjeff ;; 6586219820Sjeff 6587219820Sjeff *) 6588219820Sjeff if test "$mode" = clean ; then 6589219820Sjeff noexename=$name 6590219820Sjeff case $file in 6591219820Sjeff *.exe) 6592219820Sjeff file=`$echo $file|${SED} 's,.exe$,,'` 6593219820Sjeff noexename=`$echo $name|${SED} 's,.exe$,,'` 6594219820Sjeff # $file with .exe has already been added to rmfiles, 6595219820Sjeff # add $file without .exe 6596219820Sjeff rmfiles="$rmfiles $file" 6597219820Sjeff ;; 6598219820Sjeff esac 6599219820Sjeff # Do a test to see if this is a libtool program. 6600219820Sjeff if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6601219820Sjeff relink_command= 6602219820Sjeff . $dir/$noexename 6603219820Sjeff 6604219820Sjeff # note $name still contains .exe if it was in $file originally 6605219820Sjeff # as does the version of $file that was added into $rmfiles 6606219820Sjeff rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 6607219820Sjeff if test "$fast_install" = yes && test -n "$relink_command"; then 6608219820Sjeff rmfiles="$rmfiles $objdir/lt-$name" 6609219820Sjeff fi 6610219820Sjeff if test "X$noexename" != "X$name" ; then 6611219820Sjeff rmfiles="$rmfiles $objdir/lt-${noexename}.c" 6612219820Sjeff fi 6613219820Sjeff fi 6614219820Sjeff fi 6615219820Sjeff ;; 6616219820Sjeff esac 6617219820Sjeff $show "$rm $rmfiles" 6618219820Sjeff $run $rm $rmfiles || exit_status=1 6619219820Sjeff done 6620219820Sjeff objdir="$origobjdir" 6621219820Sjeff 6622219820Sjeff # Try to remove the ${objdir}s in the directories where we deleted files 6623219820Sjeff for dir in $rmdirs; do 6624219820Sjeff if test -d "$dir"; then 6625219820Sjeff $show "rmdir $dir" 6626219820Sjeff $run rmdir $dir >/dev/null 2>&1 6627219820Sjeff fi 6628219820Sjeff done 6629219820Sjeff 6630219820Sjeff exit $exit_status 6631219820Sjeff ;; 6632219820Sjeff 6633219820Sjeff "") 6634219820Sjeff $echo "$modename: you must specify a MODE" 1>&2 6635219820Sjeff $echo "$generic_help" 1>&2 6636219820Sjeff exit $EXIT_FAILURE 6637219820Sjeff ;; 6638219820Sjeff esac 6639219820Sjeff 6640219820Sjeff if test -z "$exec_cmd"; then 6641219820Sjeff $echo "$modename: invalid operation mode \`$mode'" 1>&2 6642219820Sjeff $echo "$generic_help" 1>&2 6643219820Sjeff exit $EXIT_FAILURE 6644219820Sjeff fi 6645219820Sjefffi # test -z "$show_help" 6646219820Sjeff 6647219820Sjeffif test -n "$exec_cmd"; then 6648219820Sjeff eval exec $exec_cmd 6649219820Sjeff exit $EXIT_FAILURE 6650219820Sjefffi 6651219820Sjeff 6652219820Sjeff# We need to display help for each of the modes. 6653219820Sjeffcase $mode in 6654219820Sjeff"") $echo \ 6655219820Sjeff"Usage: $modename [OPTION]... [MODE-ARG]... 6656219820Sjeff 6657219820SjeffProvide generalized library-building support services. 6658219820Sjeff 6659219820Sjeff --config show all configuration variables 6660219820Sjeff --debug enable verbose shell tracing 6661219820Sjeff-n, --dry-run display commands without modifying any files 6662219820Sjeff --features display basic configuration information and exit 6663219820Sjeff --finish same as \`--mode=finish' 6664219820Sjeff --help display this help message and exit 6665219820Sjeff --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 6666219820Sjeff --quiet same as \`--silent' 6667219820Sjeff --silent don't print informational messages 6668219820Sjeff --tag=TAG use configuration variables from tag TAG 6669219820Sjeff --version print version information 6670219820Sjeff 6671219820SjeffMODE must be one of the following: 6672219820Sjeff 6673219820Sjeff clean remove files from the build directory 6674219820Sjeff compile compile a source file into a libtool object 6675219820Sjeff execute automatically set library path, then run a program 6676219820Sjeff finish complete the installation of libtool libraries 6677219820Sjeff install install libraries or executables 6678219820Sjeff link create a library or an executable 6679219820Sjeff uninstall remove libraries from an installed directory 6680219820Sjeff 6681219820SjeffMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 6682219820Sjeffa more detailed description of MODE. 6683219820Sjeff 6684219820SjeffReport bugs to <bug-libtool@gnu.org>." 6685219820Sjeff exit $EXIT_SUCCESS 6686219820Sjeff ;; 6687219820Sjeff 6688219820Sjeffclean) 6689219820Sjeff $echo \ 6690219820Sjeff"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 6691219820Sjeff 6692219820SjeffRemove files from the build directory. 6693219820Sjeff 6694219820SjeffRM is the name of the program to use to delete files associated with each FILE 6695219820Sjeff(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6696219820Sjeffto RM. 6697219820Sjeff 6698219820SjeffIf FILE is a libtool library, object or program, all the files associated 6699219820Sjeffwith it are deleted. Otherwise, only FILE itself is deleted using RM." 6700219820Sjeff ;; 6701219820Sjeff 6702219820Sjeffcompile) 6703219820Sjeff $echo \ 6704219820Sjeff"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 6705219820Sjeff 6706219820SjeffCompile a source file into a libtool library object. 6707219820Sjeff 6708219820SjeffThis mode accepts the following additional options: 6709219820Sjeff 6710219820Sjeff -o OUTPUT-FILE set the output file name to OUTPUT-FILE 6711219820Sjeff -prefer-pic try to building PIC objects only 6712219820Sjeff -prefer-non-pic try to building non-PIC objects only 6713219820Sjeff -static always build a \`.o' file suitable for static linking 6714219820Sjeff 6715219820SjeffCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 6716219820Sjefffrom the given SOURCEFILE. 6717219820Sjeff 6718219820SjeffThe output file name is determined by removing the directory component from 6719219820SjeffSOURCEFILE, then substituting the C source code suffix \`.c' with the 6720219820Sjefflibrary object suffix, \`.lo'." 6721219820Sjeff ;; 6722219820Sjeff 6723219820Sjeffexecute) 6724219820Sjeff $echo \ 6725219820Sjeff"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 6726219820Sjeff 6727219820SjeffAutomatically set library path, then run a program. 6728219820Sjeff 6729219820SjeffThis mode accepts the following additional options: 6730219820Sjeff 6731219820Sjeff -dlopen FILE add the directory containing FILE to the library path 6732219820Sjeff 6733219820SjeffThis mode sets the library path environment variable according to \`-dlopen' 6734219820Sjeffflags. 6735219820Sjeff 6736219820SjeffIf any of the ARGS are libtool executable wrappers, then they are translated 6737219820Sjeffinto their corresponding uninstalled binary, and any of their required library 6738219820Sjeffdirectories are added to the library path. 6739219820Sjeff 6740219820SjeffThen, COMMAND is executed, with ARGS as arguments." 6741219820Sjeff ;; 6742219820Sjeff 6743219820Sjefffinish) 6744219820Sjeff $echo \ 6745219820Sjeff"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 6746219820Sjeff 6747219820SjeffComplete the installation of libtool libraries. 6748219820Sjeff 6749219820SjeffEach LIBDIR is a directory that contains libtool libraries. 6750219820Sjeff 6751219820SjeffThe commands that this mode executes may require superuser privileges. Use 6752219820Sjeffthe \`--dry-run' option if you just want to see what would be executed." 6753219820Sjeff ;; 6754219820Sjeff 6755219820Sjeffinstall) 6756219820Sjeff $echo \ 6757219820Sjeff"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 6758219820Sjeff 6759219820SjeffInstall executables or libraries. 6760219820Sjeff 6761219820SjeffINSTALL-COMMAND is the installation command. The first component should be 6762219820Sjeffeither the \`install' or \`cp' program. 6763219820Sjeff 6764219820SjeffThe rest of the components are interpreted as arguments to that command (only 6765219820SjeffBSD-compatible install options are recognized)." 6766219820Sjeff ;; 6767219820Sjeff 6768219820Sjefflink) 6769219820Sjeff $echo \ 6770219820Sjeff"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 6771219820Sjeff 6772219820SjeffLink object files or libraries together to form another library, or to 6773219820Sjeffcreate an executable program. 6774219820Sjeff 6775219820SjeffLINK-COMMAND is a command using the C compiler that you would use to create 6776219820Sjeffa program from several object files. 6777219820Sjeff 6778219820SjeffThe following components of LINK-COMMAND are treated specially: 6779219820Sjeff 6780219820Sjeff -all-static do not do any dynamic linking at all 6781219820Sjeff -avoid-version do not add a version suffix if possible 6782219820Sjeff -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 6783219820Sjeff -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 6784219820Sjeff -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 6785219820Sjeff -export-symbols SYMFILE 6786219820Sjeff try to export only the symbols listed in SYMFILE 6787219820Sjeff -export-symbols-regex REGEX 6788219820Sjeff try to export only the symbols matching REGEX 6789219820Sjeff -LLIBDIR search LIBDIR for required installed libraries 6790219820Sjeff -lNAME OUTPUT-FILE requires the installed library libNAME 6791219820Sjeff -module build a library that can dlopened 6792219820Sjeff -no-fast-install disable the fast-install mode 6793219820Sjeff -no-install link a not-installable executable 6794219820Sjeff -no-undefined declare that a library does not refer to external symbols 6795219820Sjeff -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 6796219820Sjeff -objectlist FILE Use a list of object files found in FILE to specify objects 6797219820Sjeff -precious-files-regex REGEX 6798219820Sjeff don't remove output files matching REGEX 6799219820Sjeff -release RELEASE specify package release information 6800219820Sjeff -rpath LIBDIR the created library will eventually be installed in LIBDIR 6801219820Sjeff -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 6802219820Sjeff -static do not do any dynamic linking of libtool libraries 6803219820Sjeff -version-info CURRENT[:REVISION[:AGE]] 6804219820Sjeff specify library version info [each variable defaults to 0] 6805219820Sjeff 6806219820SjeffAll other options (arguments beginning with \`-') are ignored. 6807219820Sjeff 6808219820SjeffEvery other argument is treated as a filename. Files ending in \`.la' are 6809219820Sjefftreated as uninstalled libtool libraries, other files are standard or library 6810219820Sjeffobject files. 6811219820Sjeff 6812219820SjeffIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 6813219820Sjeffonly library objects (\`.lo' files) may be specified, and \`-rpath' is 6814219820Sjeffrequired, except when creating a convenience library. 6815219820Sjeff 6816219820SjeffIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 6817219820Sjeffusing \`ar' and \`ranlib', or on Windows using \`lib'. 6818219820Sjeff 6819219820SjeffIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 6820219820Sjeffis created, otherwise an executable program is created." 6821219820Sjeff ;; 6822219820Sjeff 6823219820Sjeffuninstall) 6824219820Sjeff $echo \ 6825219820Sjeff"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 6826219820Sjeff 6827219820SjeffRemove libraries from an installation directory. 6828219820Sjeff 6829219820SjeffRM is the name of the program to use to delete files associated with each FILE 6830219820Sjeff(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6831219820Sjeffto RM. 6832219820Sjeff 6833219820SjeffIf FILE is a libtool library, all the files associated with it are deleted. 6834219820SjeffOtherwise, only FILE itself is deleted using RM." 6835219820Sjeff ;; 6836219820Sjeff 6837219820Sjeff*) 6838219820Sjeff $echo "$modename: invalid operation mode \`$mode'" 1>&2 6839219820Sjeff $echo "$help" 1>&2 6840219820Sjeff exit $EXIT_FAILURE 6841219820Sjeff ;; 6842219820Sjeffesac 6843219820Sjeff 6844219820Sjeff$echo 6845219820Sjeff$echo "Try \`$modename --help' for more information about other modes." 6846219820Sjeff 6847219820Sjeffexit $? 6848219820Sjeff 6849219820Sjeff# The TAGs below are defined such that we never get into a situation 6850219820Sjeff# in which we disable both kinds of libraries. Given conflicting 6851219820Sjeff# choices, we go for a static library, that is the most portable, 6852219820Sjeff# since we can't tell whether shared libraries were disabled because 6853219820Sjeff# the user asked for that or because the platform doesn't support 6854219820Sjeff# them. This is particularly important on AIX, because we don't 6855219820Sjeff# support having both static and shared libraries enabled at the same 6856219820Sjeff# time on that platform, so we default to a shared-only configuration. 6857219820Sjeff# If a disable-shared tag is given, we'll fallback to a static-only 6858219820Sjeff# configuration. But we'll never go from static-only to shared-only. 6859219820Sjeff 6860219820Sjeff# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6861219820Sjeffdisable_libs=shared 6862219820Sjeff# ### END LIBTOOL TAG CONFIG: disable-shared 6863219820Sjeff 6864219820Sjeff# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6865219820Sjeffdisable_libs=static 6866219820Sjeff# ### END LIBTOOL TAG CONFIG: disable-static 6867219820Sjeff 6868219820Sjeff# Local Variables: 6869219820Sjeff# mode:shell-script 6870219820Sjeff# sh-indentation:2 6871219820Sjeff# End: 6872