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