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