ltmain.sh revision 174832
1117610Sdes# ltmain.sh - Provide generalized library-building support services. 2125647Sdes# NOTE: Changing this file will not affect anything until you rerun configure. 3117610Sdes# 4174832Sdes# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 5174832Sdes# 2007 Free Software Foundation, Inc. 6117610Sdes# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7117610Sdes# 8117610Sdes# This program is free software; you can redistribute it and/or modify 9117610Sdes# it under the terms of the GNU General Public License as published by 10117610Sdes# the Free Software Foundation; either version 2 of the License, or 11117610Sdes# (at your option) any later version. 12117610Sdes# 13117610Sdes# This program is distributed in the hope that it will be useful, but 14117610Sdes# WITHOUT ANY WARRANTY; without even the implied warranty of 15117610Sdes# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16117610Sdes# General Public License for more details. 17117610Sdes# 18117610Sdes# You should have received a copy of the GNU General Public License 19117610Sdes# along with this program; if not, write to the Free Software 20174832Sdes# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21117610Sdes# 22117610Sdes# As a special exception to the GNU General Public License, if you 23117610Sdes# distribute this file as part of a program that contains a 24117610Sdes# configuration script generated by Autoconf, you may include it under 25117610Sdes# the same distribution terms that you use for the rest of that program. 26117610Sdes 27141098Sdesbasename="s,^.*/,,g" 28141098Sdes 29141098Sdes# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 30141098Sdes# is ksh but when the shell is invoked as "sh" and the current value of 31141098Sdes# the _XPG environment variable is not equal to 1 (one), the special 32141098Sdes# positional parameter $0, within a function call, is the name of the 33141098Sdes# function. 34141098Sdesprogpath="$0" 35141098Sdes 36141098Sdes# The name of this program: 37141098Sdesprogname=`echo "$progpath" | $SED $basename` 38141098Sdesmodename="$progname" 39141098Sdes 40141098Sdes# Global variables: 41141098SdesEXIT_SUCCESS=0 42141098SdesEXIT_FAILURE=1 43141098Sdes 44141098SdesPROGRAM=ltmain.sh 45141098SdesPACKAGE=libtool 46174832SdesVERSION=1.5.24 47174832SdesTIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)" 48141098Sdes 49174832Sdes# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 50174832Sdesif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 51174832Sdes emulate sh 52174832Sdes NULLCMD=: 53174832Sdes # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 54174832Sdes # is contrary to our usage. Disable this feature. 55174832Sdes alias -g '${1+"$@"}'='"$@"' 56141098Sdes setopt NO_GLOB_SUBST 57174832Sdeselse 58174832Sdes case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 59141098Sdesfi 60174832SdesBIN_SH=xpg4; export BIN_SH # for Tru64 61174832SdesDUALCASE=1; export DUALCASE # for MKS sh 62141098Sdes 63117610Sdes# Check that we have a working $echo. 64117610Sdesif test "X$1" = X--no-reexec; then 65117610Sdes # Discard the --no-reexec flag, and continue. 66117610Sdes shift 67117610Sdeselif test "X$1" = X--fallback-echo; then 68117610Sdes # Avoid inline document here, it may be left over 69117610Sdes : 70117610Sdeselif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 71117610Sdes # Yippee, $echo works! 72117610Sdes : 73117610Sdeselse 74117610Sdes # Restart under the correct shell, and then maybe $echo will work. 75141098Sdes exec $SHELL "$progpath" --no-reexec ${1+"$@"} 76117610Sdesfi 77117610Sdes 78117610Sdesif test "X$1" = X--fallback-echo; then 79117610Sdes # used as fallback echo 80117610Sdes shift 81117610Sdes cat <<EOF 82117610Sdes$* 83117610SdesEOF 84141098Sdes exit $EXIT_SUCCESS 85117610Sdesfi 86117610Sdes 87117610Sdesdefault_mode= 88117610Sdeshelp="Try \`$progname --help' for more information." 89117610Sdesmagic="%%%MAGIC variable%%%" 90117610Sdesmkdir="mkdir" 91117610Sdesmv="mv -f" 92117610Sdesrm="rm -f" 93117610Sdes 94117610Sdes# Sed substitution that helps us do robust quoting. It backslashifies 95117610Sdes# metacharacters that are still active within double-quoted strings. 96125647SdesXsed="${SED}"' -e 1s/^X//' 97117610Sdessed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 98141098Sdes# test EBCDIC or ASCII 99174832Sdescase `echo X|tr X '\101'` in 100174832Sdes A) # ASCII based system 101174832Sdes # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 102174832Sdes SP2NL='tr \040 \012' 103174832Sdes NL2SP='tr \015\012 \040\040' 104141098Sdes ;; 105174832Sdes *) # EBCDIC based system 106174832Sdes SP2NL='tr \100 \n' 107174832Sdes NL2SP='tr \r\n \100\100' 108141098Sdes ;; 109141098Sdesesac 110117610Sdes 111117610Sdes# NLS nuisances. 112117610Sdes# Only set LANG and LC_ALL to C if already set. 113117610Sdes# These must not be set unconditionally because not all systems understand 114117610Sdes# e.g. LANG=C (notably SCO). 115117610Sdes# We save the old values to restore during execute mode. 116174832Sdesfor lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 117174832Sdesdo 118174832Sdes eval "if test \"\${$lt_var+set}\" = set; then 119174832Sdes save_$lt_var=\$$lt_var 120174832Sdes $lt_var=C 121174832Sdes export $lt_var 122174832Sdes fi" 123174832Sdesdone 124117610Sdes 125125647Sdes# Make sure IFS has a sensible default 126174832Sdeslt_nl=' 127174832Sdes' 128174832SdesIFS=" $lt_nl" 129117610Sdes 130117610Sdesif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 131141098Sdes $echo "$modename: not configured to build any kind of library" 1>&2 132141098Sdes $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 133141098Sdes exit $EXIT_FAILURE 134117610Sdesfi 135117610Sdes 136117610Sdes# Global variables. 137117610Sdesmode=$default_mode 138117610Sdesnonopt= 139117610Sdesprev= 140117610Sdesprevopt= 141117610Sdesrun= 142117610Sdesshow="$echo" 143117610Sdesshow_help= 144117610Sdesexecute_dlfiles= 145174832Sdesduplicate_deps=no 146174832Sdespreserve_args= 147117610Sdeslo2o="s/\\.lo\$/.${objext}/" 148117610Sdeso2lo="s/\\.${objext}\$/.lo/" 149174832Sdesextracted_archives= 150174832Sdesextracted_serial=0 151117610Sdes 152141098Sdes##################################### 153141098Sdes# Shell function definitions: 154141098Sdes# This seems to be the best place for them 155141098Sdes 156174832Sdes# func_mktempdir [string] 157174832Sdes# Make a temporary directory that won't clash with other running 158174832Sdes# libtool processes, and avoids race conditions if possible. If 159174832Sdes# given, STRING is the basename for that directory. 160174832Sdesfunc_mktempdir () 161174832Sdes{ 162174832Sdes my_template="${TMPDIR-/tmp}/${1-$progname}" 163174832Sdes 164174832Sdes if test "$run" = ":"; then 165174832Sdes # Return a directory name, but don't create it in dry-run mode 166174832Sdes my_tmpdir="${my_template}-$$" 167174832Sdes else 168174832Sdes 169174832Sdes # If mktemp works, use that first and foremost 170174832Sdes my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 171174832Sdes 172174832Sdes if test ! -d "$my_tmpdir"; then 173174832Sdes # Failing that, at least try and use $RANDOM to avoid a race 174174832Sdes my_tmpdir="${my_template}-${RANDOM-0}$$" 175174832Sdes 176174832Sdes save_mktempdir_umask=`umask` 177174832Sdes umask 0077 178174832Sdes $mkdir "$my_tmpdir" 179174832Sdes umask $save_mktempdir_umask 180174832Sdes fi 181174832Sdes 182174832Sdes # If we're not in dry-run mode, bomb out on failure 183174832Sdes test -d "$my_tmpdir" || { 184174832Sdes $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 185174832Sdes exit $EXIT_FAILURE 186174832Sdes } 187174832Sdes fi 188174832Sdes 189174832Sdes $echo "X$my_tmpdir" | $Xsed 190174832Sdes} 191174832Sdes 192174832Sdes 193141098Sdes# func_win32_libid arg 194141098Sdes# return the library type of file 'arg' 195141098Sdes# 196141098Sdes# Need a lot of goo to handle *both* DLLs and import libs 197141098Sdes# Has to be a shell function in order to 'eat' the argument 198141098Sdes# that is supplied when $file_magic_command is called. 199147455Sdesfunc_win32_libid () 200147455Sdes{ 201141098Sdes win32_libid_type="unknown" 202141098Sdes win32_fileres=`file -L $1 2>/dev/null` 203141098Sdes case $win32_fileres in 204141098Sdes *ar\ archive\ import\ library*) # definitely import 205141098Sdes win32_libid_type="x86 archive import" 206141098Sdes ;; 207141098Sdes *ar\ archive*) # could be an import, or static 208141098Sdes if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 209141098Sdes $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 210141098Sdes win32_nmres=`eval $NM -f posix -A $1 | \ 211174832Sdes $SED -n -e '1,100{ 212174832Sdes / I /{ 213174832Sdes s,.*,import, 214174832Sdes p 215174832Sdes q 216174832Sdes } 217174832Sdes }'` 218174832Sdes case $win32_nmres in 219174832Sdes import*) win32_libid_type="x86 archive import";; 220174832Sdes *) win32_libid_type="x86 archive static";; 221174832Sdes esac 222141098Sdes fi 223141098Sdes ;; 224141098Sdes *DLL*) 225141098Sdes win32_libid_type="x86 DLL" 226141098Sdes ;; 227141098Sdes *executable*) # but shell scripts are "executable" too... 228141098Sdes case $win32_fileres in 229141098Sdes *MS\ Windows\ PE\ Intel*) 230141098Sdes win32_libid_type="x86 DLL" 231141098Sdes ;; 232141098Sdes esac 233141098Sdes ;; 234141098Sdes esac 235141098Sdes $echo $win32_libid_type 236141098Sdes} 237141098Sdes 238141098Sdes 239141098Sdes# func_infer_tag arg 240141098Sdes# Infer tagged configuration to use if any are available and 241141098Sdes# if one wasn't chosen via the "--tag" command line option. 242141098Sdes# Only attempt this if the compiler in the base compile 243141098Sdes# command doesn't match the default compiler. 244141098Sdes# arg is usually of the form 'gcc ...' 245147455Sdesfunc_infer_tag () 246147455Sdes{ 247174832Sdes # FreeBSD-specific: where we install compilers with non-standard names 248174832Sdes tag_compilers_CC="*cc cc* *gcc gcc*" 249174832Sdes tag_compilers_CXX="*c++ c++* *g++ g++*" 250174832Sdes base_compiler=`set -- "$@"; echo $1` 251174832Sdes 252174832Sdes # If $tagname isn't set, then try to infer if the default "CC" tag applies 253174832Sdes if test -z "$tagname"; then 254174832Sdes for zp in $tag_compilers_CC; do 255174832Sdes case $base_compiler in 256174832Sdes $zp) tagname="CC"; break;; 257174832Sdes esac 258174832Sdes done 259174832Sdes fi 260174832Sdes 261141098Sdes if test -n "$available_tags" && test -z "$tagname"; then 262141098Sdes CC_quoted= 263141098Sdes for arg in $CC; do 264141098Sdes case $arg in 265174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 266141098Sdes arg="\"$arg\"" 267141098Sdes ;; 268141098Sdes esac 269141098Sdes CC_quoted="$CC_quoted $arg" 270141098Sdes done 271141098Sdes case $@ in 272141098Sdes # Blanks in the command may have been stripped by the calling shell, 273141098Sdes # but not from the CC environment variable when configure was run. 274141098Sdes " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 275141098Sdes # Blanks at the start of $base_compile will cause this to fail 276141098Sdes # if we don't check for them as well. 277141098Sdes *) 278141098Sdes for z in $available_tags; do 279141098Sdes if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 280141098Sdes # Evaluate the configuration. 281141098Sdes eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 282141098Sdes CC_quoted= 283141098Sdes for arg in $CC; do 284141098Sdes # Double-quote args containing other shell metacharacters. 285141098Sdes case $arg in 286174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 287141098Sdes arg="\"$arg\"" 288141098Sdes ;; 289141098Sdes esac 290141098Sdes CC_quoted="$CC_quoted $arg" 291141098Sdes done 292141098Sdes case "$@ " in 293141098Sdes " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 294141098Sdes # The compiler in the base compile command matches 295141098Sdes # the one in the tagged configuration. 296141098Sdes # Assume this is the tagged configuration we want. 297141098Sdes tagname=$z 298141098Sdes break 299141098Sdes ;; 300141098Sdes esac 301174832Sdes 302174832Sdes # FreeBSD-specific: try compilers based on inferred tag 303174832Sdes if test -z "$tagname"; then 304174832Sdes eval "tag_compilers=\$tag_compilers_${z}" 305174832Sdes if test -n "$tag_compilers"; then 306174832Sdes for zp in $tag_compilers; do 307174832Sdes case $base_compiler in 308174832Sdes $zp) tagname=$z; break;; 309174832Sdes esac 310174832Sdes done 311174832Sdes if test -n "$tagname"; then 312174832Sdes break 313174832Sdes fi 314174832Sdes fi 315174832Sdes fi 316174832Sdes fi 317141098Sdes done 318141098Sdes # If $tagname still isn't set, then no tagged configuration 319141098Sdes # was found and let the user know that the "--tag" command 320141098Sdes # line option must be used. 321141098Sdes if test -z "$tagname"; then 322141098Sdes $echo "$modename: unable to infer tagged configuration" 323141098Sdes $echo "$modename: specify a tag with \`--tag'" 1>&2 324141098Sdes exit $EXIT_FAILURE 325141098Sdes# else 326141098Sdes# $echo "$modename: using $tagname tagged configuration" 327141098Sdes fi 328141098Sdes ;; 329141098Sdes esac 330141098Sdes fi 331141098Sdes} 332141098Sdes 333141098Sdes 334147455Sdes# func_extract_an_archive dir oldlib 335147455Sdesfunc_extract_an_archive () 336147455Sdes{ 337147455Sdes f_ex_an_ar_dir="$1"; shift 338147455Sdes f_ex_an_ar_oldlib="$1" 339147455Sdes 340147455Sdes $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 341147455Sdes $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 342147455Sdes if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 343147455Sdes : 344147455Sdes else 345174832Sdes $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 346174832Sdes exit $EXIT_FAILURE 347147455Sdes fi 348147455Sdes} 349147455Sdes 350141098Sdes# func_extract_archives gentop oldlib ... 351147455Sdesfunc_extract_archives () 352147455Sdes{ 353141098Sdes my_gentop="$1"; shift 354141098Sdes my_oldlibs=${1+"$@"} 355141098Sdes my_oldobjs="" 356141098Sdes my_xlib="" 357141098Sdes my_xabs="" 358141098Sdes my_xdir="" 359141098Sdes my_status="" 360141098Sdes 361141098Sdes $show "${rm}r $my_gentop" 362141098Sdes $run ${rm}r "$my_gentop" 363141098Sdes $show "$mkdir $my_gentop" 364141098Sdes $run $mkdir "$my_gentop" 365141098Sdes my_status=$? 366141098Sdes if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 367141098Sdes exit $my_status 368141098Sdes fi 369141098Sdes 370141098Sdes for my_xlib in $my_oldlibs; do 371141098Sdes # Extract the objects. 372141098Sdes case $my_xlib in 373141098Sdes [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 374141098Sdes *) my_xabs=`pwd`"/$my_xlib" ;; 375141098Sdes esac 376141098Sdes my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 377174832Sdes my_xlib_u=$my_xlib 378174832Sdes while :; do 379174832Sdes case " $extracted_archives " in 380174832Sdes *" $my_xlib_u "*) 381174832Sdes extracted_serial=`expr $extracted_serial + 1` 382174832Sdes my_xlib_u=lt$extracted_serial-$my_xlib ;; 383174832Sdes *) break ;; 384174832Sdes esac 385174832Sdes done 386174832Sdes extracted_archives="$extracted_archives $my_xlib_u" 387174832Sdes my_xdir="$my_gentop/$my_xlib_u" 388141098Sdes 389141098Sdes $show "${rm}r $my_xdir" 390141098Sdes $run ${rm}r "$my_xdir" 391141098Sdes $show "$mkdir $my_xdir" 392141098Sdes $run $mkdir "$my_xdir" 393174832Sdes exit_status=$? 394174832Sdes if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 395174832Sdes exit $exit_status 396141098Sdes fi 397141098Sdes case $host in 398141098Sdes *-darwin*) 399141098Sdes $show "Extracting $my_xabs" 400141098Sdes # Do not bother doing anything if just a dry run 401141098Sdes if test -z "$run"; then 402141098Sdes darwin_orig_dir=`pwd` 403141098Sdes cd $my_xdir || exit $? 404141098Sdes darwin_archive=$my_xabs 405141098Sdes darwin_curdir=`pwd` 406147455Sdes darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 407141098Sdes darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 408141098Sdes if test -n "$darwin_arches"; then 409141098Sdes darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 410141098Sdes darwin_arch= 411141098Sdes $show "$darwin_base_archive has multiple architectures $darwin_arches" 412141098Sdes for darwin_arch in $darwin_arches ; do 413141098Sdes mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 414141098Sdes lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 415141098Sdes cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 416147455Sdes func_extract_an_archive "`pwd`" "${darwin_base_archive}" 417141098Sdes cd "$darwin_curdir" 418147455Sdes $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 419141098Sdes done # $darwin_arches 420141098Sdes ## Okay now we have a bunch of thin objects, gotta fatten them up :) 421147455Sdes darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 422141098Sdes darwin_file= 423141098Sdes darwin_files= 424141098Sdes for darwin_file in $darwin_filelist; do 425141098Sdes darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 426141098Sdes lipo -create -output "$darwin_file" $darwin_files 427141098Sdes done # $darwin_filelist 428147455Sdes ${rm}r unfat-$$ 429141098Sdes cd "$darwin_orig_dir" 430141098Sdes else 431147455Sdes cd "$darwin_orig_dir" 432147455Sdes func_extract_an_archive "$my_xdir" "$my_xabs" 433141098Sdes fi # $darwin_arches 434141098Sdes fi # $run 435174832Sdes ;; 436141098Sdes *) 437147455Sdes func_extract_an_archive "$my_xdir" "$my_xabs" 438147455Sdes ;; 439141098Sdes esac 440141098Sdes my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 441141098Sdes done 442141098Sdes func_extract_archives_result="$my_oldobjs" 443141098Sdes} 444141098Sdes# End of Shell function definitions 445141098Sdes##################################### 446141098Sdes 447141098Sdes# Darwin sucks 448141098Sdeseval std_shrext=\"$shrext_cmds\" 449141098Sdes 450174832Sdesdisable_libs=no 451174832Sdes 452117610Sdes# Parse our command line options once, thoroughly. 453141098Sdeswhile test "$#" -gt 0 454117610Sdesdo 455117610Sdes arg="$1" 456117610Sdes shift 457117610Sdes 458125647Sdes case $arg in 459117610Sdes -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 460117610Sdes *) optarg= ;; 461117610Sdes esac 462117610Sdes 463117610Sdes # If the previous option needs an argument, assign it. 464117610Sdes if test -n "$prev"; then 465125647Sdes case $prev in 466117610Sdes execute_dlfiles) 467125647Sdes execute_dlfiles="$execute_dlfiles $arg" 468117610Sdes ;; 469141098Sdes tag) 470141098Sdes tagname="$arg" 471141098Sdes preserve_args="${preserve_args}=$arg" 472141098Sdes 473141098Sdes # Check whether tagname contains only valid characters 474141098Sdes case $tagname in 475141098Sdes *[!-_A-Za-z0-9,/]*) 476141098Sdes $echo "$progname: invalid tag name: $tagname" 1>&2 477141098Sdes exit $EXIT_FAILURE 478141098Sdes ;; 479141098Sdes esac 480141098Sdes 481141098Sdes case $tagname in 482141098Sdes CC) 483141098Sdes # Don't test for the "default" C tag, as we know, it's there, but 484141098Sdes # not specially marked. 485141098Sdes ;; 486141098Sdes *) 487141098Sdes if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 488141098Sdes taglist="$taglist $tagname" 489141098Sdes # Evaluate the configuration. 490141098Sdes eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 491141098Sdes else 492141098Sdes $echo "$progname: ignoring unknown tag $tagname" 1>&2 493141098Sdes fi 494141098Sdes ;; 495141098Sdes esac 496141098Sdes ;; 497117610Sdes *) 498117610Sdes eval "$prev=\$arg" 499117610Sdes ;; 500117610Sdes esac 501117610Sdes 502117610Sdes prev= 503117610Sdes prevopt= 504117610Sdes continue 505117610Sdes fi 506117610Sdes 507117610Sdes # Have we seen a non-optional argument yet? 508125647Sdes case $arg in 509117610Sdes --help) 510117610Sdes show_help=yes 511117610Sdes ;; 512117610Sdes 513117610Sdes --version) 514174832Sdes echo "\ 515174832Sdes$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 516174832Sdes 517174832SdesCopyright (C) 2007 Free Software Foundation, Inc. 518174832SdesThis is free software; see the source for copying conditions. There is NO 519174832Sdeswarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 520147455Sdes exit $? 521117610Sdes ;; 522117610Sdes 523117610Sdes --config) 524141098Sdes ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 525141098Sdes # Now print the configurations for the tags. 526141098Sdes for tagname in $taglist; do 527141098Sdes ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 528141098Sdes done 529147455Sdes exit $? 530117610Sdes ;; 531117610Sdes 532117610Sdes --debug) 533141098Sdes $echo "$progname: enabling shell trace mode" 534117610Sdes set -x 535141098Sdes preserve_args="$preserve_args $arg" 536117610Sdes ;; 537117610Sdes 538117610Sdes --dry-run | -n) 539117610Sdes run=: 540117610Sdes ;; 541117610Sdes 542117610Sdes --features) 543141098Sdes $echo "host: $host" 544117610Sdes if test "$build_libtool_libs" = yes; then 545141098Sdes $echo "enable shared libraries" 546117610Sdes else 547141098Sdes $echo "disable shared libraries" 548117610Sdes fi 549117610Sdes if test "$build_old_libs" = yes; then 550141098Sdes $echo "enable static libraries" 551117610Sdes else 552141098Sdes $echo "disable static libraries" 553117610Sdes fi 554147455Sdes exit $? 555117610Sdes ;; 556117610Sdes 557117610Sdes --finish) mode="finish" ;; 558117610Sdes 559117610Sdes --mode) prevopt="--mode" prev=mode ;; 560117610Sdes --mode=*) mode="$optarg" ;; 561117610Sdes 562125647Sdes --preserve-dup-deps) duplicate_deps="yes" ;; 563125647Sdes 564117610Sdes --quiet | --silent) 565117610Sdes show=: 566141098Sdes preserve_args="$preserve_args $arg" 567117610Sdes ;; 568117610Sdes 569174832Sdes --tag) 570174832Sdes prevopt="--tag" 571174832Sdes prev=tag 572174832Sdes preserve_args="$preserve_args --tag" 573174832Sdes ;; 574141098Sdes --tag=*) 575141098Sdes set tag "$optarg" ${1+"$@"} 576141098Sdes shift 577141098Sdes prev=tag 578141098Sdes preserve_args="$preserve_args --tag" 579141098Sdes ;; 580141098Sdes 581117610Sdes -dlopen) 582117610Sdes prevopt="-dlopen" 583117610Sdes prev=execute_dlfiles 584117610Sdes ;; 585117610Sdes 586117610Sdes -*) 587117610Sdes $echo "$modename: unrecognized option \`$arg'" 1>&2 588117610Sdes $echo "$help" 1>&2 589141098Sdes exit $EXIT_FAILURE 590117610Sdes ;; 591117610Sdes 592117610Sdes *) 593117610Sdes nonopt="$arg" 594117610Sdes break 595117610Sdes ;; 596117610Sdes esac 597117610Sdesdone 598117610Sdes 599117610Sdesif test -n "$prevopt"; then 600117610Sdes $echo "$modename: option \`$prevopt' requires an argument" 1>&2 601117610Sdes $echo "$help" 1>&2 602141098Sdes exit $EXIT_FAILURE 603117610Sdesfi 604117610Sdes 605174832Sdescase $disable_libs in 606174832Sdesno) 607174832Sdes ;; 608174832Sdesshared) 609174832Sdes build_libtool_libs=no 610174832Sdes build_old_libs=yes 611174832Sdes ;; 612174832Sdesstatic) 613174832Sdes build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 614174832Sdes ;; 615174832Sdesesac 616174832Sdes 617125647Sdes# If this variable is set in any of the actions, the command in it 618125647Sdes# will be execed at the end. This prevents here-documents from being 619125647Sdes# left over by shells. 620125647Sdesexec_cmd= 621125647Sdes 622117610Sdesif test -z "$show_help"; then 623117610Sdes 624117610Sdes # Infer the operation mode. 625117610Sdes if test -z "$mode"; then 626141098Sdes $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 627147455Sdes $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 628125647Sdes case $nonopt in 629141098Sdes *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 630117610Sdes mode=link 631117610Sdes for arg 632117610Sdes do 633125647Sdes case $arg in 634117610Sdes -c) 635117610Sdes mode=compile 636117610Sdes break 637117610Sdes ;; 638117610Sdes esac 639117610Sdes done 640117610Sdes ;; 641117610Sdes *db | *dbx | *strace | *truss) 642117610Sdes mode=execute 643117610Sdes ;; 644117610Sdes *install*|cp|mv) 645117610Sdes mode=install 646117610Sdes ;; 647117610Sdes *rm) 648117610Sdes mode=uninstall 649117610Sdes ;; 650117610Sdes *) 651117610Sdes # If we have no mode, but dlfiles were specified, then do execute mode. 652117610Sdes test -n "$execute_dlfiles" && mode=execute 653117610Sdes 654117610Sdes # Just use the default operation mode. 655117610Sdes if test -z "$mode"; then 656117610Sdes if test -n "$nonopt"; then 657117610Sdes $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 658117610Sdes else 659117610Sdes $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 660117610Sdes fi 661117610Sdes fi 662117610Sdes ;; 663117610Sdes esac 664117610Sdes fi 665117610Sdes 666117610Sdes # Only execute mode is allowed to have -dlopen flags. 667117610Sdes if test -n "$execute_dlfiles" && test "$mode" != execute; then 668117610Sdes $echo "$modename: unrecognized option \`-dlopen'" 1>&2 669117610Sdes $echo "$help" 1>&2 670141098Sdes exit $EXIT_FAILURE 671117610Sdes fi 672117610Sdes 673117610Sdes # Change the help message to a mode-specific one. 674117610Sdes generic_help="$help" 675117610Sdes help="Try \`$modename --help --mode=$mode' for more information." 676117610Sdes 677117610Sdes # These modes are in order of execution frequency so that they run quickly. 678125647Sdes case $mode in 679117610Sdes # libtool compile mode 680117610Sdes compile) 681117610Sdes modename="$modename: compile" 682117610Sdes # Get the compilation command and the source file. 683117610Sdes base_compile= 684141098Sdes srcfile="$nonopt" # always keep a non-empty value in "srcfile" 685141098Sdes suppress_opt=yes 686117610Sdes suppress_output= 687141098Sdes arg_mode=normal 688141098Sdes libobj= 689141098Sdes later= 690117610Sdes 691117610Sdes for arg 692117610Sdes do 693174832Sdes case $arg_mode in 694141098Sdes arg ) 695141098Sdes # do not "continue". Instead, add this to base_compile 696141098Sdes lastarg="$arg" 697141098Sdes arg_mode=normal 698141098Sdes ;; 699125647Sdes 700141098Sdes target ) 701141098Sdes libobj="$arg" 702141098Sdes arg_mode=normal 703125647Sdes continue 704125647Sdes ;; 705125647Sdes 706141098Sdes normal ) 707141098Sdes # Accept any command-line options. 708141098Sdes case $arg in 709141098Sdes -o) 710141098Sdes if test -n "$libobj" ; then 711141098Sdes $echo "$modename: you cannot specify \`-o' more than once" 1>&2 712141098Sdes exit $EXIT_FAILURE 713141098Sdes fi 714141098Sdes arg_mode=target 715141098Sdes continue 716141098Sdes ;; 717117610Sdes 718141098Sdes -static | -prefer-pic | -prefer-non-pic) 719141098Sdes later="$later $arg" 720141098Sdes continue 721141098Sdes ;; 722125647Sdes 723141098Sdes -no-suppress) 724141098Sdes suppress_opt=no 725141098Sdes continue 726141098Sdes ;; 727125647Sdes 728141098Sdes -Xcompiler) 729141098Sdes arg_mode=arg # the next one goes into the "base_compile" arg list 730141098Sdes continue # The current "srcfile" will either be retained or 731141098Sdes ;; # replaced later. I would guess that would be a bug. 732125647Sdes 733141098Sdes -Wc,*) 734141098Sdes args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 735141098Sdes lastarg= 736141098Sdes save_ifs="$IFS"; IFS=',' 737141098Sdes for arg in $args; do 738141098Sdes IFS="$save_ifs" 739125647Sdes 740141098Sdes # Double-quote args containing other shell metacharacters. 741141098Sdes # Many Bourne shells cannot handle close brackets correctly 742141098Sdes # in scan sets, so we specify it separately. 743141098Sdes case $arg in 744174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 745141098Sdes arg="\"$arg\"" 746141098Sdes ;; 747141098Sdes esac 748141098Sdes lastarg="$lastarg $arg" 749141098Sdes done 750125647Sdes IFS="$save_ifs" 751141098Sdes lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 752125647Sdes 753141098Sdes # Add the arguments to base_compile. 754125647Sdes base_compile="$base_compile $lastarg" 755141098Sdes continue 756141098Sdes ;; 757117610Sdes 758141098Sdes * ) 759141098Sdes # Accept the current argument as the source file. 760141098Sdes # The previous "srcfile" becomes the current argument. 761141098Sdes # 762141098Sdes lastarg="$srcfile" 763141098Sdes srcfile="$arg" 764141098Sdes ;; 765141098Sdes esac # case $arg 766117610Sdes ;; 767141098Sdes esac # case $arg_mode 768117610Sdes 769117610Sdes # Aesthetically quote the previous argument. 770117610Sdes lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 771117610Sdes 772141098Sdes case $lastarg in 773117610Sdes # Double-quote args containing other shell metacharacters. 774125647Sdes # Many Bourne shells cannot handle close brackets correctly 775147455Sdes # in scan sets, and some SunOS ksh mistreat backslash-escaping 776147455Sdes # in scan sets (worked around with variable expansion), 777147455Sdes # and furthermore cannot handle '|' '&' '(' ')' in scan sets 778147455Sdes # at all, so we specify them separately. 779174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 780117610Sdes lastarg="\"$lastarg\"" 781117610Sdes ;; 782117610Sdes esac 783117610Sdes 784141098Sdes base_compile="$base_compile $lastarg" 785141098Sdes done # for arg 786117610Sdes 787141098Sdes case $arg_mode in 788141098Sdes arg) 789141098Sdes $echo "$modename: you must specify an argument for -Xcompile" 790141098Sdes exit $EXIT_FAILURE 791117610Sdes ;; 792141098Sdes target) 793141098Sdes $echo "$modename: you must specify a target with \`-o'" 1>&2 794141098Sdes exit $EXIT_FAILURE 795117610Sdes ;; 796117610Sdes *) 797141098Sdes # Get the name of the library object. 798141098Sdes [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 799117610Sdes ;; 800117610Sdes esac 801117610Sdes 802117610Sdes # Recognize several different file suffixes. 803117610Sdes # If the user specifies -o file.o, it is replaced with file.lo 804141098Sdes xform='[cCFSifmso]' 805125647Sdes case $libobj in 806117610Sdes *.ada) xform=ada ;; 807117610Sdes *.adb) xform=adb ;; 808117610Sdes *.ads) xform=ads ;; 809117610Sdes *.asm) xform=asm ;; 810117610Sdes *.c++) xform=c++ ;; 811117610Sdes *.cc) xform=cc ;; 812141098Sdes *.ii) xform=ii ;; 813141098Sdes *.class) xform=class ;; 814117610Sdes *.cpp) xform=cpp ;; 815117610Sdes *.cxx) xform=cxx ;; 816174832Sdes *.[fF][09]?) xform=[fF][09]. ;; 817117610Sdes *.for) xform=for ;; 818141098Sdes *.java) xform=java ;; 819174832Sdes *.obj) xform=obj ;; 820117610Sdes esac 821117610Sdes 822117610Sdes libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 823117610Sdes 824125647Sdes case $libobj in 825117610Sdes *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 826117610Sdes *) 827117610Sdes $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 828141098Sdes exit $EXIT_FAILURE 829117610Sdes ;; 830117610Sdes esac 831117610Sdes 832141098Sdes func_infer_tag $base_compile 833141098Sdes 834141098Sdes for arg in $later; do 835141098Sdes case $arg in 836141098Sdes -static) 837141098Sdes build_old_libs=yes 838141098Sdes continue 839141098Sdes ;; 840141098Sdes 841141098Sdes -prefer-pic) 842141098Sdes pic_mode=yes 843141098Sdes continue 844141098Sdes ;; 845141098Sdes 846141098Sdes -prefer-non-pic) 847141098Sdes pic_mode=no 848141098Sdes continue 849141098Sdes ;; 850141098Sdes esac 851141098Sdes done 852141098Sdes 853174832Sdes qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 854174832Sdes case $qlibobj in 855174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 856174832Sdes qlibobj="\"$qlibobj\"" ;; 857174832Sdes esac 858174832Sdes test "X$libobj" != "X$qlibobj" \ 859174832Sdes && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 860174832Sdes && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 861141098Sdes objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 862141098Sdes xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 863141098Sdes if test "X$xdir" = "X$obj"; then 864141098Sdes xdir= 865141098Sdes else 866141098Sdes xdir=$xdir/ 867141098Sdes fi 868141098Sdes lobj=${xdir}$objdir/$objname 869141098Sdes 870117610Sdes if test -z "$base_compile"; then 871117610Sdes $echo "$modename: you must specify a compilation command" 1>&2 872117610Sdes $echo "$help" 1>&2 873141098Sdes exit $EXIT_FAILURE 874117610Sdes fi 875117610Sdes 876117610Sdes # Delete any leftover library objects. 877117610Sdes if test "$build_old_libs" = yes; then 878141098Sdes removelist="$obj $lobj $libobj ${libobj}T" 879117610Sdes else 880141098Sdes removelist="$lobj $libobj ${libobj}T" 881117610Sdes fi 882117610Sdes 883117610Sdes $run $rm $removelist 884141098Sdes trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 885117610Sdes 886125647Sdes # On Cygwin there's no "real" PIC flag so we must build both object types 887125647Sdes case $host_os in 888125647Sdes cygwin* | mingw* | pw32* | os2*) 889125647Sdes pic_mode=default 890125647Sdes ;; 891125647Sdes esac 892125647Sdes if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 893125647Sdes # non-PIC code in shared libraries is not supported 894125647Sdes pic_mode=default 895125647Sdes fi 896125647Sdes 897117610Sdes # Calculate the filename of the output object if compiler does 898117610Sdes # not support -o with -c 899117610Sdes if test "$compiler_c_o" = no; then 900125647Sdes output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 901117610Sdes lockfile="$output_obj.lock" 902117610Sdes removelist="$removelist $output_obj $lockfile" 903141098Sdes trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 904117610Sdes else 905141098Sdes output_obj= 906117610Sdes need_locks=no 907117610Sdes lockfile= 908117610Sdes fi 909117610Sdes 910117610Sdes # Lock this critical section if it is needed 911117610Sdes # We use this script file to make the link, it avoids creating a new file 912117610Sdes if test "$need_locks" = yes; then 913141098Sdes until $run ln "$progpath" "$lockfile" 2>/dev/null; do 914117610Sdes $show "Waiting for $lockfile to be removed" 915117610Sdes sleep 2 916117610Sdes done 917117610Sdes elif test "$need_locks" = warn; then 918117610Sdes if test -f "$lockfile"; then 919141098Sdes $echo "\ 920117610Sdes*** ERROR, $lockfile exists and contains: 921117610Sdes`cat $lockfile 2>/dev/null` 922117610Sdes 923117610SdesThis indicates that another process is trying to use the same 924117610Sdestemporary object file, and libtool could not work around it because 925117610Sdesyour compiler does not support \`-c' and \`-o' together. If you 926117610Sdesrepeat this compilation, it may succeed, by chance, but you had better 927117610Sdesavoid parallel builds (make -j) in this platform, or get a better 928117610Sdescompiler." 929117610Sdes 930117610Sdes $run $rm $removelist 931141098Sdes exit $EXIT_FAILURE 932117610Sdes fi 933174832Sdes $echo "$srcfile" > "$lockfile" 934117610Sdes fi 935117610Sdes 936117610Sdes if test -n "$fix_srcfile_path"; then 937117610Sdes eval srcfile=\"$fix_srcfile_path\" 938117610Sdes fi 939174832Sdes qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 940174832Sdes case $qsrcfile in 941174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 942174832Sdes qsrcfile="\"$qsrcfile\"" ;; 943174832Sdes esac 944117610Sdes 945141098Sdes $run $rm "$libobj" "${libobj}T" 946141098Sdes 947141098Sdes # Create a libtool object file (analogous to a ".la" file), 948141098Sdes # but don't create it if we're doing a dry run. 949141098Sdes test -z "$run" && cat > ${libobj}T <<EOF 950141098Sdes# $libobj - a libtool object file 951141098Sdes# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 952141098Sdes# 953141098Sdes# Please DO NOT delete this file! 954141098Sdes# It is necessary for linking the library. 955141098Sdes 956141098Sdes# Name of the PIC object. 957141098SdesEOF 958141098Sdes 959117610Sdes # Only build a PIC object if we are building libtool libraries. 960117610Sdes if test "$build_libtool_libs" = yes; then 961117610Sdes # Without this assignment, base_compile gets emptied. 962117610Sdes fbsd_hideous_sh_bug=$base_compile 963117610Sdes 964125647Sdes if test "$pic_mode" != no; then 965174832Sdes command="$base_compile $qsrcfile $pic_flag" 966125647Sdes else 967125647Sdes # Don't build PIC code 968174832Sdes command="$base_compile $qsrcfile" 969125647Sdes fi 970117610Sdes 971141098Sdes if test ! -d "${xdir}$objdir"; then 972141098Sdes $show "$mkdir ${xdir}$objdir" 973141098Sdes $run $mkdir ${xdir}$objdir 974174832Sdes exit_status=$? 975174832Sdes if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 976174832Sdes exit $exit_status 977117610Sdes fi 978117610Sdes fi 979141098Sdes 980141098Sdes if test -z "$output_obj"; then 981141098Sdes # Place PIC objects in $objdir 982141098Sdes command="$command -o $lobj" 983117610Sdes fi 984117610Sdes 985141098Sdes $run $rm "$lobj" "$output_obj" 986141098Sdes 987117610Sdes $show "$command" 988117610Sdes if $run eval "$command"; then : 989117610Sdes else 990117610Sdes test -n "$output_obj" && $run $rm $removelist 991141098Sdes exit $EXIT_FAILURE 992117610Sdes fi 993117610Sdes 994117610Sdes if test "$need_locks" = warn && 995141098Sdes test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 996141098Sdes $echo "\ 997117610Sdes*** ERROR, $lockfile contains: 998117610Sdes`cat $lockfile 2>/dev/null` 999117610Sdes 1000117610Sdesbut it should contain: 1001117610Sdes$srcfile 1002117610Sdes 1003117610SdesThis indicates that another process is trying to use the same 1004117610Sdestemporary object file, and libtool could not work around it because 1005117610Sdesyour compiler does not support \`-c' and \`-o' together. If you 1006117610Sdesrepeat this compilation, it may succeed, by chance, but you had better 1007117610Sdesavoid parallel builds (make -j) in this platform, or get a better 1008117610Sdescompiler." 1009117610Sdes 1010117610Sdes $run $rm $removelist 1011141098Sdes exit $EXIT_FAILURE 1012117610Sdes fi 1013117610Sdes 1014117610Sdes # Just move the object if needed, then go on to compile the next one 1015141098Sdes if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 1016141098Sdes $show "$mv $output_obj $lobj" 1017141098Sdes if $run $mv $output_obj $lobj; then : 1018117610Sdes else 1019117610Sdes error=$? 1020117610Sdes $run $rm $removelist 1021117610Sdes exit $error 1022117610Sdes fi 1023117610Sdes fi 1024117610Sdes 1025141098Sdes # Append the name of the PIC object to the libtool object file. 1026141098Sdes test -z "$run" && cat >> ${libobj}T <<EOF 1027141098Sdespic_object='$objdir/$objname' 1028117610Sdes 1029141098SdesEOF 1030117610Sdes 1031141098Sdes # Allow error messages only from the first compilation. 1032141098Sdes if test "$suppress_opt" = yes; then 1033141098Sdes suppress_output=' >/dev/null 2>&1' 1034117610Sdes fi 1035141098Sdes else 1036141098Sdes # No PIC object so indicate it doesn't exist in the libtool 1037141098Sdes # object file. 1038141098Sdes test -z "$run" && cat >> ${libobj}T <<EOF 1039141098Sdespic_object=none 1040117610Sdes 1041141098SdesEOF 1042117610Sdes fi 1043117610Sdes 1044117610Sdes # Only build a position-dependent object if we build old libraries. 1045117610Sdes if test "$build_old_libs" = yes; then 1046125647Sdes if test "$pic_mode" != yes; then 1047125647Sdes # Don't build PIC code 1048174832Sdes command="$base_compile $qsrcfile" 1049125647Sdes else 1050174832Sdes command="$base_compile $qsrcfile $pic_flag" 1051125647Sdes fi 1052117610Sdes if test "$compiler_c_o" = yes; then 1053117610Sdes command="$command -o $obj" 1054117610Sdes fi 1055117610Sdes 1056117610Sdes # Suppress compiler output if we already did a PIC compilation. 1057117610Sdes command="$command$suppress_output" 1058141098Sdes $run $rm "$obj" "$output_obj" 1059117610Sdes $show "$command" 1060117610Sdes if $run eval "$command"; then : 1061117610Sdes else 1062117610Sdes $run $rm $removelist 1063141098Sdes exit $EXIT_FAILURE 1064117610Sdes fi 1065117610Sdes 1066117610Sdes if test "$need_locks" = warn && 1067141098Sdes test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1068141098Sdes $echo "\ 1069117610Sdes*** ERROR, $lockfile contains: 1070117610Sdes`cat $lockfile 2>/dev/null` 1071117610Sdes 1072117610Sdesbut it should contain: 1073117610Sdes$srcfile 1074117610Sdes 1075117610SdesThis indicates that another process is trying to use the same 1076117610Sdestemporary object file, and libtool could not work around it because 1077117610Sdesyour compiler does not support \`-c' and \`-o' together. If you 1078117610Sdesrepeat this compilation, it may succeed, by chance, but you had better 1079117610Sdesavoid parallel builds (make -j) in this platform, or get a better 1080117610Sdescompiler." 1081117610Sdes 1082117610Sdes $run $rm $removelist 1083141098Sdes exit $EXIT_FAILURE 1084117610Sdes fi 1085117610Sdes 1086117610Sdes # Just move the object if needed 1087141098Sdes if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1088117610Sdes $show "$mv $output_obj $obj" 1089117610Sdes if $run $mv $output_obj $obj; then : 1090117610Sdes else 1091117610Sdes error=$? 1092117610Sdes $run $rm $removelist 1093117610Sdes exit $error 1094117610Sdes fi 1095117610Sdes fi 1096117610Sdes 1097141098Sdes # Append the name of the non-PIC object the libtool object file. 1098141098Sdes # Only append if the libtool object file exists. 1099141098Sdes test -z "$run" && cat >> ${libobj}T <<EOF 1100141098Sdes# Name of the non-PIC object. 1101141098Sdesnon_pic_object='$objname' 1102141098Sdes 1103141098SdesEOF 1104141098Sdes else 1105141098Sdes # Append the name of the non-PIC object the libtool object file. 1106141098Sdes # Only append if the libtool object file exists. 1107141098Sdes test -z "$run" && cat >> ${libobj}T <<EOF 1108141098Sdes# Name of the non-PIC object. 1109141098Sdesnon_pic_object=none 1110141098Sdes 1111141098SdesEOF 1112117610Sdes fi 1113117610Sdes 1114141098Sdes $run $mv "${libobj}T" "${libobj}" 1115141098Sdes 1116117610Sdes # Unlock the critical section if it was locked 1117117610Sdes if test "$need_locks" != no; then 1118125647Sdes $run $rm "$lockfile" 1119117610Sdes fi 1120117610Sdes 1121141098Sdes exit $EXIT_SUCCESS 1122117610Sdes ;; 1123117610Sdes 1124117610Sdes # libtool link mode 1125125647Sdes link | relink) 1126117610Sdes modename="$modename: link" 1127125647Sdes case $host in 1128125647Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1129117610Sdes # It is impossible to link a dll without this setting, and 1130117610Sdes # we shouldn't force the makefile maintainer to figure out 1131117610Sdes # which system we are compiling for in order to pass an extra 1132141098Sdes # flag for every libtool invocation. 1133117610Sdes # allow_undefined=no 1134117610Sdes 1135117610Sdes # FIXME: Unfortunately, there are problems with the above when trying 1136117610Sdes # to make a dll which has undefined symbols, in which case not 1137117610Sdes # even a static library is built. For now, we need to specify 1138117610Sdes # -no-undefined on the libtool link line when we can be certain 1139117610Sdes # that all symbols are satisfied, otherwise we get a static library. 1140117610Sdes allow_undefined=yes 1141117610Sdes ;; 1142117610Sdes *) 1143117610Sdes allow_undefined=yes 1144117610Sdes ;; 1145117610Sdes esac 1146125647Sdes libtool_args="$nonopt" 1147141098Sdes base_compile="$nonopt $@" 1148117610Sdes compile_command="$nonopt" 1149117610Sdes finalize_command="$nonopt" 1150117610Sdes 1151117610Sdes compile_rpath= 1152117610Sdes finalize_rpath= 1153117610Sdes compile_shlibpath= 1154117610Sdes finalize_shlibpath= 1155117610Sdes convenience= 1156117610Sdes old_convenience= 1157117610Sdes deplibs= 1158125647Sdes old_deplibs= 1159125647Sdes compiler_flags= 1160125647Sdes linker_flags= 1161125647Sdes dllsearchpath= 1162125647Sdes lib_search_path=`pwd` 1163141098Sdes inst_prefix_dir= 1164117610Sdes 1165117610Sdes avoid_version=no 1166117610Sdes dlfiles= 1167117610Sdes dlprefiles= 1168117610Sdes dlself=no 1169117610Sdes export_dynamic=no 1170117610Sdes export_symbols= 1171117610Sdes export_symbols_regex= 1172117610Sdes generated= 1173117610Sdes libobjs= 1174117610Sdes ltlibs= 1175117610Sdes module=no 1176125647Sdes no_install=no 1177117610Sdes objs= 1178141098Sdes non_pic_objects= 1179174832Sdes notinst_path= # paths that contain not-installed libtool libraries 1180141098Sdes precious_files_regex= 1181117610Sdes prefer_static_libs=no 1182117610Sdes preload=no 1183117610Sdes prev= 1184117610Sdes prevarg= 1185117610Sdes release= 1186117610Sdes rpath= 1187117610Sdes xrpath= 1188117610Sdes perm_rpath= 1189117610Sdes temp_rpath= 1190117610Sdes thread_safe=no 1191117610Sdes vinfo= 1192141098Sdes vinfo_number=no 1193117610Sdes 1194141098Sdes func_infer_tag $base_compile 1195141098Sdes 1196117610Sdes # We need to know -static, to get the right output filenames. 1197117610Sdes for arg 1198117610Sdes do 1199125647Sdes case $arg in 1200174832Sdes -all-static | -static | -static-libtool-libs) 1201174832Sdes case $arg in 1202174832Sdes -all-static) 1203117610Sdes if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 1204117610Sdes $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1205117610Sdes fi 1206117610Sdes if test -n "$link_static_flag"; then 1207117610Sdes dlopen_self=$dlopen_self_static 1208117610Sdes fi 1209174832Sdes prefer_static_libs=yes 1210174832Sdes ;; 1211174832Sdes -static) 1212117610Sdes if test -z "$pic_flag" && test -n "$link_static_flag"; then 1213117610Sdes dlopen_self=$dlopen_self_static 1214117610Sdes fi 1215174832Sdes prefer_static_libs=built 1216174832Sdes ;; 1217174832Sdes -static-libtool-libs) 1218174832Sdes if test -z "$pic_flag" && test -n "$link_static_flag"; then 1219174832Sdes dlopen_self=$dlopen_self_static 1220174832Sdes fi 1221174832Sdes prefer_static_libs=yes 1222174832Sdes ;; 1223174832Sdes esac 1224117610Sdes build_libtool_libs=no 1225117610Sdes build_old_libs=yes 1226117610Sdes break 1227117610Sdes ;; 1228117610Sdes esac 1229117610Sdes done 1230117610Sdes 1231117610Sdes # See if our shared archives depend on static archives. 1232117610Sdes test -n "$old_archive_from_new_cmds" && build_old_libs=yes 1233117610Sdes 1234117610Sdes # Go through the arguments, transforming them on the way. 1235141098Sdes while test "$#" -gt 0; do 1236117610Sdes arg="$1" 1237117610Sdes shift 1238125647Sdes case $arg in 1239174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1240125647Sdes qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 1241125647Sdes ;; 1242125647Sdes *) qarg=$arg ;; 1243125647Sdes esac 1244125647Sdes libtool_args="$libtool_args $qarg" 1245117610Sdes 1246117610Sdes # If the previous option needs an argument, assign it. 1247117610Sdes if test -n "$prev"; then 1248125647Sdes case $prev in 1249117610Sdes output) 1250117610Sdes compile_command="$compile_command @OUTPUT@" 1251117610Sdes finalize_command="$finalize_command @OUTPUT@" 1252117610Sdes ;; 1253117610Sdes esac 1254117610Sdes 1255125647Sdes case $prev in 1256117610Sdes dlfiles|dlprefiles) 1257117610Sdes if test "$preload" = no; then 1258117610Sdes # Add the symbol object into the linking commands. 1259117610Sdes compile_command="$compile_command @SYMFILE@" 1260117610Sdes finalize_command="$finalize_command @SYMFILE@" 1261117610Sdes preload=yes 1262117610Sdes fi 1263125647Sdes case $arg in 1264117610Sdes *.la | *.lo) ;; # We handle these cases below. 1265117610Sdes force) 1266117610Sdes if test "$dlself" = no; then 1267117610Sdes dlself=needless 1268117610Sdes export_dynamic=yes 1269117610Sdes fi 1270117610Sdes prev= 1271117610Sdes continue 1272117610Sdes ;; 1273117610Sdes self) 1274117610Sdes if test "$prev" = dlprefiles; then 1275117610Sdes dlself=yes 1276117610Sdes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 1277117610Sdes dlself=yes 1278117610Sdes else 1279117610Sdes dlself=needless 1280117610Sdes export_dynamic=yes 1281117610Sdes fi 1282117610Sdes prev= 1283117610Sdes continue 1284117610Sdes ;; 1285117610Sdes *) 1286117610Sdes if test "$prev" = dlfiles; then 1287117610Sdes dlfiles="$dlfiles $arg" 1288117610Sdes else 1289117610Sdes dlprefiles="$dlprefiles $arg" 1290117610Sdes fi 1291117610Sdes prev= 1292125647Sdes continue 1293117610Sdes ;; 1294117610Sdes esac 1295117610Sdes ;; 1296117610Sdes expsyms) 1297117610Sdes export_symbols="$arg" 1298117610Sdes if test ! -f "$arg"; then 1299117610Sdes $echo "$modename: symbol file \`$arg' does not exist" 1300141098Sdes exit $EXIT_FAILURE 1301117610Sdes fi 1302117610Sdes prev= 1303117610Sdes continue 1304117610Sdes ;; 1305117610Sdes expsyms_regex) 1306117610Sdes export_symbols_regex="$arg" 1307117610Sdes prev= 1308117610Sdes continue 1309117610Sdes ;; 1310141098Sdes inst_prefix) 1311141098Sdes inst_prefix_dir="$arg" 1312141098Sdes prev= 1313141098Sdes continue 1314141098Sdes ;; 1315141098Sdes precious_regex) 1316141098Sdes precious_files_regex="$arg" 1317141098Sdes prev= 1318141098Sdes continue 1319141098Sdes ;; 1320117610Sdes release) 1321117610Sdes release="-$arg" 1322117610Sdes prev= 1323117610Sdes continue 1324117610Sdes ;; 1325141098Sdes objectlist) 1326141098Sdes if test -f "$arg"; then 1327141098Sdes save_arg=$arg 1328141098Sdes moreargs= 1329141098Sdes for fil in `cat $save_arg` 1330141098Sdes do 1331141098Sdes# moreargs="$moreargs $fil" 1332141098Sdes arg=$fil 1333141098Sdes # A libtool-controlled object. 1334141098Sdes 1335141098Sdes # Check to see that this really is a libtool object. 1336141098Sdes if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1337141098Sdes pic_object= 1338141098Sdes non_pic_object= 1339141098Sdes 1340141098Sdes # Read the .lo file 1341141098Sdes # If there is no directory component, then add one. 1342141098Sdes case $arg in 1343141098Sdes */* | *\\*) . $arg ;; 1344141098Sdes *) . ./$arg ;; 1345141098Sdes esac 1346141098Sdes 1347141098Sdes if test -z "$pic_object" || \ 1348141098Sdes test -z "$non_pic_object" || 1349141098Sdes test "$pic_object" = none && \ 1350141098Sdes test "$non_pic_object" = none; then 1351141098Sdes $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1352141098Sdes exit $EXIT_FAILURE 1353141098Sdes fi 1354141098Sdes 1355141098Sdes # Extract subdirectory from the argument. 1356141098Sdes xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1357141098Sdes if test "X$xdir" = "X$arg"; then 1358141098Sdes xdir= 1359141098Sdes else 1360141098Sdes xdir="$xdir/" 1361141098Sdes fi 1362141098Sdes 1363141098Sdes if test "$pic_object" != none; then 1364141098Sdes # Prepend the subdirectory the object is found in. 1365141098Sdes pic_object="$xdir$pic_object" 1366141098Sdes 1367141098Sdes if test "$prev" = dlfiles; then 1368141098Sdes if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1369141098Sdes dlfiles="$dlfiles $pic_object" 1370141098Sdes prev= 1371141098Sdes continue 1372141098Sdes else 1373141098Sdes # If libtool objects are unsupported, then we need to preload. 1374141098Sdes prev=dlprefiles 1375141098Sdes fi 1376141098Sdes fi 1377141098Sdes 1378141098Sdes # CHECK ME: I think I busted this. -Ossama 1379141098Sdes if test "$prev" = dlprefiles; then 1380141098Sdes # Preload the old-style object. 1381141098Sdes dlprefiles="$dlprefiles $pic_object" 1382141098Sdes prev= 1383141098Sdes fi 1384141098Sdes 1385141098Sdes # A PIC object. 1386141098Sdes libobjs="$libobjs $pic_object" 1387141098Sdes arg="$pic_object" 1388141098Sdes fi 1389141098Sdes 1390141098Sdes # Non-PIC object. 1391141098Sdes if test "$non_pic_object" != none; then 1392141098Sdes # Prepend the subdirectory the object is found in. 1393141098Sdes non_pic_object="$xdir$non_pic_object" 1394141098Sdes 1395141098Sdes # A standard non-PIC object 1396141098Sdes non_pic_objects="$non_pic_objects $non_pic_object" 1397141098Sdes if test -z "$pic_object" || test "$pic_object" = none ; then 1398141098Sdes arg="$non_pic_object" 1399141098Sdes fi 1400174832Sdes else 1401174832Sdes # If the PIC object exists, use it instead. 1402174832Sdes # $xdir was prepended to $pic_object above. 1403174832Sdes non_pic_object="$pic_object" 1404174832Sdes non_pic_objects="$non_pic_objects $non_pic_object" 1405141098Sdes fi 1406141098Sdes else 1407141098Sdes # Only an error if not doing a dry-run. 1408141098Sdes if test -z "$run"; then 1409141098Sdes $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1410141098Sdes exit $EXIT_FAILURE 1411141098Sdes else 1412141098Sdes # Dry-run case. 1413141098Sdes 1414141098Sdes # Extract subdirectory from the argument. 1415141098Sdes xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1416141098Sdes if test "X$xdir" = "X$arg"; then 1417141098Sdes xdir= 1418141098Sdes else 1419141098Sdes xdir="$xdir/" 1420141098Sdes fi 1421141098Sdes 1422141098Sdes pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1423141098Sdes non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1424141098Sdes libobjs="$libobjs $pic_object" 1425141098Sdes non_pic_objects="$non_pic_objects $non_pic_object" 1426141098Sdes fi 1427141098Sdes fi 1428141098Sdes done 1429141098Sdes else 1430141098Sdes $echo "$modename: link input file \`$save_arg' does not exist" 1431141098Sdes exit $EXIT_FAILURE 1432141098Sdes fi 1433141098Sdes arg=$save_arg 1434141098Sdes prev= 1435141098Sdes continue 1436141098Sdes ;; 1437117610Sdes rpath | xrpath) 1438117610Sdes # We need an absolute path. 1439125647Sdes case $arg in 1440117610Sdes [\\/]* | [A-Za-z]:[\\/]*) ;; 1441117610Sdes *) 1442117610Sdes $echo "$modename: only absolute run-paths are allowed" 1>&2 1443141098Sdes exit $EXIT_FAILURE 1444117610Sdes ;; 1445117610Sdes esac 1446117610Sdes if test "$prev" = rpath; then 1447117610Sdes case "$rpath " in 1448117610Sdes *" $arg "*) ;; 1449117610Sdes *) rpath="$rpath $arg" ;; 1450117610Sdes esac 1451117610Sdes else 1452117610Sdes case "$xrpath " in 1453117610Sdes *" $arg "*) ;; 1454117610Sdes *) xrpath="$xrpath $arg" ;; 1455117610Sdes esac 1456117610Sdes fi 1457117610Sdes prev= 1458117610Sdes continue 1459117610Sdes ;; 1460125647Sdes xcompiler) 1461125647Sdes compiler_flags="$compiler_flags $qarg" 1462125647Sdes prev= 1463125647Sdes compile_command="$compile_command $qarg" 1464125647Sdes finalize_command="$finalize_command $qarg" 1465125647Sdes continue 1466125647Sdes ;; 1467125647Sdes xlinker) 1468125647Sdes linker_flags="$linker_flags $qarg" 1469125647Sdes compiler_flags="$compiler_flags $wl$qarg" 1470125647Sdes prev= 1471125647Sdes compile_command="$compile_command $wl$qarg" 1472125647Sdes finalize_command="$finalize_command $wl$qarg" 1473125647Sdes continue 1474125647Sdes ;; 1475141098Sdes xcclinker) 1476141098Sdes linker_flags="$linker_flags $qarg" 1477141098Sdes compiler_flags="$compiler_flags $qarg" 1478141098Sdes prev= 1479141098Sdes compile_command="$compile_command $qarg" 1480141098Sdes finalize_command="$finalize_command $qarg" 1481141098Sdes continue 1482141098Sdes ;; 1483141098Sdes shrext) 1484141098Sdes shrext_cmds="$arg" 1485141098Sdes prev= 1486141098Sdes continue 1487141098Sdes ;; 1488174832Sdes darwin_framework|darwin_framework_skip) 1489174832Sdes test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 1490174832Sdes compile_command="$compile_command $arg" 1491174832Sdes finalize_command="$finalize_command $arg" 1492147455Sdes prev= 1493147455Sdes continue 1494147455Sdes ;; 1495117610Sdes *) 1496117610Sdes eval "$prev=\"\$arg\"" 1497117610Sdes prev= 1498117610Sdes continue 1499117610Sdes ;; 1500117610Sdes esac 1501141098Sdes fi # test -n "$prev" 1502117610Sdes 1503117610Sdes prevarg="$arg" 1504117610Sdes 1505125647Sdes case $arg in 1506117610Sdes -all-static) 1507117610Sdes if test -n "$link_static_flag"; then 1508117610Sdes compile_command="$compile_command $link_static_flag" 1509117610Sdes finalize_command="$finalize_command $link_static_flag" 1510117610Sdes fi 1511117610Sdes continue 1512117610Sdes ;; 1513117610Sdes 1514117610Sdes -allow-undefined) 1515117610Sdes # FIXME: remove this flag sometime in the future. 1516117610Sdes $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1517117610Sdes continue 1518117610Sdes ;; 1519117610Sdes 1520117610Sdes -avoid-version) 1521117610Sdes avoid_version=yes 1522117610Sdes continue 1523117610Sdes ;; 1524117610Sdes 1525117610Sdes -dlopen) 1526117610Sdes prev=dlfiles 1527117610Sdes continue 1528117610Sdes ;; 1529117610Sdes 1530117610Sdes -dlpreopen) 1531117610Sdes prev=dlprefiles 1532117610Sdes continue 1533117610Sdes ;; 1534117610Sdes 1535117610Sdes -export-dynamic) 1536117610Sdes export_dynamic=yes 1537117610Sdes continue 1538117610Sdes ;; 1539117610Sdes 1540117610Sdes -export-symbols | -export-symbols-regex) 1541117610Sdes if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1542125647Sdes $echo "$modename: more than one -exported-symbols argument is not allowed" 1543141098Sdes exit $EXIT_FAILURE 1544117610Sdes fi 1545117610Sdes if test "X$arg" = "X-export-symbols"; then 1546117610Sdes prev=expsyms 1547117610Sdes else 1548117610Sdes prev=expsyms_regex 1549117610Sdes fi 1550117610Sdes continue 1551117610Sdes ;; 1552117610Sdes 1553174832Sdes -framework|-arch|-isysroot) 1554174832Sdes case " $CC " in 1555174832Sdes *" ${arg} ${1} "* | *" ${arg} ${1} "*) 1556174832Sdes prev=darwin_framework_skip ;; 1557174832Sdes *) compiler_flags="$compiler_flags $arg" 1558174832Sdes prev=darwin_framework ;; 1559174832Sdes esac 1560174832Sdes compile_command="$compile_command $arg" 1561174832Sdes finalize_command="$finalize_command $arg" 1562174832Sdes continue 1563174832Sdes ;; 1564147455Sdes 1565141098Sdes -inst-prefix-dir) 1566141098Sdes prev=inst_prefix 1567141098Sdes continue 1568141098Sdes ;; 1569141098Sdes 1570125647Sdes # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1571125647Sdes # so, if we see these flags be careful not to treat them like -L 1572125647Sdes -L[A-Z][A-Z]*:*) 1573125647Sdes case $with_gcc/$host in 1574141098Sdes no/*-*-irix* | /*-*-irix*) 1575125647Sdes compile_command="$compile_command $arg" 1576125647Sdes finalize_command="$finalize_command $arg" 1577125647Sdes ;; 1578125647Sdes esac 1579125647Sdes continue 1580125647Sdes ;; 1581125647Sdes 1582117610Sdes -L*) 1583117610Sdes dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1584117610Sdes # We need an absolute path. 1585125647Sdes case $dir in 1586117610Sdes [\\/]* | [A-Za-z]:[\\/]*) ;; 1587117610Sdes *) 1588117610Sdes absdir=`cd "$dir" && pwd` 1589117610Sdes if test -z "$absdir"; then 1590125647Sdes $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1591174832Sdes absdir="$dir" 1592174832Sdes notinst_path="$notinst_path $dir" 1593117610Sdes fi 1594117610Sdes dir="$absdir" 1595117610Sdes ;; 1596117610Sdes esac 1597125647Sdes case "$deplibs " in 1598125647Sdes *" -L$dir "*) ;; 1599125647Sdes *) 1600125647Sdes deplibs="$deplibs -L$dir" 1601125647Sdes lib_search_path="$lib_search_path $dir" 1602125647Sdes ;; 1603117610Sdes esac 1604125647Sdes case $host in 1605125647Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1606174832Sdes testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 1607125647Sdes case :$dllsearchpath: in 1608125647Sdes *":$dir:"*) ;; 1609125647Sdes *) dllsearchpath="$dllsearchpath:$dir";; 1610117610Sdes esac 1611174832Sdes case :$dllsearchpath: in 1612174832Sdes *":$testbindir:"*) ;; 1613174832Sdes *) dllsearchpath="$dllsearchpath:$testbindir";; 1614174832Sdes esac 1615117610Sdes ;; 1616117610Sdes esac 1617125647Sdes continue 1618117610Sdes ;; 1619117610Sdes 1620117610Sdes -l*) 1621125647Sdes if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1622125647Sdes case $host in 1623174832Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 1624125647Sdes # These systems don't actually have a C or math library (as such) 1625117610Sdes continue 1626117610Sdes ;; 1627174832Sdes *-*-os2*) 1628125647Sdes # These systems don't actually have a C library (as such) 1629125647Sdes test "X$arg" = "X-lc" && continue 1630125647Sdes ;; 1631147455Sdes *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1632125647Sdes # Do not include libc due to us having libc/libc_r. 1633125647Sdes test "X$arg" = "X-lc" && continue 1634125647Sdes ;; 1635141098Sdes *-*-rhapsody* | *-*-darwin1.[012]) 1636141098Sdes # Rhapsody C and math libraries are in the System framework 1637141098Sdes deplibs="$deplibs -framework System" 1638117610Sdes continue 1639174832Sdes ;; 1640174832Sdes *-*-sco3.2v5* | *-*-sco5v6*) 1641174832Sdes # Causes problems with __ctype 1642174832Sdes test "X$arg" = "X-lc" && continue 1643174832Sdes ;; 1644174832Sdes *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 1645174832Sdes # Compiler inserts libc in the correct place for threads to work 1646174832Sdes test "X$arg" = "X-lc" && continue 1647174832Sdes ;; 1648117610Sdes esac 1649141098Sdes elif test "X$arg" = "X-lc_r"; then 1650141098Sdes case $host in 1651147455Sdes *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1652141098Sdes # Do not include libc_r directly, use -pthread flag. 1653141098Sdes continue 1654141098Sdes ;; 1655141098Sdes esac 1656117610Sdes fi 1657117610Sdes deplibs="$deplibs $arg" 1658125647Sdes continue 1659117610Sdes ;; 1660117610Sdes 1661147455Sdes # Tru64 UNIX uses -model [arg] to determine the layout of C++ 1662147455Sdes # classes, name mangling, and exception handling. 1663147455Sdes -model) 1664147455Sdes compile_command="$compile_command $arg" 1665147455Sdes compiler_flags="$compiler_flags $arg" 1666147455Sdes finalize_command="$finalize_command $arg" 1667147455Sdes prev=xcompiler 1668147455Sdes continue 1669147455Sdes ;; 1670147455Sdes 1671174832Sdes -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 1672147455Sdes compiler_flags="$compiler_flags $arg" 1673147455Sdes compile_command="$compile_command $arg" 1674147455Sdes finalize_command="$finalize_command $arg" 1675174832Sdes deplibs="$deplibs $arg" 1676141098Sdes continue 1677141098Sdes ;; 1678141098Sdes 1679117610Sdes -module) 1680117610Sdes module=yes 1681141098Sdes continue 1682141098Sdes ;; 1683141098Sdes 1684147455Sdes # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 1685147455Sdes # -r[0-9][0-9]* specifies the processor on the SGI compiler 1686147455Sdes # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 1687147455Sdes # +DA*, +DD* enable 64-bit mode on the HP compiler 1688147455Sdes # -q* pass through compiler args for the IBM compiler 1689147455Sdes # -m* pass through architecture-specific compiler args for GCC 1690174832Sdes # -m*, -t[45]*, -txscale* pass through architecture-specific 1691174832Sdes # compiler args for GCC 1692174832Sdes # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 1693174832Sdes # -F/path gives path to uninstalled frameworks, gcc on darwin 1694174832Sdes # @file GCC response files 1695174832Sdes -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 1696174832Sdes -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 1697147455Sdes 1698141098Sdes # Unknown arguments in both finalize_command and compile_command need 1699141098Sdes # to be aesthetically quoted because they are evaled later. 1700141098Sdes arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1701141098Sdes case $arg in 1702174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1703141098Sdes arg="\"$arg\"" 1704125647Sdes ;; 1705125647Sdes esac 1706141098Sdes compile_command="$compile_command $arg" 1707141098Sdes finalize_command="$finalize_command $arg" 1708174832Sdes compiler_flags="$compiler_flags $arg" 1709141098Sdes continue 1710141098Sdes ;; 1711141098Sdes 1712141098Sdes -shrext) 1713141098Sdes prev=shrext 1714117610Sdes continue 1715117610Sdes ;; 1716117610Sdes 1717125647Sdes -no-fast-install) 1718125647Sdes fast_install=no 1719125647Sdes continue 1720125647Sdes ;; 1721125647Sdes 1722125647Sdes -no-install) 1723125647Sdes case $host in 1724174832Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 1725125647Sdes # The PATH hackery in wrapper scripts is required on Windows 1726174832Sdes # and Darwin in order for the loader to find any dlls it needs. 1727125647Sdes $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1728125647Sdes $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1729125647Sdes fast_install=no 1730125647Sdes ;; 1731125647Sdes *) no_install=yes ;; 1732125647Sdes esac 1733125647Sdes continue 1734125647Sdes ;; 1735125647Sdes 1736117610Sdes -no-undefined) 1737117610Sdes allow_undefined=no 1738117610Sdes continue 1739117610Sdes ;; 1740117610Sdes 1741141098Sdes -objectlist) 1742141098Sdes prev=objectlist 1743141098Sdes continue 1744141098Sdes ;; 1745141098Sdes 1746117610Sdes -o) prev=output ;; 1747117610Sdes 1748141098Sdes -precious-files-regex) 1749141098Sdes prev=precious_regex 1750141098Sdes continue 1751141098Sdes ;; 1752141098Sdes 1753117610Sdes -release) 1754117610Sdes prev=release 1755117610Sdes continue 1756117610Sdes ;; 1757117610Sdes 1758117610Sdes -rpath) 1759117610Sdes prev=rpath 1760117610Sdes continue 1761117610Sdes ;; 1762117610Sdes 1763117610Sdes -R) 1764117610Sdes prev=xrpath 1765117610Sdes continue 1766117610Sdes ;; 1767117610Sdes 1768117610Sdes -R*) 1769117610Sdes dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1770117610Sdes # We need an absolute path. 1771125647Sdes case $dir in 1772117610Sdes [\\/]* | [A-Za-z]:[\\/]*) ;; 1773117610Sdes *) 1774117610Sdes $echo "$modename: only absolute run-paths are allowed" 1>&2 1775141098Sdes exit $EXIT_FAILURE 1776117610Sdes ;; 1777117610Sdes esac 1778117610Sdes case "$xrpath " in 1779117610Sdes *" $dir "*) ;; 1780117610Sdes *) xrpath="$xrpath $dir" ;; 1781117610Sdes esac 1782117610Sdes continue 1783117610Sdes ;; 1784117610Sdes 1785174832Sdes -static | -static-libtool-libs) 1786125647Sdes # The effects of -static are defined in a previous loop. 1787125647Sdes # We used to do the same as -all-static on platforms that 1788125647Sdes # didn't have a PIC flag, but the assumption that the effects 1789125647Sdes # would be equivalent was wrong. It would break on at least 1790125647Sdes # Digital Unix and AIX. 1791117610Sdes continue 1792117610Sdes ;; 1793117610Sdes 1794117610Sdes -thread-safe) 1795117610Sdes thread_safe=yes 1796117610Sdes continue 1797117610Sdes ;; 1798117610Sdes 1799117610Sdes -version-info) 1800117610Sdes prev=vinfo 1801117610Sdes continue 1802117610Sdes ;; 1803141098Sdes -version-number) 1804141098Sdes prev=vinfo 1805141098Sdes vinfo_number=yes 1806141098Sdes continue 1807141098Sdes ;; 1808117610Sdes 1809125647Sdes -Wc,*) 1810125647Sdes args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1811125647Sdes arg= 1812125647Sdes save_ifs="$IFS"; IFS=',' 1813125647Sdes for flag in $args; do 1814125647Sdes IFS="$save_ifs" 1815125647Sdes case $flag in 1816174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1817125647Sdes flag="\"$flag\"" 1818125647Sdes ;; 1819125647Sdes esac 1820125647Sdes arg="$arg $wl$flag" 1821125647Sdes compiler_flags="$compiler_flags $flag" 1822125647Sdes done 1823125647Sdes IFS="$save_ifs" 1824125647Sdes arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1825125647Sdes ;; 1826125647Sdes 1827125647Sdes -Wl,*) 1828125647Sdes args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1829125647Sdes arg= 1830125647Sdes save_ifs="$IFS"; IFS=',' 1831125647Sdes for flag in $args; do 1832125647Sdes IFS="$save_ifs" 1833125647Sdes case $flag in 1834174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1835125647Sdes flag="\"$flag\"" 1836125647Sdes ;; 1837125647Sdes esac 1838125647Sdes arg="$arg $wl$flag" 1839125647Sdes compiler_flags="$compiler_flags $wl$flag" 1840125647Sdes linker_flags="$linker_flags $flag" 1841125647Sdes done 1842125647Sdes IFS="$save_ifs" 1843125647Sdes arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1844125647Sdes ;; 1845125647Sdes 1846125647Sdes -Xcompiler) 1847125647Sdes prev=xcompiler 1848125647Sdes continue 1849125647Sdes ;; 1850125647Sdes 1851125647Sdes -Xlinker) 1852125647Sdes prev=xlinker 1853125647Sdes continue 1854125647Sdes ;; 1855125647Sdes 1856141098Sdes -XCClinker) 1857141098Sdes prev=xcclinker 1858141098Sdes continue 1859141098Sdes ;; 1860141098Sdes 1861117610Sdes # Some other compiler flag. 1862117610Sdes -* | +*) 1863117610Sdes # Unknown arguments in both finalize_command and compile_command need 1864117610Sdes # to be aesthetically quoted because they are evaled later. 1865117610Sdes arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1866125647Sdes case $arg in 1867174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1868117610Sdes arg="\"$arg\"" 1869117610Sdes ;; 1870117610Sdes esac 1871117610Sdes ;; 1872117610Sdes 1873141098Sdes *.$objext) 1874141098Sdes # A standard object. 1875141098Sdes objs="$objs $arg" 1876141098Sdes ;; 1877141098Sdes 1878141098Sdes *.lo) 1879141098Sdes # A libtool-controlled object. 1880141098Sdes 1881141098Sdes # Check to see that this really is a libtool object. 1882141098Sdes if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1883141098Sdes pic_object= 1884141098Sdes non_pic_object= 1885141098Sdes 1886141098Sdes # Read the .lo file 1887141098Sdes # If there is no directory component, then add one. 1888141098Sdes case $arg in 1889141098Sdes */* | *\\*) . $arg ;; 1890141098Sdes *) . ./$arg ;; 1891141098Sdes esac 1892141098Sdes 1893141098Sdes if test -z "$pic_object" || \ 1894141098Sdes test -z "$non_pic_object" || 1895141098Sdes test "$pic_object" = none && \ 1896141098Sdes test "$non_pic_object" = none; then 1897141098Sdes $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1898141098Sdes exit $EXIT_FAILURE 1899117610Sdes fi 1900117610Sdes 1901141098Sdes # Extract subdirectory from the argument. 1902141098Sdes xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1903141098Sdes if test "X$xdir" = "X$arg"; then 1904141098Sdes xdir= 1905141098Sdes else 1906141098Sdes xdir="$xdir/" 1907141098Sdes fi 1908141098Sdes 1909141098Sdes if test "$pic_object" != none; then 1910141098Sdes # Prepend the subdirectory the object is found in. 1911141098Sdes pic_object="$xdir$pic_object" 1912141098Sdes 1913141098Sdes if test "$prev" = dlfiles; then 1914141098Sdes if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1915141098Sdes dlfiles="$dlfiles $pic_object" 1916141098Sdes prev= 1917141098Sdes continue 1918141098Sdes else 1919141098Sdes # If libtool objects are unsupported, then we need to preload. 1920141098Sdes prev=dlprefiles 1921141098Sdes fi 1922141098Sdes fi 1923141098Sdes 1924141098Sdes # CHECK ME: I think I busted this. -Ossama 1925141098Sdes if test "$prev" = dlprefiles; then 1926141098Sdes # Preload the old-style object. 1927141098Sdes dlprefiles="$dlprefiles $pic_object" 1928141098Sdes prev= 1929141098Sdes fi 1930141098Sdes 1931141098Sdes # A PIC object. 1932141098Sdes libobjs="$libobjs $pic_object" 1933141098Sdes arg="$pic_object" 1934141098Sdes fi 1935141098Sdes 1936141098Sdes # Non-PIC object. 1937141098Sdes if test "$non_pic_object" != none; then 1938141098Sdes # Prepend the subdirectory the object is found in. 1939141098Sdes non_pic_object="$xdir$non_pic_object" 1940141098Sdes 1941141098Sdes # A standard non-PIC object 1942141098Sdes non_pic_objects="$non_pic_objects $non_pic_object" 1943141098Sdes if test -z "$pic_object" || test "$pic_object" = none ; then 1944141098Sdes arg="$non_pic_object" 1945141098Sdes fi 1946174832Sdes else 1947174832Sdes # If the PIC object exists, use it instead. 1948174832Sdes # $xdir was prepended to $pic_object above. 1949174832Sdes non_pic_object="$pic_object" 1950174832Sdes non_pic_objects="$non_pic_objects $non_pic_object" 1951141098Sdes fi 1952125647Sdes else 1953141098Sdes # Only an error if not doing a dry-run. 1954141098Sdes if test -z "$run"; then 1955141098Sdes $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1956141098Sdes exit $EXIT_FAILURE 1957141098Sdes else 1958141098Sdes # Dry-run case. 1959141098Sdes 1960141098Sdes # Extract subdirectory from the argument. 1961141098Sdes xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1962141098Sdes if test "X$xdir" = "X$arg"; then 1963141098Sdes xdir= 1964141098Sdes else 1965141098Sdes xdir="$xdir/" 1966141098Sdes fi 1967141098Sdes 1968141098Sdes pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1969141098Sdes non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1970141098Sdes libobjs="$libobjs $pic_object" 1971141098Sdes non_pic_objects="$non_pic_objects $non_pic_object" 1972141098Sdes fi 1973117610Sdes fi 1974117610Sdes ;; 1975117610Sdes 1976125647Sdes *.$libext) 1977125647Sdes # An archive. 1978125647Sdes deplibs="$deplibs $arg" 1979125647Sdes old_deplibs="$old_deplibs $arg" 1980125647Sdes continue 1981125647Sdes ;; 1982125647Sdes 1983117610Sdes *.la) 1984117610Sdes # A libtool-controlled library. 1985117610Sdes 1986125647Sdes if test "$prev" = dlfiles; then 1987125647Sdes # This library was specified with -dlopen. 1988125647Sdes dlfiles="$dlfiles $arg" 1989125647Sdes prev= 1990125647Sdes elif test "$prev" = dlprefiles; then 1991125647Sdes # The library was specified with -dlpreopen. 1992125647Sdes dlprefiles="$dlprefiles $arg" 1993125647Sdes prev= 1994125647Sdes else 1995125647Sdes deplibs="$deplibs $arg" 1996125647Sdes fi 1997125647Sdes continue 1998125647Sdes ;; 1999117610Sdes 2000125647Sdes # Some other compiler argument. 2001125647Sdes *) 2002125647Sdes # Unknown arguments in both finalize_command and compile_command need 2003125647Sdes # to be aesthetically quoted because they are evaled later. 2004125647Sdes arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 2005125647Sdes case $arg in 2006174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2007125647Sdes arg="\"$arg\"" 2008125647Sdes ;; 2009125647Sdes esac 2010125647Sdes ;; 2011125647Sdes esac # arg 2012125647Sdes 2013125647Sdes # Now actually substitute the argument into the commands. 2014125647Sdes if test -n "$arg"; then 2015125647Sdes compile_command="$compile_command $arg" 2016125647Sdes finalize_command="$finalize_command $arg" 2017125647Sdes fi 2018125647Sdes done # argument parsing loop 2019125647Sdes 2020125647Sdes if test -n "$prev"; then 2021125647Sdes $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 2022125647Sdes $echo "$help" 1>&2 2023141098Sdes exit $EXIT_FAILURE 2024125647Sdes fi 2025125647Sdes 2026125647Sdes if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 2027125647Sdes eval arg=\"$export_dynamic_flag_spec\" 2028125647Sdes compile_command="$compile_command $arg" 2029125647Sdes finalize_command="$finalize_command $arg" 2030125647Sdes fi 2031125647Sdes 2032141098Sdes oldlibs= 2033125647Sdes # calculate the name of the file, without its directory 2034125647Sdes outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 2035125647Sdes libobjs_save="$libobjs" 2036125647Sdes 2037125647Sdes if test -n "$shlibpath_var"; then 2038125647Sdes # get the directories listed in $shlibpath_var 2039125647Sdes eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 2040125647Sdes else 2041125647Sdes shlib_search_path= 2042125647Sdes fi 2043125647Sdes eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 2044125647Sdes eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 2045125647Sdes 2046125647Sdes output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 2047125647Sdes if test "X$output_objdir" = "X$output"; then 2048125647Sdes output_objdir="$objdir" 2049125647Sdes else 2050125647Sdes output_objdir="$output_objdir/$objdir" 2051125647Sdes fi 2052125647Sdes # Create the object directory. 2053141098Sdes if test ! -d "$output_objdir"; then 2054125647Sdes $show "$mkdir $output_objdir" 2055125647Sdes $run $mkdir $output_objdir 2056174832Sdes exit_status=$? 2057174832Sdes if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 2058174832Sdes exit $exit_status 2059125647Sdes fi 2060125647Sdes fi 2061125647Sdes 2062125647Sdes # Determine the type of output 2063125647Sdes case $output in 2064125647Sdes "") 2065125647Sdes $echo "$modename: you must specify an output file" 1>&2 2066125647Sdes $echo "$help" 1>&2 2067141098Sdes exit $EXIT_FAILURE 2068125647Sdes ;; 2069125647Sdes *.$libext) linkmode=oldlib ;; 2070125647Sdes *.lo | *.$objext) linkmode=obj ;; 2071125647Sdes *.la) linkmode=lib ;; 2072125647Sdes *) linkmode=prog ;; # Anything else should be a program. 2073125647Sdes esac 2074125647Sdes 2075141098Sdes case $host in 2076141098Sdes *cygwin* | *mingw* | *pw32*) 2077141098Sdes # don't eliminate duplications in $postdeps and $predeps 2078141098Sdes duplicate_compiler_generated_deps=yes 2079141098Sdes ;; 2080141098Sdes *) 2081141098Sdes duplicate_compiler_generated_deps=$duplicate_deps 2082141098Sdes ;; 2083141098Sdes esac 2084125647Sdes specialdeplibs= 2085141098Sdes 2086125647Sdes libs= 2087125647Sdes # Find all interdependent deplibs by searching for libraries 2088125647Sdes # that are linked more than once (e.g. -la -lb -la) 2089125647Sdes for deplib in $deplibs; do 2090125647Sdes if test "X$duplicate_deps" = "Xyes" ; then 2091125647Sdes case "$libs " in 2092125647Sdes *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2093125647Sdes esac 2094125647Sdes fi 2095125647Sdes libs="$libs $deplib" 2096125647Sdes done 2097141098Sdes 2098141098Sdes if test "$linkmode" = lib; then 2099141098Sdes libs="$predeps $libs $compiler_lib_search_path $postdeps" 2100141098Sdes 2101141098Sdes # Compute libraries that are listed more than once in $predeps 2102141098Sdes # $postdeps and mark them as special (i.e., whose duplicates are 2103141098Sdes # not to be eliminated). 2104141098Sdes pre_post_deps= 2105141098Sdes if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 2106141098Sdes for pre_post_dep in $predeps $postdeps; do 2107141098Sdes case "$pre_post_deps " in 2108141098Sdes *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 2109141098Sdes esac 2110141098Sdes pre_post_deps="$pre_post_deps $pre_post_dep" 2111141098Sdes done 2112141098Sdes fi 2113141098Sdes pre_post_deps= 2114141098Sdes fi 2115141098Sdes 2116125647Sdes deplibs= 2117125647Sdes newdependency_libs= 2118125647Sdes newlib_search_path= 2119125647Sdes need_relink=no # whether we're linking any uninstalled libtool libraries 2120125647Sdes notinst_deplibs= # not-installed libtool libraries 2121125647Sdes case $linkmode in 2122125647Sdes lib) 2123125647Sdes passes="conv link" 2124125647Sdes for file in $dlfiles $dlprefiles; do 2125125647Sdes case $file in 2126125647Sdes *.la) ;; 2127125647Sdes *) 2128125647Sdes $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 2129141098Sdes exit $EXIT_FAILURE 2130125647Sdes ;; 2131125647Sdes esac 2132125647Sdes done 2133125647Sdes ;; 2134125647Sdes prog) 2135125647Sdes compile_deplibs= 2136125647Sdes finalize_deplibs= 2137125647Sdes alldeplibs=no 2138125647Sdes newdlfiles= 2139125647Sdes newdlprefiles= 2140125647Sdes passes="conv scan dlopen dlpreopen link" 2141125647Sdes ;; 2142125647Sdes *) passes="conv" 2143125647Sdes ;; 2144125647Sdes esac 2145125647Sdes for pass in $passes; do 2146141098Sdes if test "$linkmode,$pass" = "lib,link" || 2147141098Sdes test "$linkmode,$pass" = "prog,scan"; then 2148141098Sdes libs="$deplibs" 2149141098Sdes deplibs= 2150141098Sdes fi 2151141098Sdes if test "$linkmode" = prog; then 2152125647Sdes case $pass in 2153141098Sdes dlopen) libs="$dlfiles" ;; 2154125647Sdes dlpreopen) libs="$dlprefiles" ;; 2155125647Sdes link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 2156125647Sdes esac 2157125647Sdes fi 2158141098Sdes if test "$pass" = dlopen; then 2159141098Sdes # Collect dlpreopened libraries 2160141098Sdes save_deplibs="$deplibs" 2161141098Sdes deplibs= 2162141098Sdes fi 2163125647Sdes for deplib in $libs; do 2164125647Sdes lib= 2165125647Sdes found=no 2166125647Sdes case $deplib in 2167174832Sdes -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 2168141098Sdes if test "$linkmode,$pass" = "prog,link"; then 2169141098Sdes compile_deplibs="$deplib $compile_deplibs" 2170141098Sdes finalize_deplibs="$deplib $finalize_deplibs" 2171141098Sdes else 2172147455Sdes compiler_flags="$compiler_flags $deplib" 2173141098Sdes fi 2174174832Sdes 2175174832Sdes case $linkmode in 2176174832Sdes lib) 2177174832Sdes deplibs="$deplib $deplibs" 2178174832Sdes test "$pass" = conv && continue 2179174832Sdes newdependency_libs="$deplib $newdependency_libs" 2180174832Sdes ;; 2181174832Sdes prog) 2182174832Sdes if test "$pass" = conv; then 2183174832Sdes deplibs="$deplib $deplibs" 2184174832Sdes continue 2185174832Sdes fi 2186174832Sdes if test "$pass" = scan; then 2187174832Sdes deplibs="$deplib $deplibs" 2188174832Sdes else 2189174832Sdes compile_deplibs="$deplib $compile_deplibs" 2190174832Sdes finalize_deplibs="$deplib $finalize_deplibs" 2191174832Sdes fi 2192174832Sdes ;; 2193174832Sdes *) 2194174832Sdes ;; 2195174832Sdes esac # linkmode 2196174832Sdes 2197141098Sdes continue 2198141098Sdes ;; 2199125647Sdes -l*) 2200141098Sdes if test "$linkmode" != lib && test "$linkmode" != prog; then 2201141098Sdes $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2202125647Sdes continue 2203125647Sdes fi 2204125647Sdes name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 2205125647Sdes for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 2206141098Sdes for search_ext in .la $std_shrext .so .a; do 2207141098Sdes # Search the libtool library 2208141098Sdes lib="$searchdir/lib${name}${search_ext}" 2209141098Sdes if test -f "$lib"; then 2210141098Sdes if test "$search_ext" = ".la"; then 2211141098Sdes found=yes 2212141098Sdes else 2213141098Sdes found=no 2214141098Sdes fi 2215141098Sdes break 2 2216141098Sdes fi 2217141098Sdes done 2218125647Sdes done 2219125647Sdes if test "$found" != yes; then 2220125647Sdes # deplib doesn't seem to be a libtool library 2221125647Sdes if test "$linkmode,$pass" = "prog,link"; then 2222125647Sdes compile_deplibs="$deplib $compile_deplibs" 2223125647Sdes finalize_deplibs="$deplib $finalize_deplibs" 2224125647Sdes else 2225125647Sdes deplibs="$deplib $deplibs" 2226141098Sdes test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2227125647Sdes fi 2228125647Sdes continue 2229141098Sdes else # deplib is a libtool library 2230141098Sdes # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 2231141098Sdes # We need to do some special things here, and not later. 2232141098Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 2233141098Sdes case " $predeps $postdeps " in 2234141098Sdes *" $deplib "*) 2235141098Sdes if (${SED} -e '2q' $lib | 2236141098Sdes grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 2237141098Sdes library_names= 2238141098Sdes old_library= 2239141098Sdes case $lib in 2240141098Sdes */* | *\\*) . $lib ;; 2241141098Sdes *) . ./$lib ;; 2242141098Sdes esac 2243141098Sdes for l in $old_library $library_names; do 2244141098Sdes ll="$l" 2245141098Sdes done 2246141098Sdes if test "X$ll" = "X$old_library" ; then # only static version available 2247141098Sdes found=no 2248141098Sdes ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2249141098Sdes test "X$ladir" = "X$lib" && ladir="." 2250141098Sdes lib=$ladir/$old_library 2251141098Sdes if test "$linkmode,$pass" = "prog,link"; then 2252141098Sdes compile_deplibs="$deplib $compile_deplibs" 2253141098Sdes finalize_deplibs="$deplib $finalize_deplibs" 2254141098Sdes else 2255141098Sdes deplibs="$deplib $deplibs" 2256141098Sdes test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2257141098Sdes fi 2258141098Sdes continue 2259141098Sdes fi 2260141098Sdes fi 2261141098Sdes ;; 2262141098Sdes *) ;; 2263141098Sdes esac 2264141098Sdes fi 2265125647Sdes fi 2266125647Sdes ;; # -l 2267125647Sdes -L*) 2268125647Sdes case $linkmode in 2269125647Sdes lib) 2270125647Sdes deplibs="$deplib $deplibs" 2271141098Sdes test "$pass" = conv && continue 2272125647Sdes newdependency_libs="$deplib $newdependency_libs" 2273125647Sdes newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2274125647Sdes ;; 2275125647Sdes prog) 2276141098Sdes if test "$pass" = conv; then 2277125647Sdes deplibs="$deplib $deplibs" 2278125647Sdes continue 2279125647Sdes fi 2280141098Sdes if test "$pass" = scan; then 2281125647Sdes deplibs="$deplib $deplibs" 2282125647Sdes else 2283125647Sdes compile_deplibs="$deplib $compile_deplibs" 2284125647Sdes finalize_deplibs="$deplib $finalize_deplibs" 2285125647Sdes fi 2286141098Sdes newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2287125647Sdes ;; 2288125647Sdes *) 2289141098Sdes $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 2290125647Sdes ;; 2291125647Sdes esac # linkmode 2292125647Sdes continue 2293125647Sdes ;; # -L 2294125647Sdes -R*) 2295141098Sdes if test "$pass" = link; then 2296125647Sdes dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 2297125647Sdes # Make sure the xrpath contains only unique directories. 2298125647Sdes case "$xrpath " in 2299125647Sdes *" $dir "*) ;; 2300125647Sdes *) xrpath="$xrpath $dir" ;; 2301125647Sdes esac 2302125647Sdes fi 2303125647Sdes deplibs="$deplib $deplibs" 2304125647Sdes continue 2305125647Sdes ;; 2306125647Sdes *.la) lib="$deplib" ;; 2307125647Sdes *.$libext) 2308141098Sdes if test "$pass" = conv; then 2309125647Sdes deplibs="$deplib $deplibs" 2310125647Sdes continue 2311125647Sdes fi 2312125647Sdes case $linkmode in 2313125647Sdes lib) 2314141098Sdes valid_a_lib=no 2315141098Sdes case $deplibs_check_method in 2316141098Sdes match_pattern*) 2317141098Sdes set dummy $deplibs_check_method 2318141098Sdes match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2319141098Sdes if eval $echo \"$deplib\" 2>/dev/null \ 2320141098Sdes | $SED 10q \ 2321141098Sdes | $EGREP "$match_pattern_regex" > /dev/null; then 2322141098Sdes valid_a_lib=yes 2323141098Sdes fi 2324141098Sdes ;; 2325141098Sdes pass_all) 2326141098Sdes valid_a_lib=yes 2327141098Sdes ;; 2328141098Sdes esac 2329141098Sdes if test "$valid_a_lib" != yes; then 2330141098Sdes $echo 2331141098Sdes $echo "*** Warning: Trying to link with static lib archive $deplib." 2332141098Sdes $echo "*** I have the capability to make that library automatically link in when" 2333141098Sdes $echo "*** you link to this library. But I can only do this if you have a" 2334141098Sdes $echo "*** shared version of the library, which you do not appear to have" 2335141098Sdes $echo "*** because the file extensions .$libext of this argument makes me believe" 2336141098Sdes $echo "*** that it is just a static archive that I should not used here." 2337125647Sdes else 2338141098Sdes $echo 2339141098Sdes $echo "*** Warning: Linking the shared library $output against the" 2340141098Sdes $echo "*** static library $deplib is not portable!" 2341125647Sdes deplibs="$deplib $deplibs" 2342125647Sdes fi 2343125647Sdes continue 2344125647Sdes ;; 2345125647Sdes prog) 2346141098Sdes if test "$pass" != link; then 2347125647Sdes deplibs="$deplib $deplibs" 2348125647Sdes else 2349125647Sdes compile_deplibs="$deplib $compile_deplibs" 2350125647Sdes finalize_deplibs="$deplib $finalize_deplibs" 2351125647Sdes fi 2352125647Sdes continue 2353125647Sdes ;; 2354125647Sdes esac # linkmode 2355125647Sdes ;; # *.$libext 2356125647Sdes *.lo | *.$objext) 2357141098Sdes if test "$pass" = conv; then 2358141098Sdes deplibs="$deplib $deplibs" 2359141098Sdes elif test "$linkmode" = prog; then 2360141098Sdes if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 2361141098Sdes # If there is no dlopen support or we're linking statically, 2362141098Sdes # we need to preload. 2363141098Sdes newdlprefiles="$newdlprefiles $deplib" 2364141098Sdes compile_deplibs="$deplib $compile_deplibs" 2365141098Sdes finalize_deplibs="$deplib $finalize_deplibs" 2366141098Sdes else 2367141098Sdes newdlfiles="$newdlfiles $deplib" 2368141098Sdes fi 2369125647Sdes fi 2370125647Sdes continue 2371125647Sdes ;; 2372125647Sdes %DEPLIBS%) 2373125647Sdes alldeplibs=yes 2374125647Sdes continue 2375125647Sdes ;; 2376125647Sdes esac # case $deplib 2377141098Sdes if test "$found" = yes || test -f "$lib"; then : 2378125647Sdes else 2379174832Sdes $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 2380141098Sdes exit $EXIT_FAILURE 2381125647Sdes fi 2382125647Sdes 2383117610Sdes # Check to see that this really is a libtool archive. 2384141098Sdes if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2385117610Sdes else 2386125647Sdes $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 2387141098Sdes exit $EXIT_FAILURE 2388117610Sdes fi 2389117610Sdes 2390125647Sdes ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2391125647Sdes test "X$ladir" = "X$lib" && ladir="." 2392125647Sdes 2393125647Sdes dlname= 2394125647Sdes dlopen= 2395125647Sdes dlpreopen= 2396125647Sdes libdir= 2397125647Sdes library_names= 2398125647Sdes old_library= 2399117610Sdes # If the library was installed with an old release of libtool, 2400141098Sdes # it will not redefine variables installed, or shouldnotlink 2401117610Sdes installed=yes 2402141098Sdes shouldnotlink=no 2403147455Sdes avoidtemprpath= 2404117610Sdes 2405147455Sdes 2406117610Sdes # Read the .la file 2407125647Sdes case $lib in 2408125647Sdes */* | *\\*) . $lib ;; 2409125647Sdes *) . ./$lib ;; 2410117610Sdes esac 2411117610Sdes 2412125647Sdes if test "$linkmode,$pass" = "lib,link" || 2413125647Sdes test "$linkmode,$pass" = "prog,scan" || 2414141098Sdes { test "$linkmode" != prog && test "$linkmode" != lib; }; then 2415125647Sdes test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 2416125647Sdes test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 2417125647Sdes fi 2418125647Sdes 2419141098Sdes if test "$pass" = conv; then 2420125647Sdes # Only check for convenience libraries 2421125647Sdes deplibs="$lib $deplibs" 2422125647Sdes if test -z "$libdir"; then 2423125647Sdes if test -z "$old_library"; then 2424125647Sdes $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2425141098Sdes exit $EXIT_FAILURE 2426125647Sdes fi 2427125647Sdes # It is a libtool convenience library, so add in its objects. 2428125647Sdes convenience="$convenience $ladir/$objdir/$old_library" 2429125647Sdes old_convenience="$old_convenience $ladir/$objdir/$old_library" 2430125647Sdes tmp_libs= 2431125647Sdes for deplib in $dependency_libs; do 2432125647Sdes deplibs="$deplib $deplibs" 2433125647Sdes if test "X$duplicate_deps" = "Xyes" ; then 2434125647Sdes case "$tmp_libs " in 2435125647Sdes *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2436125647Sdes esac 2437125647Sdes fi 2438125647Sdes tmp_libs="$tmp_libs $deplib" 2439125647Sdes done 2440141098Sdes elif test "$linkmode" != prog && test "$linkmode" != lib; then 2441125647Sdes $echo "$modename: \`$lib' is not a convenience library" 1>&2 2442141098Sdes exit $EXIT_FAILURE 2443125647Sdes fi 2444125647Sdes continue 2445125647Sdes fi # $pass = conv 2446125647Sdes 2447141098Sdes 2448117610Sdes # Get the name of the library we link against. 2449117610Sdes linklib= 2450117610Sdes for l in $old_library $library_names; do 2451117610Sdes linklib="$l" 2452117610Sdes done 2453117610Sdes if test -z "$linklib"; then 2454125647Sdes $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2455141098Sdes exit $EXIT_FAILURE 2456117610Sdes fi 2457117610Sdes 2458125647Sdes # This library was specified with -dlopen. 2459141098Sdes if test "$pass" = dlopen; then 2460125647Sdes if test -z "$libdir"; then 2461125647Sdes $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 2462141098Sdes exit $EXIT_FAILURE 2463125647Sdes fi 2464141098Sdes if test -z "$dlname" || 2465141098Sdes test "$dlopen_support" != yes || 2466141098Sdes test "$build_libtool_libs" = no; then 2467125647Sdes # If there is no dlname, no dlopen support or we're linking 2468141098Sdes # statically, we need to preload. We also need to preload any 2469141098Sdes # dependent libraries so libltdl's deplib preloader doesn't 2470141098Sdes # bomb out in the load deplibs phase. 2471141098Sdes dlprefiles="$dlprefiles $lib $dependency_libs" 2472117610Sdes else 2473125647Sdes newdlfiles="$newdlfiles $lib" 2474117610Sdes fi 2475125647Sdes continue 2476125647Sdes fi # $pass = dlopen 2477117610Sdes 2478125647Sdes # We need an absolute path. 2479125647Sdes case $ladir in 2480125647Sdes [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 2481125647Sdes *) 2482125647Sdes abs_ladir=`cd "$ladir" && pwd` 2483125647Sdes if test -z "$abs_ladir"; then 2484125647Sdes $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 2485125647Sdes $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 2486125647Sdes abs_ladir="$ladir" 2487125647Sdes fi 2488125647Sdes ;; 2489125647Sdes esac 2490125647Sdes laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 2491117610Sdes 2492125647Sdes # Find the relevant object directory and library name. 2493125647Sdes if test "X$installed" = Xyes; then 2494125647Sdes if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2495125647Sdes $echo "$modename: warning: library \`$lib' was moved." 1>&2 2496125647Sdes dir="$ladir" 2497125647Sdes absdir="$abs_ladir" 2498125647Sdes libdir="$abs_ladir" 2499117610Sdes else 2500125647Sdes dir="$libdir" 2501125647Sdes absdir="$libdir" 2502117610Sdes fi 2503147455Sdes test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 2504125647Sdes else 2505141098Sdes if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2506141098Sdes dir="$ladir" 2507141098Sdes absdir="$abs_ladir" 2508141098Sdes # Remove this search path later 2509141098Sdes notinst_path="$notinst_path $abs_ladir" 2510141098Sdes else 2511141098Sdes dir="$ladir/$objdir" 2512141098Sdes absdir="$abs_ladir/$objdir" 2513141098Sdes # Remove this search path later 2514141098Sdes notinst_path="$notinst_path $abs_ladir" 2515141098Sdes fi 2516125647Sdes fi # $installed = yes 2517125647Sdes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2518117610Sdes 2519125647Sdes # This library was specified with -dlpreopen. 2520141098Sdes if test "$pass" = dlpreopen; then 2521125647Sdes if test -z "$libdir"; then 2522125647Sdes $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 2523141098Sdes exit $EXIT_FAILURE 2524125647Sdes fi 2525117610Sdes # Prefer using a static library (so that no silly _DYNAMIC symbols 2526117610Sdes # are required to link). 2527117610Sdes if test -n "$old_library"; then 2528125647Sdes newdlprefiles="$newdlprefiles $dir/$old_library" 2529125647Sdes # Otherwise, use the dlname, so that lt_dlopen finds it. 2530125647Sdes elif test -n "$dlname"; then 2531125647Sdes newdlprefiles="$newdlprefiles $dir/$dlname" 2532117610Sdes else 2533125647Sdes newdlprefiles="$newdlprefiles $dir/$linklib" 2534117610Sdes fi 2535125647Sdes fi # $pass = dlpreopen 2536125647Sdes 2537125647Sdes if test -z "$libdir"; then 2538125647Sdes # Link the convenience library 2539141098Sdes if test "$linkmode" = lib; then 2540125647Sdes deplibs="$dir/$old_library $deplibs" 2541125647Sdes elif test "$linkmode,$pass" = "prog,link"; then 2542125647Sdes compile_deplibs="$dir/$old_library $compile_deplibs" 2543125647Sdes finalize_deplibs="$dir/$old_library $finalize_deplibs" 2544125647Sdes else 2545141098Sdes deplibs="$lib $deplibs" # used for prog,scan pass 2546125647Sdes fi 2547125647Sdes continue 2548117610Sdes fi 2549117610Sdes 2550141098Sdes 2551141098Sdes if test "$linkmode" = prog && test "$pass" != link; then 2552125647Sdes newlib_search_path="$newlib_search_path $ladir" 2553125647Sdes deplibs="$lib $deplibs" 2554125647Sdes 2555125647Sdes linkalldeplibs=no 2556125647Sdes if test "$link_all_deplibs" != no || test -z "$library_names" || 2557125647Sdes test "$build_libtool_libs" = no; then 2558125647Sdes linkalldeplibs=yes 2559125647Sdes fi 2560125647Sdes 2561125647Sdes tmp_libs= 2562125647Sdes for deplib in $dependency_libs; do 2563125647Sdes case $deplib in 2564125647Sdes -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 2565125647Sdes esac 2566125647Sdes # Need to link against all dependency_libs? 2567141098Sdes if test "$linkalldeplibs" = yes; then 2568125647Sdes deplibs="$deplib $deplibs" 2569125647Sdes else 2570125647Sdes # Need to hardcode shared library paths 2571125647Sdes # or/and link against static libraries 2572125647Sdes newdependency_libs="$deplib $newdependency_libs" 2573125647Sdes fi 2574125647Sdes if test "X$duplicate_deps" = "Xyes" ; then 2575125647Sdes case "$tmp_libs " in 2576125647Sdes *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2577125647Sdes esac 2578125647Sdes fi 2579125647Sdes tmp_libs="$tmp_libs $deplib" 2580125647Sdes done # for deplib 2581125647Sdes continue 2582125647Sdes fi # $linkmode = prog... 2583125647Sdes 2584141098Sdes if test "$linkmode,$pass" = "prog,link"; then 2585141098Sdes if test -n "$library_names" && 2586174832Sdes { { test "$prefer_static_libs" = no || 2587174832Sdes test "$prefer_static_libs,$installed" = "built,yes"; } || 2588174832Sdes test -z "$old_library"; }; then 2589141098Sdes # We need to hardcode the library path 2590147455Sdes if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 2591141098Sdes # Make sure the rpath contains only unique directories. 2592141098Sdes case "$temp_rpath " in 2593141098Sdes *" $dir "*) ;; 2594141098Sdes *" $absdir "*) ;; 2595174832Sdes *) temp_rpath="$temp_rpath $absdir" ;; 2596141098Sdes esac 2597141098Sdes fi 2598117610Sdes 2599125647Sdes # Hardcode the library path. 2600125647Sdes # Skip directories that are in the system default run-time 2601125647Sdes # search path. 2602125647Sdes case " $sys_lib_dlsearch_path " in 2603117610Sdes *" $absdir "*) ;; 2604125647Sdes *) 2605125647Sdes case "$compile_rpath " in 2606125647Sdes *" $absdir "*) ;; 2607125647Sdes *) compile_rpath="$compile_rpath $absdir" 2608125647Sdes esac 2609125647Sdes ;; 2610117610Sdes esac 2611125647Sdes case " $sys_lib_dlsearch_path " in 2612117610Sdes *" $libdir "*) ;; 2613125647Sdes *) 2614125647Sdes case "$finalize_rpath " in 2615125647Sdes *" $libdir "*) ;; 2616125647Sdes *) finalize_rpath="$finalize_rpath $libdir" 2617125647Sdes esac 2618125647Sdes ;; 2619117610Sdes esac 2620125647Sdes fi # $linkmode,$pass = prog,link... 2621117610Sdes 2622125647Sdes if test "$alldeplibs" = yes && 2623125647Sdes { test "$deplibs_check_method" = pass_all || 2624125647Sdes { test "$build_libtool_libs" = yes && 2625125647Sdes test -n "$library_names"; }; }; then 2626125647Sdes # We only need to search for static libraries 2627125647Sdes continue 2628125647Sdes fi 2629141098Sdes fi 2630125647Sdes 2631141098Sdes link_static=no # Whether the deplib will be linked statically 2632174832Sdes use_static_libs=$prefer_static_libs 2633174832Sdes if test "$use_static_libs" = built && test "$installed" = yes ; then 2634174832Sdes use_static_libs=no 2635174832Sdes fi 2636141098Sdes if test -n "$library_names" && 2637174832Sdes { test "$use_static_libs" = no || test -z "$old_library"; }; then 2638125647Sdes if test "$installed" = no; then 2639125647Sdes notinst_deplibs="$notinst_deplibs $lib" 2640125647Sdes need_relink=yes 2641125647Sdes fi 2642141098Sdes # This is a shared library 2643125647Sdes 2644141098Sdes # Warn about portability, can't link against -module's on 2645141098Sdes # some systems (darwin) 2646141098Sdes if test "$shouldnotlink" = yes && test "$pass" = link ; then 2647141098Sdes $echo 2648141098Sdes if test "$linkmode" = prog; then 2649141098Sdes $echo "*** Warning: Linking the executable $output against the loadable module" 2650141098Sdes else 2651141098Sdes $echo "*** Warning: Linking the shared library $output against the loadable module" 2652141098Sdes fi 2653141098Sdes $echo "*** $linklib is not portable!" 2654141098Sdes fi 2655141098Sdes if test "$linkmode" = lib && 2656141098Sdes test "$hardcode_into_libs" = yes; then 2657141098Sdes # Hardcode the library path. 2658141098Sdes # Skip directories that are in the system default run-time 2659141098Sdes # search path. 2660141098Sdes case " $sys_lib_dlsearch_path " in 2661141098Sdes *" $absdir "*) ;; 2662141098Sdes *) 2663141098Sdes case "$compile_rpath " in 2664141098Sdes *" $absdir "*) ;; 2665141098Sdes *) compile_rpath="$compile_rpath $absdir" 2666141098Sdes esac 2667141098Sdes ;; 2668141098Sdes esac 2669141098Sdes case " $sys_lib_dlsearch_path " in 2670141098Sdes *" $libdir "*) ;; 2671141098Sdes *) 2672141098Sdes case "$finalize_rpath " in 2673141098Sdes *" $libdir "*) ;; 2674141098Sdes *) finalize_rpath="$finalize_rpath $libdir" 2675141098Sdes esac 2676141098Sdes ;; 2677141098Sdes esac 2678141098Sdes fi 2679141098Sdes 2680125647Sdes if test -n "$old_archive_from_expsyms_cmds"; then 2681125647Sdes # figure out the soname 2682125647Sdes set dummy $library_names 2683125647Sdes realname="$2" 2684125647Sdes shift; shift 2685125647Sdes libname=`eval \\$echo \"$libname_spec\"` 2686125647Sdes # use dlname if we got it. it's perfectly good, no? 2687125647Sdes if test -n "$dlname"; then 2688125647Sdes soname="$dlname" 2689125647Sdes elif test -n "$soname_spec"; then 2690125647Sdes # bleh windows 2691125647Sdes case $host in 2692141098Sdes *cygwin* | mingw*) 2693125647Sdes major=`expr $current - $age` 2694125647Sdes versuffix="-$major" 2695117610Sdes ;; 2696117610Sdes esac 2697125647Sdes eval soname=\"$soname_spec\" 2698125647Sdes else 2699125647Sdes soname="$realname" 2700125647Sdes fi 2701125647Sdes 2702125647Sdes # Make a new name for the extract_expsyms_cmds to use 2703125647Sdes soroot="$soname" 2704141098Sdes soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 2705141098Sdes newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 2706125647Sdes 2707125647Sdes # If the library has no export list, then create one now 2708125647Sdes if test -f "$output_objdir/$soname-def"; then : 2709125647Sdes else 2710125647Sdes $show "extracting exported symbol list from \`$soname'" 2711125647Sdes save_ifs="$IFS"; IFS='~' 2712141098Sdes cmds=$extract_expsyms_cmds 2713125647Sdes for cmd in $cmds; do 2714125647Sdes IFS="$save_ifs" 2715141098Sdes eval cmd=\"$cmd\" 2716125647Sdes $show "$cmd" 2717125647Sdes $run eval "$cmd" || exit $? 2718125647Sdes done 2719125647Sdes IFS="$save_ifs" 2720125647Sdes fi 2721125647Sdes 2722125647Sdes # Create $newlib 2723125647Sdes if test -f "$output_objdir/$newlib"; then :; else 2724125647Sdes $show "generating import library for \`$soname'" 2725125647Sdes save_ifs="$IFS"; IFS='~' 2726141098Sdes cmds=$old_archive_from_expsyms_cmds 2727125647Sdes for cmd in $cmds; do 2728125647Sdes IFS="$save_ifs" 2729141098Sdes eval cmd=\"$cmd\" 2730125647Sdes $show "$cmd" 2731125647Sdes $run eval "$cmd" || exit $? 2732125647Sdes done 2733125647Sdes IFS="$save_ifs" 2734125647Sdes fi 2735125647Sdes # make sure the library variables are pointing to the new library 2736125647Sdes dir=$output_objdir 2737125647Sdes linklib=$newlib 2738141098Sdes fi # test -n "$old_archive_from_expsyms_cmds" 2739125647Sdes 2740141098Sdes if test "$linkmode" = prog || test "$mode" != relink; then 2741125647Sdes add_shlibpath= 2742125647Sdes add_dir= 2743125647Sdes add= 2744125647Sdes lib_linked=yes 2745125647Sdes case $hardcode_action in 2746125647Sdes immediate | unsupported) 2747125647Sdes if test "$hardcode_direct" = no; then 2748125647Sdes add="$dir/$linklib" 2749141098Sdes case $host in 2750174832Sdes *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 2751174832Sdes *-*-sysv4*uw2*) add_dir="-L$dir" ;; 2752174832Sdes *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 2753174832Sdes *-*-unixware7*) add_dir="-L$dir" ;; 2754141098Sdes *-*-darwin* ) 2755141098Sdes # if the lib is a module then we can not link against 2756141098Sdes # it, someone is ignoring the new warnings I added 2757174832Sdes if /usr/bin/file -L $add 2> /dev/null | 2758174832Sdes $EGREP ": [^:]* bundle" >/dev/null ; then 2759141098Sdes $echo "** Warning, lib $linklib is a module, not a shared library" 2760141098Sdes if test -z "$old_library" ; then 2761141098Sdes $echo 2762141098Sdes $echo "** And there doesn't seem to be a static archive available" 2763141098Sdes $echo "** The link will probably fail, sorry" 2764141098Sdes else 2765141098Sdes add="$dir/$old_library" 2766141098Sdes fi 2767141098Sdes fi 2768141098Sdes esac 2769125647Sdes elif test "$hardcode_minus_L" = no; then 2770125647Sdes case $host in 2771125647Sdes *-*-sunos*) add_shlibpath="$dir" ;; 2772125647Sdes esac 2773125647Sdes add_dir="-L$dir" 2774125647Sdes add="-l$name" 2775125647Sdes elif test "$hardcode_shlibpath_var" = no; then 2776125647Sdes add_shlibpath="$dir" 2777125647Sdes add="-l$name" 2778125647Sdes else 2779125647Sdes lib_linked=no 2780125647Sdes fi 2781125647Sdes ;; 2782125647Sdes relink) 2783125647Sdes if test "$hardcode_direct" = yes; then 2784125647Sdes add="$dir/$linklib" 2785125647Sdes elif test "$hardcode_minus_L" = yes; then 2786125647Sdes add_dir="-L$dir" 2787141098Sdes # Try looking first in the location we're being installed to. 2788141098Sdes if test -n "$inst_prefix_dir"; then 2789174832Sdes case $libdir in 2790141098Sdes [\\/]*) 2791141098Sdes add_dir="$add_dir -L$inst_prefix_dir$libdir" 2792141098Sdes ;; 2793141098Sdes esac 2794141098Sdes fi 2795125647Sdes add="-l$name" 2796125647Sdes elif test "$hardcode_shlibpath_var" = yes; then 2797125647Sdes add_shlibpath="$dir" 2798125647Sdes add="-l$name" 2799125647Sdes else 2800125647Sdes lib_linked=no 2801125647Sdes fi 2802125647Sdes ;; 2803125647Sdes *) lib_linked=no ;; 2804125647Sdes esac 2805125647Sdes 2806125647Sdes if test "$lib_linked" != yes; then 2807125647Sdes $echo "$modename: configuration error: unsupported hardcode properties" 2808141098Sdes exit $EXIT_FAILURE 2809125647Sdes fi 2810125647Sdes 2811125647Sdes if test -n "$add_shlibpath"; then 2812125647Sdes case :$compile_shlibpath: in 2813125647Sdes *":$add_shlibpath:"*) ;; 2814125647Sdes *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2815117610Sdes esac 2816125647Sdes fi 2817141098Sdes if test "$linkmode" = prog; then 2818125647Sdes test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2819125647Sdes test -n "$add" && compile_deplibs="$add $compile_deplibs" 2820117610Sdes else 2821125647Sdes test -n "$add_dir" && deplibs="$add_dir $deplibs" 2822125647Sdes test -n "$add" && deplibs="$add $deplibs" 2823125647Sdes if test "$hardcode_direct" != yes && \ 2824125647Sdes test "$hardcode_minus_L" != yes && \ 2825125647Sdes test "$hardcode_shlibpath_var" = yes; then 2826125647Sdes case :$finalize_shlibpath: in 2827125647Sdes *":$libdir:"*) ;; 2828125647Sdes *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2829125647Sdes esac 2830125647Sdes fi 2831117610Sdes fi 2832125647Sdes fi 2833117610Sdes 2834141098Sdes if test "$linkmode" = prog || test "$mode" = relink; then 2835125647Sdes add_shlibpath= 2836125647Sdes add_dir= 2837125647Sdes add= 2838125647Sdes # Finalize command for both is simple: just hardcode it. 2839117610Sdes if test "$hardcode_direct" = yes; then 2840125647Sdes add="$libdir/$linklib" 2841117610Sdes elif test "$hardcode_minus_L" = yes; then 2842125647Sdes add_dir="-L$libdir" 2843125647Sdes add="-l$name" 2844117610Sdes elif test "$hardcode_shlibpath_var" = yes; then 2845125647Sdes case :$finalize_shlibpath: in 2846125647Sdes *":$libdir:"*) ;; 2847125647Sdes *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2848117610Sdes esac 2849125647Sdes add="-l$name" 2850141098Sdes elif test "$hardcode_automatic" = yes; then 2851141098Sdes if test -n "$inst_prefix_dir" && 2852141098Sdes test -f "$inst_prefix_dir$libdir/$linklib" ; then 2853141098Sdes add="$inst_prefix_dir$libdir/$linklib" 2854141098Sdes else 2855141098Sdes add="$libdir/$linklib" 2856141098Sdes fi 2857117610Sdes else 2858125647Sdes # We cannot seem to hardcode it, guess we'll fake it. 2859125647Sdes add_dir="-L$libdir" 2860141098Sdes # Try looking first in the location we're being installed to. 2861141098Sdes if test -n "$inst_prefix_dir"; then 2862174832Sdes case $libdir in 2863141098Sdes [\\/]*) 2864141098Sdes add_dir="$add_dir -L$inst_prefix_dir$libdir" 2865141098Sdes ;; 2866141098Sdes esac 2867141098Sdes fi 2868125647Sdes add="-l$name" 2869117610Sdes fi 2870117610Sdes 2871141098Sdes if test "$linkmode" = prog; then 2872125647Sdes test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2873125647Sdes test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2874125647Sdes else 2875125647Sdes test -n "$add_dir" && deplibs="$add_dir $deplibs" 2876125647Sdes test -n "$add" && deplibs="$add $deplibs" 2877125647Sdes fi 2878117610Sdes fi 2879141098Sdes elif test "$linkmode" = prog; then 2880117610Sdes # Here we assume that one of hardcode_direct or hardcode_minus_L 2881117610Sdes # is not unsupported. This is valid on all known static and 2882117610Sdes # shared platforms. 2883117610Sdes if test "$hardcode_direct" != unsupported; then 2884117610Sdes test -n "$old_library" && linklib="$old_library" 2885125647Sdes compile_deplibs="$dir/$linklib $compile_deplibs" 2886125647Sdes finalize_deplibs="$dir/$linklib $finalize_deplibs" 2887117610Sdes else 2888125647Sdes compile_deplibs="-l$name -L$dir $compile_deplibs" 2889125647Sdes finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2890117610Sdes fi 2891125647Sdes elif test "$build_libtool_libs" = yes; then 2892125647Sdes # Not a shared library 2893125647Sdes if test "$deplibs_check_method" != pass_all; then 2894125647Sdes # We're trying link a shared library against a static one 2895125647Sdes # but the system doesn't support it. 2896117610Sdes 2897125647Sdes # Just print a warning and add the library to dependency_libs so 2898125647Sdes # that the program can be linked against the static library. 2899141098Sdes $echo 2900141098Sdes $echo "*** Warning: This system can not link to static lib archive $lib." 2901141098Sdes $echo "*** I have the capability to make that library automatically link in when" 2902141098Sdes $echo "*** you link to this library. But I can only do this if you have a" 2903141098Sdes $echo "*** shared version of the library, which you do not appear to have." 2904125647Sdes if test "$module" = yes; then 2905141098Sdes $echo "*** But as you try to build a module library, libtool will still create " 2906141098Sdes $echo "*** a static module, that should work as long as the dlopening application" 2907141098Sdes $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 2908125647Sdes if test -z "$global_symbol_pipe"; then 2909141098Sdes $echo 2910141098Sdes $echo "*** However, this would only work if libtool was able to extract symbol" 2911141098Sdes $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2912141098Sdes $echo "*** not find such a program. So, this module is probably useless." 2913141098Sdes $echo "*** \`nm' from GNU binutils and a full rebuild may help." 2914125647Sdes fi 2915125647Sdes if test "$build_old_libs" = no; then 2916125647Sdes build_libtool_libs=module 2917125647Sdes build_old_libs=yes 2918125647Sdes else 2919125647Sdes build_libtool_libs=no 2920125647Sdes fi 2921125647Sdes fi 2922125647Sdes else 2923125647Sdes deplibs="$dir/$old_library $deplibs" 2924125647Sdes link_static=yes 2925125647Sdes fi 2926125647Sdes fi # link shared/static library? 2927117610Sdes 2928141098Sdes if test "$linkmode" = lib; then 2929125647Sdes if test -n "$dependency_libs" && 2930141098Sdes { test "$hardcode_into_libs" != yes || 2931141098Sdes test "$build_old_libs" = yes || 2932141098Sdes test "$link_static" = yes; }; then 2933125647Sdes # Extract -R from dependency_libs 2934125647Sdes temp_deplibs= 2935125647Sdes for libdir in $dependency_libs; do 2936125647Sdes case $libdir in 2937125647Sdes -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2938125647Sdes case " $xrpath " in 2939125647Sdes *" $temp_xrpath "*) ;; 2940125647Sdes *) xrpath="$xrpath $temp_xrpath";; 2941125647Sdes esac;; 2942125647Sdes *) temp_deplibs="$temp_deplibs $libdir";; 2943125647Sdes esac 2944125647Sdes done 2945125647Sdes dependency_libs="$temp_deplibs" 2946125647Sdes fi 2947117610Sdes 2948125647Sdes newlib_search_path="$newlib_search_path $absdir" 2949125647Sdes # Link against this library 2950125647Sdes test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2951125647Sdes # ... and its dependency_libs 2952125647Sdes tmp_libs= 2953125647Sdes for deplib in $dependency_libs; do 2954125647Sdes newdependency_libs="$deplib $newdependency_libs" 2955125647Sdes if test "X$duplicate_deps" = "Xyes" ; then 2956125647Sdes case "$tmp_libs " in 2957125647Sdes *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2958125647Sdes esac 2959125647Sdes fi 2960125647Sdes tmp_libs="$tmp_libs $deplib" 2961125647Sdes done 2962117610Sdes 2963141098Sdes if test "$link_all_deplibs" != no; then 2964125647Sdes # Add the search paths of all dependency libraries 2965125647Sdes for deplib in $dependency_libs; do 2966125647Sdes case $deplib in 2967125647Sdes -L*) path="$deplib" ;; 2968125647Sdes *.la) 2969125647Sdes dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2970125647Sdes test "X$dir" = "X$deplib" && dir="." 2971125647Sdes # We need an absolute path. 2972125647Sdes case $dir in 2973125647Sdes [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2974125647Sdes *) 2975125647Sdes absdir=`cd "$dir" && pwd` 2976125647Sdes if test -z "$absdir"; then 2977125647Sdes $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2978125647Sdes absdir="$dir" 2979125647Sdes fi 2980125647Sdes ;; 2981125647Sdes esac 2982125647Sdes if grep "^installed=no" $deplib > /dev/null; then 2983141098Sdes path="$absdir/$objdir" 2984125647Sdes else 2985125647Sdes eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2986125647Sdes if test -z "$libdir"; then 2987125647Sdes $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2988141098Sdes exit $EXIT_FAILURE 2989125647Sdes fi 2990125647Sdes if test "$absdir" != "$libdir"; then 2991125647Sdes $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2992125647Sdes fi 2993141098Sdes path="$absdir" 2994125647Sdes fi 2995141098Sdes depdepl= 2996141098Sdes case $host in 2997141098Sdes *-*-darwin*) 2998141098Sdes # we do not want to link against static libs, 2999141098Sdes # but need to link against shared 3000141098Sdes eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 3001141098Sdes if test -n "$deplibrary_names" ; then 3002141098Sdes for tmp in $deplibrary_names ; do 3003141098Sdes depdepl=$tmp 3004141098Sdes done 3005141098Sdes if test -f "$path/$depdepl" ; then 3006141098Sdes depdepl="$path/$depdepl" 3007141098Sdes fi 3008141098Sdes # do not add paths which are already there 3009141098Sdes case " $newlib_search_path " in 3010141098Sdes *" $path "*) ;; 3011141098Sdes *) newlib_search_path="$newlib_search_path $path";; 3012141098Sdes esac 3013141098Sdes fi 3014141098Sdes path="" 3015141098Sdes ;; 3016141098Sdes *) 3017141098Sdes path="-L$path" 3018141098Sdes ;; 3019141098Sdes esac 3020125647Sdes ;; 3021141098Sdes -l*) 3022141098Sdes case $host in 3023141098Sdes *-*-darwin*) 3024141098Sdes # Again, we only want to link against shared libraries 3025141098Sdes eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 3026141098Sdes for tmp in $newlib_search_path ; do 3027141098Sdes if test -f "$tmp/lib$tmp_libs.dylib" ; then 3028141098Sdes eval depdepl="$tmp/lib$tmp_libs.dylib" 3029141098Sdes break 3030141098Sdes fi 3031141098Sdes done 3032141098Sdes path="" 3033141098Sdes ;; 3034141098Sdes *) continue ;; 3035141098Sdes esac 3036141098Sdes ;; 3037125647Sdes *) continue ;; 3038125647Sdes esac 3039125647Sdes case " $deplibs " in 3040174832Sdes *" $path "*) ;; 3041174832Sdes *) deplibs="$path $deplibs" ;; 3042174832Sdes esac 3043174832Sdes case " $deplibs " in 3044141098Sdes *" $depdepl "*) ;; 3045141098Sdes *) deplibs="$depdepl $deplibs" ;; 3046141098Sdes esac 3047125647Sdes done 3048125647Sdes fi # link_all_deplibs != no 3049125647Sdes fi # linkmode = lib 3050125647Sdes done # for deplib in $libs 3051141098Sdes dependency_libs="$newdependency_libs" 3052141098Sdes if test "$pass" = dlpreopen; then 3053125647Sdes # Link the dlpreopened libraries before other libraries 3054125647Sdes for deplib in $save_deplibs; do 3055125647Sdes deplibs="$deplib $deplibs" 3056125647Sdes done 3057117610Sdes fi 3058141098Sdes if test "$pass" != dlopen; then 3059141098Sdes if test "$pass" != conv; then 3060125647Sdes # Make sure lib_search_path contains only unique directories. 3061125647Sdes lib_search_path= 3062125647Sdes for dir in $newlib_search_path; do 3063125647Sdes case "$lib_search_path " in 3064125647Sdes *" $dir "*) ;; 3065125647Sdes *) lib_search_path="$lib_search_path $dir" ;; 3066125647Sdes esac 3067125647Sdes done 3068125647Sdes newlib_search_path= 3069125647Sdes fi 3070117610Sdes 3071125647Sdes if test "$linkmode,$pass" != "prog,link"; then 3072125647Sdes vars="deplibs" 3073125647Sdes else 3074125647Sdes vars="compile_deplibs finalize_deplibs" 3075125647Sdes fi 3076125647Sdes for var in $vars dependency_libs; do 3077125647Sdes # Add libraries to $var in reverse order 3078125647Sdes eval tmp_libs=\"\$$var\" 3079125647Sdes new_libs= 3080125647Sdes for deplib in $tmp_libs; do 3081141098Sdes # FIXME: Pedantically, this is the right thing to do, so 3082141098Sdes # that some nasty dependency loop isn't accidentally 3083141098Sdes # broken: 3084141098Sdes #new_libs="$deplib $new_libs" 3085141098Sdes # Pragmatically, this seems to cause very few problems in 3086141098Sdes # practice: 3087125647Sdes case $deplib in 3088125647Sdes -L*) new_libs="$deplib $new_libs" ;; 3089141098Sdes -R*) ;; 3090125647Sdes *) 3091141098Sdes # And here is the reason: when a library appears more 3092141098Sdes # than once as an explicit dependence of a library, or 3093141098Sdes # is implicitly linked in more than once by the 3094141098Sdes # compiler, it is considered special, and multiple 3095141098Sdes # occurrences thereof are not removed. Compare this 3096141098Sdes # with having the same library being listed as a 3097141098Sdes # dependency of multiple other libraries: in this case, 3098141098Sdes # we know (pedantically, we assume) the library does not 3099141098Sdes # need to be listed more than once, so we keep only the 3100141098Sdes # last copy. This is not always right, but it is rare 3101141098Sdes # enough that we require users that really mean to play 3102141098Sdes # such unportable linking tricks to link the library 3103141098Sdes # using -Wl,-lname, so that libtool does not consider it 3104141098Sdes # for duplicate removal. 3105125647Sdes case " $specialdeplibs " in 3106125647Sdes *" $deplib "*) new_libs="$deplib $new_libs" ;; 3107125647Sdes *) 3108125647Sdes case " $new_libs " in 3109125647Sdes *" $deplib "*) ;; 3110125647Sdes *) new_libs="$deplib $new_libs" ;; 3111125647Sdes esac 3112125647Sdes ;; 3113125647Sdes esac 3114125647Sdes ;; 3115125647Sdes esac 3116125647Sdes done 3117125647Sdes tmp_libs= 3118125647Sdes for deplib in $new_libs; do 3119125647Sdes case $deplib in 3120125647Sdes -L*) 3121125647Sdes case " $tmp_libs " in 3122125647Sdes *" $deplib "*) ;; 3123125647Sdes *) tmp_libs="$tmp_libs $deplib" ;; 3124125647Sdes esac 3125125647Sdes ;; 3126125647Sdes *) tmp_libs="$tmp_libs $deplib" ;; 3127125647Sdes esac 3128125647Sdes done 3129125647Sdes eval $var=\"$tmp_libs\" 3130125647Sdes done # for var 3131117610Sdes fi 3132141098Sdes # Last step: remove runtime libs from dependency_libs 3133141098Sdes # (they stay in deplibs) 3134141098Sdes tmp_libs= 3135141098Sdes for i in $dependency_libs ; do 3136141098Sdes case " $predeps $postdeps $compiler_lib_search_path " in 3137141098Sdes *" $i "*) 3138141098Sdes i="" 3139141098Sdes ;; 3140141098Sdes esac 3141141098Sdes if test -n "$i" ; then 3142141098Sdes tmp_libs="$tmp_libs $i" 3143141098Sdes fi 3144141098Sdes done 3145141098Sdes dependency_libs=$tmp_libs 3146125647Sdes done # for pass 3147141098Sdes if test "$linkmode" = prog; then 3148125647Sdes dlfiles="$newdlfiles" 3149125647Sdes dlprefiles="$newdlprefiles" 3150125647Sdes fi 3151117610Sdes 3152125647Sdes case $linkmode in 3153125647Sdes oldlib) 3154141098Sdes if test -n "$deplibs"; then 3155141098Sdes $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 3156141098Sdes fi 3157141098Sdes 3158117610Sdes if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3159117610Sdes $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 3160117610Sdes fi 3161117610Sdes 3162117610Sdes if test -n "$rpath"; then 3163117610Sdes $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 3164117610Sdes fi 3165117610Sdes 3166117610Sdes if test -n "$xrpath"; then 3167117610Sdes $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 3168117610Sdes fi 3169117610Sdes 3170117610Sdes if test -n "$vinfo"; then 3171141098Sdes $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 3172117610Sdes fi 3173117610Sdes 3174117610Sdes if test -n "$release"; then 3175117610Sdes $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 3176117610Sdes fi 3177117610Sdes 3178117610Sdes if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3179117610Sdes $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 3180117610Sdes fi 3181117610Sdes 3182117610Sdes # Now set the variables for building old libraries. 3183117610Sdes build_libtool_libs=no 3184117610Sdes oldlibs="$output" 3185125647Sdes objs="$objs$old_deplibs" 3186117610Sdes ;; 3187117610Sdes 3188125647Sdes lib) 3189117610Sdes # Make sure we only generate libraries of the form `libNAME.la'. 3190125647Sdes case $outputname in 3191117610Sdes lib*) 3192117610Sdes name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 3193141098Sdes eval shared_ext=\"$shrext_cmds\" 3194117610Sdes eval libname=\"$libname_spec\" 3195117610Sdes ;; 3196117610Sdes *) 3197117610Sdes if test "$module" = no; then 3198117610Sdes $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 3199117610Sdes $echo "$help" 1>&2 3200141098Sdes exit $EXIT_FAILURE 3201117610Sdes fi 3202117610Sdes if test "$need_lib_prefix" != no; then 3203117610Sdes # Add the "lib" prefix for modules if required 3204117610Sdes name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3205141098Sdes eval shared_ext=\"$shrext_cmds\" 3206117610Sdes eval libname=\"$libname_spec\" 3207117610Sdes else 3208117610Sdes libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3209117610Sdes fi 3210117610Sdes ;; 3211117610Sdes esac 3212117610Sdes 3213117610Sdes if test -n "$objs"; then 3214125647Sdes if test "$deplibs_check_method" != pass_all; then 3215125647Sdes $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 3216141098Sdes exit $EXIT_FAILURE 3217125647Sdes else 3218141098Sdes $echo 3219141098Sdes $echo "*** Warning: Linking the shared library $output against the non-libtool" 3220141098Sdes $echo "*** objects $objs is not portable!" 3221125647Sdes libobjs="$libobjs $objs" 3222125647Sdes fi 3223117610Sdes fi 3224117610Sdes 3225125647Sdes if test "$dlself" != no; then 3226125647Sdes $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 3227117610Sdes fi 3228117610Sdes 3229117610Sdes set dummy $rpath 3230141098Sdes if test "$#" -gt 2; then 3231117610Sdes $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 3232117610Sdes fi 3233117610Sdes install_libdir="$2" 3234117610Sdes 3235117610Sdes oldlibs= 3236117610Sdes if test -z "$rpath"; then 3237117610Sdes if test "$build_libtool_libs" = yes; then 3238117610Sdes # Building a libtool convenience library. 3239141098Sdes # Some compilers have problems with a `.al' extension so 3240141098Sdes # convenience libraries should have the same extension an 3241141098Sdes # archive normally would. 3242117610Sdes oldlibs="$output_objdir/$libname.$libext $oldlibs" 3243117610Sdes build_libtool_libs=convenience 3244117610Sdes build_old_libs=yes 3245117610Sdes fi 3246117610Sdes 3247117610Sdes if test -n "$vinfo"; then 3248141098Sdes $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 3249117610Sdes fi 3250117610Sdes 3251117610Sdes if test -n "$release"; then 3252117610Sdes $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 3253117610Sdes fi 3254117610Sdes else 3255117610Sdes 3256117610Sdes # Parse the version information argument. 3257125647Sdes save_ifs="$IFS"; IFS=':' 3258117610Sdes set dummy $vinfo 0 0 0 3259117610Sdes IFS="$save_ifs" 3260117610Sdes 3261117610Sdes if test -n "$8"; then 3262117610Sdes $echo "$modename: too many parameters to \`-version-info'" 1>&2 3263117610Sdes $echo "$help" 1>&2 3264141098Sdes exit $EXIT_FAILURE 3265117610Sdes fi 3266117610Sdes 3267141098Sdes # convert absolute version numbers to libtool ages 3268141098Sdes # this retains compatibility with .la files and attempts 3269141098Sdes # to make the code below a bit more comprehensible 3270117610Sdes 3271141098Sdes case $vinfo_number in 3272141098Sdes yes) 3273141098Sdes number_major="$2" 3274141098Sdes number_minor="$3" 3275141098Sdes number_revision="$4" 3276141098Sdes # 3277141098Sdes # There are really only two kinds -- those that 3278141098Sdes # use the current revision as the major version 3279141098Sdes # and those that subtract age and use age as 3280141098Sdes # a minor version. But, then there is irix 3281141098Sdes # which has an extra 1 added just for fun 3282141098Sdes # 3283141098Sdes case $version_type in 3284174832Sdes darwin|linux|osf|windows|none) 3285141098Sdes current=`expr $number_major + $number_minor` 3286141098Sdes age="$number_minor" 3287141098Sdes revision="$number_revision" 3288141098Sdes ;; 3289141098Sdes freebsd-aout|freebsd-elf|sunos) 3290141098Sdes current="$number_major" 3291141098Sdes revision="$number_minor" 3292141098Sdes age="0" 3293141098Sdes ;; 3294141098Sdes irix|nonstopux) 3295174832Sdes current=`expr $number_major + $number_minor` 3296141098Sdes age="$number_minor" 3297141098Sdes revision="$number_minor" 3298174832Sdes lt_irix_increment=no 3299141098Sdes ;; 3300141098Sdes esac 3301141098Sdes ;; 3302141098Sdes no) 3303141098Sdes current="$2" 3304141098Sdes revision="$3" 3305141098Sdes age="$4" 3306141098Sdes ;; 3307141098Sdes esac 3308141098Sdes 3309117610Sdes # Check that each of the things are valid numbers. 3310125647Sdes case $current in 3311147455Sdes 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]) ;; 3312117610Sdes *) 3313174832Sdes $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 3314117610Sdes $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3315141098Sdes exit $EXIT_FAILURE 3316117610Sdes ;; 3317117610Sdes esac 3318117610Sdes 3319125647Sdes case $revision in 3320147455Sdes 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]) ;; 3321117610Sdes *) 3322174832Sdes $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 3323117610Sdes $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3324141098Sdes exit $EXIT_FAILURE 3325117610Sdes ;; 3326117610Sdes esac 3327117610Sdes 3328125647Sdes case $age in 3329147455Sdes 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]) ;; 3330117610Sdes *) 3331174832Sdes $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 3332117610Sdes $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3333141098Sdes exit $EXIT_FAILURE 3334117610Sdes ;; 3335117610Sdes esac 3336117610Sdes 3337141098Sdes if test "$age" -gt "$current"; then 3338117610Sdes $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 3339117610Sdes $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3340141098Sdes exit $EXIT_FAILURE 3341117610Sdes fi 3342117610Sdes 3343117610Sdes # Calculate the version variables. 3344117610Sdes major= 3345117610Sdes versuffix= 3346117610Sdes verstring= 3347125647Sdes case $version_type in 3348117610Sdes none) ;; 3349117610Sdes 3350125647Sdes darwin) 3351125647Sdes # Like Linux, but with the current version available in 3352125647Sdes # verstring for coding it into the library header 3353125647Sdes major=.`expr $current - $age` 3354125647Sdes versuffix="$major.$age.$revision" 3355125647Sdes # Darwin ld doesn't like 0 for these options... 3356125647Sdes minor_current=`expr $current + 1` 3357174832Sdes xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 3358174832Sdes verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 3359125647Sdes ;; 3360125647Sdes 3361125647Sdes freebsd-aout) 3362125647Sdes major=".$current" 3363125647Sdes versuffix=".$current.$revision"; 3364125647Sdes ;; 3365125647Sdes 3366125647Sdes freebsd-elf) 3367125647Sdes major=".$current" 3368125647Sdes versuffix=".$current"; 3369125647Sdes ;; 3370125647Sdes 3371125647Sdes irix | nonstopux) 3372174832Sdes if test "X$lt_irix_increment" = "Xno"; then 3373174832Sdes major=`expr $current - $age` 3374174832Sdes else 3375174832Sdes major=`expr $current - $age + 1` 3376174832Sdes fi 3377125647Sdes case $version_type in 3378125647Sdes nonstopux) verstring_prefix=nonstopux ;; 3379125647Sdes *) verstring_prefix=sgi ;; 3380125647Sdes esac 3381125647Sdes verstring="$verstring_prefix$major.$revision" 3382125647Sdes 3383117610Sdes # Add in all the interfaces that we are compatible with. 3384117610Sdes loop=$revision 3385141098Sdes while test "$loop" -ne 0; do 3386117610Sdes iface=`expr $revision - $loop` 3387117610Sdes loop=`expr $loop - 1` 3388125647Sdes verstring="$verstring_prefix$major.$iface:$verstring" 3389117610Sdes done 3390125647Sdes 3391125647Sdes # Before this point, $major must not contain `.'. 3392125647Sdes major=.$major 3393125647Sdes versuffix="$major.$revision" 3394117610Sdes ;; 3395117610Sdes 3396117610Sdes linux) 3397117610Sdes major=.`expr $current - $age` 3398117610Sdes versuffix="$major.$age.$revision" 3399117610Sdes ;; 3400117610Sdes 3401117610Sdes osf) 3402125647Sdes major=.`expr $current - $age` 3403117610Sdes versuffix=".$current.$age.$revision" 3404117610Sdes verstring="$current.$age.$revision" 3405117610Sdes 3406117610Sdes # Add in all the interfaces that we are compatible with. 3407117610Sdes loop=$age 3408141098Sdes while test "$loop" -ne 0; do 3409117610Sdes iface=`expr $current - $loop` 3410117610Sdes loop=`expr $loop - 1` 3411117610Sdes verstring="$verstring:${iface}.0" 3412117610Sdes done 3413117610Sdes 3414117610Sdes # Make executables depend on our current version. 3415117610Sdes verstring="$verstring:${current}.0" 3416117610Sdes ;; 3417117610Sdes 3418117610Sdes sunos) 3419117610Sdes major=".$current" 3420117610Sdes versuffix=".$current.$revision" 3421117610Sdes ;; 3422117610Sdes 3423117610Sdes windows) 3424125647Sdes # Use '-' rather than '.', since we only want one 3425125647Sdes # extension on DOS 8.3 filesystems. 3426117610Sdes major=`expr $current - $age` 3427125647Sdes versuffix="-$major" 3428117610Sdes ;; 3429117610Sdes 3430117610Sdes *) 3431117610Sdes $echo "$modename: unknown library version type \`$version_type'" 1>&2 3432141098Sdes $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 3433141098Sdes exit $EXIT_FAILURE 3434117610Sdes ;; 3435117610Sdes esac 3436117610Sdes 3437117610Sdes # Clear the version info if we defaulted, and they specified a release. 3438117610Sdes if test -z "$vinfo" && test -n "$release"; then 3439117610Sdes major= 3440125647Sdes case $version_type in 3441125647Sdes darwin) 3442125647Sdes # we can't check for "0.0" in archive_cmds due to quoting 3443125647Sdes # problems, so we reset it completely 3444141098Sdes verstring= 3445125647Sdes ;; 3446125647Sdes *) 3447125647Sdes verstring="0.0" 3448125647Sdes ;; 3449125647Sdes esac 3450117610Sdes if test "$need_version" = no; then 3451117610Sdes versuffix= 3452117610Sdes else 3453117610Sdes versuffix=".0.0" 3454117610Sdes fi 3455117610Sdes fi 3456117610Sdes 3457117610Sdes # Remove version info from name if versioning should be avoided 3458117610Sdes if test "$avoid_version" = yes && test "$need_version" = no; then 3459117610Sdes major= 3460117610Sdes versuffix= 3461117610Sdes verstring="" 3462117610Sdes fi 3463125647Sdes 3464117610Sdes # Check to see if the archive will have undefined symbols. 3465117610Sdes if test "$allow_undefined" = yes; then 3466117610Sdes if test "$allow_undefined_flag" = unsupported; then 3467117610Sdes $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 3468117610Sdes build_libtool_libs=no 3469117610Sdes build_old_libs=yes 3470117610Sdes fi 3471117610Sdes else 3472117610Sdes # Don't allow undefined symbols. 3473117610Sdes allow_undefined_flag="$no_undefined_flag" 3474117610Sdes fi 3475125647Sdes fi 3476117610Sdes 3477125647Sdes if test "$mode" != relink; then 3478141098Sdes # Remove our outputs, but don't remove object files since they 3479141098Sdes # may have been created when compiling PIC objects. 3480141098Sdes removelist= 3481141098Sdes tempremovelist=`$echo "$output_objdir/*"` 3482141098Sdes for p in $tempremovelist; do 3483141098Sdes case $p in 3484141098Sdes *.$objext) 3485141098Sdes ;; 3486141098Sdes $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 3487141098Sdes if test "X$precious_files_regex" != "X"; then 3488141098Sdes if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 3489141098Sdes then 3490141098Sdes continue 3491141098Sdes fi 3492141098Sdes fi 3493141098Sdes removelist="$removelist $p" 3494141098Sdes ;; 3495141098Sdes *) ;; 3496141098Sdes esac 3497141098Sdes done 3498141098Sdes if test -n "$removelist"; then 3499141098Sdes $show "${rm}r $removelist" 3500141098Sdes $run ${rm}r $removelist 3501141098Sdes fi 3502117610Sdes fi 3503117610Sdes 3504125647Sdes # Now set the variables for building old libraries. 3505125647Sdes if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 3506125647Sdes oldlibs="$oldlibs $output_objdir/$libname.$libext" 3507125647Sdes 3508125647Sdes # Transform .lo files to .o files. 3509125647Sdes oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3510125647Sdes fi 3511125647Sdes 3512125647Sdes # Eliminate all temporary directories. 3513174832Sdes #for path in $notinst_path; do 3514174832Sdes # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 3515174832Sdes # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 3516174832Sdes # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 3517174832Sdes #done 3518125647Sdes 3519125647Sdes if test -n "$xrpath"; then 3520117610Sdes # If the user specified any rpath flags, then add them. 3521125647Sdes temp_xrpath= 3522125647Sdes for libdir in $xrpath; do 3523125647Sdes temp_xrpath="$temp_xrpath -R$libdir" 3524117610Sdes case "$finalize_rpath " in 3525117610Sdes *" $libdir "*) ;; 3526117610Sdes *) finalize_rpath="$finalize_rpath $libdir" ;; 3527117610Sdes esac 3528117610Sdes done 3529141098Sdes if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 3530125647Sdes dependency_libs="$temp_xrpath $dependency_libs" 3531125647Sdes fi 3532117610Sdes fi 3533117610Sdes 3534125647Sdes # Make sure dlfiles contains only unique files that won't be dlpreopened 3535125647Sdes old_dlfiles="$dlfiles" 3536125647Sdes dlfiles= 3537125647Sdes for lib in $old_dlfiles; do 3538125647Sdes case " $dlprefiles $dlfiles " in 3539125647Sdes *" $lib "*) ;; 3540125647Sdes *) dlfiles="$dlfiles $lib" ;; 3541125647Sdes esac 3542117610Sdes done 3543117610Sdes 3544125647Sdes # Make sure dlprefiles contains only unique files 3545125647Sdes old_dlprefiles="$dlprefiles" 3546125647Sdes dlprefiles= 3547125647Sdes for lib in $old_dlprefiles; do 3548125647Sdes case "$dlprefiles " in 3549125647Sdes *" $lib "*) ;; 3550125647Sdes *) dlprefiles="$dlprefiles $lib" ;; 3551125647Sdes esac 3552125647Sdes done 3553125647Sdes 3554125647Sdes if test "$build_libtool_libs" = yes; then 3555125647Sdes if test -n "$rpath"; then 3556125647Sdes case $host in 3557125647Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 3558125647Sdes # these systems don't actually have a c library (as such)! 3559125647Sdes ;; 3560125647Sdes *-*-rhapsody* | *-*-darwin1.[012]) 3561125647Sdes # Rhapsody C library is in the System framework 3562125647Sdes deplibs="$deplibs -framework System" 3563125647Sdes ;; 3564125647Sdes *-*-netbsd*) 3565125647Sdes # Don't link with libc until the a.out ld.so is fixed. 3566125647Sdes ;; 3567147455Sdes *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3568125647Sdes # Do not include libc due to us having libc/libc_r. 3569125647Sdes ;; 3570174832Sdes *-*-sco3.2v5* | *-*-sco5v6*) 3571174832Sdes # Causes problems with __ctype 3572174832Sdes ;; 3573174832Sdes *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 3574174832Sdes # Compiler inserts libc in the correct place for threads to work 3575174832Sdes ;; 3576141098Sdes *) 3577125647Sdes # Add libc to deplibs on all other systems if necessary. 3578141098Sdes if test "$build_libtool_need_lc" = "yes"; then 3579125647Sdes deplibs="$deplibs -lc" 3580117610Sdes fi 3581125647Sdes ;; 3582117610Sdes esac 3583117610Sdes fi 3584117610Sdes 3585117610Sdes # Transform deplibs into only deplibs that can be linked in shared. 3586117610Sdes name_save=$name 3587117610Sdes libname_save=$libname 3588117610Sdes release_save=$release 3589117610Sdes versuffix_save=$versuffix 3590117610Sdes major_save=$major 3591117610Sdes # I'm not sure if I'm treating the release correctly. I think 3592117610Sdes # release should show up in the -l (ie -lgmp5) so we don't want to 3593117610Sdes # add it in twice. Is that correct? 3594117610Sdes release="" 3595117610Sdes versuffix="" 3596117610Sdes major="" 3597117610Sdes newdeplibs= 3598117610Sdes droppeddeps=no 3599125647Sdes case $deplibs_check_method in 3600117610Sdes pass_all) 3601117610Sdes # Don't check for shared/static. Everything works. 3602117610Sdes # This might be a little naive. We might want to check 3603117610Sdes # whether the library exists or not. But this is on 3604117610Sdes # osf3 & osf4 and I'm not really sure... Just 3605141098Sdes # implementing what was already the behavior. 3606117610Sdes newdeplibs=$deplibs 3607117610Sdes ;; 3608117610Sdes test_compile) 3609117610Sdes # This code stresses the "libraries are programs" paradigm to its 3610117610Sdes # limits. Maybe even breaks it. We compile a program, linking it 3611117610Sdes # against the deplibs as a proxy for the library. Then we can check 3612117610Sdes # whether they linked in statically or dynamically with ldd. 3613117610Sdes $rm conftest.c 3614117610Sdes cat > conftest.c <<EOF 3615117610Sdes int main() { return 0; } 3616117610SdesEOF 3617117610Sdes $rm conftest 3618174832Sdes if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 3619117610Sdes ldd_output=`ldd conftest` 3620117610Sdes for i in $deplibs; do 3621174832Sdes name=`expr $i : '-l\(.*\)'` 3622117610Sdes # If $name is empty we are operating on a -L argument. 3623174832Sdes if test "$name" != "" && test "$name" != "0"; then 3624141098Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3625141098Sdes case " $predeps $postdeps " in 3626141098Sdes *" $i "*) 3627141098Sdes newdeplibs="$newdeplibs $i" 3628141098Sdes i="" 3629141098Sdes ;; 3630141098Sdes esac 3631141098Sdes fi 3632141098Sdes if test -n "$i" ; then 3633141098Sdes libname=`eval \\$echo \"$libname_spec\"` 3634141098Sdes deplib_matches=`eval \\$echo \"$library_names_spec\"` 3635141098Sdes set dummy $deplib_matches 3636141098Sdes deplib_match=$2 3637141098Sdes if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3638141098Sdes newdeplibs="$newdeplibs $i" 3639141098Sdes else 3640141098Sdes droppeddeps=yes 3641141098Sdes $echo 3642141098Sdes $echo "*** Warning: dynamic linker does not accept needed library $i." 3643141098Sdes $echo "*** I have the capability to make that library automatically link in when" 3644141098Sdes $echo "*** you link to this library. But I can only do this if you have a" 3645141098Sdes $echo "*** shared version of the library, which I believe you do not have" 3646141098Sdes $echo "*** because a test_compile did reveal that the linker did not use it for" 3647141098Sdes $echo "*** its dynamic dependency list that programs get resolved with at runtime." 3648141098Sdes fi 3649117610Sdes fi 3650117610Sdes else 3651117610Sdes newdeplibs="$newdeplibs $i" 3652117610Sdes fi 3653117610Sdes done 3654117610Sdes else 3655141098Sdes # Error occurred in the first compile. Let's try to salvage 3656125647Sdes # the situation: Compile a separate program for each library. 3657117610Sdes for i in $deplibs; do 3658174832Sdes name=`expr $i : '-l\(.*\)'` 3659141098Sdes # If $name is empty we are operating on a -L argument. 3660141098Sdes if test "$name" != "" && test "$name" != "0"; then 3661117610Sdes $rm conftest 3662174832Sdes if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 3663117610Sdes ldd_output=`ldd conftest` 3664141098Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3665141098Sdes case " $predeps $postdeps " in 3666141098Sdes *" $i "*) 3667141098Sdes newdeplibs="$newdeplibs $i" 3668141098Sdes i="" 3669141098Sdes ;; 3670141098Sdes esac 3671117610Sdes fi 3672141098Sdes if test -n "$i" ; then 3673141098Sdes libname=`eval \\$echo \"$libname_spec\"` 3674141098Sdes deplib_matches=`eval \\$echo \"$library_names_spec\"` 3675141098Sdes set dummy $deplib_matches 3676141098Sdes deplib_match=$2 3677141098Sdes if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3678141098Sdes newdeplibs="$newdeplibs $i" 3679141098Sdes else 3680141098Sdes droppeddeps=yes 3681141098Sdes $echo 3682141098Sdes $echo "*** Warning: dynamic linker does not accept needed library $i." 3683141098Sdes $echo "*** I have the capability to make that library automatically link in when" 3684141098Sdes $echo "*** you link to this library. But I can only do this if you have a" 3685141098Sdes $echo "*** shared version of the library, which you do not appear to have" 3686141098Sdes $echo "*** because a test_compile did reveal that the linker did not use this one" 3687141098Sdes $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 3688141098Sdes fi 3689141098Sdes fi 3690117610Sdes else 3691117610Sdes droppeddeps=yes 3692141098Sdes $echo 3693141098Sdes $echo "*** Warning! Library $i is needed by this library but I was not able to" 3694174832Sdes $echo "*** make it link in! You will probably need to install it or some" 3695141098Sdes $echo "*** library that it depends on before this library will be fully" 3696141098Sdes $echo "*** functional. Installing it before continuing would be even better." 3697117610Sdes fi 3698117610Sdes else 3699117610Sdes newdeplibs="$newdeplibs $i" 3700117610Sdes fi 3701117610Sdes done 3702117610Sdes fi 3703117610Sdes ;; 3704117610Sdes file_magic*) 3705117610Sdes set dummy $deplibs_check_method 3706125647Sdes file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3707117610Sdes for a_deplib in $deplibs; do 3708174832Sdes name=`expr $a_deplib : '-l\(.*\)'` 3709117610Sdes # If $name is empty we are operating on a -L argument. 3710141098Sdes if test "$name" != "" && test "$name" != "0"; then 3711141098Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3712141098Sdes case " $predeps $postdeps " in 3713141098Sdes *" $a_deplib "*) 3714141098Sdes newdeplibs="$newdeplibs $a_deplib" 3715141098Sdes a_deplib="" 3716141098Sdes ;; 3717141098Sdes esac 3718141098Sdes fi 3719141098Sdes if test -n "$a_deplib" ; then 3720141098Sdes libname=`eval \\$echo \"$libname_spec\"` 3721141098Sdes for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3722141098Sdes potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3723141098Sdes for potent_lib in $potential_libs; do 3724117610Sdes # Follow soft links. 3725117610Sdes if ls -lLd "$potent_lib" 2>/dev/null \ 3726117610Sdes | grep " -> " >/dev/null; then 3727125647Sdes continue 3728117610Sdes fi 3729117610Sdes # The statement above tries to avoid entering an 3730117610Sdes # endless loop below, in case of cyclic links. 3731117610Sdes # We might still enter an endless loop, since a link 3732117610Sdes # loop can be closed while we follow links, 3733117610Sdes # but so what? 3734117610Sdes potlib="$potent_lib" 3735117610Sdes while test -h "$potlib" 2>/dev/null; do 3736125647Sdes potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 3737125647Sdes case $potliblink in 3738117610Sdes [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 3739117610Sdes *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 3740117610Sdes esac 3741117610Sdes done 3742117610Sdes if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 3743125647Sdes | ${SED} 10q \ 3744141098Sdes | $EGREP "$file_magic_regex" > /dev/null; then 3745117610Sdes newdeplibs="$newdeplibs $a_deplib" 3746117610Sdes a_deplib="" 3747117610Sdes break 2 3748117610Sdes fi 3749141098Sdes done 3750141098Sdes done 3751141098Sdes fi 3752117610Sdes if test -n "$a_deplib" ; then 3753117610Sdes droppeddeps=yes 3754141098Sdes $echo 3755141098Sdes $echo "*** Warning: linker path does not have real file for library $a_deplib." 3756141098Sdes $echo "*** I have the capability to make that library automatically link in when" 3757141098Sdes $echo "*** you link to this library. But I can only do this if you have a" 3758141098Sdes $echo "*** shared version of the library, which you do not appear to have" 3759141098Sdes $echo "*** because I did check the linker path looking for a file starting" 3760125647Sdes if test -z "$potlib" ; then 3761141098Sdes $echo "*** with $libname but no candidates were found. (...for file magic test)" 3762125647Sdes else 3763141098Sdes $echo "*** with $libname and none of the candidates passed a file format test" 3764141098Sdes $echo "*** using a file magic. Last file checked: $potlib" 3765125647Sdes fi 3766117610Sdes fi 3767117610Sdes else 3768117610Sdes # Add a -L argument. 3769117610Sdes newdeplibs="$newdeplibs $a_deplib" 3770117610Sdes fi 3771117610Sdes done # Gone through all deplibs. 3772117610Sdes ;; 3773125647Sdes match_pattern*) 3774125647Sdes set dummy $deplibs_check_method 3775125647Sdes match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3776125647Sdes for a_deplib in $deplibs; do 3777174832Sdes name=`expr $a_deplib : '-l\(.*\)'` 3778125647Sdes # If $name is empty we are operating on a -L argument. 3779125647Sdes if test -n "$name" && test "$name" != "0"; then 3780141098Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3781141098Sdes case " $predeps $postdeps " in 3782141098Sdes *" $a_deplib "*) 3783141098Sdes newdeplibs="$newdeplibs $a_deplib" 3784141098Sdes a_deplib="" 3785141098Sdes ;; 3786141098Sdes esac 3787141098Sdes fi 3788141098Sdes if test -n "$a_deplib" ; then 3789141098Sdes libname=`eval \\$echo \"$libname_spec\"` 3790141098Sdes for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3791141098Sdes potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3792141098Sdes for potent_lib in $potential_libs; do 3793141098Sdes potlib="$potent_lib" # see symlink-check above in file_magic test 3794141098Sdes if eval $echo \"$potent_lib\" 2>/dev/null \ 3795141098Sdes | ${SED} 10q \ 3796141098Sdes | $EGREP "$match_pattern_regex" > /dev/null; then 3797141098Sdes newdeplibs="$newdeplibs $a_deplib" 3798141098Sdes a_deplib="" 3799141098Sdes break 2 3800141098Sdes fi 3801141098Sdes done 3802125647Sdes done 3803141098Sdes fi 3804125647Sdes if test -n "$a_deplib" ; then 3805125647Sdes droppeddeps=yes 3806141098Sdes $echo 3807141098Sdes $echo "*** Warning: linker path does not have real file for library $a_deplib." 3808141098Sdes $echo "*** I have the capability to make that library automatically link in when" 3809141098Sdes $echo "*** you link to this library. But I can only do this if you have a" 3810141098Sdes $echo "*** shared version of the library, which you do not appear to have" 3811141098Sdes $echo "*** because I did check the linker path looking for a file starting" 3812125647Sdes if test -z "$potlib" ; then 3813141098Sdes $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 3814125647Sdes else 3815141098Sdes $echo "*** with $libname and none of the candidates passed a file format test" 3816141098Sdes $echo "*** using a regex pattern. Last file checked: $potlib" 3817125647Sdes fi 3818125647Sdes fi 3819125647Sdes else 3820125647Sdes # Add a -L argument. 3821125647Sdes newdeplibs="$newdeplibs $a_deplib" 3822125647Sdes fi 3823125647Sdes done # Gone through all deplibs. 3824125647Sdes ;; 3825117610Sdes none | unknown | *) 3826117610Sdes newdeplibs="" 3827141098Sdes tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 3828141098Sdes -e 's/ -[LR][^ ]*//g'` 3829141098Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3830141098Sdes for i in $predeps $postdeps ; do 3831141098Sdes # can't use Xsed below, because $i might contain '/' 3832141098Sdes tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 3833141098Sdes done 3834141098Sdes fi 3835141098Sdes if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 3836141098Sdes | grep . >/dev/null; then 3837141098Sdes $echo 3838117610Sdes if test "X$deplibs_check_method" = "Xnone"; then 3839141098Sdes $echo "*** Warning: inter-library dependencies are not supported in this platform." 3840117610Sdes else 3841141098Sdes $echo "*** Warning: inter-library dependencies are not known to be supported." 3842117610Sdes fi 3843141098Sdes $echo "*** All declared inter-library dependencies are being dropped." 3844117610Sdes droppeddeps=yes 3845117610Sdes fi 3846117610Sdes ;; 3847117610Sdes esac 3848117610Sdes versuffix=$versuffix_save 3849117610Sdes major=$major_save 3850117610Sdes release=$release_save 3851117610Sdes libname=$libname_save 3852117610Sdes name=$name_save 3853117610Sdes 3854125647Sdes case $host in 3855125647Sdes *-*-rhapsody* | *-*-darwin1.[012]) 3856125647Sdes # On Rhapsody replace the C library is the System framework 3857125647Sdes newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 3858125647Sdes ;; 3859125647Sdes esac 3860125647Sdes 3861117610Sdes if test "$droppeddeps" = yes; then 3862117610Sdes if test "$module" = yes; then 3863141098Sdes $echo 3864141098Sdes $echo "*** Warning: libtool could not satisfy all declared inter-library" 3865141098Sdes $echo "*** dependencies of module $libname. Therefore, libtool will create" 3866141098Sdes $echo "*** a static module, that should work as long as the dlopening" 3867141098Sdes $echo "*** application is linked with the -dlopen flag." 3868117610Sdes if test -z "$global_symbol_pipe"; then 3869141098Sdes $echo 3870141098Sdes $echo "*** However, this would only work if libtool was able to extract symbol" 3871141098Sdes $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 3872141098Sdes $echo "*** not find such a program. So, this module is probably useless." 3873141098Sdes $echo "*** \`nm' from GNU binutils and a full rebuild may help." 3874117610Sdes fi 3875117610Sdes if test "$build_old_libs" = no; then 3876117610Sdes oldlibs="$output_objdir/$libname.$libext" 3877117610Sdes build_libtool_libs=module 3878117610Sdes build_old_libs=yes 3879117610Sdes else 3880117610Sdes build_libtool_libs=no 3881117610Sdes fi 3882117610Sdes else 3883141098Sdes $echo "*** The inter-library dependencies that have been dropped here will be" 3884141098Sdes $echo "*** automatically added whenever a program is linked with this library" 3885141098Sdes $echo "*** or is declared to -dlopen it." 3886125647Sdes 3887141098Sdes if test "$allow_undefined" = no; then 3888141098Sdes $echo 3889141098Sdes $echo "*** Since this library must not contain undefined symbols," 3890141098Sdes $echo "*** because either the platform does not support them or" 3891141098Sdes $echo "*** it was explicitly requested with -no-undefined," 3892141098Sdes $echo "*** libtool will only create a static version of it." 3893125647Sdes if test "$build_old_libs" = no; then 3894125647Sdes oldlibs="$output_objdir/$libname.$libext" 3895125647Sdes build_libtool_libs=module 3896125647Sdes build_old_libs=yes 3897125647Sdes else 3898125647Sdes build_libtool_libs=no 3899125647Sdes fi 3900125647Sdes fi 3901117610Sdes fi 3902117610Sdes fi 3903117610Sdes # Done checking deplibs! 3904117610Sdes deplibs=$newdeplibs 3905117610Sdes fi 3906117610Sdes 3907174832Sdes 3908174832Sdes # move library search paths that coincide with paths to not yet 3909174832Sdes # installed libraries to the beginning of the library search list 3910174832Sdes new_libs= 3911174832Sdes for path in $notinst_path; do 3912174832Sdes case " $new_libs " in 3913174832Sdes *" -L$path/$objdir "*) ;; 3914174832Sdes *) 3915174832Sdes case " $deplibs " in 3916174832Sdes *" -L$path/$objdir "*) 3917174832Sdes new_libs="$new_libs -L$path/$objdir" ;; 3918174832Sdes esac 3919174832Sdes ;; 3920174832Sdes esac 3921174832Sdes done 3922174832Sdes for deplib in $deplibs; do 3923174832Sdes case $deplib in 3924174832Sdes -L*) 3925174832Sdes case " $new_libs " in 3926174832Sdes *" $deplib "*) ;; 3927174832Sdes *) new_libs="$new_libs $deplib" ;; 3928174832Sdes esac 3929174832Sdes ;; 3930174832Sdes *) new_libs="$new_libs $deplib" ;; 3931174832Sdes esac 3932174832Sdes done 3933174832Sdes deplibs="$new_libs" 3934174832Sdes 3935174832Sdes 3936117610Sdes # All the library-specific variables (install_libdir is set above). 3937117610Sdes library_names= 3938117610Sdes old_library= 3939117610Sdes dlname= 3940125647Sdes 3941117610Sdes # Test again, we may have decided not to build it any more 3942117610Sdes if test "$build_libtool_libs" = yes; then 3943141098Sdes if test "$hardcode_into_libs" = yes; then 3944125647Sdes # Hardcode the library paths 3945125647Sdes hardcode_libdirs= 3946125647Sdes dep_rpath= 3947125647Sdes rpath="$finalize_rpath" 3948125647Sdes test "$mode" != relink && rpath="$compile_rpath$rpath" 3949125647Sdes for libdir in $rpath; do 3950125647Sdes if test -n "$hardcode_libdir_flag_spec"; then 3951125647Sdes if test -n "$hardcode_libdir_separator"; then 3952125647Sdes if test -z "$hardcode_libdirs"; then 3953125647Sdes hardcode_libdirs="$libdir" 3954125647Sdes else 3955125647Sdes # Just accumulate the unique libdirs. 3956125647Sdes case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3957125647Sdes *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3958125647Sdes ;; 3959125647Sdes *) 3960125647Sdes hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3961125647Sdes ;; 3962125647Sdes esac 3963125647Sdes fi 3964125647Sdes else 3965125647Sdes eval flag=\"$hardcode_libdir_flag_spec\" 3966125647Sdes dep_rpath="$dep_rpath $flag" 3967125647Sdes fi 3968125647Sdes elif test -n "$runpath_var"; then 3969125647Sdes case "$perm_rpath " in 3970125647Sdes *" $libdir "*) ;; 3971125647Sdes *) perm_rpath="$perm_rpath $libdir" ;; 3972125647Sdes esac 3973125647Sdes fi 3974125647Sdes done 3975125647Sdes # Substitute the hardcoded libdirs into the rpath. 3976125647Sdes if test -n "$hardcode_libdir_separator" && 3977125647Sdes test -n "$hardcode_libdirs"; then 3978125647Sdes libdir="$hardcode_libdirs" 3979141098Sdes if test -n "$hardcode_libdir_flag_spec_ld"; then 3980174832Sdes case $archive_cmds in 3981174832Sdes *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 3982174832Sdes *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 3983174832Sdes esac 3984141098Sdes else 3985141098Sdes eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3986141098Sdes fi 3987125647Sdes fi 3988125647Sdes if test -n "$runpath_var" && test -n "$perm_rpath"; then 3989125647Sdes # We should set the runpath_var. 3990125647Sdes rpath= 3991125647Sdes for dir in $perm_rpath; do 3992125647Sdes rpath="$rpath$dir:" 3993125647Sdes done 3994125647Sdes eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3995125647Sdes fi 3996125647Sdes test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3997125647Sdes fi 3998125647Sdes 3999125647Sdes shlibpath="$finalize_shlibpath" 4000125647Sdes test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 4001125647Sdes if test -n "$shlibpath"; then 4002125647Sdes eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 4003125647Sdes fi 4004125647Sdes 4005117610Sdes # Get the real and link names of the library. 4006141098Sdes eval shared_ext=\"$shrext_cmds\" 4007117610Sdes eval library_names=\"$library_names_spec\" 4008117610Sdes set dummy $library_names 4009117610Sdes realname="$2" 4010117610Sdes shift; shift 4011117610Sdes 4012117610Sdes if test -n "$soname_spec"; then 4013117610Sdes eval soname=\"$soname_spec\" 4014117610Sdes else 4015117610Sdes soname="$realname" 4016117610Sdes fi 4017141098Sdes if test -z "$dlname"; then 4018141098Sdes dlname=$soname 4019141098Sdes fi 4020117610Sdes 4021117610Sdes lib="$output_objdir/$realname" 4022174832Sdes linknames= 4023117610Sdes for link 4024117610Sdes do 4025117610Sdes linknames="$linknames $link" 4026117610Sdes done 4027117610Sdes 4028117610Sdes # Use standard objects if they are pic 4029117610Sdes test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4030117610Sdes 4031117610Sdes # Prepare the list of exported symbols 4032117610Sdes if test -z "$export_symbols"; then 4033117610Sdes if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 4034117610Sdes $show "generating symbol list for \`$libname.la'" 4035117610Sdes export_symbols="$output_objdir/$libname.exp" 4036117610Sdes $run $rm $export_symbols 4037141098Sdes cmds=$export_symbols_cmds 4038125647Sdes save_ifs="$IFS"; IFS='~' 4039117610Sdes for cmd in $cmds; do 4040117610Sdes IFS="$save_ifs" 4041141098Sdes eval cmd=\"$cmd\" 4042141098Sdes if len=`expr "X$cmd" : ".*"` && 4043141098Sdes test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4044141098Sdes $show "$cmd" 4045141098Sdes $run eval "$cmd" || exit $? 4046141098Sdes skipped_export=false 4047141098Sdes else 4048141098Sdes # The command line is too long to execute in one step. 4049141098Sdes $show "using reloadable object file for export list..." 4050141098Sdes skipped_export=: 4051174832Sdes # Break out early, otherwise skipped_export may be 4052174832Sdes # set to false by a later but shorter cmd. 4053174832Sdes break 4054141098Sdes fi 4055117610Sdes done 4056117610Sdes IFS="$save_ifs" 4057117610Sdes if test -n "$export_symbols_regex"; then 4058141098Sdes $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 4059141098Sdes $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 4060117610Sdes $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 4061117610Sdes $run eval '$mv "${export_symbols}T" "$export_symbols"' 4062117610Sdes fi 4063117610Sdes fi 4064117610Sdes fi 4065117610Sdes 4066117610Sdes if test -n "$export_symbols" && test -n "$include_expsyms"; then 4067117610Sdes $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 4068117610Sdes fi 4069117610Sdes 4070141098Sdes tmp_deplibs= 4071141098Sdes for test_deplib in $deplibs; do 4072141098Sdes case " $convenience " in 4073141098Sdes *" $test_deplib "*) ;; 4074141098Sdes *) 4075141098Sdes tmp_deplibs="$tmp_deplibs $test_deplib" 4076141098Sdes ;; 4077141098Sdes esac 4078141098Sdes done 4079141098Sdes deplibs="$tmp_deplibs" 4080141098Sdes 4081117610Sdes if test -n "$convenience"; then 4082117610Sdes if test -n "$whole_archive_flag_spec"; then 4083141098Sdes save_libobjs=$libobjs 4084117610Sdes eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4085117610Sdes else 4086117610Sdes gentop="$output_objdir/${outputname}x" 4087117610Sdes generated="$generated $gentop" 4088117610Sdes 4089141098Sdes func_extract_archives $gentop $convenience 4090141098Sdes libobjs="$libobjs $func_extract_archives_result" 4091117610Sdes fi 4092117610Sdes fi 4093141098Sdes 4094117610Sdes if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 4095117610Sdes eval flag=\"$thread_safe_flag_spec\" 4096125647Sdes linker_flags="$linker_flags $flag" 4097117610Sdes fi 4098117610Sdes 4099125647Sdes # Make a backup of the uninstalled library when relinking 4100125647Sdes if test "$mode" = relink; then 4101125647Sdes $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 4102125647Sdes fi 4103125647Sdes 4104117610Sdes # Do each of the archive commands. 4105141098Sdes if test "$module" = yes && test -n "$module_cmds" ; then 4106141098Sdes if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4107141098Sdes eval test_cmds=\"$module_expsym_cmds\" 4108141098Sdes cmds=$module_expsym_cmds 4109141098Sdes else 4110141098Sdes eval test_cmds=\"$module_cmds\" 4111141098Sdes cmds=$module_cmds 4112141098Sdes fi 4113141098Sdes else 4114117610Sdes if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4115141098Sdes eval test_cmds=\"$archive_expsym_cmds\" 4116141098Sdes cmds=$archive_expsym_cmds 4117117610Sdes else 4118141098Sdes eval test_cmds=\"$archive_cmds\" 4119141098Sdes cmds=$archive_cmds 4120141098Sdes fi 4121141098Sdes fi 4122141098Sdes 4123174832Sdes if test "X$skipped_export" != "X:" && 4124174832Sdes len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4125141098Sdes test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4126141098Sdes : 4127141098Sdes else 4128141098Sdes # The command line is too long to link in one step, link piecewise. 4129141098Sdes $echo "creating reloadable object files..." 4130141098Sdes 4131141098Sdes # Save the value of $output and $libobjs because we want to 4132141098Sdes # use them later. If we have whole_archive_flag_spec, we 4133141098Sdes # want to use save_libobjs as it was before 4134141098Sdes # whole_archive_flag_spec was expanded, because we can't 4135141098Sdes # assume the linker understands whole_archive_flag_spec. 4136141098Sdes # This may have to be revisited, in case too many 4137141098Sdes # convenience libraries get linked in and end up exceeding 4138141098Sdes # the spec. 4139141098Sdes if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4140141098Sdes save_libobjs=$libobjs 4141141098Sdes fi 4142141098Sdes save_output=$output 4143147455Sdes output_la=`$echo "X$output" | $Xsed -e "$basename"` 4144141098Sdes 4145141098Sdes # Clear the reloadable object creation command queue and 4146141098Sdes # initialize k to one. 4147141098Sdes test_cmds= 4148141098Sdes concat_cmds= 4149141098Sdes objlist= 4150141098Sdes delfiles= 4151141098Sdes last_robj= 4152141098Sdes k=1 4153147455Sdes output=$output_objdir/$output_la-${k}.$objext 4154141098Sdes # Loop over the list of objects to be linked. 4155141098Sdes for obj in $save_libobjs 4156141098Sdes do 4157141098Sdes eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4158141098Sdes if test "X$objlist" = X || 4159174832Sdes { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4160141098Sdes test "$len" -le "$max_cmd_len"; }; then 4161141098Sdes objlist="$objlist $obj" 4162141098Sdes else 4163141098Sdes # The command $test_cmds is almost too long, add a 4164141098Sdes # command to the queue. 4165141098Sdes if test "$k" -eq 1 ; then 4166141098Sdes # The first file doesn't have a previous command to add. 4167141098Sdes eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 4168141098Sdes else 4169141098Sdes # All subsequent reloadable object files will link in 4170141098Sdes # the last one created. 4171141098Sdes eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4172125647Sdes fi 4173147455Sdes last_robj=$output_objdir/$output_la-${k}.$objext 4174141098Sdes k=`expr $k + 1` 4175147455Sdes output=$output_objdir/$output_la-${k}.$objext 4176141098Sdes objlist=$obj 4177141098Sdes len=1 4178141098Sdes fi 4179125647Sdes done 4180141098Sdes # Handle the remaining objects by creating one last 4181141098Sdes # reloadable object file. All subsequent reloadable object 4182141098Sdes # files will link in the last one created. 4183141098Sdes test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4184141098Sdes eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 4185141098Sdes 4186141098Sdes if ${skipped_export-false}; then 4187141098Sdes $show "generating symbol list for \`$libname.la'" 4188141098Sdes export_symbols="$output_objdir/$libname.exp" 4189141098Sdes $run $rm $export_symbols 4190141098Sdes libobjs=$output 4191141098Sdes # Append the command to create the export file. 4192141098Sdes eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4193141098Sdes fi 4194141098Sdes 4195147455Sdes # Set up a command to remove the reloadable object files 4196141098Sdes # after they are used. 4197141098Sdes i=0 4198141098Sdes while test "$i" -lt "$k" 4199141098Sdes do 4200141098Sdes i=`expr $i + 1` 4201147455Sdes delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 4202141098Sdes done 4203141098Sdes 4204141098Sdes $echo "creating a temporary reloadable object file: $output" 4205141098Sdes 4206141098Sdes # Loop through the commands generated above and execute them. 4207141098Sdes save_ifs="$IFS"; IFS='~' 4208141098Sdes for cmd in $concat_cmds; do 4209141098Sdes IFS="$save_ifs" 4210141098Sdes $show "$cmd" 4211141098Sdes $run eval "$cmd" || exit $? 4212141098Sdes done 4213141098Sdes IFS="$save_ifs" 4214141098Sdes 4215141098Sdes libobjs=$output 4216141098Sdes # Restore the value of output. 4217141098Sdes output=$save_output 4218141098Sdes 4219141098Sdes if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 4220141098Sdes eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4221141098Sdes fi 4222141098Sdes # Expand the library linking commands again to reset the 4223141098Sdes # value of $libobjs for piecewise linking. 4224141098Sdes 4225141098Sdes # Do each of the archive commands. 4226141098Sdes if test "$module" = yes && test -n "$module_cmds" ; then 4227141098Sdes if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4228141098Sdes cmds=$module_expsym_cmds 4229141098Sdes else 4230141098Sdes cmds=$module_cmds 4231141098Sdes fi 4232141098Sdes else 4233141098Sdes if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4234141098Sdes cmds=$archive_expsym_cmds 4235141098Sdes else 4236141098Sdes cmds=$archive_cmds 4237141098Sdes fi 4238141098Sdes fi 4239141098Sdes 4240141098Sdes # Append the command to remove the reloadable object files 4241141098Sdes # to the just-reset $cmds. 4242141098Sdes eval cmds=\"\$cmds~\$rm $delfiles\" 4243117610Sdes fi 4244125647Sdes save_ifs="$IFS"; IFS='~' 4245117610Sdes for cmd in $cmds; do 4246117610Sdes IFS="$save_ifs" 4247141098Sdes eval cmd=\"$cmd\" 4248117610Sdes $show "$cmd" 4249174832Sdes $run eval "$cmd" || { 4250174832Sdes lt_exit=$? 4251174832Sdes 4252174832Sdes # Restore the uninstalled library and exit 4253174832Sdes if test "$mode" = relink; then 4254174832Sdes $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 4255174832Sdes fi 4256174832Sdes 4257174832Sdes exit $lt_exit 4258174832Sdes } 4259117610Sdes done 4260117610Sdes IFS="$save_ifs" 4261117610Sdes 4262125647Sdes # Restore the uninstalled library and exit 4263125647Sdes if test "$mode" = relink; then 4264125647Sdes $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4265174832Sdes 4266174832Sdes if test -n "$convenience"; then 4267174832Sdes if test -z "$whole_archive_flag_spec"; then 4268174832Sdes $show "${rm}r $gentop" 4269174832Sdes $run ${rm}r "$gentop" 4270174832Sdes fi 4271174832Sdes fi 4272174832Sdes 4273141098Sdes exit $EXIT_SUCCESS 4274125647Sdes fi 4275125647Sdes 4276117610Sdes # Create links to the real library. 4277117610Sdes for linkname in $linknames; do 4278117610Sdes if test "$realname" != "$linkname"; then 4279117610Sdes $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 4280117610Sdes $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 4281117610Sdes fi 4282117610Sdes done 4283117610Sdes 4284117610Sdes # If -module or -export-dynamic was specified, set the dlname. 4285117610Sdes if test "$module" = yes || test "$export_dynamic" = yes; then 4286117610Sdes # On all known operating systems, these are identical. 4287117610Sdes dlname="$soname" 4288117610Sdes fi 4289117610Sdes fi 4290117610Sdes ;; 4291117610Sdes 4292125647Sdes obj) 4293117610Sdes if test -n "$deplibs"; then 4294117610Sdes $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 4295117610Sdes fi 4296117610Sdes 4297117610Sdes if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4298117610Sdes $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 4299117610Sdes fi 4300117610Sdes 4301117610Sdes if test -n "$rpath"; then 4302117610Sdes $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 4303117610Sdes fi 4304117610Sdes 4305117610Sdes if test -n "$xrpath"; then 4306117610Sdes $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 4307117610Sdes fi 4308117610Sdes 4309117610Sdes if test -n "$vinfo"; then 4310117610Sdes $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 4311117610Sdes fi 4312117610Sdes 4313117610Sdes if test -n "$release"; then 4314117610Sdes $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 4315117610Sdes fi 4316117610Sdes 4317125647Sdes case $output in 4318117610Sdes *.lo) 4319125647Sdes if test -n "$objs$old_deplibs"; then 4320117610Sdes $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 4321141098Sdes exit $EXIT_FAILURE 4322117610Sdes fi 4323117610Sdes libobj="$output" 4324117610Sdes obj=`$echo "X$output" | $Xsed -e "$lo2o"` 4325117610Sdes ;; 4326117610Sdes *) 4327117610Sdes libobj= 4328117610Sdes obj="$output" 4329117610Sdes ;; 4330117610Sdes esac 4331117610Sdes 4332117610Sdes # Delete the old objects. 4333117610Sdes $run $rm $obj $libobj 4334117610Sdes 4335117610Sdes # Objects from convenience libraries. This assumes 4336117610Sdes # single-version convenience libraries. Whenever we create 4337117610Sdes # different ones for PIC/non-PIC, this we'll have to duplicate 4338117610Sdes # the extraction. 4339117610Sdes reload_conv_objs= 4340117610Sdes gentop= 4341117610Sdes # reload_cmds runs $LD directly, so let us get rid of 4342174832Sdes # -Wl from whole_archive_flag_spec and hope we can get by with 4343174832Sdes # turning comma into space.. 4344125647Sdes wl= 4345117610Sdes 4346117610Sdes if test -n "$convenience"; then 4347117610Sdes if test -n "$whole_archive_flag_spec"; then 4348174832Sdes eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 4349174832Sdes reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 4350117610Sdes else 4351117610Sdes gentop="$output_objdir/${obj}x" 4352117610Sdes generated="$generated $gentop" 4353117610Sdes 4354141098Sdes func_extract_archives $gentop $convenience 4355141098Sdes reload_conv_objs="$reload_objs $func_extract_archives_result" 4356117610Sdes fi 4357117610Sdes fi 4358117610Sdes 4359117610Sdes # Create the old-style object. 4360125647Sdes 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 4361117610Sdes 4362117610Sdes output="$obj" 4363141098Sdes cmds=$reload_cmds 4364125647Sdes save_ifs="$IFS"; IFS='~' 4365117610Sdes for cmd in $cmds; do 4366117610Sdes IFS="$save_ifs" 4367141098Sdes eval cmd=\"$cmd\" 4368117610Sdes $show "$cmd" 4369117610Sdes $run eval "$cmd" || exit $? 4370117610Sdes done 4371117610Sdes IFS="$save_ifs" 4372117610Sdes 4373117610Sdes # Exit if we aren't doing a library object file. 4374117610Sdes if test -z "$libobj"; then 4375117610Sdes if test -n "$gentop"; then 4376117610Sdes $show "${rm}r $gentop" 4377117610Sdes $run ${rm}r $gentop 4378117610Sdes fi 4379117610Sdes 4380141098Sdes exit $EXIT_SUCCESS 4381117610Sdes fi 4382117610Sdes 4383117610Sdes if test "$build_libtool_libs" != yes; then 4384117610Sdes if test -n "$gentop"; then 4385117610Sdes $show "${rm}r $gentop" 4386117610Sdes $run ${rm}r $gentop 4387117610Sdes fi 4388117610Sdes 4389117610Sdes # Create an invalid libtool object if no PIC, so that we don't 4390117610Sdes # accidentally link it into a program. 4391141098Sdes # $show "echo timestamp > $libobj" 4392141098Sdes # $run eval "echo timestamp > $libobj" || exit $? 4393141098Sdes exit $EXIT_SUCCESS 4394117610Sdes fi 4395117610Sdes 4396125647Sdes if test -n "$pic_flag" || test "$pic_mode" != default; then 4397117610Sdes # Only do commands if we really have different PIC objects. 4398117610Sdes reload_objs="$libobjs $reload_conv_objs" 4399117610Sdes output="$libobj" 4400141098Sdes cmds=$reload_cmds 4401125647Sdes save_ifs="$IFS"; IFS='~' 4402117610Sdes for cmd in $cmds; do 4403117610Sdes IFS="$save_ifs" 4404141098Sdes eval cmd=\"$cmd\" 4405117610Sdes $show "$cmd" 4406117610Sdes $run eval "$cmd" || exit $? 4407117610Sdes done 4408117610Sdes IFS="$save_ifs" 4409117610Sdes fi 4410117610Sdes 4411117610Sdes if test -n "$gentop"; then 4412117610Sdes $show "${rm}r $gentop" 4413117610Sdes $run ${rm}r $gentop 4414117610Sdes fi 4415117610Sdes 4416141098Sdes exit $EXIT_SUCCESS 4417117610Sdes ;; 4418117610Sdes 4419125647Sdes prog) 4420125647Sdes case $host in 4421141098Sdes *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 4422125647Sdes esac 4423117610Sdes if test -n "$vinfo"; then 4424117610Sdes $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 4425117610Sdes fi 4426117610Sdes 4427117610Sdes if test -n "$release"; then 4428117610Sdes $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 4429117610Sdes fi 4430117610Sdes 4431117610Sdes if test "$preload" = yes; then 4432125647Sdes if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 4433117610Sdes test "$dlopen_self_static" = unknown; then 4434117610Sdes $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 4435125647Sdes fi 4436117610Sdes fi 4437125647Sdes 4438125647Sdes case $host in 4439125647Sdes *-*-rhapsody* | *-*-darwin1.[012]) 4440125647Sdes # On Rhapsody replace the C library is the System framework 4441125647Sdes compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4442125647Sdes finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4443125647Sdes ;; 4444125647Sdes esac 4445125647Sdes 4446141098Sdes case $host in 4447141098Sdes *darwin*) 4448141098Sdes # Don't allow lazy linking, it breaks C++ global constructors 4449141098Sdes if test "$tagname" = CXX ; then 4450141098Sdes compile_command="$compile_command ${wl}-bind_at_load" 4451141098Sdes finalize_command="$finalize_command ${wl}-bind_at_load" 4452141098Sdes fi 4453141098Sdes ;; 4454141098Sdes esac 4455141098Sdes 4456174832Sdes 4457174832Sdes # move library search paths that coincide with paths to not yet 4458174832Sdes # installed libraries to the beginning of the library search list 4459174832Sdes new_libs= 4460174832Sdes for path in $notinst_path; do 4461174832Sdes case " $new_libs " in 4462174832Sdes *" -L$path/$objdir "*) ;; 4463174832Sdes *) 4464174832Sdes case " $compile_deplibs " in 4465174832Sdes *" -L$path/$objdir "*) 4466174832Sdes new_libs="$new_libs -L$path/$objdir" ;; 4467174832Sdes esac 4468174832Sdes ;; 4469174832Sdes esac 4470174832Sdes done 4471174832Sdes for deplib in $compile_deplibs; do 4472174832Sdes case $deplib in 4473174832Sdes -L*) 4474174832Sdes case " $new_libs " in 4475174832Sdes *" $deplib "*) ;; 4476174832Sdes *) new_libs="$new_libs $deplib" ;; 4477174832Sdes esac 4478174832Sdes ;; 4479174832Sdes *) new_libs="$new_libs $deplib" ;; 4480174832Sdes esac 4481174832Sdes done 4482174832Sdes compile_deplibs="$new_libs" 4483174832Sdes 4484174832Sdes 4485125647Sdes compile_command="$compile_command $compile_deplibs" 4486125647Sdes finalize_command="$finalize_command $finalize_deplibs" 4487125647Sdes 4488117610Sdes if test -n "$rpath$xrpath"; then 4489117610Sdes # If the user specified any rpath flags, then add them. 4490117610Sdes for libdir in $rpath $xrpath; do 4491117610Sdes # This is the magic to use -rpath. 4492117610Sdes case "$finalize_rpath " in 4493117610Sdes *" $libdir "*) ;; 4494117610Sdes *) finalize_rpath="$finalize_rpath $libdir" ;; 4495117610Sdes esac 4496117610Sdes done 4497117610Sdes fi 4498117610Sdes 4499117610Sdes # Now hardcode the library paths 4500117610Sdes rpath= 4501117610Sdes hardcode_libdirs= 4502117610Sdes for libdir in $compile_rpath $finalize_rpath; do 4503117610Sdes if test -n "$hardcode_libdir_flag_spec"; then 4504117610Sdes if test -n "$hardcode_libdir_separator"; then 4505117610Sdes if test -z "$hardcode_libdirs"; then 4506117610Sdes hardcode_libdirs="$libdir" 4507117610Sdes else 4508117610Sdes # Just accumulate the unique libdirs. 4509125647Sdes case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4510117610Sdes *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4511117610Sdes ;; 4512117610Sdes *) 4513117610Sdes hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4514117610Sdes ;; 4515117610Sdes esac 4516117610Sdes fi 4517117610Sdes else 4518117610Sdes eval flag=\"$hardcode_libdir_flag_spec\" 4519117610Sdes rpath="$rpath $flag" 4520117610Sdes fi 4521117610Sdes elif test -n "$runpath_var"; then 4522117610Sdes case "$perm_rpath " in 4523117610Sdes *" $libdir "*) ;; 4524117610Sdes *) perm_rpath="$perm_rpath $libdir" ;; 4525117610Sdes esac 4526117610Sdes fi 4527125647Sdes case $host in 4528125647Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4529174832Sdes testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 4530125647Sdes case :$dllsearchpath: in 4531125647Sdes *":$libdir:"*) ;; 4532125647Sdes *) dllsearchpath="$dllsearchpath:$libdir";; 4533125647Sdes esac 4534174832Sdes case :$dllsearchpath: in 4535174832Sdes *":$testbindir:"*) ;; 4536174832Sdes *) dllsearchpath="$dllsearchpath:$testbindir";; 4537174832Sdes esac 4538125647Sdes ;; 4539125647Sdes esac 4540117610Sdes done 4541117610Sdes # Substitute the hardcoded libdirs into the rpath. 4542117610Sdes if test -n "$hardcode_libdir_separator" && 4543117610Sdes test -n "$hardcode_libdirs"; then 4544117610Sdes libdir="$hardcode_libdirs" 4545117610Sdes eval rpath=\" $hardcode_libdir_flag_spec\" 4546117610Sdes fi 4547117610Sdes compile_rpath="$rpath" 4548117610Sdes 4549117610Sdes rpath= 4550117610Sdes hardcode_libdirs= 4551117610Sdes for libdir in $finalize_rpath; do 4552117610Sdes if test -n "$hardcode_libdir_flag_spec"; then 4553117610Sdes if test -n "$hardcode_libdir_separator"; then 4554117610Sdes if test -z "$hardcode_libdirs"; then 4555117610Sdes hardcode_libdirs="$libdir" 4556117610Sdes else 4557117610Sdes # Just accumulate the unique libdirs. 4558125647Sdes case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4559117610Sdes *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4560117610Sdes ;; 4561117610Sdes *) 4562117610Sdes hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4563117610Sdes ;; 4564117610Sdes esac 4565117610Sdes fi 4566117610Sdes else 4567117610Sdes eval flag=\"$hardcode_libdir_flag_spec\" 4568117610Sdes rpath="$rpath $flag" 4569117610Sdes fi 4570117610Sdes elif test -n "$runpath_var"; then 4571117610Sdes case "$finalize_perm_rpath " in 4572117610Sdes *" $libdir "*) ;; 4573117610Sdes *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 4574117610Sdes esac 4575117610Sdes fi 4576117610Sdes done 4577117610Sdes # Substitute the hardcoded libdirs into the rpath. 4578117610Sdes if test -n "$hardcode_libdir_separator" && 4579117610Sdes test -n "$hardcode_libdirs"; then 4580117610Sdes libdir="$hardcode_libdirs" 4581117610Sdes eval rpath=\" $hardcode_libdir_flag_spec\" 4582117610Sdes fi 4583117610Sdes finalize_rpath="$rpath" 4584117610Sdes 4585117610Sdes if test -n "$libobjs" && test "$build_old_libs" = yes; then 4586117610Sdes # Transform all the library objects into standard objects. 4587117610Sdes compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4588117610Sdes finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4589117610Sdes fi 4590117610Sdes 4591117610Sdes dlsyms= 4592117610Sdes if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4593117610Sdes if test -n "$NM" && test -n "$global_symbol_pipe"; then 4594117610Sdes dlsyms="${outputname}S.c" 4595117610Sdes else 4596117610Sdes $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 4597117610Sdes fi 4598117610Sdes fi 4599117610Sdes 4600117610Sdes if test -n "$dlsyms"; then 4601125647Sdes case $dlsyms in 4602117610Sdes "") ;; 4603117610Sdes *.c) 4604117610Sdes # Discover the nlist of each of the dlfiles. 4605117610Sdes nlist="$output_objdir/${outputname}.nm" 4606117610Sdes 4607117610Sdes $show "$rm $nlist ${nlist}S ${nlist}T" 4608117610Sdes $run $rm "$nlist" "${nlist}S" "${nlist}T" 4609117610Sdes 4610117610Sdes # Parse the name list into a source file. 4611117610Sdes $show "creating $output_objdir/$dlsyms" 4612117610Sdes 4613117610Sdes test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 4614117610Sdes/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 4615117610Sdes/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 4616117610Sdes 4617117610Sdes#ifdef __cplusplus 4618117610Sdesextern \"C\" { 4619117610Sdes#endif 4620117610Sdes 4621117610Sdes/* Prevent the only kind of declaration conflicts we can make. */ 4622117610Sdes#define lt_preloaded_symbols some_other_symbol 4623117610Sdes 4624117610Sdes/* External symbol declarations for the compiler. */\ 4625117610Sdes" 4626117610Sdes 4627117610Sdes if test "$dlself" = yes; then 4628117610Sdes $show "generating symbol list for \`$output'" 4629117610Sdes 4630117610Sdes test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 4631117610Sdes 4632117610Sdes # Add our own program objects to the symbol list. 4633125647Sdes progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4634117610Sdes for arg in $progfiles; do 4635117610Sdes $show "extracting global C symbols from \`$arg'" 4636117610Sdes $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4637117610Sdes done 4638117610Sdes 4639117610Sdes if test -n "$exclude_expsyms"; then 4640141098Sdes $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4641117610Sdes $run eval '$mv "$nlist"T "$nlist"' 4642117610Sdes fi 4643125647Sdes 4644117610Sdes if test -n "$export_symbols_regex"; then 4645141098Sdes $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4646117610Sdes $run eval '$mv "$nlist"T "$nlist"' 4647117610Sdes fi 4648117610Sdes 4649117610Sdes # Prepare the list of exported symbols 4650117610Sdes if test -z "$export_symbols"; then 4651147455Sdes export_symbols="$output_objdir/$outputname.exp" 4652117610Sdes $run $rm $export_symbols 4653174832Sdes $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4654174832Sdes case $host in 4655174832Sdes *cygwin* | *mingw* ) 4656174832Sdes $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4657174832Sdes $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4658174832Sdes ;; 4659174832Sdes esac 4660117610Sdes else 4661174832Sdes $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4662147455Sdes $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4663117610Sdes $run eval 'mv "$nlist"T "$nlist"' 4664174832Sdes case $host in 4665174832Sdes *cygwin* | *mingw* ) 4666174832Sdes $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4667174832Sdes $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4668174832Sdes ;; 4669174832Sdes esac 4670117610Sdes fi 4671117610Sdes fi 4672117610Sdes 4673117610Sdes for arg in $dlprefiles; do 4674117610Sdes $show "extracting global C symbols from \`$arg'" 4675141098Sdes name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 4676141098Sdes $run eval '$echo ": $name " >> "$nlist"' 4677117610Sdes $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4678117610Sdes done 4679117610Sdes 4680117610Sdes if test -z "$run"; then 4681117610Sdes # Make sure we have at least an empty file. 4682117610Sdes test -f "$nlist" || : > "$nlist" 4683117610Sdes 4684117610Sdes if test -n "$exclude_expsyms"; then 4685141098Sdes $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4686117610Sdes $mv "$nlist"T "$nlist" 4687117610Sdes fi 4688117610Sdes 4689117610Sdes # Try sorting and uniquifying the output. 4690125647Sdes if grep -v "^: " < "$nlist" | 4691125647Sdes if sort -k 3 </dev/null >/dev/null 2>&1; then 4692125647Sdes sort -k 3 4693125647Sdes else 4694125647Sdes sort +2 4695125647Sdes fi | 4696125647Sdes uniq > "$nlist"S; then 4697117610Sdes : 4698117610Sdes else 4699117610Sdes grep -v "^: " < "$nlist" > "$nlist"S 4700117610Sdes fi 4701117610Sdes 4702117610Sdes if test -f "$nlist"S; then 4703117610Sdes eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 4704117610Sdes else 4705141098Sdes $echo '/* NONE */' >> "$output_objdir/$dlsyms" 4706117610Sdes fi 4707117610Sdes 4708117610Sdes $echo >> "$output_objdir/$dlsyms" "\ 4709117610Sdes 4710117610Sdes#undef lt_preloaded_symbols 4711117610Sdes 4712117610Sdes#if defined (__STDC__) && __STDC__ 4713125647Sdes# define lt_ptr void * 4714117610Sdes#else 4715125647Sdes# define lt_ptr char * 4716117610Sdes# define const 4717117610Sdes#endif 4718117610Sdes 4719117610Sdes/* The mapping between symbol names and symbols. */ 4720147455Sdes" 4721147455Sdes 4722147455Sdes case $host in 4723147455Sdes *cygwin* | *mingw* ) 4724147455Sdes $echo >> "$output_objdir/$dlsyms" "\ 4725147455Sdes/* DATA imports from DLLs on WIN32 can't be const, because 4726147455Sdes runtime relocations are performed -- see ld's documentation 4727147455Sdes on pseudo-relocs */ 4728147455Sdesstruct { 4729147455Sdes" 4730147455Sdes ;; 4731147455Sdes * ) 4732147455Sdes $echo >> "$output_objdir/$dlsyms" "\ 4733117610Sdesconst struct { 4734147455Sdes" 4735147455Sdes ;; 4736147455Sdes esac 4737147455Sdes 4738147455Sdes 4739147455Sdes $echo >> "$output_objdir/$dlsyms" "\ 4740117610Sdes const char *name; 4741125647Sdes lt_ptr address; 4742117610Sdes} 4743117610Sdeslt_preloaded_symbols[] = 4744117610Sdes{\ 4745117610Sdes" 4746117610Sdes 4747125647Sdes eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 4748117610Sdes 4749117610Sdes $echo >> "$output_objdir/$dlsyms" "\ 4750125647Sdes {0, (lt_ptr) 0} 4751117610Sdes}; 4752117610Sdes 4753117610Sdes/* This works around a problem in FreeBSD linker */ 4754117610Sdes#ifdef FREEBSD_WORKAROUND 4755117610Sdesstatic const void *lt_preloaded_setup() { 4756117610Sdes return lt_preloaded_symbols; 4757117610Sdes} 4758117610Sdes#endif 4759117610Sdes 4760117610Sdes#ifdef __cplusplus 4761117610Sdes} 4762117610Sdes#endif\ 4763117610Sdes" 4764117610Sdes fi 4765117610Sdes 4766117610Sdes pic_flag_for_symtable= 4767125647Sdes case $host in 4768117610Sdes # compiling the symbol table file with pic_flag works around 4769117610Sdes # a FreeBSD bug that causes programs to crash when -lm is 4770117610Sdes # linked before any other PIC object. But we must not use 4771117610Sdes # pic_flag when linking with -static. The problem exists in 4772117610Sdes # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 4773125647Sdes *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 4774117610Sdes case "$compile_command " in 4775117610Sdes *" -static "*) ;; 4776141098Sdes *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 4777117610Sdes esac;; 4778117610Sdes *-*-hpux*) 4779117610Sdes case "$compile_command " in 4780117610Sdes *" -static "*) ;; 4781141098Sdes *) pic_flag_for_symtable=" $pic_flag";; 4782117610Sdes esac 4783117610Sdes esac 4784117610Sdes 4785117610Sdes # Now compile the dynamic symbol file. 4786174832Sdes $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4787174832Sdes $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 4788117610Sdes 4789117610Sdes # Clean up the generated files. 4790117610Sdes $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4791117610Sdes $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4792117610Sdes 4793117610Sdes # Transform the symbol file into the correct name. 4794174832Sdes case $host in 4795174832Sdes *cygwin* | *mingw* ) 4796174832Sdes if test -f "$output_objdir/${outputname}.def" ; then 4797174832Sdes compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4798174832Sdes finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4799174832Sdes else 4800174832Sdes compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4801174832Sdes finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4802174832Sdes fi 4803174832Sdes ;; 4804174832Sdes * ) 4805174832Sdes compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4806174832Sdes finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4807174832Sdes ;; 4808174832Sdes esac 4809117610Sdes ;; 4810174832Sdes *-*-freebsd*) 4811174832Sdes # FreeBSD doesn't need this... 4812174832Sdes ;; 4813117610Sdes *) 4814117610Sdes $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4815141098Sdes exit $EXIT_FAILURE 4816117610Sdes ;; 4817117610Sdes esac 4818117610Sdes else 4819117610Sdes # We keep going just in case the user didn't refer to 4820117610Sdes # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 4821117610Sdes # really was required. 4822117610Sdes 4823117610Sdes # Nullify the symbol file. 4824174832Sdes compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4825174832Sdes finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4826117610Sdes fi 4827117610Sdes 4828141098Sdes if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 4829117610Sdes # Replace the output file specification. 4830174832Sdes compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 4831117610Sdes link_command="$compile_command$compile_rpath" 4832117610Sdes 4833117610Sdes # We have no uninstalled library dependencies, so finalize right now. 4834117610Sdes $show "$link_command" 4835117610Sdes $run eval "$link_command" 4836174832Sdes exit_status=$? 4837125647Sdes 4838117610Sdes # Delete the generated files. 4839117610Sdes if test -n "$dlsyms"; then 4840117610Sdes $show "$rm $output_objdir/${outputname}S.${objext}" 4841117610Sdes $run $rm "$output_objdir/${outputname}S.${objext}" 4842117610Sdes fi 4843117610Sdes 4844174832Sdes exit $exit_status 4845117610Sdes fi 4846117610Sdes 4847117610Sdes if test -n "$shlibpath_var"; then 4848117610Sdes # We should set the shlibpath_var 4849117610Sdes rpath= 4850117610Sdes for dir in $temp_rpath; do 4851125647Sdes case $dir in 4852117610Sdes [\\/]* | [A-Za-z]:[\\/]*) 4853117610Sdes # Absolute path. 4854117610Sdes rpath="$rpath$dir:" 4855117610Sdes ;; 4856117610Sdes *) 4857117610Sdes # Relative path: add a thisdir entry. 4858117610Sdes rpath="$rpath\$thisdir/$dir:" 4859117610Sdes ;; 4860117610Sdes esac 4861117610Sdes done 4862117610Sdes temp_rpath="$rpath" 4863117610Sdes fi 4864117610Sdes 4865117610Sdes if test -n "$compile_shlibpath$finalize_shlibpath"; then 4866117610Sdes compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 4867117610Sdes fi 4868117610Sdes if test -n "$finalize_shlibpath"; then 4869117610Sdes finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 4870117610Sdes fi 4871117610Sdes 4872117610Sdes compile_var= 4873117610Sdes finalize_var= 4874117610Sdes if test -n "$runpath_var"; then 4875117610Sdes if test -n "$perm_rpath"; then 4876117610Sdes # We should set the runpath_var. 4877117610Sdes rpath= 4878117610Sdes for dir in $perm_rpath; do 4879117610Sdes rpath="$rpath$dir:" 4880117610Sdes done 4881117610Sdes compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 4882117610Sdes fi 4883117610Sdes if test -n "$finalize_perm_rpath"; then 4884117610Sdes # We should set the runpath_var. 4885117610Sdes rpath= 4886117610Sdes for dir in $finalize_perm_rpath; do 4887117610Sdes rpath="$rpath$dir:" 4888117610Sdes done 4889117610Sdes finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 4890117610Sdes fi 4891117610Sdes fi 4892117610Sdes 4893125647Sdes if test "$no_install" = yes; then 4894125647Sdes # We don't need to create a wrapper script. 4895125647Sdes link_command="$compile_var$compile_command$compile_rpath" 4896125647Sdes # Replace the output file specification. 4897125647Sdes link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4898125647Sdes # Delete the old output file. 4899125647Sdes $run $rm $output 4900125647Sdes # Link the executable and exit 4901125647Sdes $show "$link_command" 4902125647Sdes $run eval "$link_command" || exit $? 4903141098Sdes exit $EXIT_SUCCESS 4904125647Sdes fi 4905125647Sdes 4906117610Sdes if test "$hardcode_action" = relink; then 4907117610Sdes # Fast installation is not supported 4908117610Sdes link_command="$compile_var$compile_command$compile_rpath" 4909117610Sdes relink_command="$finalize_var$finalize_command$finalize_rpath" 4910125647Sdes 4911117610Sdes $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 4912117610Sdes $echo "$modename: \`$output' will be relinked during installation" 1>&2 4913117610Sdes else 4914117610Sdes if test "$fast_install" != no; then 4915117610Sdes link_command="$finalize_var$compile_command$finalize_rpath" 4916117610Sdes if test "$fast_install" = yes; then 4917174832Sdes relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 4918117610Sdes else 4919117610Sdes # fast_install is set to needless 4920117610Sdes relink_command= 4921117610Sdes fi 4922117610Sdes else 4923117610Sdes link_command="$compile_var$compile_command$compile_rpath" 4924117610Sdes relink_command="$finalize_var$finalize_command$finalize_rpath" 4925117610Sdes fi 4926117610Sdes fi 4927117610Sdes 4928117610Sdes # Replace the output file specification. 4929117610Sdes link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 4930125647Sdes 4931117610Sdes # Delete the old output files. 4932117610Sdes $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 4933117610Sdes 4934117610Sdes $show "$link_command" 4935117610Sdes $run eval "$link_command" || exit $? 4936117610Sdes 4937117610Sdes # Now create the wrapper script. 4938117610Sdes $show "creating $output" 4939117610Sdes 4940117610Sdes # Quote the relink command for shipping. 4941117610Sdes if test -n "$relink_command"; then 4942125647Sdes # Preserve any variables that may affect compiler behavior 4943125647Sdes for var in $variables_saved_for_relink; do 4944125647Sdes if eval test -z \"\${$var+set}\"; then 4945125647Sdes relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4946125647Sdes elif eval var_value=\$$var; test -z "$var_value"; then 4947125647Sdes relink_command="$var=; export $var; $relink_command" 4948125647Sdes else 4949125647Sdes var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4950125647Sdes relink_command="$var=\"$var_value\"; export $var; $relink_command" 4951125647Sdes fi 4952125647Sdes done 4953125647Sdes relink_command="(cd `pwd`; $relink_command)" 4954174832Sdes relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 4955117610Sdes fi 4956117610Sdes 4957117610Sdes # Quote $echo for shipping. 4958141098Sdes if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 4959141098Sdes case $progpath in 4960141098Sdes [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 4961141098Sdes *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 4962117610Sdes esac 4963117610Sdes qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 4964117610Sdes else 4965117610Sdes qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 4966117610Sdes fi 4967117610Sdes 4968117610Sdes # Only actually do things if our run command is non-null. 4969117610Sdes if test -z "$run"; then 4970117610Sdes # win32 will think the script is a binary if it has 4971117610Sdes # a .exe suffix, so we strip it off here. 4972117610Sdes case $output in 4973141098Sdes *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 4974117610Sdes esac 4975125647Sdes # test for cygwin because mv fails w/o .exe extensions 4976125647Sdes case $host in 4977141098Sdes *cygwin*) 4978141098Sdes exeext=.exe 4979141098Sdes outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4980125647Sdes *) exeext= ;; 4981125647Sdes esac 4982141098Sdes case $host in 4983141098Sdes *cygwin* | *mingw* ) 4984174832Sdes output_name=`basename $output` 4985174832Sdes output_path=`dirname $output` 4986174832Sdes cwrappersource="$output_path/$objdir/lt-$output_name.c" 4987174832Sdes cwrapper="$output_path/$output_name.exe" 4988174832Sdes $rm $cwrappersource $cwrapper 4989174832Sdes trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4990141098Sdes 4991141098Sdes cat > $cwrappersource <<EOF 4992141098Sdes 4993141098Sdes/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4994141098Sdes Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4995141098Sdes 4996141098Sdes The $output program cannot be directly executed until all the libtool 4997141098Sdes libraries that it depends on are installed. 4998141098Sdes 4999141098Sdes This wrapper executable should never be moved out of the build directory. 5000141098Sdes If it is, it will not operate correctly. 5001141098Sdes 5002141098Sdes Currently, it simply execs the wrapper *script* "/bin/sh $output", 5003141098Sdes but could eventually absorb all of the scripts functionality and 5004141098Sdes exec $objdir/$outputname directly. 5005141098Sdes*/ 5006141098SdesEOF 5007141098Sdes cat >> $cwrappersource<<"EOF" 5008141098Sdes#include <stdio.h> 5009141098Sdes#include <stdlib.h> 5010141098Sdes#include <unistd.h> 5011141098Sdes#include <malloc.h> 5012141098Sdes#include <stdarg.h> 5013141098Sdes#include <assert.h> 5014174832Sdes#include <string.h> 5015174832Sdes#include <ctype.h> 5016174832Sdes#include <sys/stat.h> 5017141098Sdes 5018141098Sdes#if defined(PATH_MAX) 5019141098Sdes# define LT_PATHMAX PATH_MAX 5020141098Sdes#elif defined(MAXPATHLEN) 5021141098Sdes# define LT_PATHMAX MAXPATHLEN 5022141098Sdes#else 5023141098Sdes# define LT_PATHMAX 1024 5024141098Sdes#endif 5025141098Sdes 5026141098Sdes#ifndef DIR_SEPARATOR 5027174832Sdes# define DIR_SEPARATOR '/' 5028174832Sdes# define PATH_SEPARATOR ':' 5029141098Sdes#endif 5030141098Sdes 5031141098Sdes#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 5032141098Sdes defined (__OS2__) 5033174832Sdes# define HAVE_DOS_BASED_FILE_SYSTEM 5034174832Sdes# ifndef DIR_SEPARATOR_2 5035174832Sdes# define DIR_SEPARATOR_2 '\\' 5036174832Sdes# endif 5037174832Sdes# ifndef PATH_SEPARATOR_2 5038174832Sdes# define PATH_SEPARATOR_2 ';' 5039174832Sdes# endif 5040141098Sdes#endif 5041141098Sdes 5042141098Sdes#ifndef DIR_SEPARATOR_2 5043141098Sdes# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 5044141098Sdes#else /* DIR_SEPARATOR_2 */ 5045141098Sdes# define IS_DIR_SEPARATOR(ch) \ 5046141098Sdes (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 5047141098Sdes#endif /* DIR_SEPARATOR_2 */ 5048141098Sdes 5049174832Sdes#ifndef PATH_SEPARATOR_2 5050174832Sdes# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 5051174832Sdes#else /* PATH_SEPARATOR_2 */ 5052174832Sdes# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 5053174832Sdes#endif /* PATH_SEPARATOR_2 */ 5054174832Sdes 5055141098Sdes#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 5056141098Sdes#define XFREE(stale) do { \ 5057141098Sdes if (stale) { free ((void *) stale); stale = 0; } \ 5058141098Sdes} while (0) 5059141098Sdes 5060174832Sdes/* -DDEBUG is fairly common in CFLAGS. */ 5061174832Sdes#undef DEBUG 5062174832Sdes#if defined DEBUGWRAPPER 5063174832Sdes# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 5064174832Sdes#else 5065174832Sdes# define DEBUG(format, ...) 5066174832Sdes#endif 5067174832Sdes 5068141098Sdesconst char *program_name = NULL; 5069141098Sdes 5070141098Sdesvoid * xmalloc (size_t num); 5071141098Sdeschar * xstrdup (const char *string); 5072174832Sdesconst char * base_name (const char *name); 5073174832Sdeschar * find_executable(const char *wrapper); 5074174832Sdesint check_executable(const char *path); 5075141098Sdeschar * strendzap(char *str, const char *pat); 5076141098Sdesvoid lt_fatal (const char *message, ...); 5077141098Sdes 5078141098Sdesint 5079141098Sdesmain (int argc, char *argv[]) 5080141098Sdes{ 5081141098Sdes char **newargz; 5082141098Sdes int i; 5083141098Sdes 5084174832Sdes program_name = (char *) xstrdup (base_name (argv[0])); 5085174832Sdes DEBUG("(main) argv[0] : %s\n",argv[0]); 5086174832Sdes DEBUG("(main) program_name : %s\n",program_name); 5087141098Sdes newargz = XMALLOC(char *, argc+2); 5088141098SdesEOF 5089141098Sdes 5090174832Sdes cat >> $cwrappersource <<EOF 5091174832Sdes newargz[0] = (char *) xstrdup("$SHELL"); 5092141098SdesEOF 5093141098Sdes 5094174832Sdes cat >> $cwrappersource <<"EOF" 5095174832Sdes newargz[1] = find_executable(argv[0]); 5096174832Sdes if (newargz[1] == NULL) 5097174832Sdes lt_fatal("Couldn't find %s", argv[0]); 5098174832Sdes DEBUG("(main) found exe at : %s\n",newargz[1]); 5099141098Sdes /* we know the script has the same name, without the .exe */ 5100141098Sdes /* so make sure newargz[1] doesn't end in .exe */ 5101141098Sdes strendzap(newargz[1],".exe"); 5102141098Sdes for (i = 1; i < argc; i++) 5103141098Sdes newargz[i+1] = xstrdup(argv[i]); 5104141098Sdes newargz[argc+1] = NULL; 5105174832Sdes 5106174832Sdes for (i=0; i<argc+1; i++) 5107174832Sdes { 5108174832Sdes DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 5109174832Sdes ; 5110174832Sdes } 5111174832Sdes 5112141098SdesEOF 5113141098Sdes 5114174832Sdes case $host_os in 5115174832Sdes mingw*) 5116174832Sdes cat >> $cwrappersource <<EOF 5117174832Sdes execv("$SHELL",(char const **)newargz); 5118174832SdesEOF 5119174832Sdes ;; 5120174832Sdes *) 5121174832Sdes cat >> $cwrappersource <<EOF 5122141098Sdes execv("$SHELL",newargz); 5123141098SdesEOF 5124174832Sdes ;; 5125174832Sdes esac 5126141098Sdes 5127174832Sdes cat >> $cwrappersource <<"EOF" 5128174832Sdes return 127; 5129141098Sdes} 5130141098Sdes 5131141098Sdesvoid * 5132141098Sdesxmalloc (size_t num) 5133141098Sdes{ 5134141098Sdes void * p = (void *) malloc (num); 5135141098Sdes if (!p) 5136141098Sdes lt_fatal ("Memory exhausted"); 5137141098Sdes 5138141098Sdes return p; 5139141098Sdes} 5140141098Sdes 5141141098Sdeschar * 5142141098Sdesxstrdup (const char *string) 5143141098Sdes{ 5144141098Sdes return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5145141098Sdes; 5146141098Sdes} 5147141098Sdes 5148174832Sdesconst char * 5149174832Sdesbase_name (const char *name) 5150141098Sdes{ 5151141098Sdes const char *base; 5152141098Sdes 5153141098Sdes#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5154141098Sdes /* Skip over the disk name in MSDOS pathnames. */ 5155174832Sdes if (isalpha ((unsigned char)name[0]) && name[1] == ':') 5156141098Sdes name += 2; 5157141098Sdes#endif 5158141098Sdes 5159141098Sdes for (base = name; *name; name++) 5160141098Sdes if (IS_DIR_SEPARATOR (*name)) 5161141098Sdes base = name + 1; 5162174832Sdes return base; 5163141098Sdes} 5164141098Sdes 5165174832Sdesint 5166174832Sdescheck_executable(const char * path) 5167174832Sdes{ 5168174832Sdes struct stat st; 5169174832Sdes 5170174832Sdes DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 5171174832Sdes if ((!path) || (!*path)) 5172174832Sdes return 0; 5173174832Sdes 5174174832Sdes if ((stat (path, &st) >= 0) && 5175174832Sdes ( 5176174832Sdes /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 5177174832Sdes#if defined (S_IXOTH) 5178174832Sdes ((st.st_mode & S_IXOTH) == S_IXOTH) || 5179174832Sdes#endif 5180174832Sdes#if defined (S_IXGRP) 5181174832Sdes ((st.st_mode & S_IXGRP) == S_IXGRP) || 5182174832Sdes#endif 5183174832Sdes ((st.st_mode & S_IXUSR) == S_IXUSR)) 5184174832Sdes ) 5185174832Sdes return 1; 5186174832Sdes else 5187174832Sdes return 0; 5188174832Sdes} 5189174832Sdes 5190174832Sdes/* Searches for the full path of the wrapper. Returns 5191174832Sdes newly allocated full path name if found, NULL otherwise */ 5192141098Sdeschar * 5193174832Sdesfind_executable (const char* wrapper) 5194141098Sdes{ 5195174832Sdes int has_slash = 0; 5196174832Sdes const char* p; 5197174832Sdes const char* p_next; 5198174832Sdes /* static buffer for getcwd */ 5199141098Sdes char tmp[LT_PATHMAX + 1]; 5200174832Sdes int tmp_len; 5201174832Sdes char* concat_name; 5202141098Sdes 5203174832Sdes DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 5204141098Sdes 5205174832Sdes if ((wrapper == NULL) || (*wrapper == '\0')) 5206174832Sdes return NULL; 5207174832Sdes 5208174832Sdes /* Absolute path? */ 5209141098Sdes#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5210174832Sdes if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 5211174832Sdes { 5212174832Sdes concat_name = xstrdup (wrapper); 5213174832Sdes if (check_executable(concat_name)) 5214174832Sdes return concat_name; 5215174832Sdes XFREE(concat_name); 5216174832Sdes } 5217174832Sdes else 5218174832Sdes { 5219141098Sdes#endif 5220174832Sdes if (IS_DIR_SEPARATOR (wrapper[0])) 5221174832Sdes { 5222174832Sdes concat_name = xstrdup (wrapper); 5223174832Sdes if (check_executable(concat_name)) 5224174832Sdes return concat_name; 5225174832Sdes XFREE(concat_name); 5226174832Sdes } 5227174832Sdes#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5228174832Sdes } 5229174832Sdes#endif 5230141098Sdes 5231174832Sdes for (p = wrapper; *p; p++) 5232174832Sdes if (*p == '/') 5233174832Sdes { 5234174832Sdes has_slash = 1; 5235174832Sdes break; 5236174832Sdes } 5237174832Sdes if (!has_slash) 5238174832Sdes { 5239174832Sdes /* no slashes; search PATH */ 5240174832Sdes const char* path = getenv ("PATH"); 5241174832Sdes if (path != NULL) 5242174832Sdes { 5243174832Sdes for (p = path; *p; p = p_next) 5244174832Sdes { 5245174832Sdes const char* q; 5246174832Sdes size_t p_len; 5247174832Sdes for (q = p; *q; q++) 5248174832Sdes if (IS_PATH_SEPARATOR(*q)) 5249174832Sdes break; 5250174832Sdes p_len = q - p; 5251174832Sdes p_next = (*q == '\0' ? q : q + 1); 5252174832Sdes if (p_len == 0) 5253174832Sdes { 5254174832Sdes /* empty path: current directory */ 5255174832Sdes if (getcwd (tmp, LT_PATHMAX) == NULL) 5256174832Sdes lt_fatal ("getcwd failed"); 5257174832Sdes tmp_len = strlen(tmp); 5258174832Sdes concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5259174832Sdes memcpy (concat_name, tmp, tmp_len); 5260174832Sdes concat_name[tmp_len] = '/'; 5261174832Sdes strcpy (concat_name + tmp_len + 1, wrapper); 5262174832Sdes } 5263174832Sdes else 5264174832Sdes { 5265174832Sdes concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 5266174832Sdes memcpy (concat_name, p, p_len); 5267174832Sdes concat_name[p_len] = '/'; 5268174832Sdes strcpy (concat_name + p_len + 1, wrapper); 5269174832Sdes } 5270174832Sdes if (check_executable(concat_name)) 5271174832Sdes return concat_name; 5272174832Sdes XFREE(concat_name); 5273174832Sdes } 5274174832Sdes } 5275174832Sdes /* not found in PATH; assume curdir */ 5276174832Sdes } 5277174832Sdes /* Relative path | not found in path: prepend cwd */ 5278141098Sdes if (getcwd (tmp, LT_PATHMAX) == NULL) 5279141098Sdes lt_fatal ("getcwd failed"); 5280174832Sdes tmp_len = strlen(tmp); 5281174832Sdes concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5282174832Sdes memcpy (concat_name, tmp, tmp_len); 5283174832Sdes concat_name[tmp_len] = '/'; 5284174832Sdes strcpy (concat_name + tmp_len + 1, wrapper); 5285174832Sdes 5286174832Sdes if (check_executable(concat_name)) 5287174832Sdes return concat_name; 5288174832Sdes XFREE(concat_name); 5289174832Sdes return NULL; 5290141098Sdes} 5291141098Sdes 5292141098Sdeschar * 5293141098Sdesstrendzap(char *str, const char *pat) 5294141098Sdes{ 5295141098Sdes size_t len, patlen; 5296141098Sdes 5297141098Sdes assert(str != NULL); 5298141098Sdes assert(pat != NULL); 5299141098Sdes 5300141098Sdes len = strlen(str); 5301141098Sdes patlen = strlen(pat); 5302141098Sdes 5303141098Sdes if (patlen <= len) 5304141098Sdes { 5305141098Sdes str += len - patlen; 5306141098Sdes if (strcmp(str, pat) == 0) 5307141098Sdes *str = '\0'; 5308141098Sdes } 5309141098Sdes return str; 5310141098Sdes} 5311141098Sdes 5312141098Sdesstatic void 5313141098Sdeslt_error_core (int exit_status, const char * mode, 5314141098Sdes const char * message, va_list ap) 5315141098Sdes{ 5316141098Sdes fprintf (stderr, "%s: %s: ", program_name, mode); 5317141098Sdes vfprintf (stderr, message, ap); 5318141098Sdes fprintf (stderr, ".\n"); 5319141098Sdes 5320141098Sdes if (exit_status >= 0) 5321141098Sdes exit (exit_status); 5322141098Sdes} 5323141098Sdes 5324141098Sdesvoid 5325141098Sdeslt_fatal (const char *message, ...) 5326141098Sdes{ 5327141098Sdes va_list ap; 5328141098Sdes va_start (ap, message); 5329141098Sdes lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5330141098Sdes va_end (ap); 5331141098Sdes} 5332141098SdesEOF 5333174832Sdes # we should really use a build-platform specific compiler 5334174832Sdes # here, but OTOH, the wrappers (shell script and this C one) 5335174832Sdes # are only useful if you want to execute the "real" binary. 5336174832Sdes # Since the "real" binary is built for $host, then this 5337174832Sdes # wrapper might as well be built for $host, too. 5338174832Sdes $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 5339174832Sdes ;; 5340174832Sdes esac 5341174832Sdes $rm $output 5342174832Sdes trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5343117610Sdes 5344117610Sdes $echo > $output "\ 5345117610Sdes#! $SHELL 5346117610Sdes 5347117610Sdes# $output - temporary wrapper script for $objdir/$outputname 5348117610Sdes# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5349117610Sdes# 5350117610Sdes# The $output program cannot be directly executed until all the libtool 5351117610Sdes# libraries that it depends on are installed. 5352117610Sdes# 5353117610Sdes# This wrapper script should never be moved out of the build directory. 5354117610Sdes# If it is, it will not operate correctly. 5355117610Sdes 5356117610Sdes# Sed substitution that helps us do robust quoting. It backslashifies 5357117610Sdes# metacharacters that are still active within double-quoted strings. 5358141098SdesXsed='${SED} -e 1s/^X//' 5359117610Sdessed_quote_subst='$sed_quote_subst' 5360117610Sdes 5361174832Sdes# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 5362174832Sdesif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 5363174832Sdes emulate sh 5364174832Sdes NULLCMD=: 5365174832Sdes # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 5366174832Sdes # is contrary to our usage. Disable this feature. 5367174832Sdes alias -g '\${1+\"\$@\"}'='\"\$@\"' 5368174832Sdes setopt NO_GLOB_SUBST 5369174832Sdeselse 5370174832Sdes case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 5371174832Sdesfi 5372174832SdesBIN_SH=xpg4; export BIN_SH # for Tru64 5373174832SdesDUALCASE=1; export DUALCASE # for MKS sh 5374174832Sdes 5375117610Sdes# The HP-UX ksh and POSIX shell print the target directory to stdout 5376117610Sdes# if CDPATH is set. 5377141098Sdes(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5378117610Sdes 5379117610Sdesrelink_command=\"$relink_command\" 5380117610Sdes 5381117610Sdes# This environment variable determines our operation mode. 5382117610Sdesif test \"\$libtool_install_magic\" = \"$magic\"; then 5383117610Sdes # install mode needs the following variable: 5384125647Sdes notinst_deplibs='$notinst_deplibs' 5385117610Sdeselse 5386117610Sdes # When we are sourced in execute mode, \$file and \$echo are already set. 5387117610Sdes if test \"\$libtool_execute_magic\" != \"$magic\"; then 5388117610Sdes echo=\"$qecho\" 5389117610Sdes file=\"\$0\" 5390117610Sdes # Make sure echo works. 5391117610Sdes if test \"X\$1\" = X--no-reexec; then 5392117610Sdes # Discard the --no-reexec flag, and continue. 5393117610Sdes shift 5394117610Sdes elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 5395117610Sdes # Yippee, \$echo works! 5396117610Sdes : 5397117610Sdes else 5398117610Sdes # Restart under the correct shell, and then maybe \$echo will work. 5399117610Sdes exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 5400117610Sdes fi 5401117610Sdes fi\ 5402117610Sdes" 5403117610Sdes $echo >> $output "\ 5404117610Sdes 5405117610Sdes # Find the directory that this script lives in. 5406117610Sdes thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 5407117610Sdes test \"x\$thisdir\" = \"x\$file\" && thisdir=. 5408117610Sdes 5409117610Sdes # Follow symbolic links until we get to the real thisdir. 5410125647Sdes file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 5411117610Sdes while test -n \"\$file\"; do 5412117610Sdes destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 5413117610Sdes 5414117610Sdes # If there was a directory component, then change thisdir. 5415117610Sdes if test \"x\$destdir\" != \"x\$file\"; then 5416117610Sdes case \"\$destdir\" in 5417125647Sdes [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5418117610Sdes *) thisdir=\"\$thisdir/\$destdir\" ;; 5419117610Sdes esac 5420117610Sdes fi 5421117610Sdes 5422117610Sdes file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 5423125647Sdes file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 5424117610Sdes done 5425117610Sdes 5426117610Sdes # Try to get the absolute directory name. 5427117610Sdes absdir=\`cd \"\$thisdir\" && pwd\` 5428117610Sdes test -n \"\$absdir\" && thisdir=\"\$absdir\" 5429117610Sdes" 5430117610Sdes 5431117610Sdes if test "$fast_install" = yes; then 5432141098Sdes $echo >> $output "\ 5433125647Sdes program=lt-'$outputname'$exeext 5434117610Sdes progdir=\"\$thisdir/$objdir\" 5435125647Sdes 5436117610Sdes if test ! -f \"\$progdir/\$program\" || \\ 5437125647Sdes { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 5438117610Sdes test \"X\$file\" != \"X\$progdir/\$program\"; }; then 5439117610Sdes 5440117610Sdes file=\"\$\$-\$program\" 5441117610Sdes 5442117610Sdes if test ! -d \"\$progdir\"; then 5443117610Sdes $mkdir \"\$progdir\" 5444117610Sdes else 5445117610Sdes $rm \"\$progdir/\$file\" 5446117610Sdes fi" 5447117610Sdes 5448141098Sdes $echo >> $output "\ 5449117610Sdes 5450117610Sdes # relink executable if necessary 5451117610Sdes if test -n \"\$relink_command\"; then 5452125647Sdes if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5453117610Sdes else 5454125647Sdes $echo \"\$relink_command_output\" >&2 5455117610Sdes $rm \"\$progdir/\$file\" 5456141098Sdes exit $EXIT_FAILURE 5457117610Sdes fi 5458117610Sdes fi 5459117610Sdes 5460117610Sdes $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5461117610Sdes { $rm \"\$progdir/\$program\"; 5462117610Sdes $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5463117610Sdes $rm \"\$progdir/\$file\" 5464117610Sdes fi" 5465117610Sdes else 5466141098Sdes $echo >> $output "\ 5467117610Sdes program='$outputname' 5468117610Sdes progdir=\"\$thisdir/$objdir\" 5469117610Sdes" 5470117610Sdes fi 5471117610Sdes 5472141098Sdes $echo >> $output "\ 5473117610Sdes 5474117610Sdes if test -f \"\$progdir/\$program\"; then" 5475117610Sdes 5476117610Sdes # Export our shlibpath_var if we have one. 5477117610Sdes if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5478117610Sdes $echo >> $output "\ 5479117610Sdes # Add our own library path to $shlibpath_var 5480117610Sdes $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 5481117610Sdes 5482117610Sdes # Some systems cannot cope with colon-terminated $shlibpath_var 5483141098Sdes # The second colon is a workaround for a bug in BeOS R4 sed 5484117610Sdes $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 5485117610Sdes 5486117610Sdes export $shlibpath_var 5487117610Sdes" 5488117610Sdes fi 5489117610Sdes 5490117610Sdes # fixup the dll searchpath if we need to. 5491117610Sdes if test -n "$dllsearchpath"; then 5492117610Sdes $echo >> $output "\ 5493117610Sdes # Add the dll search path components to the executable PATH 5494117610Sdes PATH=$dllsearchpath:\$PATH 5495117610Sdes" 5496117610Sdes fi 5497117610Sdes 5498117610Sdes $echo >> $output "\ 5499117610Sdes if test \"\$libtool_execute_magic\" != \"$magic\"; then 5500117610Sdes # Run the actual program with our arguments. 5501117610Sdes" 5502117610Sdes case $host in 5503117610Sdes # Backslashes separate directories on plain windows 5504117610Sdes *-*-mingw | *-*-os2*) 5505117610Sdes $echo >> $output "\ 5506174832Sdes exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5507117610Sdes" 5508117610Sdes ;; 5509117610Sdes 5510117610Sdes *) 5511117610Sdes $echo >> $output "\ 5512174832Sdes exec \"\$progdir/\$program\" \${1+\"\$@\"} 5513117610Sdes" 5514117610Sdes ;; 5515117610Sdes esac 5516117610Sdes $echo >> $output "\ 5517174832Sdes \$echo \"\$0: cannot exec \$program \$*\" 5518141098Sdes exit $EXIT_FAILURE 5519117610Sdes fi 5520117610Sdes else 5521117610Sdes # The program doesn't exist. 5522174832Sdes \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 5523117610Sdes \$echo \"This script is just a wrapper for \$program.\" 1>&2 5524141098Sdes $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5525141098Sdes exit $EXIT_FAILURE 5526117610Sdes fi 5527117610Sdesfi\ 5528117610Sdes" 5529117610Sdes chmod +x $output 5530117610Sdes fi 5531141098Sdes exit $EXIT_SUCCESS 5532117610Sdes ;; 5533117610Sdes esac 5534117610Sdes 5535117610Sdes # See if we need to build an old-fashioned archive. 5536117610Sdes for oldlib in $oldlibs; do 5537117610Sdes 5538117610Sdes if test "$build_libtool_libs" = convenience; then 5539117610Sdes oldobjs="$libobjs_save" 5540117610Sdes addlibs="$convenience" 5541117610Sdes build_libtool_libs=no 5542117610Sdes else 5543117610Sdes if test "$build_libtool_libs" = module; then 5544117610Sdes oldobjs="$libobjs_save" 5545117610Sdes build_libtool_libs=no 5546117610Sdes else 5547141098Sdes oldobjs="$old_deplibs $non_pic_objects" 5548117610Sdes fi 5549117610Sdes addlibs="$old_convenience" 5550117610Sdes fi 5551117610Sdes 5552117610Sdes if test -n "$addlibs"; then 5553117610Sdes gentop="$output_objdir/${outputname}x" 5554117610Sdes generated="$generated $gentop" 5555125647Sdes 5556141098Sdes func_extract_archives $gentop $addlibs 5557141098Sdes oldobjs="$oldobjs $func_extract_archives_result" 5558117610Sdes fi 5559117610Sdes 5560117610Sdes # Do each command in the archive commands. 5561117610Sdes if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5562141098Sdes cmds=$old_archive_from_new_cmds 5563117610Sdes else 5564174832Sdes # POSIX demands no paths to be encoded in archives. We have 5565174832Sdes # to avoid creating archives with duplicate basenames if we 5566174832Sdes # might have to extract them afterwards, e.g., when creating a 5567174832Sdes # static archive out of a convenience library, or when linking 5568174832Sdes # the entirety of a libtool archive into another (currently 5569174832Sdes # not supported by libtool). 5570174832Sdes if (for obj in $oldobjs 5571174832Sdes do 5572174832Sdes $echo "X$obj" | $Xsed -e 's%^.*/%%' 5573174832Sdes done | sort | sort -uc >/dev/null 2>&1); then 5574174832Sdes : 5575174832Sdes else 5576174832Sdes $echo "copying selected object files to avoid basename conflicts..." 5577174832Sdes 5578174832Sdes if test -z "$gentop"; then 5579174832Sdes gentop="$output_objdir/${outputname}x" 5580174832Sdes generated="$generated $gentop" 5581174832Sdes 5582174832Sdes $show "${rm}r $gentop" 5583174832Sdes $run ${rm}r "$gentop" 5584174832Sdes $show "$mkdir $gentop" 5585174832Sdes $run $mkdir "$gentop" 5586174832Sdes exit_status=$? 5587174832Sdes if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 5588174832Sdes exit $exit_status 5589174832Sdes fi 5590174832Sdes fi 5591174832Sdes 5592174832Sdes save_oldobjs=$oldobjs 5593174832Sdes oldobjs= 5594174832Sdes counter=1 5595174832Sdes for obj in $save_oldobjs 5596174832Sdes do 5597174832Sdes objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 5598174832Sdes case " $oldobjs " in 5599174832Sdes " ") oldobjs=$obj ;; 5600174832Sdes *[\ /]"$objbase "*) 5601174832Sdes while :; do 5602174832Sdes # Make sure we don't pick an alternate name that also 5603174832Sdes # overlaps. 5604174832Sdes newobj=lt$counter-$objbase 5605174832Sdes counter=`expr $counter + 1` 5606174832Sdes case " $oldobjs " in 5607174832Sdes *[\ /]"$newobj "*) ;; 5608174832Sdes *) if test ! -f "$gentop/$newobj"; then break; fi ;; 5609174832Sdes esac 5610174832Sdes done 5611174832Sdes $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 5612174832Sdes $run ln "$obj" "$gentop/$newobj" || 5613174832Sdes $run cp "$obj" "$gentop/$newobj" 5614174832Sdes oldobjs="$oldobjs $gentop/$newobj" 5615174832Sdes ;; 5616174832Sdes *) oldobjs="$oldobjs $obj" ;; 5617174832Sdes esac 5618174832Sdes done 5619174832Sdes fi 5620174832Sdes 5621141098Sdes eval cmds=\"$old_archive_cmds\" 5622141098Sdes 5623141098Sdes if len=`expr "X$cmds" : ".*"` && 5624141098Sdes test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5625141098Sdes cmds=$old_archive_cmds 5626141098Sdes else 5627141098Sdes # the command line is too long to link in one step, link in parts 5628141098Sdes $echo "using piecewise archive linking..." 5629141098Sdes save_RANLIB=$RANLIB 5630141098Sdes RANLIB=: 5631141098Sdes objlist= 5632141098Sdes concat_cmds= 5633141098Sdes save_oldobjs=$oldobjs 5634174832Sdes 5635141098Sdes # Is there a better way of finding the last object in the list? 5636141098Sdes for obj in $save_oldobjs 5637141098Sdes do 5638141098Sdes last_oldobj=$obj 5639141098Sdes done 5640141098Sdes for obj in $save_oldobjs 5641141098Sdes do 5642141098Sdes oldobjs="$objlist $obj" 5643141098Sdes objlist="$objlist $obj" 5644141098Sdes eval test_cmds=\"$old_archive_cmds\" 5645174832Sdes if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5646141098Sdes test "$len" -le "$max_cmd_len"; then 5647141098Sdes : 5648117610Sdes else 5649141098Sdes # the above command should be used before it gets too long 5650141098Sdes oldobjs=$objlist 5651141098Sdes if test "$obj" = "$last_oldobj" ; then 5652141098Sdes RANLIB=$save_RANLIB 5653141098Sdes fi 5654141098Sdes test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5655141098Sdes eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 5656141098Sdes objlist= 5657117610Sdes fi 5658141098Sdes done 5659141098Sdes RANLIB=$save_RANLIB 5660141098Sdes oldobjs=$objlist 5661141098Sdes if test "X$oldobjs" = "X" ; then 5662141098Sdes eval cmds=\"\$concat_cmds\" 5663141098Sdes else 5664141098Sdes eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 5665117610Sdes fi 5666141098Sdes fi 5667117610Sdes fi 5668125647Sdes save_ifs="$IFS"; IFS='~' 5669117610Sdes for cmd in $cmds; do 5670141098Sdes eval cmd=\"$cmd\" 5671117610Sdes IFS="$save_ifs" 5672117610Sdes $show "$cmd" 5673117610Sdes $run eval "$cmd" || exit $? 5674117610Sdes done 5675117610Sdes IFS="$save_ifs" 5676117610Sdes done 5677117610Sdes 5678117610Sdes if test -n "$generated"; then 5679117610Sdes $show "${rm}r$generated" 5680117610Sdes $run ${rm}r$generated 5681117610Sdes fi 5682117610Sdes 5683117610Sdes # Now create the libtool archive. 5684125647Sdes case $output in 5685117610Sdes *.la) 5686117610Sdes old_library= 5687117610Sdes test "$build_old_libs" = yes && old_library="$libname.$libext" 5688117610Sdes $show "creating $output" 5689117610Sdes 5690125647Sdes # Preserve any variables that may affect compiler behavior 5691125647Sdes for var in $variables_saved_for_relink; do 5692125647Sdes if eval test -z \"\${$var+set}\"; then 5693125647Sdes relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 5694125647Sdes elif eval var_value=\$$var; test -z "$var_value"; then 5695125647Sdes relink_command="$var=; export $var; $relink_command" 5696125647Sdes else 5697125647Sdes var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 5698125647Sdes relink_command="$var=\"$var_value\"; export $var; $relink_command" 5699125647Sdes fi 5700125647Sdes done 5701125647Sdes # Quote the link command for shipping. 5702141098Sdes relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 5703174832Sdes relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 5704141098Sdes if test "$hardcode_automatic" = yes ; then 5705141098Sdes relink_command= 5706141098Sdes fi 5707117610Sdes 5708141098Sdes 5709117610Sdes # Only create the output if not a dry run. 5710117610Sdes if test -z "$run"; then 5711117610Sdes for installed in no yes; do 5712117610Sdes if test "$installed" = yes; then 5713117610Sdes if test -z "$install_libdir"; then 5714117610Sdes break 5715117610Sdes fi 5716117610Sdes output="$output_objdir/$outputname"i 5717125647Sdes # Replace all uninstalled libtool libraries with the installed ones 5718125647Sdes newdependency_libs= 5719125647Sdes for deplib in $dependency_libs; do 5720125647Sdes case $deplib in 5721125647Sdes *.la) 5722125647Sdes name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 5723125647Sdes eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5724125647Sdes if test -z "$libdir"; then 5725125647Sdes $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 5726141098Sdes exit $EXIT_FAILURE 5727125647Sdes fi 5728125647Sdes newdependency_libs="$newdependency_libs $libdir/$name" 5729125647Sdes ;; 5730125647Sdes *) newdependency_libs="$newdependency_libs $deplib" ;; 5731125647Sdes esac 5732125647Sdes done 5733125647Sdes dependency_libs="$newdependency_libs" 5734125647Sdes newdlfiles= 5735125647Sdes for lib in $dlfiles; do 5736125647Sdes name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5737125647Sdes eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5738125647Sdes if test -z "$libdir"; then 5739125647Sdes $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5740141098Sdes exit $EXIT_FAILURE 5741125647Sdes fi 5742125647Sdes newdlfiles="$newdlfiles $libdir/$name" 5743125647Sdes done 5744125647Sdes dlfiles="$newdlfiles" 5745125647Sdes newdlprefiles= 5746125647Sdes for lib in $dlprefiles; do 5747125647Sdes name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5748125647Sdes eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5749125647Sdes if test -z "$libdir"; then 5750125647Sdes $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5751141098Sdes exit $EXIT_FAILURE 5752125647Sdes fi 5753125647Sdes newdlprefiles="$newdlprefiles $libdir/$name" 5754125647Sdes done 5755125647Sdes dlprefiles="$newdlprefiles" 5756141098Sdes else 5757141098Sdes newdlfiles= 5758141098Sdes for lib in $dlfiles; do 5759141098Sdes case $lib in 5760141098Sdes [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5761141098Sdes *) abs=`pwd`"/$lib" ;; 5762141098Sdes esac 5763141098Sdes newdlfiles="$newdlfiles $abs" 5764141098Sdes done 5765141098Sdes dlfiles="$newdlfiles" 5766141098Sdes newdlprefiles= 5767141098Sdes for lib in $dlprefiles; do 5768141098Sdes case $lib in 5769141098Sdes [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5770141098Sdes *) abs=`pwd`"/$lib" ;; 5771141098Sdes esac 5772141098Sdes newdlprefiles="$newdlprefiles $abs" 5773141098Sdes done 5774141098Sdes dlprefiles="$newdlprefiles" 5775117610Sdes fi 5776117610Sdes $rm $output 5777125647Sdes # place dlname in correct position for cygwin 5778125647Sdes tdlname=$dlname 5779125647Sdes case $host,$output,$installed,$module,$dlname in 5780141098Sdes *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 5781125647Sdes esac 5782117610Sdes $echo > $output "\ 5783117610Sdes# $outputname - a libtool library file 5784117610Sdes# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5785117610Sdes# 5786117610Sdes# Please DO NOT delete this file! 5787117610Sdes# It is necessary for linking the library. 5788117610Sdes 5789117610Sdes# The name that we can dlopen(3). 5790125647Sdesdlname='$tdlname' 5791117610Sdes 5792117610Sdes# Names of this library. 5793117610Sdeslibrary_names='$library_names' 5794117610Sdes 5795117610Sdes# The name of the static archive. 5796117610Sdesold_library='$old_library' 5797117610Sdes 5798117610Sdes# Libraries that this one depends upon. 5799117610Sdesdependency_libs='$dependency_libs' 5800117610Sdes 5801117610Sdes# Version information for $libname. 5802117610Sdescurrent=$current 5803117610Sdesage=$age 5804117610Sdesrevision=$revision 5805117610Sdes 5806117610Sdes# Is this an already installed library? 5807117610Sdesinstalled=$installed 5808117610Sdes 5809141098Sdes# Should we warn about portability when linking against -modules? 5810141098Sdesshouldnotlink=$module 5811141098Sdes 5812125647Sdes# Files to dlopen/dlpreopen 5813125647Sdesdlopen='$dlfiles' 5814125647Sdesdlpreopen='$dlprefiles' 5815125647Sdes 5816117610Sdes# Directory that this library needs to be installed in: 5817125647Sdeslibdir='$install_libdir'" 5818141098Sdes if test "$installed" = no && test "$need_relink" = yes; then 5819125647Sdes $echo >> $output "\ 5820125647Sdesrelink_command=\"$relink_command\"" 5821125647Sdes fi 5822117610Sdes done 5823117610Sdes fi 5824117610Sdes 5825117610Sdes # Do a symbolic link so that the libtool archive can be found in 5826117610Sdes # LD_LIBRARY_PATH before the program is installed. 5827117610Sdes $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 5828125647Sdes $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 5829117610Sdes ;; 5830117610Sdes esac 5831141098Sdes exit $EXIT_SUCCESS 5832117610Sdes ;; 5833117610Sdes 5834117610Sdes # libtool install mode 5835117610Sdes install) 5836117610Sdes modename="$modename: install" 5837117610Sdes 5838117610Sdes # There may be an optional sh(1) argument at the beginning of 5839117610Sdes # install_prog (especially on Windows NT). 5840125647Sdes if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5841125647Sdes # Allow the use of GNU shtool's install command. 5842174832Sdes $echo "X$nonopt" | grep shtool > /dev/null; then 5843117610Sdes # Aesthetically quote it. 5844117610Sdes arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5845125647Sdes case $arg in 5846174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5847117610Sdes arg="\"$arg\"" 5848117610Sdes ;; 5849117610Sdes esac 5850117610Sdes install_prog="$arg " 5851117610Sdes arg="$1" 5852117610Sdes shift 5853117610Sdes else 5854117610Sdes install_prog= 5855174832Sdes arg=$nonopt 5856117610Sdes fi 5857117610Sdes 5858117610Sdes # The real first argument should be the name of the installation program. 5859117610Sdes # Aesthetically quote it. 5860117610Sdes arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5861125647Sdes case $arg in 5862174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5863117610Sdes arg="\"$arg\"" 5864117610Sdes ;; 5865117610Sdes esac 5866117610Sdes install_prog="$install_prog$arg" 5867117610Sdes 5868117610Sdes # We need to accept at least all the BSD install flags. 5869117610Sdes dest= 5870117610Sdes files= 5871117610Sdes opts= 5872117610Sdes prev= 5873117610Sdes install_type= 5874117610Sdes isdir=no 5875117610Sdes stripme= 5876117610Sdes for arg 5877117610Sdes do 5878117610Sdes if test -n "$dest"; then 5879117610Sdes files="$files $dest" 5880174832Sdes dest=$arg 5881117610Sdes continue 5882117610Sdes fi 5883117610Sdes 5884125647Sdes case $arg in 5885117610Sdes -d) isdir=yes ;; 5886174832Sdes -f) 5887174832Sdes case " $install_prog " in 5888174832Sdes *[\\\ /]cp\ *) ;; 5889174832Sdes *) prev=$arg ;; 5890174832Sdes esac 5891174832Sdes ;; 5892174832Sdes -g | -m | -o) prev=$arg ;; 5893117610Sdes -s) 5894117610Sdes stripme=" -s" 5895117610Sdes continue 5896117610Sdes ;; 5897174832Sdes -*) 5898174832Sdes ;; 5899117610Sdes *) 5900117610Sdes # If the previous option needed an argument, then skip it. 5901117610Sdes if test -n "$prev"; then 5902117610Sdes prev= 5903117610Sdes else 5904174832Sdes dest=$arg 5905117610Sdes continue 5906117610Sdes fi 5907117610Sdes ;; 5908117610Sdes esac 5909117610Sdes 5910117610Sdes # Aesthetically quote the argument. 5911117610Sdes arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5912125647Sdes case $arg in 5913174832Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5914117610Sdes arg="\"$arg\"" 5915117610Sdes ;; 5916117610Sdes esac 5917117610Sdes install_prog="$install_prog $arg" 5918117610Sdes done 5919117610Sdes 5920117610Sdes if test -z "$install_prog"; then 5921117610Sdes $echo "$modename: you must specify an install program" 1>&2 5922117610Sdes $echo "$help" 1>&2 5923141098Sdes exit $EXIT_FAILURE 5924117610Sdes fi 5925117610Sdes 5926117610Sdes if test -n "$prev"; then 5927117610Sdes $echo "$modename: the \`$prev' option requires an argument" 1>&2 5928117610Sdes $echo "$help" 1>&2 5929141098Sdes exit $EXIT_FAILURE 5930117610Sdes fi 5931117610Sdes 5932117610Sdes if test -z "$files"; then 5933117610Sdes if test -z "$dest"; then 5934117610Sdes $echo "$modename: no file or destination specified" 1>&2 5935117610Sdes else 5936117610Sdes $echo "$modename: you must specify a destination" 1>&2 5937117610Sdes fi 5938117610Sdes $echo "$help" 1>&2 5939141098Sdes exit $EXIT_FAILURE 5940117610Sdes fi 5941117610Sdes 5942117610Sdes # Strip any trailing slash from the destination. 5943117610Sdes dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 5944117610Sdes 5945117610Sdes # Check to see that the destination is a directory. 5946117610Sdes test -d "$dest" && isdir=yes 5947117610Sdes if test "$isdir" = yes; then 5948117610Sdes destdir="$dest" 5949117610Sdes destname= 5950117610Sdes else 5951117610Sdes destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 5952117610Sdes test "X$destdir" = "X$dest" && destdir=. 5953117610Sdes destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 5954117610Sdes 5955117610Sdes # Not a directory, so check to see that there is only one file specified. 5956117610Sdes set dummy $files 5957141098Sdes if test "$#" -gt 2; then 5958117610Sdes $echo "$modename: \`$dest' is not a directory" 1>&2 5959117610Sdes $echo "$help" 1>&2 5960141098Sdes exit $EXIT_FAILURE 5961117610Sdes fi 5962117610Sdes fi 5963125647Sdes case $destdir in 5964117610Sdes [\\/]* | [A-Za-z]:[\\/]*) ;; 5965117610Sdes *) 5966117610Sdes for file in $files; do 5967125647Sdes case $file in 5968117610Sdes *.lo) ;; 5969117610Sdes *) 5970117610Sdes $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 5971117610Sdes $echo "$help" 1>&2 5972141098Sdes exit $EXIT_FAILURE 5973117610Sdes ;; 5974117610Sdes esac 5975117610Sdes done 5976117610Sdes ;; 5977117610Sdes esac 5978117610Sdes 5979117610Sdes # This variable tells wrapper scripts just to set variables rather 5980117610Sdes # than running their programs. 5981117610Sdes libtool_install_magic="$magic" 5982117610Sdes 5983117610Sdes staticlibs= 5984117610Sdes future_libdirs= 5985117610Sdes current_libdirs= 5986117610Sdes for file in $files; do 5987117610Sdes 5988117610Sdes # Do each installation. 5989125647Sdes case $file in 5990125647Sdes *.$libext) 5991117610Sdes # Do the static libraries later. 5992117610Sdes staticlibs="$staticlibs $file" 5993117610Sdes ;; 5994117610Sdes 5995117610Sdes *.la) 5996117610Sdes # Check to see that this really is a libtool archive. 5997141098Sdes if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 5998117610Sdes else 5999117610Sdes $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 6000117610Sdes $echo "$help" 1>&2 6001141098Sdes exit $EXIT_FAILURE 6002117610Sdes fi 6003117610Sdes 6004117610Sdes library_names= 6005117610Sdes old_library= 6006125647Sdes relink_command= 6007117610Sdes # If there is no directory component, then add one. 6008125647Sdes case $file in 6009117610Sdes */* | *\\*) . $file ;; 6010117610Sdes *) . ./$file ;; 6011117610Sdes esac 6012117610Sdes 6013117610Sdes # Add the libdir to current_libdirs if it is the destination. 6014117610Sdes if test "X$destdir" = "X$libdir"; then 6015117610Sdes case "$current_libdirs " in 6016117610Sdes *" $libdir "*) ;; 6017117610Sdes *) current_libdirs="$current_libdirs $libdir" ;; 6018117610Sdes esac 6019117610Sdes else 6020117610Sdes # Note the libdir as a future libdir. 6021117610Sdes case "$future_libdirs " in 6022117610Sdes *" $libdir "*) ;; 6023117610Sdes *) future_libdirs="$future_libdirs $libdir" ;; 6024117610Sdes esac 6025117610Sdes fi 6026117610Sdes 6027125647Sdes dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 6028117610Sdes test "X$dir" = "X$file/" && dir= 6029117610Sdes dir="$dir$objdir" 6030117610Sdes 6031125647Sdes if test -n "$relink_command"; then 6032141098Sdes # Determine the prefix the user has applied to our future dir. 6033141098Sdes inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 6034141098Sdes 6035141098Sdes # Don't allow the user to place us outside of our expected 6036141098Sdes # location b/c this prevents finding dependent libraries that 6037141098Sdes # are installed to the same prefix. 6038141098Sdes # At present, this check doesn't affect windows .dll's that 6039141098Sdes # are installed into $libdir/../bin (currently, that works fine) 6040141098Sdes # but it's something to keep an eye on. 6041141098Sdes if test "$inst_prefix_dir" = "$destdir"; then 6042141098Sdes $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 6043141098Sdes exit $EXIT_FAILURE 6044141098Sdes fi 6045141098Sdes 6046141098Sdes if test -n "$inst_prefix_dir"; then 6047141098Sdes # Stick the inst_prefix_dir data into the link command. 6048174832Sdes relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 6049141098Sdes else 6050174832Sdes relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 6051141098Sdes fi 6052141098Sdes 6053125647Sdes $echo "$modename: warning: relinking \`$file'" 1>&2 6054125647Sdes $show "$relink_command" 6055125647Sdes if $run eval "$relink_command"; then : 6056125647Sdes else 6057125647Sdes $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6058141098Sdes exit $EXIT_FAILURE 6059125647Sdes fi 6060125647Sdes fi 6061125647Sdes 6062117610Sdes # See the names of the shared library. 6063117610Sdes set dummy $library_names 6064117610Sdes if test -n "$2"; then 6065117610Sdes realname="$2" 6066117610Sdes shift 6067117610Sdes shift 6068117610Sdes 6069125647Sdes srcname="$realname" 6070125647Sdes test -n "$relink_command" && srcname="$realname"T 6071125647Sdes 6072117610Sdes # Install the shared library and build the symlinks. 6073125647Sdes $show "$install_prog $dir/$srcname $destdir/$realname" 6074125647Sdes $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 6075125647Sdes if test -n "$stripme" && test -n "$striplib"; then 6076125647Sdes $show "$striplib $destdir/$realname" 6077125647Sdes $run eval "$striplib $destdir/$realname" || exit $? 6078125647Sdes fi 6079117610Sdes 6080141098Sdes if test "$#" -gt 0; then 6081117610Sdes # Delete the old symlinks, and create new ones. 6082174832Sdes # Try `ln -sf' first, because the `ln' binary might depend on 6083174832Sdes # the symlink we replace! Solaris /bin/ln does not understand -f, 6084174832Sdes # so we also need to try rm && ln -s. 6085117610Sdes for linkname 6086117610Sdes do 6087117610Sdes if test "$linkname" != "$realname"; then 6088174832Sdes $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6089174832Sdes $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6090117610Sdes fi 6091117610Sdes done 6092117610Sdes fi 6093117610Sdes 6094117610Sdes # Do each command in the postinstall commands. 6095117610Sdes lib="$destdir/$realname" 6096141098Sdes cmds=$postinstall_cmds 6097125647Sdes save_ifs="$IFS"; IFS='~' 6098117610Sdes for cmd in $cmds; do 6099117610Sdes IFS="$save_ifs" 6100141098Sdes eval cmd=\"$cmd\" 6101117610Sdes $show "$cmd" 6102174832Sdes $run eval "$cmd" || { 6103174832Sdes lt_exit=$? 6104174832Sdes 6105174832Sdes # Restore the uninstalled library and exit 6106174832Sdes if test "$mode" = relink; then 6107174832Sdes $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 6108174832Sdes fi 6109174832Sdes 6110174832Sdes exit $lt_exit 6111174832Sdes } 6112117610Sdes done 6113117610Sdes IFS="$save_ifs" 6114117610Sdes fi 6115117610Sdes 6116117610Sdes # Install the pseudo-library for information purposes. 6117141098Sdes name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6118141098Sdes instname="$dir/$name"i 6119141098Sdes $show "$install_prog $instname $destdir/$name" 6120141098Sdes $run eval "$install_prog $instname $destdir/$name" || exit $? 6121117610Sdes 6122117610Sdes # Maybe install the static library, too. 6123117610Sdes test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 6124117610Sdes ;; 6125117610Sdes 6126117610Sdes *.lo) 6127117610Sdes # Install (i.e. copy) a libtool object. 6128117610Sdes 6129117610Sdes # Figure out destination file name, if it wasn't already specified. 6130117610Sdes if test -n "$destname"; then 6131117610Sdes destfile="$destdir/$destname" 6132117610Sdes else 6133117610Sdes destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6134117610Sdes destfile="$destdir/$destfile" 6135117610Sdes fi 6136117610Sdes 6137117610Sdes # Deduce the name of the destination old-style object file. 6138125647Sdes case $destfile in 6139117610Sdes *.lo) 6140117610Sdes staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 6141117610Sdes ;; 6142125647Sdes *.$objext) 6143117610Sdes staticdest="$destfile" 6144117610Sdes destfile= 6145117610Sdes ;; 6146117610Sdes *) 6147117610Sdes $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 6148117610Sdes $echo "$help" 1>&2 6149141098Sdes exit $EXIT_FAILURE 6150117610Sdes ;; 6151117610Sdes esac 6152117610Sdes 6153117610Sdes # Install the libtool object if requested. 6154117610Sdes if test -n "$destfile"; then 6155117610Sdes $show "$install_prog $file $destfile" 6156117610Sdes $run eval "$install_prog $file $destfile" || exit $? 6157117610Sdes fi 6158117610Sdes 6159117610Sdes # Install the old object if enabled. 6160117610Sdes if test "$build_old_libs" = yes; then 6161117610Sdes # Deduce the name of the old-style object file. 6162117610Sdes staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 6163117610Sdes 6164117610Sdes $show "$install_prog $staticobj $staticdest" 6165117610Sdes $run eval "$install_prog \$staticobj \$staticdest" || exit $? 6166117610Sdes fi 6167141098Sdes exit $EXIT_SUCCESS 6168117610Sdes ;; 6169117610Sdes 6170117610Sdes *) 6171117610Sdes # Figure out destination file name, if it wasn't already specified. 6172117610Sdes if test -n "$destname"; then 6173117610Sdes destfile="$destdir/$destname" 6174117610Sdes else 6175117610Sdes destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6176117610Sdes destfile="$destdir/$destfile" 6177117610Sdes fi 6178117610Sdes 6179141098Sdes # If the file is missing, and there is a .exe on the end, strip it 6180141098Sdes # because it is most likely a libtool script we actually want to 6181141098Sdes # install 6182141098Sdes stripped_ext="" 6183141098Sdes case $file in 6184141098Sdes *.exe) 6185141098Sdes if test ! -f "$file"; then 6186141098Sdes file=`$echo $file|${SED} 's,.exe$,,'` 6187141098Sdes stripped_ext=".exe" 6188141098Sdes fi 6189141098Sdes ;; 6190141098Sdes esac 6191141098Sdes 6192117610Sdes # Do a test to see if this is really a libtool program. 6193125647Sdes case $host in 6194125647Sdes *cygwin*|*mingw*) 6195141098Sdes wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 6196125647Sdes ;; 6197125647Sdes *) 6198125647Sdes wrapper=$file 6199125647Sdes ;; 6200125647Sdes esac 6201141098Sdes if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6202125647Sdes notinst_deplibs= 6203117610Sdes relink_command= 6204117610Sdes 6205174832Sdes # Note that it is not necessary on cygwin/mingw to append a dot to 6206174832Sdes # foo even if both foo and FILE.exe exist: automatic-append-.exe 6207174832Sdes # behavior happens only for exec(3), not for open(2)! Also, sourcing 6208174832Sdes # `FILE.' does not work on cygwin managed mounts. 6209174832Sdes # 6210117610Sdes # If there is no directory component, then add one. 6211174832Sdes case $wrapper in 6212174832Sdes */* | *\\*) . ${wrapper} ;; 6213174832Sdes *) . ./${wrapper} ;; 6214117610Sdes esac 6215117610Sdes 6216117610Sdes # Check the variables that should have been set. 6217125647Sdes if test -z "$notinst_deplibs"; then 6218125647Sdes $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6219141098Sdes exit $EXIT_FAILURE 6220117610Sdes fi 6221117610Sdes 6222117610Sdes finalize=yes 6223125647Sdes for lib in $notinst_deplibs; do 6224117610Sdes # Check to see that each library is installed. 6225117610Sdes libdir= 6226117610Sdes if test -f "$lib"; then 6227117610Sdes # If there is no directory component, then add one. 6228125647Sdes case $lib in 6229117610Sdes */* | *\\*) . $lib ;; 6230117610Sdes *) . ./$lib ;; 6231117610Sdes esac 6232117610Sdes fi 6233125647Sdes libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 6234117610Sdes if test -n "$libdir" && test ! -f "$libfile"; then 6235125647Sdes $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 6236117610Sdes finalize=no 6237117610Sdes fi 6238117610Sdes done 6239117610Sdes 6240125647Sdes relink_command= 6241174832Sdes # Note that it is not necessary on cygwin/mingw to append a dot to 6242174832Sdes # foo even if both foo and FILE.exe exist: automatic-append-.exe 6243174832Sdes # behavior happens only for exec(3), not for open(2)! Also, sourcing 6244174832Sdes # `FILE.' does not work on cygwin managed mounts. 6245174832Sdes # 6246125647Sdes # If there is no directory component, then add one. 6247174832Sdes case $wrapper in 6248174832Sdes */* | *\\*) . ${wrapper} ;; 6249174832Sdes *) . ./${wrapper} ;; 6250125647Sdes esac 6251125647Sdes 6252117610Sdes outputname= 6253117610Sdes if test "$fast_install" = no && test -n "$relink_command"; then 6254117610Sdes if test "$finalize" = yes && test -z "$run"; then 6255174832Sdes tmpdir=`func_mktempdir` 6256141098Sdes file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6257117610Sdes outputname="$tmpdir/$file" 6258117610Sdes # Replace the output file specification. 6259174832Sdes relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 6260117610Sdes 6261117610Sdes $show "$relink_command" 6262117610Sdes if $run eval "$relink_command"; then : 6263117610Sdes else 6264117610Sdes $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6265117610Sdes ${rm}r "$tmpdir" 6266117610Sdes continue 6267117610Sdes fi 6268117610Sdes file="$outputname" 6269117610Sdes else 6270117610Sdes $echo "$modename: warning: cannot relink \`$file'" 1>&2 6271117610Sdes fi 6272117610Sdes else 6273117610Sdes # Install the binary that we compiled earlier. 6274141098Sdes file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 6275117610Sdes fi 6276117610Sdes fi 6277117610Sdes 6278125647Sdes # remove .exe since cygwin /usr/bin/install will append another 6279174832Sdes # one anyway 6280125647Sdes case $install_prog,$host in 6281141098Sdes */usr/bin/install*,*cygwin*) 6282125647Sdes case $file:$destfile in 6283125647Sdes *.exe:*.exe) 6284125647Sdes # this is ok 6285125647Sdes ;; 6286125647Sdes *.exe:*) 6287125647Sdes destfile=$destfile.exe 6288125647Sdes ;; 6289125647Sdes *:*.exe) 6290141098Sdes destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 6291125647Sdes ;; 6292125647Sdes esac 6293125647Sdes ;; 6294125647Sdes esac 6295117610Sdes $show "$install_prog$stripme $file $destfile" 6296117610Sdes $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 6297117610Sdes test -n "$outputname" && ${rm}r "$tmpdir" 6298117610Sdes ;; 6299117610Sdes esac 6300117610Sdes done 6301117610Sdes 6302117610Sdes for file in $staticlibs; do 6303117610Sdes name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6304117610Sdes 6305117610Sdes # Set up the ranlib parameters. 6306117610Sdes oldlib="$destdir/$name" 6307117610Sdes 6308117610Sdes $show "$install_prog $file $oldlib" 6309117610Sdes $run eval "$install_prog \$file \$oldlib" || exit $? 6310117610Sdes 6311141098Sdes if test -n "$stripme" && test -n "$old_striplib"; then 6312125647Sdes $show "$old_striplib $oldlib" 6313125647Sdes $run eval "$old_striplib $oldlib" || exit $? 6314125647Sdes fi 6315125647Sdes 6316117610Sdes # Do each command in the postinstall commands. 6317141098Sdes cmds=$old_postinstall_cmds 6318125647Sdes save_ifs="$IFS"; IFS='~' 6319117610Sdes for cmd in $cmds; do 6320117610Sdes IFS="$save_ifs" 6321141098Sdes eval cmd=\"$cmd\" 6322117610Sdes $show "$cmd" 6323117610Sdes $run eval "$cmd" || exit $? 6324117610Sdes done 6325117610Sdes IFS="$save_ifs" 6326117610Sdes done 6327117610Sdes 6328117610Sdes if test -n "$future_libdirs"; then 6329117610Sdes $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 6330117610Sdes fi 6331117610Sdes 6332117610Sdes if test -n "$current_libdirs"; then 6333117610Sdes # Maybe just do a dry run. 6334117610Sdes test -n "$run" && current_libdirs=" -n$current_libdirs" 6335141098Sdes exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 6336125647Sdes else 6337141098Sdes exit $EXIT_SUCCESS 6338117610Sdes fi 6339117610Sdes ;; 6340117610Sdes 6341117610Sdes # libtool finish mode 6342117610Sdes finish) 6343117610Sdes modename="$modename: finish" 6344117610Sdes libdirs="$nonopt" 6345117610Sdes admincmds= 6346117610Sdes 6347117610Sdes if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 6348117610Sdes for dir 6349117610Sdes do 6350117610Sdes libdirs="$libdirs $dir" 6351117610Sdes done 6352117610Sdes 6353117610Sdes for libdir in $libdirs; do 6354117610Sdes if test -n "$finish_cmds"; then 6355117610Sdes # Do each command in the finish commands. 6356141098Sdes cmds=$finish_cmds 6357125647Sdes save_ifs="$IFS"; IFS='~' 6358117610Sdes for cmd in $cmds; do 6359117610Sdes IFS="$save_ifs" 6360141098Sdes eval cmd=\"$cmd\" 6361117610Sdes $show "$cmd" 6362117610Sdes $run eval "$cmd" || admincmds="$admincmds 6363117610Sdes $cmd" 6364117610Sdes done 6365117610Sdes IFS="$save_ifs" 6366117610Sdes fi 6367117610Sdes if test -n "$finish_eval"; then 6368117610Sdes # Do the single finish_eval. 6369117610Sdes eval cmds=\"$finish_eval\" 6370117610Sdes $run eval "$cmds" || admincmds="$admincmds 6371117610Sdes $cmds" 6372117610Sdes fi 6373117610Sdes done 6374117610Sdes fi 6375117610Sdes 6376117610Sdes # Exit here if they wanted silent mode. 6377141098Sdes test "$show" = : && exit $EXIT_SUCCESS 6378117610Sdes 6379174832Sdes $echo "X----------------------------------------------------------------------" | $Xsed 6380141098Sdes $echo "Libraries have been installed in:" 6381117610Sdes for libdir in $libdirs; do 6382141098Sdes $echo " $libdir" 6383117610Sdes done 6384141098Sdes $echo 6385141098Sdes $echo "If you ever happen to want to link against installed libraries" 6386141098Sdes $echo "in a given directory, LIBDIR, you must either use libtool, and" 6387141098Sdes $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 6388141098Sdes $echo "flag during linking and do at least one of the following:" 6389117610Sdes if test -n "$shlibpath_var"; then 6390141098Sdes $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 6391141098Sdes $echo " during execution" 6392117610Sdes fi 6393117610Sdes if test -n "$runpath_var"; then 6394141098Sdes $echo " - add LIBDIR to the \`$runpath_var' environment variable" 6395141098Sdes $echo " during linking" 6396117610Sdes fi 6397117610Sdes if test -n "$hardcode_libdir_flag_spec"; then 6398117610Sdes libdir=LIBDIR 6399117610Sdes eval flag=\"$hardcode_libdir_flag_spec\" 6400117610Sdes 6401141098Sdes $echo " - use the \`$flag' linker flag" 6402117610Sdes fi 6403117610Sdes if test -n "$admincmds"; then 6404141098Sdes $echo " - have your system administrator run these commands:$admincmds" 6405117610Sdes fi 6406117610Sdes if test -f /etc/ld.so.conf; then 6407141098Sdes $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6408117610Sdes fi 6409141098Sdes $echo 6410141098Sdes $echo "See any operating system documentation about shared libraries for" 6411141098Sdes $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6412174832Sdes $echo "X----------------------------------------------------------------------" | $Xsed 6413141098Sdes exit $EXIT_SUCCESS 6414117610Sdes ;; 6415117610Sdes 6416117610Sdes # libtool execute mode 6417117610Sdes execute) 6418117610Sdes modename="$modename: execute" 6419117610Sdes 6420117610Sdes # The first argument is the command name. 6421117610Sdes cmd="$nonopt" 6422117610Sdes if test -z "$cmd"; then 6423117610Sdes $echo "$modename: you must specify a COMMAND" 1>&2 6424117610Sdes $echo "$help" 6425141098Sdes exit $EXIT_FAILURE 6426117610Sdes fi 6427117610Sdes 6428117610Sdes # Handle -dlopen flags immediately. 6429117610Sdes for file in $execute_dlfiles; do 6430117610Sdes if test ! -f "$file"; then 6431117610Sdes $echo "$modename: \`$file' is not a file" 1>&2 6432117610Sdes $echo "$help" 1>&2 6433141098Sdes exit $EXIT_FAILURE 6434117610Sdes fi 6435117610Sdes 6436117610Sdes dir= 6437125647Sdes case $file in 6438117610Sdes *.la) 6439117610Sdes # Check to see that this really is a libtool archive. 6440141098Sdes if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 6441117610Sdes else 6442117610Sdes $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 6443117610Sdes $echo "$help" 1>&2 6444141098Sdes exit $EXIT_FAILURE 6445117610Sdes fi 6446117610Sdes 6447117610Sdes # Read the libtool library. 6448117610Sdes dlname= 6449117610Sdes library_names= 6450117610Sdes 6451117610Sdes # If there is no directory component, then add one. 6452125647Sdes case $file in 6453117610Sdes */* | *\\*) . $file ;; 6454117610Sdes *) . ./$file ;; 6455117610Sdes esac 6456117610Sdes 6457117610Sdes # Skip this library if it cannot be dlopened. 6458117610Sdes if test -z "$dlname"; then 6459117610Sdes # Warn if it was a shared library. 6460117610Sdes test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 6461117610Sdes continue 6462117610Sdes fi 6463117610Sdes 6464117610Sdes dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6465117610Sdes test "X$dir" = "X$file" && dir=. 6466117610Sdes 6467117610Sdes if test -f "$dir/$objdir/$dlname"; then 6468117610Sdes dir="$dir/$objdir" 6469117610Sdes else 6470174832Sdes if test ! -f "$dir/$dlname"; then 6471174832Sdes $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 6472174832Sdes exit $EXIT_FAILURE 6473174832Sdes fi 6474117610Sdes fi 6475117610Sdes ;; 6476117610Sdes 6477117610Sdes *.lo) 6478117610Sdes # Just add the directory containing the .lo file. 6479117610Sdes dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6480117610Sdes test "X$dir" = "X$file" && dir=. 6481117610Sdes ;; 6482117610Sdes 6483117610Sdes *) 6484117610Sdes $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 6485117610Sdes continue 6486117610Sdes ;; 6487117610Sdes esac 6488117610Sdes 6489117610Sdes # Get the absolute pathname. 6490117610Sdes absdir=`cd "$dir" && pwd` 6491117610Sdes test -n "$absdir" && dir="$absdir" 6492117610Sdes 6493117610Sdes # Now add the directory to shlibpath_var. 6494117610Sdes if eval "test -z \"\$$shlibpath_var\""; then 6495117610Sdes eval "$shlibpath_var=\"\$dir\"" 6496117610Sdes else 6497117610Sdes eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 6498117610Sdes fi 6499117610Sdes done 6500117610Sdes 6501117610Sdes # This variable tells wrapper scripts just to set shlibpath_var 6502117610Sdes # rather than running their programs. 6503117610Sdes libtool_execute_magic="$magic" 6504117610Sdes 6505117610Sdes # Check if any of the arguments is a wrapper script. 6506117610Sdes args= 6507117610Sdes for file 6508117610Sdes do 6509125647Sdes case $file in 6510117610Sdes -*) ;; 6511117610Sdes *) 6512117610Sdes # Do a test to see if this is really a libtool program. 6513141098Sdes if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6514117610Sdes # If there is no directory component, then add one. 6515125647Sdes case $file in 6516117610Sdes */* | *\\*) . $file ;; 6517117610Sdes *) . ./$file ;; 6518117610Sdes esac 6519117610Sdes 6520117610Sdes # Transform arg to wrapped name. 6521117610Sdes file="$progdir/$program" 6522117610Sdes fi 6523117610Sdes ;; 6524117610Sdes esac 6525117610Sdes # Quote arguments (to preserve shell metacharacters). 6526117610Sdes file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 6527117610Sdes args="$args \"$file\"" 6528117610Sdes done 6529117610Sdes 6530117610Sdes if test -z "$run"; then 6531117610Sdes if test -n "$shlibpath_var"; then 6532125647Sdes # Export the shlibpath_var. 6533125647Sdes eval "export $shlibpath_var" 6534117610Sdes fi 6535117610Sdes 6536141098Sdes # Restore saved environment variables 6537174832Sdes for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 6538174832Sdes do 6539174832Sdes eval "if test \"\${save_$lt_var+set}\" = set; then 6540174832Sdes $lt_var=\$save_$lt_var; export $lt_var 6541174832Sdes fi" 6542174832Sdes done 6543117610Sdes 6544125647Sdes # Now prepare to actually exec the command. 6545125647Sdes exec_cmd="\$cmd$args" 6546117610Sdes else 6547117610Sdes # Display what would be done. 6548117610Sdes if test -n "$shlibpath_var"; then 6549125647Sdes eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 6550125647Sdes $echo "export $shlibpath_var" 6551117610Sdes fi 6552117610Sdes $echo "$cmd$args" 6553141098Sdes exit $EXIT_SUCCESS 6554117610Sdes fi 6555117610Sdes ;; 6556117610Sdes 6557125647Sdes # libtool clean and uninstall mode 6558125647Sdes clean | uninstall) 6559125647Sdes modename="$modename: $mode" 6560117610Sdes rm="$nonopt" 6561117610Sdes files= 6562125647Sdes rmforce= 6563125647Sdes exit_status=0 6564117610Sdes 6565125647Sdes # This variable tells wrapper scripts just to set variables rather 6566125647Sdes # than running their programs. 6567125647Sdes libtool_install_magic="$magic" 6568125647Sdes 6569117610Sdes for arg 6570117610Sdes do 6571125647Sdes case $arg in 6572125647Sdes -f) rm="$rm $arg"; rmforce=yes ;; 6573117610Sdes -*) rm="$rm $arg" ;; 6574117610Sdes *) files="$files $arg" ;; 6575117610Sdes esac 6576117610Sdes done 6577117610Sdes 6578117610Sdes if test -z "$rm"; then 6579117610Sdes $echo "$modename: you must specify an RM program" 1>&2 6580117610Sdes $echo "$help" 1>&2 6581141098Sdes exit $EXIT_FAILURE 6582117610Sdes fi 6583117610Sdes 6584125647Sdes rmdirs= 6585125647Sdes 6586141098Sdes origobjdir="$objdir" 6587117610Sdes for file in $files; do 6588117610Sdes dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6589125647Sdes if test "X$dir" = "X$file"; then 6590125647Sdes dir=. 6591141098Sdes objdir="$origobjdir" 6592125647Sdes else 6593141098Sdes objdir="$dir/$origobjdir" 6594125647Sdes fi 6595117610Sdes name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6596141098Sdes test "$mode" = uninstall && objdir="$dir" 6597117610Sdes 6598125647Sdes # Remember objdir for removal later, being careful to avoid duplicates 6599141098Sdes if test "$mode" = clean; then 6600125647Sdes case " $rmdirs " in 6601125647Sdes *" $objdir "*) ;; 6602125647Sdes *) rmdirs="$rmdirs $objdir" ;; 6603125647Sdes esac 6604125647Sdes fi 6605125647Sdes 6606125647Sdes # Don't error if the file doesn't exist and rm -f was used. 6607125647Sdes if (test -L "$file") >/dev/null 2>&1 \ 6608125647Sdes || (test -h "$file") >/dev/null 2>&1 \ 6609125647Sdes || test -f "$file"; then 6610125647Sdes : 6611125647Sdes elif test -d "$file"; then 6612125647Sdes exit_status=1 6613125647Sdes continue 6614125647Sdes elif test "$rmforce" = yes; then 6615125647Sdes continue 6616125647Sdes fi 6617125647Sdes 6618117610Sdes rmfiles="$file" 6619117610Sdes 6620125647Sdes case $name in 6621117610Sdes *.la) 6622117610Sdes # Possibly a libtool archive, so verify it. 6623141098Sdes if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6624117610Sdes . $dir/$name 6625117610Sdes 6626117610Sdes # Delete the libtool libraries and symlinks. 6627117610Sdes for n in $library_names; do 6628125647Sdes rmfiles="$rmfiles $objdir/$n" 6629117610Sdes done 6630125647Sdes test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6631117610Sdes 6632174832Sdes case "$mode" in 6633174832Sdes clean) 6634174832Sdes case " $library_names " in 6635174832Sdes # " " in the beginning catches empty $dlname 6636174832Sdes *" $dlname "*) ;; 6637174832Sdes *) rmfiles="$rmfiles $objdir/$dlname" ;; 6638174832Sdes esac 6639174832Sdes test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 6640174832Sdes ;; 6641174832Sdes uninstall) 6642125647Sdes if test -n "$library_names"; then 6643125647Sdes # Do each command in the postuninstall commands. 6644141098Sdes cmds=$postuninstall_cmds 6645125647Sdes save_ifs="$IFS"; IFS='~' 6646125647Sdes for cmd in $cmds; do 6647125647Sdes IFS="$save_ifs" 6648141098Sdes eval cmd=\"$cmd\" 6649125647Sdes $show "$cmd" 6650125647Sdes $run eval "$cmd" 6651141098Sdes if test "$?" -ne 0 && test "$rmforce" != yes; then 6652125647Sdes exit_status=1 6653125647Sdes fi 6654125647Sdes done 6655117610Sdes IFS="$save_ifs" 6656125647Sdes fi 6657117610Sdes 6658125647Sdes if test -n "$old_library"; then 6659125647Sdes # Do each command in the old_postuninstall commands. 6660141098Sdes cmds=$old_postuninstall_cmds 6661125647Sdes save_ifs="$IFS"; IFS='~' 6662125647Sdes for cmd in $cmds; do 6663125647Sdes IFS="$save_ifs" 6664141098Sdes eval cmd=\"$cmd\" 6665125647Sdes $show "$cmd" 6666125647Sdes $run eval "$cmd" 6667141098Sdes if test "$?" -ne 0 && test "$rmforce" != yes; then 6668125647Sdes exit_status=1 6669125647Sdes fi 6670125647Sdes done 6671117610Sdes IFS="$save_ifs" 6672125647Sdes fi 6673125647Sdes # FIXME: should reinstall the best remaining shared library. 6674174832Sdes ;; 6675174832Sdes esac 6676117610Sdes fi 6677117610Sdes ;; 6678117610Sdes 6679117610Sdes *.lo) 6680141098Sdes # Possibly a libtool object, so verify it. 6681141098Sdes if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6682141098Sdes 6683141098Sdes # Read the .lo file 6684141098Sdes . $dir/$name 6685141098Sdes 6686141098Sdes # Add PIC object to the list of files to remove. 6687141098Sdes if test -n "$pic_object" \ 6688141098Sdes && test "$pic_object" != none; then 6689141098Sdes rmfiles="$rmfiles $dir/$pic_object" 6690141098Sdes fi 6691141098Sdes 6692141098Sdes # Add non-PIC object to the list of files to remove. 6693141098Sdes if test -n "$non_pic_object" \ 6694141098Sdes && test "$non_pic_object" != none; then 6695141098Sdes rmfiles="$rmfiles $dir/$non_pic_object" 6696141098Sdes fi 6697117610Sdes fi 6698117610Sdes ;; 6699117610Sdes 6700117610Sdes *) 6701141098Sdes if test "$mode" = clean ; then 6702141098Sdes noexename=$name 6703141098Sdes case $file in 6704141098Sdes *.exe) 6705141098Sdes file=`$echo $file|${SED} 's,.exe$,,'` 6706141098Sdes noexename=`$echo $name|${SED} 's,.exe$,,'` 6707141098Sdes # $file with .exe has already been added to rmfiles, 6708141098Sdes # add $file without .exe 6709141098Sdes rmfiles="$rmfiles $file" 6710141098Sdes ;; 6711141098Sdes esac 6712141098Sdes # Do a test to see if this is a libtool program. 6713141098Sdes if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6714141098Sdes relink_command= 6715141098Sdes . $dir/$noexename 6716125647Sdes 6717141098Sdes # note $name still contains .exe if it was in $file originally 6718141098Sdes # as does the version of $file that was added into $rmfiles 6719141098Sdes rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 6720141098Sdes if test "$fast_install" = yes && test -n "$relink_command"; then 6721141098Sdes rmfiles="$rmfiles $objdir/lt-$name" 6722141098Sdes fi 6723141098Sdes if test "X$noexename" != "X$name" ; then 6724141098Sdes rmfiles="$rmfiles $objdir/lt-${noexename}.c" 6725141098Sdes fi 6726125647Sdes fi 6727125647Sdes fi 6728117610Sdes ;; 6729117610Sdes esac 6730125647Sdes $show "$rm $rmfiles" 6731125647Sdes $run $rm $rmfiles || exit_status=1 6732117610Sdes done 6733141098Sdes objdir="$origobjdir" 6734125647Sdes 6735125647Sdes # Try to remove the ${objdir}s in the directories where we deleted files 6736125647Sdes for dir in $rmdirs; do 6737125647Sdes if test -d "$dir"; then 6738125647Sdes $show "rmdir $dir" 6739125647Sdes $run rmdir $dir >/dev/null 2>&1 6740125647Sdes fi 6741125647Sdes done 6742125647Sdes 6743125647Sdes exit $exit_status 6744117610Sdes ;; 6745117610Sdes 6746117610Sdes "") 6747117610Sdes $echo "$modename: you must specify a MODE" 1>&2 6748117610Sdes $echo "$generic_help" 1>&2 6749141098Sdes exit $EXIT_FAILURE 6750117610Sdes ;; 6751117610Sdes esac 6752117610Sdes 6753125647Sdes if test -z "$exec_cmd"; then 6754125647Sdes $echo "$modename: invalid operation mode \`$mode'" 1>&2 6755125647Sdes $echo "$generic_help" 1>&2 6756141098Sdes exit $EXIT_FAILURE 6757125647Sdes fi 6758117610Sdesfi # test -z "$show_help" 6759117610Sdes 6760125647Sdesif test -n "$exec_cmd"; then 6761125647Sdes eval exec $exec_cmd 6762141098Sdes exit $EXIT_FAILURE 6763125647Sdesfi 6764125647Sdes 6765117610Sdes# We need to display help for each of the modes. 6766125647Sdescase $mode in 6767117610Sdes"") $echo \ 6768117610Sdes"Usage: $modename [OPTION]... [MODE-ARG]... 6769117610Sdes 6770117610SdesProvide generalized library-building support services. 6771117610Sdes 6772117610Sdes --config show all configuration variables 6773117610Sdes --debug enable verbose shell tracing 6774117610Sdes-n, --dry-run display commands without modifying any files 6775117610Sdes --features display basic configuration information and exit 6776117610Sdes --finish same as \`--mode=finish' 6777117610Sdes --help display this help message and exit 6778117610Sdes --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 6779117610Sdes --quiet same as \`--silent' 6780117610Sdes --silent don't print informational messages 6781141098Sdes --tag=TAG use configuration variables from tag TAG 6782117610Sdes --version print version information 6783117610Sdes 6784117610SdesMODE must be one of the following: 6785117610Sdes 6786125647Sdes clean remove files from the build directory 6787117610Sdes compile compile a source file into a libtool object 6788117610Sdes execute automatically set library path, then run a program 6789117610Sdes finish complete the installation of libtool libraries 6790117610Sdes install install libraries or executables 6791117610Sdes link create a library or an executable 6792117610Sdes uninstall remove libraries from an installed directory 6793117610Sdes 6794117610SdesMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 6795141098Sdesa more detailed description of MODE. 6796141098Sdes 6797141098SdesReport bugs to <bug-libtool@gnu.org>." 6798141098Sdes exit $EXIT_SUCCESS 6799117610Sdes ;; 6800117610Sdes 6801125647Sdesclean) 6802125647Sdes $echo \ 6803125647Sdes"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 6804125647Sdes 6805125647SdesRemove files from the build directory. 6806125647Sdes 6807125647SdesRM is the name of the program to use to delete files associated with each FILE 6808125647Sdes(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6809125647Sdesto RM. 6810125647Sdes 6811125647SdesIf FILE is a libtool library, object or program, all the files associated 6812125647Sdeswith it are deleted. Otherwise, only FILE itself is deleted using RM." 6813125647Sdes ;; 6814125647Sdes 6815117610Sdescompile) 6816117610Sdes $echo \ 6817117610Sdes"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 6818117610Sdes 6819117610SdesCompile a source file into a libtool library object. 6820117610Sdes 6821117610SdesThis mode accepts the following additional options: 6822117610Sdes 6823117610Sdes -o OUTPUT-FILE set the output file name to OUTPUT-FILE 6824125647Sdes -prefer-pic try to building PIC objects only 6825125647Sdes -prefer-non-pic try to building non-PIC objects only 6826117610Sdes -static always build a \`.o' file suitable for static linking 6827117610Sdes 6828117610SdesCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 6829117610Sdesfrom the given SOURCEFILE. 6830117610Sdes 6831117610SdesThe output file name is determined by removing the directory component from 6832117610SdesSOURCEFILE, then substituting the C source code suffix \`.c' with the 6833117610Sdeslibrary object suffix, \`.lo'." 6834117610Sdes ;; 6835117610Sdes 6836117610Sdesexecute) 6837117610Sdes $echo \ 6838117610Sdes"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 6839117610Sdes 6840117610SdesAutomatically set library path, then run a program. 6841117610Sdes 6842117610SdesThis mode accepts the following additional options: 6843117610Sdes 6844117610Sdes -dlopen FILE add the directory containing FILE to the library path 6845117610Sdes 6846117610SdesThis mode sets the library path environment variable according to \`-dlopen' 6847117610Sdesflags. 6848117610Sdes 6849117610SdesIf any of the ARGS are libtool executable wrappers, then they are translated 6850117610Sdesinto their corresponding uninstalled binary, and any of their required library 6851117610Sdesdirectories are added to the library path. 6852117610Sdes 6853117610SdesThen, COMMAND is executed, with ARGS as arguments." 6854117610Sdes ;; 6855117610Sdes 6856117610Sdesfinish) 6857117610Sdes $echo \ 6858117610Sdes"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 6859117610Sdes 6860117610SdesComplete the installation of libtool libraries. 6861117610Sdes 6862117610SdesEach LIBDIR is a directory that contains libtool libraries. 6863117610Sdes 6864117610SdesThe commands that this mode executes may require superuser privileges. Use 6865117610Sdesthe \`--dry-run' option if you just want to see what would be executed." 6866117610Sdes ;; 6867117610Sdes 6868117610Sdesinstall) 6869117610Sdes $echo \ 6870117610Sdes"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 6871117610Sdes 6872117610SdesInstall executables or libraries. 6873117610Sdes 6874117610SdesINSTALL-COMMAND is the installation command. The first component should be 6875117610Sdeseither the \`install' or \`cp' program. 6876117610Sdes 6877117610SdesThe rest of the components are interpreted as arguments to that command (only 6878117610SdesBSD-compatible install options are recognized)." 6879117610Sdes ;; 6880117610Sdes 6881117610Sdeslink) 6882117610Sdes $echo \ 6883117610Sdes"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 6884117610Sdes 6885117610SdesLink object files or libraries together to form another library, or to 6886117610Sdescreate an executable program. 6887117610Sdes 6888117610SdesLINK-COMMAND is a command using the C compiler that you would use to create 6889117610Sdesa program from several object files. 6890117610Sdes 6891117610SdesThe following components of LINK-COMMAND are treated specially: 6892117610Sdes 6893117610Sdes -all-static do not do any dynamic linking at all 6894117610Sdes -avoid-version do not add a version suffix if possible 6895117610Sdes -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 6896117610Sdes -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 6897117610Sdes -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 6898117610Sdes -export-symbols SYMFILE 6899174832Sdes try to export only the symbols listed in SYMFILE 6900117610Sdes -export-symbols-regex REGEX 6901174832Sdes try to export only the symbols matching REGEX 6902117610Sdes -LLIBDIR search LIBDIR for required installed libraries 6903117610Sdes -lNAME OUTPUT-FILE requires the installed library libNAME 6904117610Sdes -module build a library that can dlopened 6905125647Sdes -no-fast-install disable the fast-install mode 6906125647Sdes -no-install link a not-installable executable 6907117610Sdes -no-undefined declare that a library does not refer to external symbols 6908117610Sdes -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 6909141098Sdes -objectlist FILE Use a list of object files found in FILE to specify objects 6910141098Sdes -precious-files-regex REGEX 6911141098Sdes don't remove output files matching REGEX 6912117610Sdes -release RELEASE specify package release information 6913117610Sdes -rpath LIBDIR the created library will eventually be installed in LIBDIR 6914117610Sdes -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 6915174832Sdes -static do not do any dynamic linking of uninstalled libtool libraries 6916174832Sdes -static-libtool-libs 6917174832Sdes do not do any dynamic linking of libtool libraries 6918117610Sdes -version-info CURRENT[:REVISION[:AGE]] 6919174832Sdes specify library version info [each variable defaults to 0] 6920117610Sdes 6921117610SdesAll other options (arguments beginning with \`-') are ignored. 6922117610Sdes 6923117610SdesEvery other argument is treated as a filename. Files ending in \`.la' are 6924117610Sdestreated as uninstalled libtool libraries, other files are standard or library 6925117610Sdesobject files. 6926117610Sdes 6927117610SdesIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 6928117610Sdesonly library objects (\`.lo' files) may be specified, and \`-rpath' is 6929117610Sdesrequired, except when creating a convenience library. 6930117610Sdes 6931117610SdesIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 6932117610Sdesusing \`ar' and \`ranlib', or on Windows using \`lib'. 6933117610Sdes 6934117610SdesIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 6935117610Sdesis created, otherwise an executable program is created." 6936117610Sdes ;; 6937117610Sdes 6938117610Sdesuninstall) 6939117610Sdes $echo \ 6940117610Sdes"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 6941117610Sdes 6942117610SdesRemove libraries from an installation directory. 6943117610Sdes 6944117610SdesRM is the name of the program to use to delete files associated with each FILE 6945117610Sdes(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6946117610Sdesto RM. 6947117610Sdes 6948117610SdesIf FILE is a libtool library, all the files associated with it are deleted. 6949117610SdesOtherwise, only FILE itself is deleted using RM." 6950117610Sdes ;; 6951117610Sdes 6952117610Sdes*) 6953117610Sdes $echo "$modename: invalid operation mode \`$mode'" 1>&2 6954117610Sdes $echo "$help" 1>&2 6955141098Sdes exit $EXIT_FAILURE 6956117610Sdes ;; 6957117610Sdesesac 6958117610Sdes 6959141098Sdes$echo 6960117610Sdes$echo "Try \`$modename --help' for more information about other modes." 6961117610Sdes 6962147455Sdesexit $? 6963117610Sdes 6964141098Sdes# The TAGs below are defined such that we never get into a situation 6965141098Sdes# in which we disable both kinds of libraries. Given conflicting 6966141098Sdes# choices, we go for a static library, that is the most portable, 6967141098Sdes# since we can't tell whether shared libraries were disabled because 6968141098Sdes# the user asked for that or because the platform doesn't support 6969141098Sdes# them. This is particularly important on AIX, because we don't 6970141098Sdes# support having both static and shared libraries enabled at the same 6971141098Sdes# time on that platform, so we default to a shared-only configuration. 6972141098Sdes# If a disable-shared tag is given, we'll fallback to a static-only 6973141098Sdes# configuration. But we'll never go from static-only to shared-only. 6974141098Sdes 6975141098Sdes# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6976174832Sdesdisable_libs=shared 6977141098Sdes# ### END LIBTOOL TAG CONFIG: disable-shared 6978141098Sdes 6979141098Sdes# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6980174832Sdesdisable_libs=static 6981141098Sdes# ### END LIBTOOL TAG CONFIG: disable-static 6982141098Sdes 6983117610Sdes# Local Variables: 6984117610Sdes# mode:shell-script 6985117610Sdes# sh-indentation:2 6986117610Sdes# End: 6987