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