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