ltmain.sh revision 16fd1166
16df26cacSmrg# ltmain.sh - Provide generalized library-building support services. 26df26cacSmrg# NOTE: Changing this file will not affect anything until you rerun configure. 36df26cacSmrg# 416fd1166Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 516fd1166Smrg# 2007 Free Software Foundation, Inc. 66df26cacSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 76df26cacSmrg# 86df26cacSmrg# This program is free software; you can redistribute it and/or modify 96df26cacSmrg# it under the terms of the GNU General Public License as published by 106df26cacSmrg# the Free Software Foundation; either version 2 of the License, or 116df26cacSmrg# (at your option) any later version. 126df26cacSmrg# 136df26cacSmrg# This program is distributed in the hope that it will be useful, but 146df26cacSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 156df26cacSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 166df26cacSmrg# General Public License for more details. 176df26cacSmrg# 186df26cacSmrg# You should have received a copy of the GNU General Public License 196df26cacSmrg# along with this program; if not, write to the Free Software 206df26cacSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 216df26cacSmrg# 226df26cacSmrg# As a special exception to the GNU General Public License, if you 236df26cacSmrg# distribute this file as part of a program that contains a 246df26cacSmrg# configuration script generated by Autoconf, you may include it under 256df26cacSmrg# the same distribution terms that you use for the rest of that program. 266df26cacSmrg 276df26cacSmrgbasename="s,^.*/,,g" 286df26cacSmrg 296df26cacSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 306df26cacSmrg# is ksh but when the shell is invoked as "sh" and the current value of 316df26cacSmrg# the _XPG environment variable is not equal to 1 (one), the special 326df26cacSmrg# positional parameter $0, within a function call, is the name of the 336df26cacSmrg# function. 346df26cacSmrgprogpath="$0" 356df26cacSmrg 366df26cacSmrg# The name of this program: 376df26cacSmrgprogname=`echo "$progpath" | $SED $basename` 386df26cacSmrgmodename="$progname" 396df26cacSmrg 406df26cacSmrg# Global variables: 416df26cacSmrgEXIT_SUCCESS=0 426df26cacSmrgEXIT_FAILURE=1 436df26cacSmrg 446df26cacSmrgPROGRAM=ltmain.sh 456df26cacSmrgPACKAGE=libtool 4616fd1166SmrgVERSION=1.5.24 4716fd1166SmrgTIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)" 4816fd1166Smrg 4916fd1166Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 5016fd1166Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 5116fd1166Smrg emulate sh 5216fd1166Smrg NULLCMD=: 5316fd1166Smrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 5416fd1166Smrg # is contrary to our usage. Disable this feature. 5516fd1166Smrg alias -g '${1+"$@"}'='"$@"' 566df26cacSmrg setopt NO_GLOB_SUBST 5716fd1166Smrgelse 5816fd1166Smrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 596df26cacSmrgfi 6016fd1166SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 6116fd1166SmrgDUALCASE=1; export DUALCASE # for MKS sh 626df26cacSmrg 636df26cacSmrg# Check that we have a working $echo. 646df26cacSmrgif test "X$1" = X--no-reexec; then 656df26cacSmrg # Discard the --no-reexec flag, and continue. 666df26cacSmrg shift 676df26cacSmrgelif test "X$1" = X--fallback-echo; then 686df26cacSmrg # Avoid inline document here, it may be left over 696df26cacSmrg : 706df26cacSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 716df26cacSmrg # Yippee, $echo works! 726df26cacSmrg : 736df26cacSmrgelse 746df26cacSmrg # Restart under the correct shell, and then maybe $echo will work. 756df26cacSmrg exec $SHELL "$progpath" --no-reexec ${1+"$@"} 766df26cacSmrgfi 776df26cacSmrg 786df26cacSmrgif test "X$1" = X--fallback-echo; then 796df26cacSmrg # used as fallback echo 806df26cacSmrg shift 816df26cacSmrg cat <<EOF 826df26cacSmrg$* 836df26cacSmrgEOF 846df26cacSmrg exit $EXIT_SUCCESS 856df26cacSmrgfi 866df26cacSmrg 876df26cacSmrgdefault_mode= 886df26cacSmrghelp="Try \`$progname --help' for more information." 896df26cacSmrgmagic="%%%MAGIC variable%%%" 906df26cacSmrgmkdir="mkdir" 916df26cacSmrgmv="mv -f" 926df26cacSmrgrm="rm -f" 936df26cacSmrg 946df26cacSmrg# Sed substitution that helps us do robust quoting. It backslashifies 956df26cacSmrg# metacharacters that are still active within double-quoted strings. 966df26cacSmrgXsed="${SED}"' -e 1s/^X//' 976df26cacSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 986df26cacSmrg# test EBCDIC or ASCII 996df26cacSmrgcase `echo X|tr X '\101'` in 1006df26cacSmrg A) # ASCII based system 1016df26cacSmrg # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 1026df26cacSmrg SP2NL='tr \040 \012' 1036df26cacSmrg NL2SP='tr \015\012 \040\040' 1046df26cacSmrg ;; 1056df26cacSmrg *) # EBCDIC based system 1066df26cacSmrg SP2NL='tr \100 \n' 1076df26cacSmrg NL2SP='tr \r\n \100\100' 1086df26cacSmrg ;; 1096df26cacSmrgesac 1106df26cacSmrg 1116df26cacSmrg# NLS nuisances. 1126df26cacSmrg# Only set LANG and LC_ALL to C if already set. 1136df26cacSmrg# These must not be set unconditionally because not all systems understand 1146df26cacSmrg# e.g. LANG=C (notably SCO). 1156df26cacSmrg# We save the old values to restore during execute mode. 11616fd1166Smrgfor lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 11716fd1166Smrgdo 11816fd1166Smrg eval "if test \"\${$lt_var+set}\" = set; then 11916fd1166Smrg save_$lt_var=\$$lt_var 12016fd1166Smrg $lt_var=C 12116fd1166Smrg export $lt_var 12216fd1166Smrg fi" 12316fd1166Smrgdone 1246df26cacSmrg 1256df26cacSmrg# Make sure IFS has a sensible default 1266df26cacSmrglt_nl=' 1276df26cacSmrg' 1286df26cacSmrgIFS=" $lt_nl" 1296df26cacSmrg 1306df26cacSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 1316df26cacSmrg $echo "$modename: not configured to build any kind of library" 1>&2 1326df26cacSmrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 1336df26cacSmrg exit $EXIT_FAILURE 1346df26cacSmrgfi 1356df26cacSmrg 1366df26cacSmrg# Global variables. 1376df26cacSmrgmode=$default_mode 1386df26cacSmrgnonopt= 1396df26cacSmrgprev= 1406df26cacSmrgprevopt= 1416df26cacSmrgrun= 1426df26cacSmrgshow="$echo" 1436df26cacSmrgshow_help= 1446df26cacSmrgexecute_dlfiles= 1456df26cacSmrgduplicate_deps=no 1466df26cacSmrgpreserve_args= 1476df26cacSmrglo2o="s/\\.lo\$/.${objext}/" 1486df26cacSmrgo2lo="s/\\.${objext}\$/.lo/" 14916fd1166Smrgextracted_archives= 15016fd1166Smrgextracted_serial=0 1516df26cacSmrg 1526df26cacSmrg##################################### 1536df26cacSmrg# Shell function definitions: 1546df26cacSmrg# This seems to be the best place for them 1556df26cacSmrg 1566df26cacSmrg# func_mktempdir [string] 1576df26cacSmrg# Make a temporary directory that won't clash with other running 1586df26cacSmrg# libtool processes, and avoids race conditions if possible. If 1596df26cacSmrg# given, STRING is the basename for that directory. 1606df26cacSmrgfunc_mktempdir () 1616df26cacSmrg{ 1626df26cacSmrg my_template="${TMPDIR-/tmp}/${1-$progname}" 1636df26cacSmrg 1646df26cacSmrg if test "$run" = ":"; then 1656df26cacSmrg # Return a directory name, but don't create it in dry-run mode 1666df26cacSmrg my_tmpdir="${my_template}-$$" 1676df26cacSmrg else 1686df26cacSmrg 1696df26cacSmrg # If mktemp works, use that first and foremost 1706df26cacSmrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 1716df26cacSmrg 1726df26cacSmrg if test ! -d "$my_tmpdir"; then 1736df26cacSmrg # Failing that, at least try and use $RANDOM to avoid a race 1746df26cacSmrg my_tmpdir="${my_template}-${RANDOM-0}$$" 1756df26cacSmrg 1766df26cacSmrg save_mktempdir_umask=`umask` 1776df26cacSmrg umask 0077 1786df26cacSmrg $mkdir "$my_tmpdir" 1796df26cacSmrg umask $save_mktempdir_umask 1806df26cacSmrg fi 1816df26cacSmrg 1826df26cacSmrg # If we're not in dry-run mode, bomb out on failure 1836df26cacSmrg test -d "$my_tmpdir" || { 1846df26cacSmrg $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 1856df26cacSmrg exit $EXIT_FAILURE 1866df26cacSmrg } 1876df26cacSmrg fi 1886df26cacSmrg 1896df26cacSmrg $echo "X$my_tmpdir" | $Xsed 1906df26cacSmrg} 1916df26cacSmrg 1926df26cacSmrg 1936df26cacSmrg# func_win32_libid arg 1946df26cacSmrg# return the library type of file 'arg' 1956df26cacSmrg# 1966df26cacSmrg# Need a lot of goo to handle *both* DLLs and import libs 1976df26cacSmrg# Has to be a shell function in order to 'eat' the argument 1986df26cacSmrg# that is supplied when $file_magic_command is called. 1996df26cacSmrgfunc_win32_libid () 2006df26cacSmrg{ 2016df26cacSmrg win32_libid_type="unknown" 2026df26cacSmrg win32_fileres=`file -L $1 2>/dev/null` 2036df26cacSmrg case $win32_fileres in 2046df26cacSmrg *ar\ archive\ import\ library*) # definitely import 2056df26cacSmrg win32_libid_type="x86 archive import" 2066df26cacSmrg ;; 2076df26cacSmrg *ar\ archive*) # could be an import, or static 2086df26cacSmrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 2096df26cacSmrg $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 2106df26cacSmrg win32_nmres=`eval $NM -f posix -A $1 | \ 21116fd1166Smrg $SED -n -e '1,100{ 21216fd1166Smrg / I /{ 21316fd1166Smrg s,.*,import, 21416fd1166Smrg p 21516fd1166Smrg q 21616fd1166Smrg } 21716fd1166Smrg }'` 2186df26cacSmrg case $win32_nmres in 2196df26cacSmrg import*) win32_libid_type="x86 archive import";; 2206df26cacSmrg *) win32_libid_type="x86 archive static";; 2216df26cacSmrg esac 2226df26cacSmrg fi 2236df26cacSmrg ;; 2246df26cacSmrg *DLL*) 2256df26cacSmrg win32_libid_type="x86 DLL" 2266df26cacSmrg ;; 2276df26cacSmrg *executable*) # but shell scripts are "executable" too... 2286df26cacSmrg case $win32_fileres in 2296df26cacSmrg *MS\ Windows\ PE\ Intel*) 2306df26cacSmrg win32_libid_type="x86 DLL" 2316df26cacSmrg ;; 2326df26cacSmrg esac 2336df26cacSmrg ;; 2346df26cacSmrg esac 2356df26cacSmrg $echo $win32_libid_type 2366df26cacSmrg} 2376df26cacSmrg 2386df26cacSmrg 2396df26cacSmrg# func_infer_tag arg 2406df26cacSmrg# Infer tagged configuration to use if any are available and 2416df26cacSmrg# if one wasn't chosen via the "--tag" command line option. 2426df26cacSmrg# Only attempt this if the compiler in the base compile 2436df26cacSmrg# command doesn't match the default compiler. 2446df26cacSmrg# arg is usually of the form 'gcc ...' 2456df26cacSmrgfunc_infer_tag () 2466df26cacSmrg{ 2476df26cacSmrg if test -n "$available_tags" && test -z "$tagname"; then 2486df26cacSmrg CC_quoted= 2496df26cacSmrg for arg in $CC; do 2506df26cacSmrg case $arg in 2516df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2526df26cacSmrg arg="\"$arg\"" 2536df26cacSmrg ;; 2546df26cacSmrg esac 2556df26cacSmrg CC_quoted="$CC_quoted $arg" 2566df26cacSmrg done 2576df26cacSmrg case $@ in 2586df26cacSmrg # Blanks in the command may have been stripped by the calling shell, 2596df26cacSmrg # but not from the CC environment variable when configure was run. 2606df26cacSmrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 2616df26cacSmrg # Blanks at the start of $base_compile will cause this to fail 2626df26cacSmrg # if we don't check for them as well. 2636df26cacSmrg *) 2646df26cacSmrg for z in $available_tags; do 2656df26cacSmrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 2666df26cacSmrg # Evaluate the configuration. 2676df26cacSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 2686df26cacSmrg CC_quoted= 2696df26cacSmrg for arg in $CC; do 2706df26cacSmrg # Double-quote args containing other shell metacharacters. 2716df26cacSmrg case $arg in 2726df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 2736df26cacSmrg arg="\"$arg\"" 2746df26cacSmrg ;; 2756df26cacSmrg esac 2766df26cacSmrg CC_quoted="$CC_quoted $arg" 2776df26cacSmrg done 2786df26cacSmrg case "$@ " in 2796df26cacSmrg " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 2806df26cacSmrg # The compiler in the base compile command matches 2816df26cacSmrg # the one in the tagged configuration. 2826df26cacSmrg # Assume this is the tagged configuration we want. 2836df26cacSmrg tagname=$z 2846df26cacSmrg break 2856df26cacSmrg ;; 2866df26cacSmrg esac 2876df26cacSmrg fi 2886df26cacSmrg done 2896df26cacSmrg # If $tagname still isn't set, then no tagged configuration 2906df26cacSmrg # was found and let the user know that the "--tag" command 2916df26cacSmrg # line option must be used. 2926df26cacSmrg if test -z "$tagname"; then 2936df26cacSmrg $echo "$modename: unable to infer tagged configuration" 2946df26cacSmrg $echo "$modename: specify a tag with \`--tag'" 1>&2 2956df26cacSmrg exit $EXIT_FAILURE 2966df26cacSmrg# else 2976df26cacSmrg# $echo "$modename: using $tagname tagged configuration" 2986df26cacSmrg fi 2996df26cacSmrg ;; 3006df26cacSmrg esac 3016df26cacSmrg fi 3026df26cacSmrg} 3036df26cacSmrg 3046df26cacSmrg 3056df26cacSmrg# func_extract_an_archive dir oldlib 3066df26cacSmrgfunc_extract_an_archive () 3076df26cacSmrg{ 3086df26cacSmrg f_ex_an_ar_dir="$1"; shift 3096df26cacSmrg f_ex_an_ar_oldlib="$1" 3106df26cacSmrg 3116df26cacSmrg $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 3126df26cacSmrg $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 3136df26cacSmrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3146df26cacSmrg : 3156df26cacSmrg else 3166df26cacSmrg $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 3176df26cacSmrg exit $EXIT_FAILURE 3186df26cacSmrg fi 3196df26cacSmrg} 3206df26cacSmrg 3216df26cacSmrg# func_extract_archives gentop oldlib ... 3226df26cacSmrgfunc_extract_archives () 3236df26cacSmrg{ 3246df26cacSmrg my_gentop="$1"; shift 3256df26cacSmrg my_oldlibs=${1+"$@"} 3266df26cacSmrg my_oldobjs="" 3276df26cacSmrg my_xlib="" 3286df26cacSmrg my_xabs="" 3296df26cacSmrg my_xdir="" 3306df26cacSmrg my_status="" 3316df26cacSmrg 3326df26cacSmrg $show "${rm}r $my_gentop" 3336df26cacSmrg $run ${rm}r "$my_gentop" 3346df26cacSmrg $show "$mkdir $my_gentop" 3356df26cacSmrg $run $mkdir "$my_gentop" 3366df26cacSmrg my_status=$? 3376df26cacSmrg if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 3386df26cacSmrg exit $my_status 3396df26cacSmrg fi 3406df26cacSmrg 3416df26cacSmrg for my_xlib in $my_oldlibs; do 3426df26cacSmrg # Extract the objects. 3436df26cacSmrg case $my_xlib in 3446df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3456df26cacSmrg *) my_xabs=`pwd`"/$my_xlib" ;; 3466df26cacSmrg esac 3476df26cacSmrg my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 34816fd1166Smrg my_xlib_u=$my_xlib 34916fd1166Smrg while :; do 35016fd1166Smrg case " $extracted_archives " in 35116fd1166Smrg *" $my_xlib_u "*) 35216fd1166Smrg extracted_serial=`expr $extracted_serial + 1` 35316fd1166Smrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 35416fd1166Smrg *) break ;; 35516fd1166Smrg esac 35616fd1166Smrg done 35716fd1166Smrg extracted_archives="$extracted_archives $my_xlib_u" 35816fd1166Smrg my_xdir="$my_gentop/$my_xlib_u" 3596df26cacSmrg 3606df26cacSmrg $show "${rm}r $my_xdir" 3616df26cacSmrg $run ${rm}r "$my_xdir" 3626df26cacSmrg $show "$mkdir $my_xdir" 3636df26cacSmrg $run $mkdir "$my_xdir" 3646df26cacSmrg exit_status=$? 3656df26cacSmrg if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 3666df26cacSmrg exit $exit_status 3676df26cacSmrg fi 3686df26cacSmrg case $host in 3696df26cacSmrg *-darwin*) 3706df26cacSmrg $show "Extracting $my_xabs" 3716df26cacSmrg # Do not bother doing anything if just a dry run 3726df26cacSmrg if test -z "$run"; then 3736df26cacSmrg darwin_orig_dir=`pwd` 3746df26cacSmrg cd $my_xdir || exit $? 3756df26cacSmrg darwin_archive=$my_xabs 3766df26cacSmrg darwin_curdir=`pwd` 3776df26cacSmrg darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 3786df26cacSmrg darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 3796df26cacSmrg if test -n "$darwin_arches"; then 3806df26cacSmrg darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 3816df26cacSmrg darwin_arch= 3826df26cacSmrg $show "$darwin_base_archive has multiple architectures $darwin_arches" 3836df26cacSmrg for darwin_arch in $darwin_arches ; do 3846df26cacSmrg mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3856df26cacSmrg lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3866df26cacSmrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3876df26cacSmrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3886df26cacSmrg cd "$darwin_curdir" 3896df26cacSmrg $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3906df26cacSmrg done # $darwin_arches 3916df26cacSmrg ## Okay now we have a bunch of thin objects, gotta fatten them up :) 3926df26cacSmrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 3936df26cacSmrg darwin_file= 3946df26cacSmrg darwin_files= 3956df26cacSmrg for darwin_file in $darwin_filelist; do 3966df26cacSmrg darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 3976df26cacSmrg lipo -create -output "$darwin_file" $darwin_files 3986df26cacSmrg done # $darwin_filelist 3996df26cacSmrg ${rm}r unfat-$$ 4006df26cacSmrg cd "$darwin_orig_dir" 4016df26cacSmrg else 4026df26cacSmrg cd "$darwin_orig_dir" 4036df26cacSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 4046df26cacSmrg fi # $darwin_arches 4056df26cacSmrg fi # $run 4066df26cacSmrg ;; 4076df26cacSmrg *) 4086df26cacSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 4096df26cacSmrg ;; 4106df26cacSmrg esac 4116df26cacSmrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 4126df26cacSmrg done 4136df26cacSmrg func_extract_archives_result="$my_oldobjs" 4146df26cacSmrg} 4156df26cacSmrg# End of Shell function definitions 4166df26cacSmrg##################################### 4176df26cacSmrg 4186df26cacSmrg# Darwin sucks 4196df26cacSmrgeval std_shrext=\"$shrext_cmds\" 4206df26cacSmrg 4216df26cacSmrgdisable_libs=no 4226df26cacSmrg 4236df26cacSmrg# Parse our command line options once, thoroughly. 4246df26cacSmrgwhile test "$#" -gt 0 4256df26cacSmrgdo 4266df26cacSmrg arg="$1" 4276df26cacSmrg shift 4286df26cacSmrg 4296df26cacSmrg case $arg in 4306df26cacSmrg -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 4316df26cacSmrg *) optarg= ;; 4326df26cacSmrg esac 4336df26cacSmrg 4346df26cacSmrg # If the previous option needs an argument, assign it. 4356df26cacSmrg if test -n "$prev"; then 4366df26cacSmrg case $prev in 4376df26cacSmrg execute_dlfiles) 4386df26cacSmrg execute_dlfiles="$execute_dlfiles $arg" 4396df26cacSmrg ;; 4406df26cacSmrg tag) 4416df26cacSmrg tagname="$arg" 4426df26cacSmrg preserve_args="${preserve_args}=$arg" 4436df26cacSmrg 4446df26cacSmrg # Check whether tagname contains only valid characters 4456df26cacSmrg case $tagname in 4466df26cacSmrg *[!-_A-Za-z0-9,/]*) 4476df26cacSmrg $echo "$progname: invalid tag name: $tagname" 1>&2 4486df26cacSmrg exit $EXIT_FAILURE 4496df26cacSmrg ;; 4506df26cacSmrg esac 4516df26cacSmrg 4526df26cacSmrg case $tagname in 4536df26cacSmrg CC) 4546df26cacSmrg # Don't test for the "default" C tag, as we know, it's there, but 4556df26cacSmrg # not specially marked. 4566df26cacSmrg ;; 4576df26cacSmrg *) 4586df26cacSmrg if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 4596df26cacSmrg taglist="$taglist $tagname" 4606df26cacSmrg # Evaluate the configuration. 4616df26cacSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 4626df26cacSmrg else 4636df26cacSmrg $echo "$progname: ignoring unknown tag $tagname" 1>&2 4646df26cacSmrg fi 4656df26cacSmrg ;; 4666df26cacSmrg esac 4676df26cacSmrg ;; 4686df26cacSmrg *) 4696df26cacSmrg eval "$prev=\$arg" 4706df26cacSmrg ;; 4716df26cacSmrg esac 4726df26cacSmrg 4736df26cacSmrg prev= 4746df26cacSmrg prevopt= 4756df26cacSmrg continue 4766df26cacSmrg fi 4776df26cacSmrg 4786df26cacSmrg # Have we seen a non-optional argument yet? 4796df26cacSmrg case $arg in 4806df26cacSmrg --help) 4816df26cacSmrg show_help=yes 4826df26cacSmrg ;; 4836df26cacSmrg 4846df26cacSmrg --version) 48516fd1166Smrg echo "\ 48616fd1166Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 48716fd1166Smrg 48816fd1166SmrgCopyright (C) 2007 Free Software Foundation, Inc. 48916fd1166SmrgThis is free software; see the source for copying conditions. There is NO 49016fd1166Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 4916df26cacSmrg exit $? 4926df26cacSmrg ;; 4936df26cacSmrg 4946df26cacSmrg --config) 4956df26cacSmrg ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 4966df26cacSmrg # Now print the configurations for the tags. 4976df26cacSmrg for tagname in $taglist; do 4986df26cacSmrg ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 4996df26cacSmrg done 5006df26cacSmrg exit $? 5016df26cacSmrg ;; 5026df26cacSmrg 5036df26cacSmrg --debug) 5046df26cacSmrg $echo "$progname: enabling shell trace mode" 5056df26cacSmrg set -x 5066df26cacSmrg preserve_args="$preserve_args $arg" 5076df26cacSmrg ;; 5086df26cacSmrg 5096df26cacSmrg --dry-run | -n) 5106df26cacSmrg run=: 5116df26cacSmrg ;; 5126df26cacSmrg 5136df26cacSmrg --features) 5146df26cacSmrg $echo "host: $host" 5156df26cacSmrg if test "$build_libtool_libs" = yes; then 5166df26cacSmrg $echo "enable shared libraries" 5176df26cacSmrg else 5186df26cacSmrg $echo "disable shared libraries" 5196df26cacSmrg fi 5206df26cacSmrg if test "$build_old_libs" = yes; then 5216df26cacSmrg $echo "enable static libraries" 5226df26cacSmrg else 5236df26cacSmrg $echo "disable static libraries" 5246df26cacSmrg fi 5256df26cacSmrg exit $? 5266df26cacSmrg ;; 5276df26cacSmrg 5286df26cacSmrg --finish) mode="finish" ;; 5296df26cacSmrg 5306df26cacSmrg --mode) prevopt="--mode" prev=mode ;; 5316df26cacSmrg --mode=*) mode="$optarg" ;; 5326df26cacSmrg 5336df26cacSmrg --preserve-dup-deps) duplicate_deps="yes" ;; 5346df26cacSmrg 5356df26cacSmrg --quiet | --silent) 5366df26cacSmrg show=: 5376df26cacSmrg preserve_args="$preserve_args $arg" 5386df26cacSmrg ;; 5396df26cacSmrg 5406df26cacSmrg --tag) 5416df26cacSmrg prevopt="--tag" 5426df26cacSmrg prev=tag 5436df26cacSmrg preserve_args="$preserve_args --tag" 5446df26cacSmrg ;; 5456df26cacSmrg --tag=*) 5466df26cacSmrg set tag "$optarg" ${1+"$@"} 5476df26cacSmrg shift 5486df26cacSmrg prev=tag 5496df26cacSmrg preserve_args="$preserve_args --tag" 5506df26cacSmrg ;; 5516df26cacSmrg 5526df26cacSmrg -dlopen) 5536df26cacSmrg prevopt="-dlopen" 5546df26cacSmrg prev=execute_dlfiles 5556df26cacSmrg ;; 5566df26cacSmrg 5576df26cacSmrg -*) 5586df26cacSmrg $echo "$modename: unrecognized option \`$arg'" 1>&2 5596df26cacSmrg $echo "$help" 1>&2 5606df26cacSmrg exit $EXIT_FAILURE 5616df26cacSmrg ;; 5626df26cacSmrg 5636df26cacSmrg *) 5646df26cacSmrg nonopt="$arg" 5656df26cacSmrg break 5666df26cacSmrg ;; 5676df26cacSmrg esac 5686df26cacSmrgdone 5696df26cacSmrg 5706df26cacSmrgif test -n "$prevopt"; then 5716df26cacSmrg $echo "$modename: option \`$prevopt' requires an argument" 1>&2 5726df26cacSmrg $echo "$help" 1>&2 5736df26cacSmrg exit $EXIT_FAILURE 5746df26cacSmrgfi 5756df26cacSmrg 5766df26cacSmrgcase $disable_libs in 5776df26cacSmrgno) 5786df26cacSmrg ;; 5796df26cacSmrgshared) 5806df26cacSmrg build_libtool_libs=no 5816df26cacSmrg build_old_libs=yes 5826df26cacSmrg ;; 5836df26cacSmrgstatic) 5846df26cacSmrg build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 5856df26cacSmrg ;; 5866df26cacSmrgesac 5876df26cacSmrg 5886df26cacSmrg# If this variable is set in any of the actions, the command in it 5896df26cacSmrg# will be execed at the end. This prevents here-documents from being 5906df26cacSmrg# left over by shells. 5916df26cacSmrgexec_cmd= 5926df26cacSmrg 5936df26cacSmrgif test -z "$show_help"; then 5946df26cacSmrg 5956df26cacSmrg # Infer the operation mode. 5966df26cacSmrg if test -z "$mode"; then 5976df26cacSmrg $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 5986df26cacSmrg $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 5996df26cacSmrg case $nonopt in 6006df26cacSmrg *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 6016df26cacSmrg mode=link 6026df26cacSmrg for arg 6036df26cacSmrg do 6046df26cacSmrg case $arg in 6056df26cacSmrg -c) 6066df26cacSmrg mode=compile 6076df26cacSmrg break 6086df26cacSmrg ;; 6096df26cacSmrg esac 6106df26cacSmrg done 6116df26cacSmrg ;; 6126df26cacSmrg *db | *dbx | *strace | *truss) 6136df26cacSmrg mode=execute 6146df26cacSmrg ;; 6156df26cacSmrg *install*|cp|mv) 6166df26cacSmrg mode=install 6176df26cacSmrg ;; 6186df26cacSmrg *rm) 6196df26cacSmrg mode=uninstall 6206df26cacSmrg ;; 6216df26cacSmrg *) 6226df26cacSmrg # If we have no mode, but dlfiles were specified, then do execute mode. 6236df26cacSmrg test -n "$execute_dlfiles" && mode=execute 6246df26cacSmrg 6256df26cacSmrg # Just use the default operation mode. 6266df26cacSmrg if test -z "$mode"; then 6276df26cacSmrg if test -n "$nonopt"; then 6286df26cacSmrg $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 6296df26cacSmrg else 6306df26cacSmrg $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 6316df26cacSmrg fi 6326df26cacSmrg fi 6336df26cacSmrg ;; 6346df26cacSmrg esac 6356df26cacSmrg fi 6366df26cacSmrg 6376df26cacSmrg # Only execute mode is allowed to have -dlopen flags. 6386df26cacSmrg if test -n "$execute_dlfiles" && test "$mode" != execute; then 6396df26cacSmrg $echo "$modename: unrecognized option \`-dlopen'" 1>&2 6406df26cacSmrg $echo "$help" 1>&2 6416df26cacSmrg exit $EXIT_FAILURE 6426df26cacSmrg fi 6436df26cacSmrg 6446df26cacSmrg # Change the help message to a mode-specific one. 6456df26cacSmrg generic_help="$help" 6466df26cacSmrg help="Try \`$modename --help --mode=$mode' for more information." 6476df26cacSmrg 6486df26cacSmrg # These modes are in order of execution frequency so that they run quickly. 6496df26cacSmrg case $mode in 6506df26cacSmrg # libtool compile mode 6516df26cacSmrg compile) 6526df26cacSmrg modename="$modename: compile" 6536df26cacSmrg # Get the compilation command and the source file. 6546df26cacSmrg base_compile= 6556df26cacSmrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 6566df26cacSmrg suppress_opt=yes 6576df26cacSmrg suppress_output= 6586df26cacSmrg arg_mode=normal 6596df26cacSmrg libobj= 6606df26cacSmrg later= 6616df26cacSmrg 6626df26cacSmrg for arg 6636df26cacSmrg do 6646df26cacSmrg case $arg_mode in 6656df26cacSmrg arg ) 6666df26cacSmrg # do not "continue". Instead, add this to base_compile 6676df26cacSmrg lastarg="$arg" 6686df26cacSmrg arg_mode=normal 6696df26cacSmrg ;; 6706df26cacSmrg 6716df26cacSmrg target ) 6726df26cacSmrg libobj="$arg" 6736df26cacSmrg arg_mode=normal 6746df26cacSmrg continue 6756df26cacSmrg ;; 6766df26cacSmrg 6776df26cacSmrg normal ) 6786df26cacSmrg # Accept any command-line options. 6796df26cacSmrg case $arg in 6806df26cacSmrg -o) 6816df26cacSmrg if test -n "$libobj" ; then 6826df26cacSmrg $echo "$modename: you cannot specify \`-o' more than once" 1>&2 6836df26cacSmrg exit $EXIT_FAILURE 6846df26cacSmrg fi 6856df26cacSmrg arg_mode=target 6866df26cacSmrg continue 6876df26cacSmrg ;; 6886df26cacSmrg 6896df26cacSmrg -static | -prefer-pic | -prefer-non-pic) 6906df26cacSmrg later="$later $arg" 6916df26cacSmrg continue 6926df26cacSmrg ;; 6936df26cacSmrg 6946df26cacSmrg -no-suppress) 6956df26cacSmrg suppress_opt=no 6966df26cacSmrg continue 6976df26cacSmrg ;; 6986df26cacSmrg 6996df26cacSmrg -Xcompiler) 7006df26cacSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 7016df26cacSmrg continue # The current "srcfile" will either be retained or 7026df26cacSmrg ;; # replaced later. I would guess that would be a bug. 7036df26cacSmrg 7046df26cacSmrg -Wc,*) 7056df26cacSmrg args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 7066df26cacSmrg lastarg= 7076df26cacSmrg save_ifs="$IFS"; IFS=',' 7086df26cacSmrg for arg in $args; do 7096df26cacSmrg IFS="$save_ifs" 7106df26cacSmrg 7116df26cacSmrg # Double-quote args containing other shell metacharacters. 7126df26cacSmrg # Many Bourne shells cannot handle close brackets correctly 7136df26cacSmrg # in scan sets, so we specify it separately. 7146df26cacSmrg case $arg in 7156df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7166df26cacSmrg arg="\"$arg\"" 7176df26cacSmrg ;; 7186df26cacSmrg esac 7196df26cacSmrg lastarg="$lastarg $arg" 7206df26cacSmrg done 7216df26cacSmrg IFS="$save_ifs" 7226df26cacSmrg lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 7236df26cacSmrg 7246df26cacSmrg # Add the arguments to base_compile. 7256df26cacSmrg base_compile="$base_compile $lastarg" 7266df26cacSmrg continue 7276df26cacSmrg ;; 7286df26cacSmrg 7296df26cacSmrg * ) 7306df26cacSmrg # Accept the current argument as the source file. 7316df26cacSmrg # The previous "srcfile" becomes the current argument. 7326df26cacSmrg # 7336df26cacSmrg lastarg="$srcfile" 7346df26cacSmrg srcfile="$arg" 7356df26cacSmrg ;; 7366df26cacSmrg esac # case $arg 7376df26cacSmrg ;; 7386df26cacSmrg esac # case $arg_mode 7396df26cacSmrg 7406df26cacSmrg # Aesthetically quote the previous argument. 7416df26cacSmrg lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 7426df26cacSmrg 7436df26cacSmrg case $lastarg in 7446df26cacSmrg # Double-quote args containing other shell metacharacters. 7456df26cacSmrg # Many Bourne shells cannot handle close brackets correctly 7466df26cacSmrg # in scan sets, and some SunOS ksh mistreat backslash-escaping 7476df26cacSmrg # in scan sets (worked around with variable expansion), 7486df26cacSmrg # and furthermore cannot handle '|' '&' '(' ')' in scan sets 7496df26cacSmrg # at all, so we specify them separately. 7506df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 7516df26cacSmrg lastarg="\"$lastarg\"" 7526df26cacSmrg ;; 7536df26cacSmrg esac 7546df26cacSmrg 7556df26cacSmrg base_compile="$base_compile $lastarg" 7566df26cacSmrg done # for arg 7576df26cacSmrg 7586df26cacSmrg case $arg_mode in 7596df26cacSmrg arg) 7606df26cacSmrg $echo "$modename: you must specify an argument for -Xcompile" 7616df26cacSmrg exit $EXIT_FAILURE 7626df26cacSmrg ;; 7636df26cacSmrg target) 7646df26cacSmrg $echo "$modename: you must specify a target with \`-o'" 1>&2 7656df26cacSmrg exit $EXIT_FAILURE 7666df26cacSmrg ;; 7676df26cacSmrg *) 7686df26cacSmrg # Get the name of the library object. 7696df26cacSmrg [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 7706df26cacSmrg ;; 7716df26cacSmrg esac 7726df26cacSmrg 7736df26cacSmrg # Recognize several different file suffixes. 7746df26cacSmrg # If the user specifies -o file.o, it is replaced with file.lo 7756df26cacSmrg xform='[cCFSifmso]' 7766df26cacSmrg case $libobj in 7776df26cacSmrg *.ada) xform=ada ;; 7786df26cacSmrg *.adb) xform=adb ;; 7796df26cacSmrg *.ads) xform=ads ;; 7806df26cacSmrg *.asm) xform=asm ;; 7816df26cacSmrg *.c++) xform=c++ ;; 7826df26cacSmrg *.cc) xform=cc ;; 7836df26cacSmrg *.ii) xform=ii ;; 7846df26cacSmrg *.class) xform=class ;; 7856df26cacSmrg *.cpp) xform=cpp ;; 7866df26cacSmrg *.cxx) xform=cxx ;; 78716fd1166Smrg *.[fF][09]?) xform=[fF][09]. ;; 7886df26cacSmrg *.for) xform=for ;; 7896df26cacSmrg *.java) xform=java ;; 79016fd1166Smrg *.obj) xform=obj ;; 7916df26cacSmrg esac 7926df26cacSmrg 7936df26cacSmrg libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 7946df26cacSmrg 7956df26cacSmrg case $libobj in 7966df26cacSmrg *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 7976df26cacSmrg *) 7986df26cacSmrg $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 7996df26cacSmrg exit $EXIT_FAILURE 8006df26cacSmrg ;; 8016df26cacSmrg esac 8026df26cacSmrg 8036df26cacSmrg func_infer_tag $base_compile 8046df26cacSmrg 8056df26cacSmrg for arg in $later; do 8066df26cacSmrg case $arg in 8076df26cacSmrg -static) 8086df26cacSmrg build_old_libs=yes 8096df26cacSmrg continue 8106df26cacSmrg ;; 8116df26cacSmrg 8126df26cacSmrg -prefer-pic) 8136df26cacSmrg pic_mode=yes 8146df26cacSmrg continue 8156df26cacSmrg ;; 8166df26cacSmrg 8176df26cacSmrg -prefer-non-pic) 8186df26cacSmrg pic_mode=no 8196df26cacSmrg continue 8206df26cacSmrg ;; 8216df26cacSmrg esac 8226df26cacSmrg done 8236df26cacSmrg 8246df26cacSmrg qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 8256df26cacSmrg case $qlibobj in 8266df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 8276df26cacSmrg qlibobj="\"$qlibobj\"" ;; 8286df26cacSmrg esac 8296df26cacSmrg test "X$libobj" != "X$qlibobj" \ 8306df26cacSmrg && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 8316df26cacSmrg && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 8326df26cacSmrg objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 8336df26cacSmrg xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 8346df26cacSmrg if test "X$xdir" = "X$obj"; then 8356df26cacSmrg xdir= 8366df26cacSmrg else 8376df26cacSmrg xdir=$xdir/ 8386df26cacSmrg fi 8396df26cacSmrg lobj=${xdir}$objdir/$objname 8406df26cacSmrg 8416df26cacSmrg if test -z "$base_compile"; then 8426df26cacSmrg $echo "$modename: you must specify a compilation command" 1>&2 8436df26cacSmrg $echo "$help" 1>&2 8446df26cacSmrg exit $EXIT_FAILURE 8456df26cacSmrg fi 8466df26cacSmrg 8476df26cacSmrg # Delete any leftover library objects. 8486df26cacSmrg if test "$build_old_libs" = yes; then 8496df26cacSmrg removelist="$obj $lobj $libobj ${libobj}T" 8506df26cacSmrg else 8516df26cacSmrg removelist="$lobj $libobj ${libobj}T" 8526df26cacSmrg fi 8536df26cacSmrg 8546df26cacSmrg $run $rm $removelist 8556df26cacSmrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8566df26cacSmrg 8576df26cacSmrg # On Cygwin there's no "real" PIC flag so we must build both object types 8586df26cacSmrg case $host_os in 8596df26cacSmrg cygwin* | mingw* | pw32* | os2*) 8606df26cacSmrg pic_mode=default 8616df26cacSmrg ;; 8626df26cacSmrg esac 8636df26cacSmrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 8646df26cacSmrg # non-PIC code in shared libraries is not supported 8656df26cacSmrg pic_mode=default 8666df26cacSmrg fi 8676df26cacSmrg 8686df26cacSmrg # Calculate the filename of the output object if compiler does 8696df26cacSmrg # not support -o with -c 8706df26cacSmrg if test "$compiler_c_o" = no; then 8716df26cacSmrg output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 8726df26cacSmrg lockfile="$output_obj.lock" 8736df26cacSmrg removelist="$removelist $output_obj $lockfile" 8746df26cacSmrg trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 8756df26cacSmrg else 8766df26cacSmrg output_obj= 8776df26cacSmrg need_locks=no 8786df26cacSmrg lockfile= 8796df26cacSmrg fi 8806df26cacSmrg 8816df26cacSmrg # Lock this critical section if it is needed 8826df26cacSmrg # We use this script file to make the link, it avoids creating a new file 8836df26cacSmrg if test "$need_locks" = yes; then 8846df26cacSmrg until $run ln "$progpath" "$lockfile" 2>/dev/null; do 8856df26cacSmrg $show "Waiting for $lockfile to be removed" 8866df26cacSmrg sleep 2 8876df26cacSmrg done 8886df26cacSmrg elif test "$need_locks" = warn; then 8896df26cacSmrg if test -f "$lockfile"; then 8906df26cacSmrg $echo "\ 8916df26cacSmrg*** ERROR, $lockfile exists and contains: 8926df26cacSmrg`cat $lockfile 2>/dev/null` 8936df26cacSmrg 8946df26cacSmrgThis indicates that another process is trying to use the same 8956df26cacSmrgtemporary object file, and libtool could not work around it because 8966df26cacSmrgyour compiler does not support \`-c' and \`-o' together. If you 8976df26cacSmrgrepeat this compilation, it may succeed, by chance, but you had better 8986df26cacSmrgavoid parallel builds (make -j) in this platform, or get a better 8996df26cacSmrgcompiler." 9006df26cacSmrg 9016df26cacSmrg $run $rm $removelist 9026df26cacSmrg exit $EXIT_FAILURE 9036df26cacSmrg fi 9046df26cacSmrg $echo "$srcfile" > "$lockfile" 9056df26cacSmrg fi 9066df26cacSmrg 9076df26cacSmrg if test -n "$fix_srcfile_path"; then 9086df26cacSmrg eval srcfile=\"$fix_srcfile_path\" 9096df26cacSmrg fi 9106df26cacSmrg qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 9116df26cacSmrg case $qsrcfile in 9126df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 9136df26cacSmrg qsrcfile="\"$qsrcfile\"" ;; 9146df26cacSmrg esac 9156df26cacSmrg 9166df26cacSmrg $run $rm "$libobj" "${libobj}T" 9176df26cacSmrg 9186df26cacSmrg # Create a libtool object file (analogous to a ".la" file), 9196df26cacSmrg # but don't create it if we're doing a dry run. 9206df26cacSmrg test -z "$run" && cat > ${libobj}T <<EOF 9216df26cacSmrg# $libobj - a libtool object file 9226df26cacSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 9236df26cacSmrg# 9246df26cacSmrg# Please DO NOT delete this file! 9256df26cacSmrg# It is necessary for linking the library. 9266df26cacSmrg 9276df26cacSmrg# Name of the PIC object. 9286df26cacSmrgEOF 9296df26cacSmrg 9306df26cacSmrg # Only build a PIC object if we are building libtool libraries. 9316df26cacSmrg if test "$build_libtool_libs" = yes; then 9326df26cacSmrg # Without this assignment, base_compile gets emptied. 9336df26cacSmrg fbsd_hideous_sh_bug=$base_compile 9346df26cacSmrg 9356df26cacSmrg if test "$pic_mode" != no; then 9366df26cacSmrg command="$base_compile $qsrcfile $pic_flag" 9376df26cacSmrg else 9386df26cacSmrg # Don't build PIC code 9396df26cacSmrg command="$base_compile $qsrcfile" 9406df26cacSmrg fi 9416df26cacSmrg 9426df26cacSmrg if test ! -d "${xdir}$objdir"; then 9436df26cacSmrg $show "$mkdir ${xdir}$objdir" 9446df26cacSmrg $run $mkdir ${xdir}$objdir 9456df26cacSmrg exit_status=$? 9466df26cacSmrg if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 9476df26cacSmrg exit $exit_status 9486df26cacSmrg fi 9496df26cacSmrg fi 9506df26cacSmrg 9516df26cacSmrg if test -z "$output_obj"; then 9526df26cacSmrg # Place PIC objects in $objdir 9536df26cacSmrg command="$command -o $lobj" 9546df26cacSmrg fi 9556df26cacSmrg 9566df26cacSmrg $run $rm "$lobj" "$output_obj" 9576df26cacSmrg 9586df26cacSmrg $show "$command" 9596df26cacSmrg if $run eval "$command"; then : 9606df26cacSmrg else 9616df26cacSmrg test -n "$output_obj" && $run $rm $removelist 9626df26cacSmrg exit $EXIT_FAILURE 9636df26cacSmrg fi 9646df26cacSmrg 9656df26cacSmrg if test "$need_locks" = warn && 9666df26cacSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 9676df26cacSmrg $echo "\ 9686df26cacSmrg*** ERROR, $lockfile contains: 9696df26cacSmrg`cat $lockfile 2>/dev/null` 9706df26cacSmrg 9716df26cacSmrgbut it should contain: 9726df26cacSmrg$srcfile 9736df26cacSmrg 9746df26cacSmrgThis indicates that another process is trying to use the same 9756df26cacSmrgtemporary object file, and libtool could not work around it because 9766df26cacSmrgyour compiler does not support \`-c' and \`-o' together. If you 9776df26cacSmrgrepeat this compilation, it may succeed, by chance, but you had better 9786df26cacSmrgavoid parallel builds (make -j) in this platform, or get a better 9796df26cacSmrgcompiler." 9806df26cacSmrg 9816df26cacSmrg $run $rm $removelist 9826df26cacSmrg exit $EXIT_FAILURE 9836df26cacSmrg fi 9846df26cacSmrg 9856df26cacSmrg # Just move the object if needed, then go on to compile the next one 9866df26cacSmrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 9876df26cacSmrg $show "$mv $output_obj $lobj" 9886df26cacSmrg if $run $mv $output_obj $lobj; then : 9896df26cacSmrg else 9906df26cacSmrg error=$? 9916df26cacSmrg $run $rm $removelist 9926df26cacSmrg exit $error 9936df26cacSmrg fi 9946df26cacSmrg fi 9956df26cacSmrg 9966df26cacSmrg # Append the name of the PIC object to the libtool object file. 9976df26cacSmrg test -z "$run" && cat >> ${libobj}T <<EOF 9986df26cacSmrgpic_object='$objdir/$objname' 9996df26cacSmrg 10006df26cacSmrgEOF 10016df26cacSmrg 10026df26cacSmrg # Allow error messages only from the first compilation. 10036df26cacSmrg if test "$suppress_opt" = yes; then 10046df26cacSmrg suppress_output=' >/dev/null 2>&1' 10056df26cacSmrg fi 10066df26cacSmrg else 10076df26cacSmrg # No PIC object so indicate it doesn't exist in the libtool 10086df26cacSmrg # object file. 10096df26cacSmrg test -z "$run" && cat >> ${libobj}T <<EOF 10106df26cacSmrgpic_object=none 10116df26cacSmrg 10126df26cacSmrgEOF 10136df26cacSmrg fi 10146df26cacSmrg 10156df26cacSmrg # Only build a position-dependent object if we build old libraries. 10166df26cacSmrg if test "$build_old_libs" = yes; then 10176df26cacSmrg if test "$pic_mode" != yes; then 10186df26cacSmrg # Don't build PIC code 10196df26cacSmrg command="$base_compile $qsrcfile" 10206df26cacSmrg else 10216df26cacSmrg command="$base_compile $qsrcfile $pic_flag" 10226df26cacSmrg fi 10236df26cacSmrg if test "$compiler_c_o" = yes; then 10246df26cacSmrg command="$command -o $obj" 10256df26cacSmrg fi 10266df26cacSmrg 10276df26cacSmrg # Suppress compiler output if we already did a PIC compilation. 10286df26cacSmrg command="$command$suppress_output" 10296df26cacSmrg $run $rm "$obj" "$output_obj" 10306df26cacSmrg $show "$command" 10316df26cacSmrg if $run eval "$command"; then : 10326df26cacSmrg else 10336df26cacSmrg $run $rm $removelist 10346df26cacSmrg exit $EXIT_FAILURE 10356df26cacSmrg fi 10366df26cacSmrg 10376df26cacSmrg if test "$need_locks" = warn && 10386df26cacSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 10396df26cacSmrg $echo "\ 10406df26cacSmrg*** ERROR, $lockfile contains: 10416df26cacSmrg`cat $lockfile 2>/dev/null` 10426df26cacSmrg 10436df26cacSmrgbut it should contain: 10446df26cacSmrg$srcfile 10456df26cacSmrg 10466df26cacSmrgThis indicates that another process is trying to use the same 10476df26cacSmrgtemporary object file, and libtool could not work around it because 10486df26cacSmrgyour compiler does not support \`-c' and \`-o' together. If you 10496df26cacSmrgrepeat this compilation, it may succeed, by chance, but you had better 10506df26cacSmrgavoid parallel builds (make -j) in this platform, or get a better 10516df26cacSmrgcompiler." 10526df26cacSmrg 10536df26cacSmrg $run $rm $removelist 10546df26cacSmrg exit $EXIT_FAILURE 10556df26cacSmrg fi 10566df26cacSmrg 10576df26cacSmrg # Just move the object if needed 10586df26cacSmrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 10596df26cacSmrg $show "$mv $output_obj $obj" 10606df26cacSmrg if $run $mv $output_obj $obj; then : 10616df26cacSmrg else 10626df26cacSmrg error=$? 10636df26cacSmrg $run $rm $removelist 10646df26cacSmrg exit $error 10656df26cacSmrg fi 10666df26cacSmrg fi 10676df26cacSmrg 10686df26cacSmrg # Append the name of the non-PIC object the libtool object file. 10696df26cacSmrg # Only append if the libtool object file exists. 10706df26cacSmrg test -z "$run" && cat >> ${libobj}T <<EOF 10716df26cacSmrg# Name of the non-PIC object. 10726df26cacSmrgnon_pic_object='$objname' 10736df26cacSmrg 10746df26cacSmrgEOF 10756df26cacSmrg else 10766df26cacSmrg # Append the name of the non-PIC object the libtool object file. 10776df26cacSmrg # Only append if the libtool object file exists. 10786df26cacSmrg test -z "$run" && cat >> ${libobj}T <<EOF 10796df26cacSmrg# Name of the non-PIC object. 10806df26cacSmrgnon_pic_object=none 10816df26cacSmrg 10826df26cacSmrgEOF 10836df26cacSmrg fi 10846df26cacSmrg 10856df26cacSmrg $run $mv "${libobj}T" "${libobj}" 10866df26cacSmrg 10876df26cacSmrg # Unlock the critical section if it was locked 10886df26cacSmrg if test "$need_locks" != no; then 10896df26cacSmrg $run $rm "$lockfile" 10906df26cacSmrg fi 10916df26cacSmrg 10926df26cacSmrg exit $EXIT_SUCCESS 10936df26cacSmrg ;; 10946df26cacSmrg 10956df26cacSmrg # libtool link mode 10966df26cacSmrg link | relink) 10976df26cacSmrg modename="$modename: link" 10986df26cacSmrg case $host in 10996df26cacSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 11006df26cacSmrg # It is impossible to link a dll without this setting, and 11016df26cacSmrg # we shouldn't force the makefile maintainer to figure out 11026df26cacSmrg # which system we are compiling for in order to pass an extra 11036df26cacSmrg # flag for every libtool invocation. 11046df26cacSmrg # allow_undefined=no 11056df26cacSmrg 11066df26cacSmrg # FIXME: Unfortunately, there are problems with the above when trying 11076df26cacSmrg # to make a dll which has undefined symbols, in which case not 11086df26cacSmrg # even a static library is built. For now, we need to specify 11096df26cacSmrg # -no-undefined on the libtool link line when we can be certain 11106df26cacSmrg # that all symbols are satisfied, otherwise we get a static library. 11116df26cacSmrg allow_undefined=yes 11126df26cacSmrg ;; 11136df26cacSmrg *) 11146df26cacSmrg allow_undefined=yes 11156df26cacSmrg ;; 11166df26cacSmrg esac 11176df26cacSmrg libtool_args="$nonopt" 11186df26cacSmrg base_compile="$nonopt $@" 11196df26cacSmrg compile_command="$nonopt" 11206df26cacSmrg finalize_command="$nonopt" 11216df26cacSmrg 11226df26cacSmrg compile_rpath= 11236df26cacSmrg finalize_rpath= 11246df26cacSmrg compile_shlibpath= 11256df26cacSmrg finalize_shlibpath= 11266df26cacSmrg convenience= 11276df26cacSmrg old_convenience= 11286df26cacSmrg deplibs= 11296df26cacSmrg old_deplibs= 11306df26cacSmrg compiler_flags= 11316df26cacSmrg linker_flags= 11326df26cacSmrg dllsearchpath= 11336df26cacSmrg lib_search_path=`pwd` 11346df26cacSmrg inst_prefix_dir= 11356df26cacSmrg 11366df26cacSmrg avoid_version=no 11376df26cacSmrg dlfiles= 11386df26cacSmrg dlprefiles= 11396df26cacSmrg dlself=no 11406df26cacSmrg export_dynamic=no 11416df26cacSmrg export_symbols= 11426df26cacSmrg export_symbols_regex= 11436df26cacSmrg generated= 11446df26cacSmrg libobjs= 11456df26cacSmrg ltlibs= 11466df26cacSmrg module=no 11476df26cacSmrg no_install=no 11486df26cacSmrg objs= 11496df26cacSmrg non_pic_objects= 11506df26cacSmrg notinst_path= # paths that contain not-installed libtool libraries 11516df26cacSmrg precious_files_regex= 11526df26cacSmrg prefer_static_libs=no 11536df26cacSmrg preload=no 11546df26cacSmrg prev= 11556df26cacSmrg prevarg= 11566df26cacSmrg release= 11576df26cacSmrg rpath= 11586df26cacSmrg xrpath= 11596df26cacSmrg perm_rpath= 11606df26cacSmrg temp_rpath= 11616df26cacSmrg thread_safe=no 11626df26cacSmrg vinfo= 11636df26cacSmrg vinfo_number=no 11646df26cacSmrg 11656df26cacSmrg func_infer_tag $base_compile 11666df26cacSmrg 11676df26cacSmrg # We need to know -static, to get the right output filenames. 11686df26cacSmrg for arg 11696df26cacSmrg do 11706df26cacSmrg case $arg in 117116fd1166Smrg -all-static | -static | -static-libtool-libs) 117216fd1166Smrg case $arg in 117316fd1166Smrg -all-static) 11746df26cacSmrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 11756df26cacSmrg $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 11766df26cacSmrg fi 11776df26cacSmrg if test -n "$link_static_flag"; then 11786df26cacSmrg dlopen_self=$dlopen_self_static 11796df26cacSmrg fi 11806df26cacSmrg prefer_static_libs=yes 118116fd1166Smrg ;; 118216fd1166Smrg -static) 11836df26cacSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 11846df26cacSmrg dlopen_self=$dlopen_self_static 11856df26cacSmrg fi 11866df26cacSmrg prefer_static_libs=built 118716fd1166Smrg ;; 118816fd1166Smrg -static-libtool-libs) 118916fd1166Smrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 119016fd1166Smrg dlopen_self=$dlopen_self_static 119116fd1166Smrg fi 119216fd1166Smrg prefer_static_libs=yes 119316fd1166Smrg ;; 119416fd1166Smrg esac 11956df26cacSmrg build_libtool_libs=no 11966df26cacSmrg build_old_libs=yes 11976df26cacSmrg break 11986df26cacSmrg ;; 11996df26cacSmrg esac 12006df26cacSmrg done 12016df26cacSmrg 12026df26cacSmrg # See if our shared archives depend on static archives. 12036df26cacSmrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 12046df26cacSmrg 12056df26cacSmrg # Go through the arguments, transforming them on the way. 12066df26cacSmrg while test "$#" -gt 0; do 12076df26cacSmrg arg="$1" 12086df26cacSmrg shift 12096df26cacSmrg case $arg in 12106df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 12116df26cacSmrg qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 12126df26cacSmrg ;; 12136df26cacSmrg *) qarg=$arg ;; 12146df26cacSmrg esac 12156df26cacSmrg libtool_args="$libtool_args $qarg" 12166df26cacSmrg 12176df26cacSmrg # If the previous option needs an argument, assign it. 12186df26cacSmrg if test -n "$prev"; then 12196df26cacSmrg case $prev in 12206df26cacSmrg output) 12216df26cacSmrg compile_command="$compile_command @OUTPUT@" 12226df26cacSmrg finalize_command="$finalize_command @OUTPUT@" 12236df26cacSmrg ;; 12246df26cacSmrg esac 12256df26cacSmrg 12266df26cacSmrg case $prev in 12276df26cacSmrg dlfiles|dlprefiles) 12286df26cacSmrg if test "$preload" = no; then 12296df26cacSmrg # Add the symbol object into the linking commands. 12306df26cacSmrg compile_command="$compile_command @SYMFILE@" 12316df26cacSmrg finalize_command="$finalize_command @SYMFILE@" 12326df26cacSmrg preload=yes 12336df26cacSmrg fi 12346df26cacSmrg case $arg in 12356df26cacSmrg *.la | *.lo) ;; # We handle these cases below. 12366df26cacSmrg force) 12376df26cacSmrg if test "$dlself" = no; then 12386df26cacSmrg dlself=needless 12396df26cacSmrg export_dynamic=yes 12406df26cacSmrg fi 12416df26cacSmrg prev= 12426df26cacSmrg continue 12436df26cacSmrg ;; 12446df26cacSmrg self) 12456df26cacSmrg if test "$prev" = dlprefiles; then 12466df26cacSmrg dlself=yes 12476df26cacSmrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 12486df26cacSmrg dlself=yes 12496df26cacSmrg else 12506df26cacSmrg dlself=needless 12516df26cacSmrg export_dynamic=yes 12526df26cacSmrg fi 12536df26cacSmrg prev= 12546df26cacSmrg continue 12556df26cacSmrg ;; 12566df26cacSmrg *) 12576df26cacSmrg if test "$prev" = dlfiles; then 12586df26cacSmrg dlfiles="$dlfiles $arg" 12596df26cacSmrg else 12606df26cacSmrg dlprefiles="$dlprefiles $arg" 12616df26cacSmrg fi 12626df26cacSmrg prev= 12636df26cacSmrg continue 12646df26cacSmrg ;; 12656df26cacSmrg esac 12666df26cacSmrg ;; 12676df26cacSmrg expsyms) 12686df26cacSmrg export_symbols="$arg" 12696df26cacSmrg if test ! -f "$arg"; then 12706df26cacSmrg $echo "$modename: symbol file \`$arg' does not exist" 12716df26cacSmrg exit $EXIT_FAILURE 12726df26cacSmrg fi 12736df26cacSmrg prev= 12746df26cacSmrg continue 12756df26cacSmrg ;; 12766df26cacSmrg expsyms_regex) 12776df26cacSmrg export_symbols_regex="$arg" 12786df26cacSmrg prev= 12796df26cacSmrg continue 12806df26cacSmrg ;; 12816df26cacSmrg inst_prefix) 12826df26cacSmrg inst_prefix_dir="$arg" 12836df26cacSmrg prev= 12846df26cacSmrg continue 12856df26cacSmrg ;; 12866df26cacSmrg precious_regex) 12876df26cacSmrg precious_files_regex="$arg" 12886df26cacSmrg prev= 12896df26cacSmrg continue 12906df26cacSmrg ;; 12916df26cacSmrg release) 12926df26cacSmrg release="-$arg" 12936df26cacSmrg prev= 12946df26cacSmrg continue 12956df26cacSmrg ;; 12966df26cacSmrg objectlist) 12976df26cacSmrg if test -f "$arg"; then 12986df26cacSmrg save_arg=$arg 12996df26cacSmrg moreargs= 13006df26cacSmrg for fil in `cat $save_arg` 13016df26cacSmrg do 13026df26cacSmrg# moreargs="$moreargs $fil" 13036df26cacSmrg arg=$fil 13046df26cacSmrg # A libtool-controlled object. 13056df26cacSmrg 13066df26cacSmrg # Check to see that this really is a libtool object. 13076df26cacSmrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 13086df26cacSmrg pic_object= 13096df26cacSmrg non_pic_object= 13106df26cacSmrg 13116df26cacSmrg # Read the .lo file 13126df26cacSmrg # If there is no directory component, then add one. 13136df26cacSmrg case $arg in 13146df26cacSmrg */* | *\\*) . $arg ;; 13156df26cacSmrg *) . ./$arg ;; 13166df26cacSmrg esac 13176df26cacSmrg 13186df26cacSmrg if test -z "$pic_object" || \ 13196df26cacSmrg test -z "$non_pic_object" || 13206df26cacSmrg test "$pic_object" = none && \ 13216df26cacSmrg test "$non_pic_object" = none; then 13226df26cacSmrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 13236df26cacSmrg exit $EXIT_FAILURE 13246df26cacSmrg fi 13256df26cacSmrg 13266df26cacSmrg # Extract subdirectory from the argument. 13276df26cacSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13286df26cacSmrg if test "X$xdir" = "X$arg"; then 13296df26cacSmrg xdir= 13306df26cacSmrg else 13316df26cacSmrg xdir="$xdir/" 13326df26cacSmrg fi 13336df26cacSmrg 13346df26cacSmrg if test "$pic_object" != none; then 13356df26cacSmrg # Prepend the subdirectory the object is found in. 13366df26cacSmrg pic_object="$xdir$pic_object" 13376df26cacSmrg 13386df26cacSmrg if test "$prev" = dlfiles; then 13396df26cacSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 13406df26cacSmrg dlfiles="$dlfiles $pic_object" 13416df26cacSmrg prev= 13426df26cacSmrg continue 13436df26cacSmrg else 13446df26cacSmrg # If libtool objects are unsupported, then we need to preload. 13456df26cacSmrg prev=dlprefiles 13466df26cacSmrg fi 13476df26cacSmrg fi 13486df26cacSmrg 13496df26cacSmrg # CHECK ME: I think I busted this. -Ossama 13506df26cacSmrg if test "$prev" = dlprefiles; then 13516df26cacSmrg # Preload the old-style object. 13526df26cacSmrg dlprefiles="$dlprefiles $pic_object" 13536df26cacSmrg prev= 13546df26cacSmrg fi 13556df26cacSmrg 13566df26cacSmrg # A PIC object. 13576df26cacSmrg libobjs="$libobjs $pic_object" 13586df26cacSmrg arg="$pic_object" 13596df26cacSmrg fi 13606df26cacSmrg 13616df26cacSmrg # Non-PIC object. 13626df26cacSmrg if test "$non_pic_object" != none; then 13636df26cacSmrg # Prepend the subdirectory the object is found in. 13646df26cacSmrg non_pic_object="$xdir$non_pic_object" 13656df26cacSmrg 13666df26cacSmrg # A standard non-PIC object 13676df26cacSmrg non_pic_objects="$non_pic_objects $non_pic_object" 13686df26cacSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 13696df26cacSmrg arg="$non_pic_object" 13706df26cacSmrg fi 13716df26cacSmrg else 13726df26cacSmrg # If the PIC object exists, use it instead. 13736df26cacSmrg # $xdir was prepended to $pic_object above. 13746df26cacSmrg non_pic_object="$pic_object" 13756df26cacSmrg non_pic_objects="$non_pic_objects $non_pic_object" 13766df26cacSmrg fi 13776df26cacSmrg else 13786df26cacSmrg # Only an error if not doing a dry-run. 13796df26cacSmrg if test -z "$run"; then 13806df26cacSmrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 13816df26cacSmrg exit $EXIT_FAILURE 13826df26cacSmrg else 13836df26cacSmrg # Dry-run case. 13846df26cacSmrg 13856df26cacSmrg # Extract subdirectory from the argument. 13866df26cacSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 13876df26cacSmrg if test "X$xdir" = "X$arg"; then 13886df26cacSmrg xdir= 13896df26cacSmrg else 13906df26cacSmrg xdir="$xdir/" 13916df26cacSmrg fi 13926df26cacSmrg 13936df26cacSmrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 13946df26cacSmrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 13956df26cacSmrg libobjs="$libobjs $pic_object" 13966df26cacSmrg non_pic_objects="$non_pic_objects $non_pic_object" 13976df26cacSmrg fi 13986df26cacSmrg fi 13996df26cacSmrg done 14006df26cacSmrg else 14016df26cacSmrg $echo "$modename: link input file \`$save_arg' does not exist" 14026df26cacSmrg exit $EXIT_FAILURE 14036df26cacSmrg fi 14046df26cacSmrg arg=$save_arg 14056df26cacSmrg prev= 14066df26cacSmrg continue 14076df26cacSmrg ;; 14086df26cacSmrg rpath | xrpath) 14096df26cacSmrg # We need an absolute path. 14106df26cacSmrg case $arg in 14116df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 14126df26cacSmrg *) 14136df26cacSmrg $echo "$modename: only absolute run-paths are allowed" 1>&2 14146df26cacSmrg exit $EXIT_FAILURE 14156df26cacSmrg ;; 14166df26cacSmrg esac 14176df26cacSmrg if test "$prev" = rpath; then 14186df26cacSmrg case "$rpath " in 14196df26cacSmrg *" $arg "*) ;; 14206df26cacSmrg *) rpath="$rpath $arg" ;; 14216df26cacSmrg esac 14226df26cacSmrg else 14236df26cacSmrg case "$xrpath " in 14246df26cacSmrg *" $arg "*) ;; 14256df26cacSmrg *) xrpath="$xrpath $arg" ;; 14266df26cacSmrg esac 14276df26cacSmrg fi 14286df26cacSmrg prev= 14296df26cacSmrg continue 14306df26cacSmrg ;; 14316df26cacSmrg xcompiler) 14326df26cacSmrg compiler_flags="$compiler_flags $qarg" 14336df26cacSmrg prev= 14346df26cacSmrg compile_command="$compile_command $qarg" 14356df26cacSmrg finalize_command="$finalize_command $qarg" 14366df26cacSmrg continue 14376df26cacSmrg ;; 14386df26cacSmrg xlinker) 14396df26cacSmrg linker_flags="$linker_flags $qarg" 14406df26cacSmrg compiler_flags="$compiler_flags $wl$qarg" 14416df26cacSmrg prev= 14426df26cacSmrg compile_command="$compile_command $wl$qarg" 14436df26cacSmrg finalize_command="$finalize_command $wl$qarg" 14446df26cacSmrg continue 14456df26cacSmrg ;; 14466df26cacSmrg xcclinker) 14476df26cacSmrg linker_flags="$linker_flags $qarg" 14486df26cacSmrg compiler_flags="$compiler_flags $qarg" 14496df26cacSmrg prev= 14506df26cacSmrg compile_command="$compile_command $qarg" 14516df26cacSmrg finalize_command="$finalize_command $qarg" 14526df26cacSmrg continue 14536df26cacSmrg ;; 14546df26cacSmrg shrext) 14556df26cacSmrg shrext_cmds="$arg" 14566df26cacSmrg prev= 14576df26cacSmrg continue 14586df26cacSmrg ;; 14596df26cacSmrg darwin_framework|darwin_framework_skip) 14606df26cacSmrg test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 14616df26cacSmrg compile_command="$compile_command $arg" 14626df26cacSmrg finalize_command="$finalize_command $arg" 14636df26cacSmrg prev= 14646df26cacSmrg continue 14656df26cacSmrg ;; 14666df26cacSmrg *) 14676df26cacSmrg eval "$prev=\"\$arg\"" 14686df26cacSmrg prev= 14696df26cacSmrg continue 14706df26cacSmrg ;; 14716df26cacSmrg esac 14726df26cacSmrg fi # test -n "$prev" 14736df26cacSmrg 14746df26cacSmrg prevarg="$arg" 14756df26cacSmrg 14766df26cacSmrg case $arg in 14776df26cacSmrg -all-static) 14786df26cacSmrg if test -n "$link_static_flag"; then 14796df26cacSmrg compile_command="$compile_command $link_static_flag" 14806df26cacSmrg finalize_command="$finalize_command $link_static_flag" 14816df26cacSmrg fi 14826df26cacSmrg continue 14836df26cacSmrg ;; 14846df26cacSmrg 14856df26cacSmrg -allow-undefined) 14866df26cacSmrg # FIXME: remove this flag sometime in the future. 14876df26cacSmrg $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 14886df26cacSmrg continue 14896df26cacSmrg ;; 14906df26cacSmrg 14916df26cacSmrg -avoid-version) 14926df26cacSmrg avoid_version=yes 14936df26cacSmrg continue 14946df26cacSmrg ;; 14956df26cacSmrg 14966df26cacSmrg -dlopen) 14976df26cacSmrg prev=dlfiles 14986df26cacSmrg continue 14996df26cacSmrg ;; 15006df26cacSmrg 15016df26cacSmrg -dlpreopen) 15026df26cacSmrg prev=dlprefiles 15036df26cacSmrg continue 15046df26cacSmrg ;; 15056df26cacSmrg 15066df26cacSmrg -export-dynamic) 15076df26cacSmrg export_dynamic=yes 15086df26cacSmrg continue 15096df26cacSmrg ;; 15106df26cacSmrg 15116df26cacSmrg -export-symbols | -export-symbols-regex) 15126df26cacSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 15136df26cacSmrg $echo "$modename: more than one -exported-symbols argument is not allowed" 15146df26cacSmrg exit $EXIT_FAILURE 15156df26cacSmrg fi 15166df26cacSmrg if test "X$arg" = "X-export-symbols"; then 15176df26cacSmrg prev=expsyms 15186df26cacSmrg else 15196df26cacSmrg prev=expsyms_regex 15206df26cacSmrg fi 15216df26cacSmrg continue 15226df26cacSmrg ;; 15236df26cacSmrg 15246df26cacSmrg -framework|-arch|-isysroot) 15256df26cacSmrg case " $CC " in 15266df26cacSmrg *" ${arg} ${1} "* | *" ${arg} ${1} "*) 15276df26cacSmrg prev=darwin_framework_skip ;; 15286df26cacSmrg *) compiler_flags="$compiler_flags $arg" 15296df26cacSmrg prev=darwin_framework ;; 15306df26cacSmrg esac 15316df26cacSmrg compile_command="$compile_command $arg" 15326df26cacSmrg finalize_command="$finalize_command $arg" 15336df26cacSmrg continue 15346df26cacSmrg ;; 15356df26cacSmrg 15366df26cacSmrg -inst-prefix-dir) 15376df26cacSmrg prev=inst_prefix 15386df26cacSmrg continue 15396df26cacSmrg ;; 15406df26cacSmrg 15416df26cacSmrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 15426df26cacSmrg # so, if we see these flags be careful not to treat them like -L 15436df26cacSmrg -L[A-Z][A-Z]*:*) 15446df26cacSmrg case $with_gcc/$host in 15456df26cacSmrg no/*-*-irix* | /*-*-irix*) 15466df26cacSmrg compile_command="$compile_command $arg" 15476df26cacSmrg finalize_command="$finalize_command $arg" 15486df26cacSmrg ;; 15496df26cacSmrg esac 15506df26cacSmrg continue 15516df26cacSmrg ;; 15526df26cacSmrg 15536df26cacSmrg -L*) 15546df26cacSmrg dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 15556df26cacSmrg # We need an absolute path. 15566df26cacSmrg case $dir in 15576df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 15586df26cacSmrg *) 15596df26cacSmrg absdir=`cd "$dir" && pwd` 15606df26cacSmrg if test -z "$absdir"; then 15616df26cacSmrg $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 15626df26cacSmrg absdir="$dir" 15636df26cacSmrg notinst_path="$notinst_path $dir" 15646df26cacSmrg fi 15656df26cacSmrg dir="$absdir" 15666df26cacSmrg ;; 15676df26cacSmrg esac 15686df26cacSmrg case "$deplibs " in 15696df26cacSmrg *" -L$dir "*) ;; 15706df26cacSmrg *) 15716df26cacSmrg deplibs="$deplibs -L$dir" 15726df26cacSmrg lib_search_path="$lib_search_path $dir" 15736df26cacSmrg ;; 15746df26cacSmrg esac 15756df26cacSmrg case $host in 15766df26cacSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 15776df26cacSmrg testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 15786df26cacSmrg case :$dllsearchpath: in 15796df26cacSmrg *":$dir:"*) ;; 15806df26cacSmrg *) dllsearchpath="$dllsearchpath:$dir";; 15816df26cacSmrg esac 15826df26cacSmrg case :$dllsearchpath: in 15836df26cacSmrg *":$testbindir:"*) ;; 15846df26cacSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 15856df26cacSmrg esac 15866df26cacSmrg ;; 15876df26cacSmrg esac 15886df26cacSmrg continue 15896df26cacSmrg ;; 15906df26cacSmrg 15916df26cacSmrg -l*) 15926df26cacSmrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 15936df26cacSmrg case $host in 15946df26cacSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 15956df26cacSmrg # These systems don't actually have a C or math library (as such) 15966df26cacSmrg continue 15976df26cacSmrg ;; 15986df26cacSmrg *-*-os2*) 15996df26cacSmrg # These systems don't actually have a C library (as such) 16006df26cacSmrg test "X$arg" = "X-lc" && continue 16016df26cacSmrg ;; 16026df26cacSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16036df26cacSmrg # Do not include libc due to us having libc/libc_r. 16046df26cacSmrg test "X$arg" = "X-lc" && continue 16056df26cacSmrg ;; 16066df26cacSmrg *-*-rhapsody* | *-*-darwin1.[012]) 16076df26cacSmrg # Rhapsody C and math libraries are in the System framework 16086df26cacSmrg deplibs="$deplibs -framework System" 16096df26cacSmrg continue 16106df26cacSmrg ;; 16116df26cacSmrg *-*-sco3.2v5* | *-*-sco5v6*) 16126df26cacSmrg # Causes problems with __ctype 16136df26cacSmrg test "X$arg" = "X-lc" && continue 16146df26cacSmrg ;; 16156df26cacSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 16166df26cacSmrg # Compiler inserts libc in the correct place for threads to work 16176df26cacSmrg test "X$arg" = "X-lc" && continue 16186df26cacSmrg ;; 16196df26cacSmrg esac 16206df26cacSmrg elif test "X$arg" = "X-lc_r"; then 16216df26cacSmrg case $host in 16226df26cacSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 16236df26cacSmrg # Do not include libc_r directly, use -pthread flag. 16246df26cacSmrg continue 16256df26cacSmrg ;; 16266df26cacSmrg esac 16276df26cacSmrg fi 16286df26cacSmrg deplibs="$deplibs $arg" 16296df26cacSmrg continue 16306df26cacSmrg ;; 16316df26cacSmrg 16326df26cacSmrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 16336df26cacSmrg # classes, name mangling, and exception handling. 16346df26cacSmrg -model) 16356df26cacSmrg compile_command="$compile_command $arg" 16366df26cacSmrg compiler_flags="$compiler_flags $arg" 16376df26cacSmrg finalize_command="$finalize_command $arg" 16386df26cacSmrg prev=xcompiler 16396df26cacSmrg continue 16406df26cacSmrg ;; 16416df26cacSmrg 164216fd1166Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 16436df26cacSmrg compiler_flags="$compiler_flags $arg" 16446df26cacSmrg compile_command="$compile_command $arg" 16456df26cacSmrg finalize_command="$finalize_command $arg" 16466df26cacSmrg continue 16476df26cacSmrg ;; 16486df26cacSmrg 16496df26cacSmrg -module) 16506df26cacSmrg module=yes 16516df26cacSmrg continue 16526df26cacSmrg ;; 16536df26cacSmrg 16546df26cacSmrg # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 16556df26cacSmrg # -r[0-9][0-9]* specifies the processor on the SGI compiler 16566df26cacSmrg # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 16576df26cacSmrg # +DA*, +DD* enable 64-bit mode on the HP compiler 16586df26cacSmrg # -q* pass through compiler args for the IBM compiler 16596df26cacSmrg # -m* pass through architecture-specific compiler args for GCC 16606df26cacSmrg # -m*, -t[45]*, -txscale* pass through architecture-specific 16616df26cacSmrg # compiler args for GCC 166216fd1166Smrg # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 166316fd1166Smrg # -F/path gives path to uninstalled frameworks, gcc on darwin 16646df26cacSmrg # @file GCC response files 166516fd1166Smrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 166616fd1166Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 16676df26cacSmrg 16686df26cacSmrg # Unknown arguments in both finalize_command and compile_command need 16696df26cacSmrg # to be aesthetically quoted because they are evaled later. 16706df26cacSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 16716df26cacSmrg case $arg in 16726df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 16736df26cacSmrg arg="\"$arg\"" 16746df26cacSmrg ;; 16756df26cacSmrg esac 16766df26cacSmrg compile_command="$compile_command $arg" 16776df26cacSmrg finalize_command="$finalize_command $arg" 16786df26cacSmrg compiler_flags="$compiler_flags $arg" 16796df26cacSmrg continue 16806df26cacSmrg ;; 16816df26cacSmrg 16826df26cacSmrg -shrext) 16836df26cacSmrg prev=shrext 16846df26cacSmrg continue 16856df26cacSmrg ;; 16866df26cacSmrg 16876df26cacSmrg -no-fast-install) 16886df26cacSmrg fast_install=no 16896df26cacSmrg continue 16906df26cacSmrg ;; 16916df26cacSmrg 16926df26cacSmrg -no-install) 16936df26cacSmrg case $host in 169416fd1166Smrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 16956df26cacSmrg # The PATH hackery in wrapper scripts is required on Windows 169616fd1166Smrg # and Darwin in order for the loader to find any dlls it needs. 16976df26cacSmrg $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 16986df26cacSmrg $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 16996df26cacSmrg fast_install=no 17006df26cacSmrg ;; 17016df26cacSmrg *) no_install=yes ;; 17026df26cacSmrg esac 17036df26cacSmrg continue 17046df26cacSmrg ;; 17056df26cacSmrg 17066df26cacSmrg -no-undefined) 17076df26cacSmrg allow_undefined=no 17086df26cacSmrg continue 17096df26cacSmrg ;; 17106df26cacSmrg 17116df26cacSmrg -objectlist) 17126df26cacSmrg prev=objectlist 17136df26cacSmrg continue 17146df26cacSmrg ;; 17156df26cacSmrg 17166df26cacSmrg -o) prev=output ;; 17176df26cacSmrg 17186df26cacSmrg -precious-files-regex) 17196df26cacSmrg prev=precious_regex 17206df26cacSmrg continue 17216df26cacSmrg ;; 17226df26cacSmrg 17236df26cacSmrg -release) 17246df26cacSmrg prev=release 17256df26cacSmrg continue 17266df26cacSmrg ;; 17276df26cacSmrg 17286df26cacSmrg -rpath) 17296df26cacSmrg prev=rpath 17306df26cacSmrg continue 17316df26cacSmrg ;; 17326df26cacSmrg 17336df26cacSmrg -R) 17346df26cacSmrg prev=xrpath 17356df26cacSmrg continue 17366df26cacSmrg ;; 17376df26cacSmrg 17386df26cacSmrg -R*) 17396df26cacSmrg dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 17406df26cacSmrg # We need an absolute path. 17416df26cacSmrg case $dir in 17426df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 17436df26cacSmrg *) 17446df26cacSmrg $echo "$modename: only absolute run-paths are allowed" 1>&2 17456df26cacSmrg exit $EXIT_FAILURE 17466df26cacSmrg ;; 17476df26cacSmrg esac 17486df26cacSmrg case "$xrpath " in 17496df26cacSmrg *" $dir "*) ;; 17506df26cacSmrg *) xrpath="$xrpath $dir" ;; 17516df26cacSmrg esac 17526df26cacSmrg continue 17536df26cacSmrg ;; 17546df26cacSmrg 175516fd1166Smrg -static | -static-libtool-libs) 17566df26cacSmrg # The effects of -static are defined in a previous loop. 17576df26cacSmrg # We used to do the same as -all-static on platforms that 17586df26cacSmrg # didn't have a PIC flag, but the assumption that the effects 17596df26cacSmrg # would be equivalent was wrong. It would break on at least 17606df26cacSmrg # Digital Unix and AIX. 17616df26cacSmrg continue 17626df26cacSmrg ;; 17636df26cacSmrg 17646df26cacSmrg -thread-safe) 17656df26cacSmrg thread_safe=yes 17666df26cacSmrg continue 17676df26cacSmrg ;; 17686df26cacSmrg 17696df26cacSmrg -version-info) 17706df26cacSmrg prev=vinfo 17716df26cacSmrg continue 17726df26cacSmrg ;; 17736df26cacSmrg -version-number) 17746df26cacSmrg prev=vinfo 17756df26cacSmrg vinfo_number=yes 17766df26cacSmrg continue 17776df26cacSmrg ;; 17786df26cacSmrg 17796df26cacSmrg -Wc,*) 17806df26cacSmrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 17816df26cacSmrg arg= 17826df26cacSmrg save_ifs="$IFS"; IFS=',' 17836df26cacSmrg for flag in $args; do 17846df26cacSmrg IFS="$save_ifs" 17856df26cacSmrg case $flag in 17866df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 17876df26cacSmrg flag="\"$flag\"" 17886df26cacSmrg ;; 17896df26cacSmrg esac 17906df26cacSmrg arg="$arg $wl$flag" 17916df26cacSmrg compiler_flags="$compiler_flags $flag" 17926df26cacSmrg done 17936df26cacSmrg IFS="$save_ifs" 17946df26cacSmrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 17956df26cacSmrg ;; 17966df26cacSmrg 17976df26cacSmrg -Wl,*) 17986df26cacSmrg args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 17996df26cacSmrg arg= 18006df26cacSmrg save_ifs="$IFS"; IFS=',' 18016df26cacSmrg for flag in $args; do 18026df26cacSmrg IFS="$save_ifs" 18036df26cacSmrg case $flag in 18046df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18056df26cacSmrg flag="\"$flag\"" 18066df26cacSmrg ;; 18076df26cacSmrg esac 18086df26cacSmrg arg="$arg $wl$flag" 18096df26cacSmrg compiler_flags="$compiler_flags $wl$flag" 18106df26cacSmrg linker_flags="$linker_flags $flag" 18116df26cacSmrg done 18126df26cacSmrg IFS="$save_ifs" 18136df26cacSmrg arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 18146df26cacSmrg ;; 18156df26cacSmrg 18166df26cacSmrg -Xcompiler) 18176df26cacSmrg prev=xcompiler 18186df26cacSmrg continue 18196df26cacSmrg ;; 18206df26cacSmrg 18216df26cacSmrg -Xlinker) 18226df26cacSmrg prev=xlinker 18236df26cacSmrg continue 18246df26cacSmrg ;; 18256df26cacSmrg 18266df26cacSmrg -XCClinker) 18276df26cacSmrg prev=xcclinker 18286df26cacSmrg continue 18296df26cacSmrg ;; 18306df26cacSmrg 18316df26cacSmrg # Some other compiler flag. 18326df26cacSmrg -* | +*) 18336df26cacSmrg # Unknown arguments in both finalize_command and compile_command need 18346df26cacSmrg # to be aesthetically quoted because they are evaled later. 18356df26cacSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 18366df26cacSmrg case $arg in 18376df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 18386df26cacSmrg arg="\"$arg\"" 18396df26cacSmrg ;; 18406df26cacSmrg esac 18416df26cacSmrg ;; 18426df26cacSmrg 18436df26cacSmrg *.$objext) 18446df26cacSmrg # A standard object. 18456df26cacSmrg objs="$objs $arg" 18466df26cacSmrg ;; 18476df26cacSmrg 18486df26cacSmrg *.lo) 18496df26cacSmrg # A libtool-controlled object. 18506df26cacSmrg 18516df26cacSmrg # Check to see that this really is a libtool object. 18526df26cacSmrg if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 18536df26cacSmrg pic_object= 18546df26cacSmrg non_pic_object= 18556df26cacSmrg 18566df26cacSmrg # Read the .lo file 18576df26cacSmrg # If there is no directory component, then add one. 18586df26cacSmrg case $arg in 18596df26cacSmrg */* | *\\*) . $arg ;; 18606df26cacSmrg *) . ./$arg ;; 18616df26cacSmrg esac 18626df26cacSmrg 18636df26cacSmrg if test -z "$pic_object" || \ 18646df26cacSmrg test -z "$non_pic_object" || 18656df26cacSmrg test "$pic_object" = none && \ 18666df26cacSmrg test "$non_pic_object" = none; then 18676df26cacSmrg $echo "$modename: cannot find name of object for \`$arg'" 1>&2 18686df26cacSmrg exit $EXIT_FAILURE 18696df26cacSmrg fi 18706df26cacSmrg 18716df26cacSmrg # Extract subdirectory from the argument. 18726df26cacSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 18736df26cacSmrg if test "X$xdir" = "X$arg"; then 18746df26cacSmrg xdir= 18756df26cacSmrg else 18766df26cacSmrg xdir="$xdir/" 18776df26cacSmrg fi 18786df26cacSmrg 18796df26cacSmrg if test "$pic_object" != none; then 18806df26cacSmrg # Prepend the subdirectory the object is found in. 18816df26cacSmrg pic_object="$xdir$pic_object" 18826df26cacSmrg 18836df26cacSmrg if test "$prev" = dlfiles; then 18846df26cacSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 18856df26cacSmrg dlfiles="$dlfiles $pic_object" 18866df26cacSmrg prev= 18876df26cacSmrg continue 18886df26cacSmrg else 18896df26cacSmrg # If libtool objects are unsupported, then we need to preload. 18906df26cacSmrg prev=dlprefiles 18916df26cacSmrg fi 18926df26cacSmrg fi 18936df26cacSmrg 18946df26cacSmrg # CHECK ME: I think I busted this. -Ossama 18956df26cacSmrg if test "$prev" = dlprefiles; then 18966df26cacSmrg # Preload the old-style object. 18976df26cacSmrg dlprefiles="$dlprefiles $pic_object" 18986df26cacSmrg prev= 18996df26cacSmrg fi 19006df26cacSmrg 19016df26cacSmrg # A PIC object. 19026df26cacSmrg libobjs="$libobjs $pic_object" 19036df26cacSmrg arg="$pic_object" 19046df26cacSmrg fi 19056df26cacSmrg 19066df26cacSmrg # Non-PIC object. 19076df26cacSmrg if test "$non_pic_object" != none; then 19086df26cacSmrg # Prepend the subdirectory the object is found in. 19096df26cacSmrg non_pic_object="$xdir$non_pic_object" 19106df26cacSmrg 19116df26cacSmrg # A standard non-PIC object 19126df26cacSmrg non_pic_objects="$non_pic_objects $non_pic_object" 19136df26cacSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 19146df26cacSmrg arg="$non_pic_object" 19156df26cacSmrg fi 19166df26cacSmrg else 19176df26cacSmrg # If the PIC object exists, use it instead. 19186df26cacSmrg # $xdir was prepended to $pic_object above. 19196df26cacSmrg non_pic_object="$pic_object" 19206df26cacSmrg non_pic_objects="$non_pic_objects $non_pic_object" 19216df26cacSmrg fi 19226df26cacSmrg else 19236df26cacSmrg # Only an error if not doing a dry-run. 19246df26cacSmrg if test -z "$run"; then 19256df26cacSmrg $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 19266df26cacSmrg exit $EXIT_FAILURE 19276df26cacSmrg else 19286df26cacSmrg # Dry-run case. 19296df26cacSmrg 19306df26cacSmrg # Extract subdirectory from the argument. 19316df26cacSmrg xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 19326df26cacSmrg if test "X$xdir" = "X$arg"; then 19336df26cacSmrg xdir= 19346df26cacSmrg else 19356df26cacSmrg xdir="$xdir/" 19366df26cacSmrg fi 19376df26cacSmrg 19386df26cacSmrg pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 19396df26cacSmrg non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 19406df26cacSmrg libobjs="$libobjs $pic_object" 19416df26cacSmrg non_pic_objects="$non_pic_objects $non_pic_object" 19426df26cacSmrg fi 19436df26cacSmrg fi 19446df26cacSmrg ;; 19456df26cacSmrg 19466df26cacSmrg *.$libext) 19476df26cacSmrg # An archive. 19486df26cacSmrg deplibs="$deplibs $arg" 19496df26cacSmrg old_deplibs="$old_deplibs $arg" 19506df26cacSmrg continue 19516df26cacSmrg ;; 19526df26cacSmrg 19536df26cacSmrg *.la) 19546df26cacSmrg # A libtool-controlled library. 19556df26cacSmrg 19566df26cacSmrg if test "$prev" = dlfiles; then 19576df26cacSmrg # This library was specified with -dlopen. 19586df26cacSmrg dlfiles="$dlfiles $arg" 19596df26cacSmrg prev= 19606df26cacSmrg elif test "$prev" = dlprefiles; then 19616df26cacSmrg # The library was specified with -dlpreopen. 19626df26cacSmrg dlprefiles="$dlprefiles $arg" 19636df26cacSmrg prev= 19646df26cacSmrg else 19656df26cacSmrg deplibs="$deplibs $arg" 19666df26cacSmrg fi 19676df26cacSmrg continue 19686df26cacSmrg ;; 19696df26cacSmrg 19706df26cacSmrg # Some other compiler argument. 19716df26cacSmrg *) 19726df26cacSmrg # Unknown arguments in both finalize_command and compile_command need 19736df26cacSmrg # to be aesthetically quoted because they are evaled later. 19746df26cacSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 19756df26cacSmrg case $arg in 19766df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 19776df26cacSmrg arg="\"$arg\"" 19786df26cacSmrg ;; 19796df26cacSmrg esac 19806df26cacSmrg ;; 19816df26cacSmrg esac # arg 19826df26cacSmrg 19836df26cacSmrg # Now actually substitute the argument into the commands. 19846df26cacSmrg if test -n "$arg"; then 19856df26cacSmrg compile_command="$compile_command $arg" 19866df26cacSmrg finalize_command="$finalize_command $arg" 19876df26cacSmrg fi 19886df26cacSmrg done # argument parsing loop 19896df26cacSmrg 19906df26cacSmrg if test -n "$prev"; then 19916df26cacSmrg $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 19926df26cacSmrg $echo "$help" 1>&2 19936df26cacSmrg exit $EXIT_FAILURE 19946df26cacSmrg fi 19956df26cacSmrg 19966df26cacSmrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 19976df26cacSmrg eval arg=\"$export_dynamic_flag_spec\" 19986df26cacSmrg compile_command="$compile_command $arg" 19996df26cacSmrg finalize_command="$finalize_command $arg" 20006df26cacSmrg fi 20016df26cacSmrg 20026df26cacSmrg oldlibs= 20036df26cacSmrg # calculate the name of the file, without its directory 20046df26cacSmrg outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 20056df26cacSmrg libobjs_save="$libobjs" 20066df26cacSmrg 20076df26cacSmrg if test -n "$shlibpath_var"; then 20086df26cacSmrg # get the directories listed in $shlibpath_var 20096df26cacSmrg eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 20106df26cacSmrg else 20116df26cacSmrg shlib_search_path= 20126df26cacSmrg fi 20136df26cacSmrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 20146df26cacSmrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 20156df26cacSmrg 20166df26cacSmrg output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 20176df26cacSmrg if test "X$output_objdir" = "X$output"; then 20186df26cacSmrg output_objdir="$objdir" 20196df26cacSmrg else 20206df26cacSmrg output_objdir="$output_objdir/$objdir" 20216df26cacSmrg fi 20226df26cacSmrg # Create the object directory. 20236df26cacSmrg if test ! -d "$output_objdir"; then 20246df26cacSmrg $show "$mkdir $output_objdir" 20256df26cacSmrg $run $mkdir $output_objdir 20266df26cacSmrg exit_status=$? 20276df26cacSmrg if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 20286df26cacSmrg exit $exit_status 20296df26cacSmrg fi 20306df26cacSmrg fi 20316df26cacSmrg 20326df26cacSmrg # Determine the type of output 20336df26cacSmrg case $output in 20346df26cacSmrg "") 20356df26cacSmrg $echo "$modename: you must specify an output file" 1>&2 20366df26cacSmrg $echo "$help" 1>&2 20376df26cacSmrg exit $EXIT_FAILURE 20386df26cacSmrg ;; 20396df26cacSmrg *.$libext) linkmode=oldlib ;; 20406df26cacSmrg *.lo | *.$objext) linkmode=obj ;; 20416df26cacSmrg *.la) linkmode=lib ;; 20426df26cacSmrg *) linkmode=prog ;; # Anything else should be a program. 20436df26cacSmrg esac 20446df26cacSmrg 20456df26cacSmrg case $host in 20466df26cacSmrg *cygwin* | *mingw* | *pw32*) 20476df26cacSmrg # don't eliminate duplications in $postdeps and $predeps 20486df26cacSmrg duplicate_compiler_generated_deps=yes 20496df26cacSmrg ;; 20506df26cacSmrg *) 20516df26cacSmrg duplicate_compiler_generated_deps=$duplicate_deps 20526df26cacSmrg ;; 20536df26cacSmrg esac 20546df26cacSmrg specialdeplibs= 20556df26cacSmrg 20566df26cacSmrg libs= 20576df26cacSmrg # Find all interdependent deplibs by searching for libraries 20586df26cacSmrg # that are linked more than once (e.g. -la -lb -la) 20596df26cacSmrg for deplib in $deplibs; do 20606df26cacSmrg if test "X$duplicate_deps" = "Xyes" ; then 20616df26cacSmrg case "$libs " in 20626df26cacSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 20636df26cacSmrg esac 20646df26cacSmrg fi 20656df26cacSmrg libs="$libs $deplib" 20666df26cacSmrg done 20676df26cacSmrg 20686df26cacSmrg if test "$linkmode" = lib; then 20696df26cacSmrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 20706df26cacSmrg 20716df26cacSmrg # Compute libraries that are listed more than once in $predeps 20726df26cacSmrg # $postdeps and mark them as special (i.e., whose duplicates are 20736df26cacSmrg # not to be eliminated). 20746df26cacSmrg pre_post_deps= 20756df26cacSmrg if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 20766df26cacSmrg for pre_post_dep in $predeps $postdeps; do 20776df26cacSmrg case "$pre_post_deps " in 20786df26cacSmrg *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 20796df26cacSmrg esac 20806df26cacSmrg pre_post_deps="$pre_post_deps $pre_post_dep" 20816df26cacSmrg done 20826df26cacSmrg fi 20836df26cacSmrg pre_post_deps= 20846df26cacSmrg fi 20856df26cacSmrg 20866df26cacSmrg deplibs= 20876df26cacSmrg newdependency_libs= 20886df26cacSmrg newlib_search_path= 20896df26cacSmrg need_relink=no # whether we're linking any uninstalled libtool libraries 20906df26cacSmrg notinst_deplibs= # not-installed libtool libraries 20916df26cacSmrg case $linkmode in 20926df26cacSmrg lib) 20936df26cacSmrg passes="conv link" 20946df26cacSmrg for file in $dlfiles $dlprefiles; do 20956df26cacSmrg case $file in 20966df26cacSmrg *.la) ;; 20976df26cacSmrg *) 20986df26cacSmrg $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 20996df26cacSmrg exit $EXIT_FAILURE 21006df26cacSmrg ;; 21016df26cacSmrg esac 21026df26cacSmrg done 21036df26cacSmrg ;; 21046df26cacSmrg prog) 21056df26cacSmrg compile_deplibs= 21066df26cacSmrg finalize_deplibs= 21076df26cacSmrg alldeplibs=no 21086df26cacSmrg newdlfiles= 21096df26cacSmrg newdlprefiles= 21106df26cacSmrg passes="conv scan dlopen dlpreopen link" 21116df26cacSmrg ;; 21126df26cacSmrg *) passes="conv" 21136df26cacSmrg ;; 21146df26cacSmrg esac 21156df26cacSmrg for pass in $passes; do 21166df26cacSmrg if test "$linkmode,$pass" = "lib,link" || 21176df26cacSmrg test "$linkmode,$pass" = "prog,scan"; then 21186df26cacSmrg libs="$deplibs" 21196df26cacSmrg deplibs= 21206df26cacSmrg fi 21216df26cacSmrg if test "$linkmode" = prog; then 21226df26cacSmrg case $pass in 21236df26cacSmrg dlopen) libs="$dlfiles" ;; 21246df26cacSmrg dlpreopen) libs="$dlprefiles" ;; 212516fd1166Smrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 21266df26cacSmrg esac 21276df26cacSmrg fi 21286df26cacSmrg if test "$pass" = dlopen; then 21296df26cacSmrg # Collect dlpreopened libraries 21306df26cacSmrg save_deplibs="$deplibs" 21316df26cacSmrg deplibs= 21326df26cacSmrg fi 21336df26cacSmrg for deplib in $libs; do 21346df26cacSmrg lib= 21356df26cacSmrg found=no 21366df26cacSmrg case $deplib in 213716fd1166Smrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 21386df26cacSmrg if test "$linkmode,$pass" = "prog,link"; then 21396df26cacSmrg compile_deplibs="$deplib $compile_deplibs" 21406df26cacSmrg finalize_deplibs="$deplib $finalize_deplibs" 21416df26cacSmrg else 21426df26cacSmrg compiler_flags="$compiler_flags $deplib" 21436df26cacSmrg fi 21446df26cacSmrg continue 21456df26cacSmrg ;; 21466df26cacSmrg -l*) 21476df26cacSmrg if test "$linkmode" != lib && test "$linkmode" != prog; then 21486df26cacSmrg $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 21496df26cacSmrg continue 21506df26cacSmrg fi 21516df26cacSmrg name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 21526df26cacSmrg for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 21536df26cacSmrg for search_ext in .la $std_shrext .so .a; do 21546df26cacSmrg # Search the libtool library 21556df26cacSmrg lib="$searchdir/lib${name}${search_ext}" 21566df26cacSmrg if test -f "$lib"; then 21576df26cacSmrg if test "$search_ext" = ".la"; then 21586df26cacSmrg found=yes 21596df26cacSmrg else 21606df26cacSmrg found=no 21616df26cacSmrg fi 21626df26cacSmrg break 2 21636df26cacSmrg fi 21646df26cacSmrg done 21656df26cacSmrg done 21666df26cacSmrg if test "$found" != yes; then 21676df26cacSmrg # deplib doesn't seem to be a libtool library 21686df26cacSmrg if test "$linkmode,$pass" = "prog,link"; then 21696df26cacSmrg compile_deplibs="$deplib $compile_deplibs" 21706df26cacSmrg finalize_deplibs="$deplib $finalize_deplibs" 21716df26cacSmrg else 21726df26cacSmrg deplibs="$deplib $deplibs" 21736df26cacSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 21746df26cacSmrg fi 21756df26cacSmrg continue 21766df26cacSmrg else # deplib is a libtool library 21776df26cacSmrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 21786df26cacSmrg # We need to do some special things here, and not later. 21796df26cacSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 21806df26cacSmrg case " $predeps $postdeps " in 21816df26cacSmrg *" $deplib "*) 21826df26cacSmrg if (${SED} -e '2q' $lib | 21836df26cacSmrg grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 21846df26cacSmrg library_names= 21856df26cacSmrg old_library= 21866df26cacSmrg case $lib in 21876df26cacSmrg */* | *\\*) . $lib ;; 21886df26cacSmrg *) . ./$lib ;; 21896df26cacSmrg esac 21906df26cacSmrg for l in $old_library $library_names; do 21916df26cacSmrg ll="$l" 21926df26cacSmrg done 21936df26cacSmrg if test "X$ll" = "X$old_library" ; then # only static version available 21946df26cacSmrg found=no 21956df26cacSmrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 21966df26cacSmrg test "X$ladir" = "X$lib" && ladir="." 21976df26cacSmrg lib=$ladir/$old_library 21986df26cacSmrg if test "$linkmode,$pass" = "prog,link"; then 21996df26cacSmrg compile_deplibs="$deplib $compile_deplibs" 22006df26cacSmrg finalize_deplibs="$deplib $finalize_deplibs" 22016df26cacSmrg else 22026df26cacSmrg deplibs="$deplib $deplibs" 22036df26cacSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 22046df26cacSmrg fi 22056df26cacSmrg continue 22066df26cacSmrg fi 22076df26cacSmrg fi 22086df26cacSmrg ;; 22096df26cacSmrg *) ;; 22106df26cacSmrg esac 22116df26cacSmrg fi 22126df26cacSmrg fi 22136df26cacSmrg ;; # -l 22146df26cacSmrg -L*) 22156df26cacSmrg case $linkmode in 22166df26cacSmrg lib) 22176df26cacSmrg deplibs="$deplib $deplibs" 22186df26cacSmrg test "$pass" = conv && continue 22196df26cacSmrg newdependency_libs="$deplib $newdependency_libs" 22206df26cacSmrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 22216df26cacSmrg ;; 22226df26cacSmrg prog) 22236df26cacSmrg if test "$pass" = conv; then 22246df26cacSmrg deplibs="$deplib $deplibs" 22256df26cacSmrg continue 22266df26cacSmrg fi 22276df26cacSmrg if test "$pass" = scan; then 22286df26cacSmrg deplibs="$deplib $deplibs" 22296df26cacSmrg else 22306df26cacSmrg compile_deplibs="$deplib $compile_deplibs" 22316df26cacSmrg finalize_deplibs="$deplib $finalize_deplibs" 22326df26cacSmrg fi 22336df26cacSmrg newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 22346df26cacSmrg ;; 22356df26cacSmrg *) 22366df26cacSmrg $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 22376df26cacSmrg ;; 22386df26cacSmrg esac # linkmode 22396df26cacSmrg continue 22406df26cacSmrg ;; # -L 22416df26cacSmrg -R*) 22426df26cacSmrg if test "$pass" = link; then 22436df26cacSmrg dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 22446df26cacSmrg # Make sure the xrpath contains only unique directories. 22456df26cacSmrg case "$xrpath " in 22466df26cacSmrg *" $dir "*) ;; 22476df26cacSmrg *) xrpath="$xrpath $dir" ;; 22486df26cacSmrg esac 22496df26cacSmrg fi 22506df26cacSmrg deplibs="$deplib $deplibs" 22516df26cacSmrg continue 22526df26cacSmrg ;; 22536df26cacSmrg *.la) lib="$deplib" ;; 22546df26cacSmrg *.$libext) 22556df26cacSmrg if test "$pass" = conv; then 22566df26cacSmrg deplibs="$deplib $deplibs" 22576df26cacSmrg continue 22586df26cacSmrg fi 22596df26cacSmrg case $linkmode in 22606df26cacSmrg lib) 22616df26cacSmrg valid_a_lib=no 22626df26cacSmrg case $deplibs_check_method in 22636df26cacSmrg match_pattern*) 22646df26cacSmrg set dummy $deplibs_check_method 22656df26cacSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 22666df26cacSmrg if eval $echo \"$deplib\" 2>/dev/null \ 22676df26cacSmrg | $SED 10q \ 22686df26cacSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 22696df26cacSmrg valid_a_lib=yes 22706df26cacSmrg fi 22716df26cacSmrg ;; 22726df26cacSmrg pass_all) 22736df26cacSmrg valid_a_lib=yes 22746df26cacSmrg ;; 22756df26cacSmrg esac 22766df26cacSmrg if test "$valid_a_lib" != yes; then 22776df26cacSmrg $echo 22786df26cacSmrg $echo "*** Warning: Trying to link with static lib archive $deplib." 22796df26cacSmrg $echo "*** I have the capability to make that library automatically link in when" 22806df26cacSmrg $echo "*** you link to this library. But I can only do this if you have a" 22816df26cacSmrg $echo "*** shared version of the library, which you do not appear to have" 22826df26cacSmrg $echo "*** because the file extensions .$libext of this argument makes me believe" 22836df26cacSmrg $echo "*** that it is just a static archive that I should not used here." 22846df26cacSmrg else 22856df26cacSmrg $echo 22866df26cacSmrg $echo "*** Warning: Linking the shared library $output against the" 22876df26cacSmrg $echo "*** static library $deplib is not portable!" 22886df26cacSmrg deplibs="$deplib $deplibs" 22896df26cacSmrg fi 22906df26cacSmrg continue 22916df26cacSmrg ;; 22926df26cacSmrg prog) 22936df26cacSmrg if test "$pass" != link; then 22946df26cacSmrg deplibs="$deplib $deplibs" 22956df26cacSmrg else 22966df26cacSmrg compile_deplibs="$deplib $compile_deplibs" 22976df26cacSmrg finalize_deplibs="$deplib $finalize_deplibs" 22986df26cacSmrg fi 22996df26cacSmrg continue 23006df26cacSmrg ;; 23016df26cacSmrg esac # linkmode 23026df26cacSmrg ;; # *.$libext 23036df26cacSmrg *.lo | *.$objext) 23046df26cacSmrg if test "$pass" = conv; then 23056df26cacSmrg deplibs="$deplib $deplibs" 23066df26cacSmrg elif test "$linkmode" = prog; then 23076df26cacSmrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 23086df26cacSmrg # If there is no dlopen support or we're linking statically, 23096df26cacSmrg # we need to preload. 23106df26cacSmrg newdlprefiles="$newdlprefiles $deplib" 23116df26cacSmrg compile_deplibs="$deplib $compile_deplibs" 23126df26cacSmrg finalize_deplibs="$deplib $finalize_deplibs" 23136df26cacSmrg else 23146df26cacSmrg newdlfiles="$newdlfiles $deplib" 23156df26cacSmrg fi 23166df26cacSmrg fi 23176df26cacSmrg continue 23186df26cacSmrg ;; 23196df26cacSmrg %DEPLIBS%) 23206df26cacSmrg alldeplibs=yes 23216df26cacSmrg continue 23226df26cacSmrg ;; 23236df26cacSmrg esac # case $deplib 23246df26cacSmrg if test "$found" = yes || test -f "$lib"; then : 23256df26cacSmrg else 23266df26cacSmrg $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 23276df26cacSmrg exit $EXIT_FAILURE 23286df26cacSmrg fi 23296df26cacSmrg 23306df26cacSmrg # Check to see that this really is a libtool archive. 23316df26cacSmrg if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 23326df26cacSmrg else 23336df26cacSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 23346df26cacSmrg exit $EXIT_FAILURE 23356df26cacSmrg fi 23366df26cacSmrg 23376df26cacSmrg ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 23386df26cacSmrg test "X$ladir" = "X$lib" && ladir="." 23396df26cacSmrg 23406df26cacSmrg dlname= 23416df26cacSmrg dlopen= 23426df26cacSmrg dlpreopen= 23436df26cacSmrg libdir= 23446df26cacSmrg library_names= 23456df26cacSmrg old_library= 23466df26cacSmrg # If the library was installed with an old release of libtool, 23476df26cacSmrg # it will not redefine variables installed, or shouldnotlink 23486df26cacSmrg installed=yes 23496df26cacSmrg shouldnotlink=no 23506df26cacSmrg avoidtemprpath= 23516df26cacSmrg 23526df26cacSmrg 23536df26cacSmrg # Read the .la file 23546df26cacSmrg case $lib in 23556df26cacSmrg */* | *\\*) . $lib ;; 23566df26cacSmrg *) . ./$lib ;; 23576df26cacSmrg esac 23586df26cacSmrg 23596df26cacSmrg if test "$linkmode,$pass" = "lib,link" || 23606df26cacSmrg test "$linkmode,$pass" = "prog,scan" || 23616df26cacSmrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 23626df26cacSmrg test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 23636df26cacSmrg test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 23646df26cacSmrg fi 23656df26cacSmrg 23666df26cacSmrg if test "$pass" = conv; then 23676df26cacSmrg # Only check for convenience libraries 23686df26cacSmrg deplibs="$lib $deplibs" 23696df26cacSmrg if test -z "$libdir"; then 23706df26cacSmrg if test -z "$old_library"; then 23716df26cacSmrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 23726df26cacSmrg exit $EXIT_FAILURE 23736df26cacSmrg fi 23746df26cacSmrg # It is a libtool convenience library, so add in its objects. 23756df26cacSmrg convenience="$convenience $ladir/$objdir/$old_library" 23766df26cacSmrg old_convenience="$old_convenience $ladir/$objdir/$old_library" 23776df26cacSmrg tmp_libs= 23786df26cacSmrg for deplib in $dependency_libs; do 23796df26cacSmrg deplibs="$deplib $deplibs" 23806df26cacSmrg if test "X$duplicate_deps" = "Xyes" ; then 23816df26cacSmrg case "$tmp_libs " in 23826df26cacSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 23836df26cacSmrg esac 23846df26cacSmrg fi 23856df26cacSmrg tmp_libs="$tmp_libs $deplib" 23866df26cacSmrg done 23876df26cacSmrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 23886df26cacSmrg $echo "$modename: \`$lib' is not a convenience library" 1>&2 23896df26cacSmrg exit $EXIT_FAILURE 23906df26cacSmrg fi 23916df26cacSmrg continue 23926df26cacSmrg fi # $pass = conv 23936df26cacSmrg 23946df26cacSmrg 23956df26cacSmrg # Get the name of the library we link against. 23966df26cacSmrg linklib= 23976df26cacSmrg for l in $old_library $library_names; do 23986df26cacSmrg linklib="$l" 23996df26cacSmrg done 24006df26cacSmrg if test -z "$linklib"; then 24016df26cacSmrg $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 24026df26cacSmrg exit $EXIT_FAILURE 24036df26cacSmrg fi 24046df26cacSmrg 24056df26cacSmrg # This library was specified with -dlopen. 24066df26cacSmrg if test "$pass" = dlopen; then 24076df26cacSmrg if test -z "$libdir"; then 24086df26cacSmrg $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 24096df26cacSmrg exit $EXIT_FAILURE 24106df26cacSmrg fi 24116df26cacSmrg if test -z "$dlname" || 24126df26cacSmrg test "$dlopen_support" != yes || 24136df26cacSmrg test "$build_libtool_libs" = no; then 24146df26cacSmrg # If there is no dlname, no dlopen support or we're linking 24156df26cacSmrg # statically, we need to preload. We also need to preload any 24166df26cacSmrg # dependent libraries so libltdl's deplib preloader doesn't 24176df26cacSmrg # bomb out in the load deplibs phase. 24186df26cacSmrg dlprefiles="$dlprefiles $lib $dependency_libs" 24196df26cacSmrg else 24206df26cacSmrg newdlfiles="$newdlfiles $lib" 24216df26cacSmrg fi 24226df26cacSmrg continue 24236df26cacSmrg fi # $pass = dlopen 24246df26cacSmrg 24256df26cacSmrg # We need an absolute path. 24266df26cacSmrg case $ladir in 24276df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 24286df26cacSmrg *) 24296df26cacSmrg abs_ladir=`cd "$ladir" && pwd` 24306df26cacSmrg if test -z "$abs_ladir"; then 24316df26cacSmrg $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 24326df26cacSmrg $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 24336df26cacSmrg abs_ladir="$ladir" 24346df26cacSmrg fi 24356df26cacSmrg ;; 24366df26cacSmrg esac 24376df26cacSmrg laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 24386df26cacSmrg 24396df26cacSmrg # Find the relevant object directory and library name. 24406df26cacSmrg if test "X$installed" = Xyes; then 24416df26cacSmrg if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24426df26cacSmrg $echo "$modename: warning: library \`$lib' was moved." 1>&2 24436df26cacSmrg dir="$ladir" 24446df26cacSmrg absdir="$abs_ladir" 24456df26cacSmrg libdir="$abs_ladir" 24466df26cacSmrg else 24476df26cacSmrg dir="$libdir" 24486df26cacSmrg absdir="$libdir" 24496df26cacSmrg fi 24506df26cacSmrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 24516df26cacSmrg else 24526df26cacSmrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 24536df26cacSmrg dir="$ladir" 24546df26cacSmrg absdir="$abs_ladir" 24556df26cacSmrg # Remove this search path later 24566df26cacSmrg notinst_path="$notinst_path $abs_ladir" 24576df26cacSmrg else 24586df26cacSmrg dir="$ladir/$objdir" 24596df26cacSmrg absdir="$abs_ladir/$objdir" 24606df26cacSmrg # Remove this search path later 24616df26cacSmrg notinst_path="$notinst_path $abs_ladir" 24626df26cacSmrg fi 24636df26cacSmrg fi # $installed = yes 24646df26cacSmrg name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 24656df26cacSmrg 24666df26cacSmrg # This library was specified with -dlpreopen. 24676df26cacSmrg if test "$pass" = dlpreopen; then 24686df26cacSmrg if test -z "$libdir"; then 24696df26cacSmrg $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 24706df26cacSmrg exit $EXIT_FAILURE 24716df26cacSmrg fi 24726df26cacSmrg # Prefer using a static library (so that no silly _DYNAMIC symbols 24736df26cacSmrg # are required to link). 24746df26cacSmrg if test -n "$old_library"; then 24756df26cacSmrg newdlprefiles="$newdlprefiles $dir/$old_library" 24766df26cacSmrg # Otherwise, use the dlname, so that lt_dlopen finds it. 24776df26cacSmrg elif test -n "$dlname"; then 24786df26cacSmrg newdlprefiles="$newdlprefiles $dir/$dlname" 24796df26cacSmrg else 24806df26cacSmrg newdlprefiles="$newdlprefiles $dir/$linklib" 24816df26cacSmrg fi 24826df26cacSmrg fi # $pass = dlpreopen 24836df26cacSmrg 24846df26cacSmrg if test -z "$libdir"; then 24856df26cacSmrg # Link the convenience library 24866df26cacSmrg if test "$linkmode" = lib; then 24876df26cacSmrg deplibs="$dir/$old_library $deplibs" 24886df26cacSmrg elif test "$linkmode,$pass" = "prog,link"; then 24896df26cacSmrg compile_deplibs="$dir/$old_library $compile_deplibs" 24906df26cacSmrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 24916df26cacSmrg else 24926df26cacSmrg deplibs="$lib $deplibs" # used for prog,scan pass 24936df26cacSmrg fi 24946df26cacSmrg continue 24956df26cacSmrg fi 24966df26cacSmrg 24976df26cacSmrg 24986df26cacSmrg if test "$linkmode" = prog && test "$pass" != link; then 24996df26cacSmrg newlib_search_path="$newlib_search_path $ladir" 25006df26cacSmrg deplibs="$lib $deplibs" 25016df26cacSmrg 25026df26cacSmrg linkalldeplibs=no 25036df26cacSmrg if test "$link_all_deplibs" != no || test -z "$library_names" || 25046df26cacSmrg test "$build_libtool_libs" = no; then 25056df26cacSmrg linkalldeplibs=yes 25066df26cacSmrg fi 25076df26cacSmrg 25086df26cacSmrg tmp_libs= 25096df26cacSmrg for deplib in $dependency_libs; do 25106df26cacSmrg case $deplib in 25116df26cacSmrg -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 25126df26cacSmrg esac 25136df26cacSmrg # Need to link against all dependency_libs? 25146df26cacSmrg if test "$linkalldeplibs" = yes; then 25156df26cacSmrg deplibs="$deplib $deplibs" 25166df26cacSmrg else 25176df26cacSmrg # Need to hardcode shared library paths 25186df26cacSmrg # or/and link against static libraries 25196df26cacSmrg newdependency_libs="$deplib $newdependency_libs" 25206df26cacSmrg fi 25216df26cacSmrg if test "X$duplicate_deps" = "Xyes" ; then 25226df26cacSmrg case "$tmp_libs " in 25236df26cacSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 25246df26cacSmrg esac 25256df26cacSmrg fi 25266df26cacSmrg tmp_libs="$tmp_libs $deplib" 25276df26cacSmrg done # for deplib 25286df26cacSmrg continue 25296df26cacSmrg fi # $linkmode = prog... 25306df26cacSmrg 25316df26cacSmrg if test "$linkmode,$pass" = "prog,link"; then 25326df26cacSmrg if test -n "$library_names" && 253316fd1166Smrg { { test "$prefer_static_libs" = no || 253416fd1166Smrg test "$prefer_static_libs,$installed" = "built,yes"; } || 253516fd1166Smrg test -z "$old_library"; }; then 25366df26cacSmrg # We need to hardcode the library path 25376df26cacSmrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 25386df26cacSmrg # Make sure the rpath contains only unique directories. 25396df26cacSmrg case "$temp_rpath " in 25406df26cacSmrg *" $dir "*) ;; 25416df26cacSmrg *" $absdir "*) ;; 25426df26cacSmrg *) temp_rpath="$temp_rpath $absdir" ;; 25436df26cacSmrg esac 25446df26cacSmrg fi 25456df26cacSmrg 25466df26cacSmrg # Hardcode the library path. 25476df26cacSmrg # Skip directories that are in the system default run-time 25486df26cacSmrg # search path. 25496df26cacSmrg case " $sys_lib_dlsearch_path " in 25506df26cacSmrg *" $absdir "*) ;; 25516df26cacSmrg *) 25526df26cacSmrg case "$compile_rpath " in 25536df26cacSmrg *" $absdir "*) ;; 25546df26cacSmrg *) compile_rpath="$compile_rpath $absdir" 25556df26cacSmrg esac 25566df26cacSmrg ;; 25576df26cacSmrg esac 25586df26cacSmrg case " $sys_lib_dlsearch_path " in 25596df26cacSmrg *" $libdir "*) ;; 25606df26cacSmrg *) 25616df26cacSmrg case "$finalize_rpath " in 25626df26cacSmrg *" $libdir "*) ;; 25636df26cacSmrg *) finalize_rpath="$finalize_rpath $libdir" 25646df26cacSmrg esac 25656df26cacSmrg ;; 25666df26cacSmrg esac 25676df26cacSmrg fi # $linkmode,$pass = prog,link... 25686df26cacSmrg 25696df26cacSmrg if test "$alldeplibs" = yes && 25706df26cacSmrg { test "$deplibs_check_method" = pass_all || 25716df26cacSmrg { test "$build_libtool_libs" = yes && 25726df26cacSmrg test -n "$library_names"; }; }; then 25736df26cacSmrg # We only need to search for static libraries 25746df26cacSmrg continue 25756df26cacSmrg fi 25766df26cacSmrg fi 25776df26cacSmrg 25786df26cacSmrg link_static=no # Whether the deplib will be linked statically 25796df26cacSmrg use_static_libs=$prefer_static_libs 25806df26cacSmrg if test "$use_static_libs" = built && test "$installed" = yes ; then 25816df26cacSmrg use_static_libs=no 25826df26cacSmrg fi 25836df26cacSmrg if test -n "$library_names" && 25846df26cacSmrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 25856df26cacSmrg if test "$installed" = no; then 25866df26cacSmrg notinst_deplibs="$notinst_deplibs $lib" 25876df26cacSmrg need_relink=yes 25886df26cacSmrg fi 25896df26cacSmrg # This is a shared library 25906df26cacSmrg 25916df26cacSmrg # Warn about portability, can't link against -module's on 25926df26cacSmrg # some systems (darwin) 25936df26cacSmrg if test "$shouldnotlink" = yes && test "$pass" = link ; then 25946df26cacSmrg $echo 25956df26cacSmrg if test "$linkmode" = prog; then 25966df26cacSmrg $echo "*** Warning: Linking the executable $output against the loadable module" 25976df26cacSmrg else 25986df26cacSmrg $echo "*** Warning: Linking the shared library $output against the loadable module" 25996df26cacSmrg fi 26006df26cacSmrg $echo "*** $linklib is not portable!" 26016df26cacSmrg fi 26026df26cacSmrg if test "$linkmode" = lib && 26036df26cacSmrg test "$hardcode_into_libs" = yes; then 26046df26cacSmrg # Hardcode the library path. 26056df26cacSmrg # Skip directories that are in the system default run-time 26066df26cacSmrg # search path. 26076df26cacSmrg case " $sys_lib_dlsearch_path " in 26086df26cacSmrg *" $absdir "*) ;; 26096df26cacSmrg *) 26106df26cacSmrg case "$compile_rpath " in 26116df26cacSmrg *" $absdir "*) ;; 26126df26cacSmrg *) compile_rpath="$compile_rpath $absdir" 26136df26cacSmrg esac 26146df26cacSmrg ;; 26156df26cacSmrg esac 26166df26cacSmrg case " $sys_lib_dlsearch_path " in 26176df26cacSmrg *" $libdir "*) ;; 26186df26cacSmrg *) 26196df26cacSmrg case "$finalize_rpath " in 26206df26cacSmrg *" $libdir "*) ;; 26216df26cacSmrg *) finalize_rpath="$finalize_rpath $libdir" 26226df26cacSmrg esac 26236df26cacSmrg ;; 26246df26cacSmrg esac 26256df26cacSmrg fi 26266df26cacSmrg 26276df26cacSmrg if test -n "$old_archive_from_expsyms_cmds"; then 26286df26cacSmrg # figure out the soname 26296df26cacSmrg set dummy $library_names 26306df26cacSmrg realname="$2" 26316df26cacSmrg shift; shift 26326df26cacSmrg libname=`eval \\$echo \"$libname_spec\"` 26336df26cacSmrg # use dlname if we got it. it's perfectly good, no? 26346df26cacSmrg if test -n "$dlname"; then 26356df26cacSmrg soname="$dlname" 26366df26cacSmrg elif test -n "$soname_spec"; then 26376df26cacSmrg # bleh windows 26386df26cacSmrg case $host in 26396df26cacSmrg *cygwin* | mingw*) 26406df26cacSmrg major=`expr $current - $age` 26416df26cacSmrg versuffix="-$major" 26426df26cacSmrg ;; 26436df26cacSmrg esac 26446df26cacSmrg eval soname=\"$soname_spec\" 26456df26cacSmrg else 26466df26cacSmrg soname="$realname" 26476df26cacSmrg fi 26486df26cacSmrg 26496df26cacSmrg # Make a new name for the extract_expsyms_cmds to use 26506df26cacSmrg soroot="$soname" 26516df26cacSmrg soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 26526df26cacSmrg newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 26536df26cacSmrg 26546df26cacSmrg # If the library has no export list, then create one now 26556df26cacSmrg if test -f "$output_objdir/$soname-def"; then : 26566df26cacSmrg else 26576df26cacSmrg $show "extracting exported symbol list from \`$soname'" 26586df26cacSmrg save_ifs="$IFS"; IFS='~' 26596df26cacSmrg cmds=$extract_expsyms_cmds 26606df26cacSmrg for cmd in $cmds; do 26616df26cacSmrg IFS="$save_ifs" 26626df26cacSmrg eval cmd=\"$cmd\" 26636df26cacSmrg $show "$cmd" 26646df26cacSmrg $run eval "$cmd" || exit $? 26656df26cacSmrg done 26666df26cacSmrg IFS="$save_ifs" 26676df26cacSmrg fi 26686df26cacSmrg 26696df26cacSmrg # Create $newlib 26706df26cacSmrg if test -f "$output_objdir/$newlib"; then :; else 26716df26cacSmrg $show "generating import library for \`$soname'" 26726df26cacSmrg save_ifs="$IFS"; IFS='~' 26736df26cacSmrg cmds=$old_archive_from_expsyms_cmds 26746df26cacSmrg for cmd in $cmds; do 26756df26cacSmrg IFS="$save_ifs" 26766df26cacSmrg eval cmd=\"$cmd\" 26776df26cacSmrg $show "$cmd" 26786df26cacSmrg $run eval "$cmd" || exit $? 26796df26cacSmrg done 26806df26cacSmrg IFS="$save_ifs" 26816df26cacSmrg fi 26826df26cacSmrg # make sure the library variables are pointing to the new library 26836df26cacSmrg dir=$output_objdir 26846df26cacSmrg linklib=$newlib 26856df26cacSmrg fi # test -n "$old_archive_from_expsyms_cmds" 26866df26cacSmrg 26876df26cacSmrg if test "$linkmode" = prog || test "$mode" != relink; then 26886df26cacSmrg add_shlibpath= 26896df26cacSmrg add_dir= 26906df26cacSmrg add= 26916df26cacSmrg lib_linked=yes 26926df26cacSmrg case $hardcode_action in 26936df26cacSmrg immediate | unsupported) 26946df26cacSmrg if test "$hardcode_direct" = no; then 26956df26cacSmrg add="$dir/$linklib" 26966df26cacSmrg case $host in 26976df26cacSmrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 26986df26cacSmrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 26996df26cacSmrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 27006df26cacSmrg *-*-unixware7*) add_dir="-L$dir" ;; 27016df26cacSmrg *-*-darwin* ) 27026df26cacSmrg # if the lib is a module then we can not link against 27036df26cacSmrg # it, someone is ignoring the new warnings I added 27046df26cacSmrg if /usr/bin/file -L $add 2> /dev/null | 27056df26cacSmrg $EGREP ": [^:]* bundle" >/dev/null ; then 27066df26cacSmrg $echo "** Warning, lib $linklib is a module, not a shared library" 27076df26cacSmrg if test -z "$old_library" ; then 27086df26cacSmrg $echo 27096df26cacSmrg $echo "** And there doesn't seem to be a static archive available" 27106df26cacSmrg $echo "** The link will probably fail, sorry" 27116df26cacSmrg else 27126df26cacSmrg add="$dir/$old_library" 27136df26cacSmrg fi 27146df26cacSmrg fi 27156df26cacSmrg esac 27166df26cacSmrg elif test "$hardcode_minus_L" = no; then 27176df26cacSmrg case $host in 27186df26cacSmrg *-*-sunos*) add_shlibpath="$dir" ;; 27196df26cacSmrg esac 27206df26cacSmrg add_dir="-L$dir" 27216df26cacSmrg add="-l$name" 27226df26cacSmrg elif test "$hardcode_shlibpath_var" = no; then 27236df26cacSmrg add_shlibpath="$dir" 27246df26cacSmrg add="-l$name" 27256df26cacSmrg else 27266df26cacSmrg lib_linked=no 27276df26cacSmrg fi 27286df26cacSmrg ;; 27296df26cacSmrg relink) 27306df26cacSmrg if test "$hardcode_direct" = yes; then 27316df26cacSmrg add="$dir/$linklib" 27326df26cacSmrg elif test "$hardcode_minus_L" = yes; then 27336df26cacSmrg add_dir="-L$dir" 27346df26cacSmrg # Try looking first in the location we're being installed to. 27356df26cacSmrg if test -n "$inst_prefix_dir"; then 27366df26cacSmrg case $libdir in 27376df26cacSmrg [\\/]*) 27386df26cacSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 27396df26cacSmrg ;; 27406df26cacSmrg esac 27416df26cacSmrg fi 27426df26cacSmrg add="-l$name" 27436df26cacSmrg elif test "$hardcode_shlibpath_var" = yes; then 27446df26cacSmrg add_shlibpath="$dir" 27456df26cacSmrg add="-l$name" 27466df26cacSmrg else 27476df26cacSmrg lib_linked=no 27486df26cacSmrg fi 27496df26cacSmrg ;; 27506df26cacSmrg *) lib_linked=no ;; 27516df26cacSmrg esac 27526df26cacSmrg 27536df26cacSmrg if test "$lib_linked" != yes; then 27546df26cacSmrg $echo "$modename: configuration error: unsupported hardcode properties" 27556df26cacSmrg exit $EXIT_FAILURE 27566df26cacSmrg fi 27576df26cacSmrg 27586df26cacSmrg if test -n "$add_shlibpath"; then 27596df26cacSmrg case :$compile_shlibpath: in 27606df26cacSmrg *":$add_shlibpath:"*) ;; 27616df26cacSmrg *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 27626df26cacSmrg esac 27636df26cacSmrg fi 27646df26cacSmrg if test "$linkmode" = prog; then 27656df26cacSmrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 27666df26cacSmrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 27676df26cacSmrg else 27686df26cacSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 27696df26cacSmrg test -n "$add" && deplibs="$add $deplibs" 27706df26cacSmrg if test "$hardcode_direct" != yes && \ 27716df26cacSmrg test "$hardcode_minus_L" != yes && \ 27726df26cacSmrg test "$hardcode_shlibpath_var" = yes; then 27736df26cacSmrg case :$finalize_shlibpath: in 27746df26cacSmrg *":$libdir:"*) ;; 27756df26cacSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 27766df26cacSmrg esac 27776df26cacSmrg fi 27786df26cacSmrg fi 27796df26cacSmrg fi 27806df26cacSmrg 27816df26cacSmrg if test "$linkmode" = prog || test "$mode" = relink; then 27826df26cacSmrg add_shlibpath= 27836df26cacSmrg add_dir= 27846df26cacSmrg add= 27856df26cacSmrg # Finalize command for both is simple: just hardcode it. 27866df26cacSmrg if test "$hardcode_direct" = yes; then 27876df26cacSmrg add="$libdir/$linklib" 27886df26cacSmrg elif test "$hardcode_minus_L" = yes; then 27896df26cacSmrg add_dir="-L$libdir" 27906df26cacSmrg add="-l$name" 27916df26cacSmrg elif test "$hardcode_shlibpath_var" = yes; then 27926df26cacSmrg case :$finalize_shlibpath: in 27936df26cacSmrg *":$libdir:"*) ;; 27946df26cacSmrg *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 27956df26cacSmrg esac 27966df26cacSmrg add="-l$name" 27976df26cacSmrg elif test "$hardcode_automatic" = yes; then 27986df26cacSmrg if test -n "$inst_prefix_dir" && 27996df26cacSmrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 28006df26cacSmrg add="$inst_prefix_dir$libdir/$linklib" 28016df26cacSmrg else 28026df26cacSmrg add="$libdir/$linklib" 28036df26cacSmrg fi 28046df26cacSmrg else 28056df26cacSmrg # We cannot seem to hardcode it, guess we'll fake it. 28066df26cacSmrg add_dir="-L$libdir" 28076df26cacSmrg # Try looking first in the location we're being installed to. 28086df26cacSmrg if test -n "$inst_prefix_dir"; then 28096df26cacSmrg case $libdir in 28106df26cacSmrg [\\/]*) 28116df26cacSmrg add_dir="$add_dir -L$inst_prefix_dir$libdir" 28126df26cacSmrg ;; 28136df26cacSmrg esac 28146df26cacSmrg fi 28156df26cacSmrg add="-l$name" 28166df26cacSmrg fi 28176df26cacSmrg 28186df26cacSmrg if test "$linkmode" = prog; then 28196df26cacSmrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 28206df26cacSmrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 28216df26cacSmrg else 28226df26cacSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 28236df26cacSmrg test -n "$add" && deplibs="$add $deplibs" 28246df26cacSmrg fi 28256df26cacSmrg fi 28266df26cacSmrg elif test "$linkmode" = prog; then 28276df26cacSmrg # Here we assume that one of hardcode_direct or hardcode_minus_L 28286df26cacSmrg # is not unsupported. This is valid on all known static and 28296df26cacSmrg # shared platforms. 28306df26cacSmrg if test "$hardcode_direct" != unsupported; then 28316df26cacSmrg test -n "$old_library" && linklib="$old_library" 28326df26cacSmrg compile_deplibs="$dir/$linklib $compile_deplibs" 28336df26cacSmrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 28346df26cacSmrg else 28356df26cacSmrg compile_deplibs="-l$name -L$dir $compile_deplibs" 28366df26cacSmrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 28376df26cacSmrg fi 28386df26cacSmrg elif test "$build_libtool_libs" = yes; then 28396df26cacSmrg # Not a shared library 28406df26cacSmrg if test "$deplibs_check_method" != pass_all; then 28416df26cacSmrg # We're trying link a shared library against a static one 28426df26cacSmrg # but the system doesn't support it. 28436df26cacSmrg 28446df26cacSmrg # Just print a warning and add the library to dependency_libs so 28456df26cacSmrg # that the program can be linked against the static library. 28466df26cacSmrg $echo 28476df26cacSmrg $echo "*** Warning: This system can not link to static lib archive $lib." 28486df26cacSmrg $echo "*** I have the capability to make that library automatically link in when" 28496df26cacSmrg $echo "*** you link to this library. But I can only do this if you have a" 28506df26cacSmrg $echo "*** shared version of the library, which you do not appear to have." 28516df26cacSmrg if test "$module" = yes; then 28526df26cacSmrg $echo "*** But as you try to build a module library, libtool will still create " 28536df26cacSmrg $echo "*** a static module, that should work as long as the dlopening application" 28546df26cacSmrg $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 28556df26cacSmrg if test -z "$global_symbol_pipe"; then 28566df26cacSmrg $echo 28576df26cacSmrg $echo "*** However, this would only work if libtool was able to extract symbol" 28586df26cacSmrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 28596df26cacSmrg $echo "*** not find such a program. So, this module is probably useless." 28606df26cacSmrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 28616df26cacSmrg fi 28626df26cacSmrg if test "$build_old_libs" = no; then 28636df26cacSmrg build_libtool_libs=module 28646df26cacSmrg build_old_libs=yes 28656df26cacSmrg else 28666df26cacSmrg build_libtool_libs=no 28676df26cacSmrg fi 28686df26cacSmrg fi 28696df26cacSmrg else 28706df26cacSmrg deplibs="$dir/$old_library $deplibs" 28716df26cacSmrg link_static=yes 28726df26cacSmrg fi 28736df26cacSmrg fi # link shared/static library? 28746df26cacSmrg 28756df26cacSmrg if test "$linkmode" = lib; then 28766df26cacSmrg if test -n "$dependency_libs" && 28776df26cacSmrg { test "$hardcode_into_libs" != yes || 28786df26cacSmrg test "$build_old_libs" = yes || 28796df26cacSmrg test "$link_static" = yes; }; then 28806df26cacSmrg # Extract -R from dependency_libs 28816df26cacSmrg temp_deplibs= 28826df26cacSmrg for libdir in $dependency_libs; do 28836df26cacSmrg case $libdir in 28846df26cacSmrg -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 28856df26cacSmrg case " $xrpath " in 28866df26cacSmrg *" $temp_xrpath "*) ;; 28876df26cacSmrg *) xrpath="$xrpath $temp_xrpath";; 28886df26cacSmrg esac;; 28896df26cacSmrg *) temp_deplibs="$temp_deplibs $libdir";; 28906df26cacSmrg esac 28916df26cacSmrg done 28926df26cacSmrg dependency_libs="$temp_deplibs" 28936df26cacSmrg fi 28946df26cacSmrg 28956df26cacSmrg newlib_search_path="$newlib_search_path $absdir" 28966df26cacSmrg # Link against this library 28976df26cacSmrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 28986df26cacSmrg # ... and its dependency_libs 28996df26cacSmrg tmp_libs= 29006df26cacSmrg for deplib in $dependency_libs; do 29016df26cacSmrg newdependency_libs="$deplib $newdependency_libs" 29026df26cacSmrg if test "X$duplicate_deps" = "Xyes" ; then 29036df26cacSmrg case "$tmp_libs " in 29046df26cacSmrg *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 29056df26cacSmrg esac 29066df26cacSmrg fi 29076df26cacSmrg tmp_libs="$tmp_libs $deplib" 29086df26cacSmrg done 29096df26cacSmrg 29106df26cacSmrg if test "$link_all_deplibs" != no; then 29116df26cacSmrg # Add the search paths of all dependency libraries 29126df26cacSmrg for deplib in $dependency_libs; do 29136df26cacSmrg case $deplib in 29146df26cacSmrg -L*) path="$deplib" ;; 29156df26cacSmrg *.la) 29166df26cacSmrg dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 29176df26cacSmrg test "X$dir" = "X$deplib" && dir="." 29186df26cacSmrg # We need an absolute path. 29196df26cacSmrg case $dir in 29206df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 29216df26cacSmrg *) 29226df26cacSmrg absdir=`cd "$dir" && pwd` 29236df26cacSmrg if test -z "$absdir"; then 29246df26cacSmrg $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 29256df26cacSmrg absdir="$dir" 29266df26cacSmrg fi 29276df26cacSmrg ;; 29286df26cacSmrg esac 29296df26cacSmrg if grep "^installed=no" $deplib > /dev/null; then 29306df26cacSmrg path="$absdir/$objdir" 29316df26cacSmrg else 29326df26cacSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 29336df26cacSmrg if test -z "$libdir"; then 29346df26cacSmrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 29356df26cacSmrg exit $EXIT_FAILURE 29366df26cacSmrg fi 293716fd1166Smrg #if test "$absdir" != "$libdir"; then 293816fd1166Smrg # $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 293916fd1166Smrg #fi 29406df26cacSmrg path="$absdir" 29416df26cacSmrg fi 29426df26cacSmrg depdepl= 29436df26cacSmrg case $host in 29446df26cacSmrg *-*-darwin*) 29456df26cacSmrg # we do not want to link against static libs, 29466df26cacSmrg # but need to link against shared 29476df26cacSmrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 29486df26cacSmrg if test -n "$deplibrary_names" ; then 29496df26cacSmrg for tmp in $deplibrary_names ; do 29506df26cacSmrg depdepl=$tmp 29516df26cacSmrg done 29526df26cacSmrg if test -f "$path/$depdepl" ; then 29536df26cacSmrg depdepl="$path/$depdepl" 29546df26cacSmrg fi 29556df26cacSmrg # do not add paths which are already there 29566df26cacSmrg case " $newlib_search_path " in 29576df26cacSmrg *" $path "*) ;; 29586df26cacSmrg *) newlib_search_path="$newlib_search_path $path";; 29596df26cacSmrg esac 29606df26cacSmrg fi 29616df26cacSmrg path="" 29626df26cacSmrg ;; 29636df26cacSmrg *) 29646df26cacSmrg path="-L$path" 29656df26cacSmrg ;; 29666df26cacSmrg esac 29676df26cacSmrg ;; 29686df26cacSmrg -l*) 29696df26cacSmrg case $host in 29706df26cacSmrg *-*-darwin*) 29716df26cacSmrg # Again, we only want to link against shared libraries 29726df26cacSmrg eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 29736df26cacSmrg for tmp in $newlib_search_path ; do 29746df26cacSmrg if test -f "$tmp/lib$tmp_libs.dylib" ; then 29756df26cacSmrg eval depdepl="$tmp/lib$tmp_libs.dylib" 29766df26cacSmrg break 29776df26cacSmrg fi 29786df26cacSmrg done 29796df26cacSmrg path="" 29806df26cacSmrg ;; 29816df26cacSmrg *) continue ;; 29826df26cacSmrg esac 29836df26cacSmrg ;; 29846df26cacSmrg *) continue ;; 29856df26cacSmrg esac 29866df26cacSmrg case " $deplibs " in 29876df26cacSmrg *" $path "*) ;; 29886df26cacSmrg *) deplibs="$path $deplibs" ;; 29896df26cacSmrg esac 29906df26cacSmrg case " $deplibs " in 29916df26cacSmrg *" $depdepl "*) ;; 29926df26cacSmrg *) deplibs="$depdepl $deplibs" ;; 29936df26cacSmrg esac 29946df26cacSmrg done 29956df26cacSmrg fi # link_all_deplibs != no 29966df26cacSmrg fi # linkmode = lib 29976df26cacSmrg done # for deplib in $libs 29986df26cacSmrg dependency_libs="$newdependency_libs" 29996df26cacSmrg if test "$pass" = dlpreopen; then 30006df26cacSmrg # Link the dlpreopened libraries before other libraries 30016df26cacSmrg for deplib in $save_deplibs; do 30026df26cacSmrg deplibs="$deplib $deplibs" 30036df26cacSmrg done 30046df26cacSmrg fi 30056df26cacSmrg if test "$pass" != dlopen; then 30066df26cacSmrg if test "$pass" != conv; then 30076df26cacSmrg # Make sure lib_search_path contains only unique directories. 30086df26cacSmrg lib_search_path= 30096df26cacSmrg for dir in $newlib_search_path; do 30106df26cacSmrg case "$lib_search_path " in 30116df26cacSmrg *" $dir "*) ;; 30126df26cacSmrg *) lib_search_path="$lib_search_path $dir" ;; 30136df26cacSmrg esac 30146df26cacSmrg done 30156df26cacSmrg newlib_search_path= 30166df26cacSmrg fi 30176df26cacSmrg 30186df26cacSmrg if test "$linkmode,$pass" != "prog,link"; then 30196df26cacSmrg vars="deplibs" 30206df26cacSmrg else 30216df26cacSmrg vars="compile_deplibs finalize_deplibs" 30226df26cacSmrg fi 30236df26cacSmrg for var in $vars dependency_libs; do 30246df26cacSmrg # Add libraries to $var in reverse order 30256df26cacSmrg eval tmp_libs=\"\$$var\" 30266df26cacSmrg new_libs= 30276df26cacSmrg for deplib in $tmp_libs; do 30286df26cacSmrg # FIXME: Pedantically, this is the right thing to do, so 30296df26cacSmrg # that some nasty dependency loop isn't accidentally 30306df26cacSmrg # broken: 30316df26cacSmrg #new_libs="$deplib $new_libs" 30326df26cacSmrg # Pragmatically, this seems to cause very few problems in 30336df26cacSmrg # practice: 30346df26cacSmrg case $deplib in 30356df26cacSmrg -L*) new_libs="$deplib $new_libs" ;; 30366df26cacSmrg -R*) ;; 30376df26cacSmrg *) 30386df26cacSmrg # And here is the reason: when a library appears more 30396df26cacSmrg # than once as an explicit dependence of a library, or 30406df26cacSmrg # is implicitly linked in more than once by the 30416df26cacSmrg # compiler, it is considered special, and multiple 30426df26cacSmrg # occurrences thereof are not removed. Compare this 30436df26cacSmrg # with having the same library being listed as a 30446df26cacSmrg # dependency of multiple other libraries: in this case, 30456df26cacSmrg # we know (pedantically, we assume) the library does not 30466df26cacSmrg # need to be listed more than once, so we keep only the 30476df26cacSmrg # last copy. This is not always right, but it is rare 30486df26cacSmrg # enough that we require users that really mean to play 30496df26cacSmrg # such unportable linking tricks to link the library 30506df26cacSmrg # using -Wl,-lname, so that libtool does not consider it 30516df26cacSmrg # for duplicate removal. 30526df26cacSmrg case " $specialdeplibs " in 30536df26cacSmrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 30546df26cacSmrg *) 30556df26cacSmrg case " $new_libs " in 30566df26cacSmrg *" $deplib "*) ;; 30576df26cacSmrg *) new_libs="$deplib $new_libs" ;; 30586df26cacSmrg esac 30596df26cacSmrg ;; 30606df26cacSmrg esac 30616df26cacSmrg ;; 30626df26cacSmrg esac 30636df26cacSmrg done 30646df26cacSmrg tmp_libs= 30656df26cacSmrg for deplib in $new_libs; do 30666df26cacSmrg case $deplib in 30676df26cacSmrg -L*) 30686df26cacSmrg case " $tmp_libs " in 30696df26cacSmrg *" $deplib "*) ;; 30706df26cacSmrg *) tmp_libs="$tmp_libs $deplib" ;; 30716df26cacSmrg esac 30726df26cacSmrg ;; 30736df26cacSmrg *) tmp_libs="$tmp_libs $deplib" ;; 30746df26cacSmrg esac 30756df26cacSmrg done 30766df26cacSmrg eval $var=\"$tmp_libs\" 30776df26cacSmrg done # for var 30786df26cacSmrg fi 30796df26cacSmrg # Last step: remove runtime libs from dependency_libs 30806df26cacSmrg # (they stay in deplibs) 30816df26cacSmrg tmp_libs= 30826df26cacSmrg for i in $dependency_libs ; do 30836df26cacSmrg case " $predeps $postdeps $compiler_lib_search_path " in 30846df26cacSmrg *" $i "*) 30856df26cacSmrg i="" 30866df26cacSmrg ;; 30876df26cacSmrg esac 30886df26cacSmrg if test -n "$i" ; then 30896df26cacSmrg tmp_libs="$tmp_libs $i" 30906df26cacSmrg fi 30916df26cacSmrg done 30926df26cacSmrg dependency_libs=$tmp_libs 30936df26cacSmrg done # for pass 30946df26cacSmrg if test "$linkmode" = prog; then 30956df26cacSmrg dlfiles="$newdlfiles" 30966df26cacSmrg dlprefiles="$newdlprefiles" 30976df26cacSmrg fi 30986df26cacSmrg 30996df26cacSmrg case $linkmode in 31006df26cacSmrg oldlib) 31016df26cacSmrg if test -n "$deplibs"; then 31026df26cacSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 31036df26cacSmrg fi 31046df26cacSmrg 31056df26cacSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 31066df26cacSmrg $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 31076df26cacSmrg fi 31086df26cacSmrg 31096df26cacSmrg if test -n "$rpath"; then 31106df26cacSmrg $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 31116df26cacSmrg fi 31126df26cacSmrg 31136df26cacSmrg if test -n "$xrpath"; then 31146df26cacSmrg $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 31156df26cacSmrg fi 31166df26cacSmrg 31176df26cacSmrg if test -n "$vinfo"; then 31186df26cacSmrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 31196df26cacSmrg fi 31206df26cacSmrg 31216df26cacSmrg if test -n "$release"; then 31226df26cacSmrg $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 31236df26cacSmrg fi 31246df26cacSmrg 31256df26cacSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 31266df26cacSmrg $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 31276df26cacSmrg fi 31286df26cacSmrg 31296df26cacSmrg # Now set the variables for building old libraries. 31306df26cacSmrg build_libtool_libs=no 31316df26cacSmrg oldlibs="$output" 31326df26cacSmrg objs="$objs$old_deplibs" 31336df26cacSmrg ;; 31346df26cacSmrg 31356df26cacSmrg lib) 31366df26cacSmrg # Make sure we only generate libraries of the form `libNAME.la'. 31376df26cacSmrg case $outputname in 31386df26cacSmrg lib*) 31396df26cacSmrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 31406df26cacSmrg eval shared_ext=\"$shrext_cmds\" 31416df26cacSmrg eval libname=\"$libname_spec\" 31426df26cacSmrg ;; 31436df26cacSmrg *) 31446df26cacSmrg if test "$module" = no; then 31456df26cacSmrg $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 31466df26cacSmrg $echo "$help" 1>&2 31476df26cacSmrg exit $EXIT_FAILURE 31486df26cacSmrg fi 31496df26cacSmrg if test "$need_lib_prefix" != no; then 31506df26cacSmrg # Add the "lib" prefix for modules if required 31516df26cacSmrg name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31526df26cacSmrg eval shared_ext=\"$shrext_cmds\" 31536df26cacSmrg eval libname=\"$libname_spec\" 31546df26cacSmrg else 31556df26cacSmrg libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 31566df26cacSmrg fi 31576df26cacSmrg ;; 31586df26cacSmrg esac 31596df26cacSmrg 31606df26cacSmrg if test -n "$objs"; then 31616df26cacSmrg if test "$deplibs_check_method" != pass_all; then 31626df26cacSmrg $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 31636df26cacSmrg exit $EXIT_FAILURE 31646df26cacSmrg else 31656df26cacSmrg $echo 31666df26cacSmrg $echo "*** Warning: Linking the shared library $output against the non-libtool" 31676df26cacSmrg $echo "*** objects $objs is not portable!" 31686df26cacSmrg libobjs="$libobjs $objs" 31696df26cacSmrg fi 31706df26cacSmrg fi 31716df26cacSmrg 31726df26cacSmrg if test "$dlself" != no; then 31736df26cacSmrg $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 31746df26cacSmrg fi 31756df26cacSmrg 31766df26cacSmrg set dummy $rpath 31776df26cacSmrg if test "$#" -gt 2; then 31786df26cacSmrg $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 31796df26cacSmrg fi 31806df26cacSmrg install_libdir="$2" 31816df26cacSmrg 31826df26cacSmrg oldlibs= 31836df26cacSmrg if test -z "$rpath"; then 31846df26cacSmrg if test "$build_libtool_libs" = yes; then 31856df26cacSmrg # Building a libtool convenience library. 31866df26cacSmrg # Some compilers have problems with a `.al' extension so 31876df26cacSmrg # convenience libraries should have the same extension an 31886df26cacSmrg # archive normally would. 31896df26cacSmrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 31906df26cacSmrg build_libtool_libs=convenience 31916df26cacSmrg build_old_libs=yes 31926df26cacSmrg fi 31936df26cacSmrg 31946df26cacSmrg if test -n "$vinfo"; then 31956df26cacSmrg $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 31966df26cacSmrg fi 31976df26cacSmrg 31986df26cacSmrg if test -n "$release"; then 31996df26cacSmrg $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 32006df26cacSmrg fi 32016df26cacSmrg else 32026df26cacSmrg 32036df26cacSmrg # Parse the version information argument. 32046df26cacSmrg save_ifs="$IFS"; IFS=':' 32056df26cacSmrg set dummy $vinfo 0 0 0 32066df26cacSmrg IFS="$save_ifs" 32076df26cacSmrg 32086df26cacSmrg if test -n "$8"; then 32096df26cacSmrg $echo "$modename: too many parameters to \`-version-info'" 1>&2 32106df26cacSmrg $echo "$help" 1>&2 32116df26cacSmrg exit $EXIT_FAILURE 32126df26cacSmrg fi 32136df26cacSmrg 32146df26cacSmrg # convert absolute version numbers to libtool ages 32156df26cacSmrg # this retains compatibility with .la files and attempts 32166df26cacSmrg # to make the code below a bit more comprehensible 32176df26cacSmrg 32186df26cacSmrg case $vinfo_number in 32196df26cacSmrg yes) 32206df26cacSmrg number_major="$2" 32216df26cacSmrg number_minor="$3" 32226df26cacSmrg number_revision="$4" 32236df26cacSmrg # 32246df26cacSmrg # There are really only two kinds -- those that 32256df26cacSmrg # use the current revision as the major version 32266df26cacSmrg # and those that subtract age and use age as 32276df26cacSmrg # a minor version. But, then there is irix 32286df26cacSmrg # which has an extra 1 added just for fun 32296df26cacSmrg # 32306df26cacSmrg case $version_type in 323116fd1166Smrg darwin|linux|osf|windows|none) 32326df26cacSmrg current=`expr $number_major + $number_minor` 32336df26cacSmrg age="$number_minor" 32346df26cacSmrg revision="$number_revision" 32356df26cacSmrg ;; 32366df26cacSmrg freebsd-aout|freebsd-elf|sunos) 32376df26cacSmrg current="$number_major" 32386df26cacSmrg revision="$number_minor" 32396df26cacSmrg age="0" 32406df26cacSmrg ;; 32416df26cacSmrg irix|nonstopux) 324216fd1166Smrg current=`expr $number_major + $number_minor` 32436df26cacSmrg age="$number_minor" 32446df26cacSmrg revision="$number_minor" 324516fd1166Smrg lt_irix_increment=no 32466df26cacSmrg ;; 32476df26cacSmrg esac 32486df26cacSmrg ;; 32496df26cacSmrg no) 32506df26cacSmrg current="$2" 32516df26cacSmrg revision="$3" 32526df26cacSmrg age="$4" 32536df26cacSmrg ;; 32546df26cacSmrg esac 32556df26cacSmrg 32566df26cacSmrg # Check that each of the things are valid numbers. 32576df26cacSmrg case $current in 32586df26cacSmrg 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]) ;; 32596df26cacSmrg *) 32606df26cacSmrg $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 32616df26cacSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32626df26cacSmrg exit $EXIT_FAILURE 32636df26cacSmrg ;; 32646df26cacSmrg esac 32656df26cacSmrg 32666df26cacSmrg case $revision in 32676df26cacSmrg 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]) ;; 32686df26cacSmrg *) 32696df26cacSmrg $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 32706df26cacSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32716df26cacSmrg exit $EXIT_FAILURE 32726df26cacSmrg ;; 32736df26cacSmrg esac 32746df26cacSmrg 32756df26cacSmrg case $age in 32766df26cacSmrg 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]) ;; 32776df26cacSmrg *) 32786df26cacSmrg $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 32796df26cacSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32806df26cacSmrg exit $EXIT_FAILURE 32816df26cacSmrg ;; 32826df26cacSmrg esac 32836df26cacSmrg 32846df26cacSmrg if test "$age" -gt "$current"; then 32856df26cacSmrg $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 32866df26cacSmrg $echo "$modename: \`$vinfo' is not valid version information" 1>&2 32876df26cacSmrg exit $EXIT_FAILURE 32886df26cacSmrg fi 32896df26cacSmrg 32906df26cacSmrg # Calculate the version variables. 32916df26cacSmrg major= 32926df26cacSmrg versuffix= 32936df26cacSmrg verstring= 32946df26cacSmrg case $version_type in 32956df26cacSmrg none) ;; 32966df26cacSmrg 32976df26cacSmrg darwin) 32986df26cacSmrg # Like Linux, but with the current version available in 32996df26cacSmrg # verstring for coding it into the library header 33006df26cacSmrg major=.`expr $current - $age` 33016df26cacSmrg versuffix="$major.$age.$revision" 33026df26cacSmrg # Darwin ld doesn't like 0 for these options... 33036df26cacSmrg minor_current=`expr $current + 1` 330416fd1166Smrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 330516fd1166Smrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 33066df26cacSmrg ;; 33076df26cacSmrg 33086df26cacSmrg freebsd-aout) 33096df26cacSmrg major=".$current" 33106df26cacSmrg versuffix=".$current.$revision"; 33116df26cacSmrg ;; 33126df26cacSmrg 33136df26cacSmrg freebsd-elf) 33146df26cacSmrg major=".$current" 33156df26cacSmrg versuffix=".$current"; 33166df26cacSmrg ;; 33176df26cacSmrg 33186df26cacSmrg irix | nonstopux) 331916fd1166Smrg if test "X$lt_irix_increment" = "Xno"; then 332016fd1166Smrg major=`expr $current - $age` 332116fd1166Smrg else 332216fd1166Smrg major=`expr $current - $age + 1` 332316fd1166Smrg fi 33246df26cacSmrg case $version_type in 33256df26cacSmrg nonstopux) verstring_prefix=nonstopux ;; 33266df26cacSmrg *) verstring_prefix=sgi ;; 33276df26cacSmrg esac 33286df26cacSmrg verstring="$verstring_prefix$major.$revision" 33296df26cacSmrg 33306df26cacSmrg # Add in all the interfaces that we are compatible with. 33316df26cacSmrg loop=$revision 33326df26cacSmrg while test "$loop" -ne 0; do 33336df26cacSmrg iface=`expr $revision - $loop` 33346df26cacSmrg loop=`expr $loop - 1` 33356df26cacSmrg verstring="$verstring_prefix$major.$iface:$verstring" 33366df26cacSmrg done 33376df26cacSmrg 33386df26cacSmrg # Before this point, $major must not contain `.'. 33396df26cacSmrg major=.$major 33406df26cacSmrg versuffix="$major.$revision" 33416df26cacSmrg ;; 33426df26cacSmrg 33436df26cacSmrg linux) 33446df26cacSmrg major=.`expr $current - $age` 33456df26cacSmrg versuffix="$major.$age.$revision" 33466df26cacSmrg ;; 33476df26cacSmrg 33486df26cacSmrg osf) 33496df26cacSmrg major=.`expr $current - $age` 33506df26cacSmrg versuffix=".$current.$age.$revision" 33516df26cacSmrg verstring="$current.$age.$revision" 33526df26cacSmrg 33536df26cacSmrg # Add in all the interfaces that we are compatible with. 33546df26cacSmrg loop=$age 33556df26cacSmrg while test "$loop" -ne 0; do 33566df26cacSmrg iface=`expr $current - $loop` 33576df26cacSmrg loop=`expr $loop - 1` 33586df26cacSmrg verstring="$verstring:${iface}.0" 33596df26cacSmrg done 33606df26cacSmrg 33616df26cacSmrg # Make executables depend on our current version. 33626df26cacSmrg verstring="$verstring:${current}.0" 33636df26cacSmrg ;; 33646df26cacSmrg 33656df26cacSmrg sunos) 33666df26cacSmrg major=".$current" 33676df26cacSmrg versuffix=".$current.$revision" 33686df26cacSmrg ;; 33696df26cacSmrg 33706df26cacSmrg windows) 33716df26cacSmrg # Use '-' rather than '.', since we only want one 33726df26cacSmrg # extension on DOS 8.3 filesystems. 33736df26cacSmrg major=`expr $current - $age` 33746df26cacSmrg versuffix="-$major" 33756df26cacSmrg ;; 33766df26cacSmrg 33776df26cacSmrg *) 33786df26cacSmrg $echo "$modename: unknown library version type \`$version_type'" 1>&2 33796df26cacSmrg $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 33806df26cacSmrg exit $EXIT_FAILURE 33816df26cacSmrg ;; 33826df26cacSmrg esac 33836df26cacSmrg 33846df26cacSmrg # Clear the version info if we defaulted, and they specified a release. 33856df26cacSmrg if test -z "$vinfo" && test -n "$release"; then 33866df26cacSmrg major= 33876df26cacSmrg case $version_type in 33886df26cacSmrg darwin) 33896df26cacSmrg # we can't check for "0.0" in archive_cmds due to quoting 33906df26cacSmrg # problems, so we reset it completely 33916df26cacSmrg verstring= 33926df26cacSmrg ;; 33936df26cacSmrg *) 33946df26cacSmrg verstring="0.0" 33956df26cacSmrg ;; 33966df26cacSmrg esac 33976df26cacSmrg if test "$need_version" = no; then 33986df26cacSmrg versuffix= 33996df26cacSmrg else 34006df26cacSmrg versuffix=".0.0" 34016df26cacSmrg fi 34026df26cacSmrg fi 34036df26cacSmrg 34046df26cacSmrg # Remove version info from name if versioning should be avoided 34056df26cacSmrg if test "$avoid_version" = yes && test "$need_version" = no; then 34066df26cacSmrg major= 34076df26cacSmrg versuffix= 34086df26cacSmrg verstring="" 34096df26cacSmrg fi 34106df26cacSmrg 34116df26cacSmrg # Check to see if the archive will have undefined symbols. 34126df26cacSmrg if test "$allow_undefined" = yes; then 34136df26cacSmrg if test "$allow_undefined_flag" = unsupported; then 34146df26cacSmrg $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 34156df26cacSmrg build_libtool_libs=no 34166df26cacSmrg build_old_libs=yes 34176df26cacSmrg fi 34186df26cacSmrg else 34196df26cacSmrg # Don't allow undefined symbols. 34206df26cacSmrg allow_undefined_flag="$no_undefined_flag" 34216df26cacSmrg fi 34226df26cacSmrg fi 34236df26cacSmrg 34246df26cacSmrg if test "$mode" != relink; then 34256df26cacSmrg # Remove our outputs, but don't remove object files since they 34266df26cacSmrg # may have been created when compiling PIC objects. 34276df26cacSmrg removelist= 34286df26cacSmrg tempremovelist=`$echo "$output_objdir/*"` 34296df26cacSmrg for p in $tempremovelist; do 34306df26cacSmrg case $p in 34316df26cacSmrg *.$objext) 34326df26cacSmrg ;; 34336df26cacSmrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 34346df26cacSmrg if test "X$precious_files_regex" != "X"; then 34356df26cacSmrg if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 34366df26cacSmrg then 34376df26cacSmrg continue 34386df26cacSmrg fi 34396df26cacSmrg fi 34406df26cacSmrg removelist="$removelist $p" 34416df26cacSmrg ;; 34426df26cacSmrg *) ;; 34436df26cacSmrg esac 34446df26cacSmrg done 34456df26cacSmrg if test -n "$removelist"; then 34466df26cacSmrg $show "${rm}r $removelist" 34476df26cacSmrg $run ${rm}r $removelist 34486df26cacSmrg fi 34496df26cacSmrg fi 34506df26cacSmrg 34516df26cacSmrg # Now set the variables for building old libraries. 34526df26cacSmrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 34536df26cacSmrg oldlibs="$oldlibs $output_objdir/$libname.$libext" 34546df26cacSmrg 34556df26cacSmrg # Transform .lo files to .o files. 34566df26cacSmrg oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 34576df26cacSmrg fi 34586df26cacSmrg 34596df26cacSmrg # Eliminate all temporary directories. 346016fd1166Smrg #for path in $notinst_path; do 346116fd1166Smrg # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 346216fd1166Smrg # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 346316fd1166Smrg # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 346416fd1166Smrg #done 34656df26cacSmrg 34666df26cacSmrg if test -n "$xrpath"; then 34676df26cacSmrg # If the user specified any rpath flags, then add them. 34686df26cacSmrg temp_xrpath= 34696df26cacSmrg for libdir in $xrpath; do 34706df26cacSmrg temp_xrpath="$temp_xrpath -R$libdir" 34716df26cacSmrg case "$finalize_rpath " in 34726df26cacSmrg *" $libdir "*) ;; 34736df26cacSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 34746df26cacSmrg esac 34756df26cacSmrg done 34766df26cacSmrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 34776df26cacSmrg dependency_libs="$temp_xrpath $dependency_libs" 34786df26cacSmrg fi 34796df26cacSmrg fi 34806df26cacSmrg 34816df26cacSmrg # Make sure dlfiles contains only unique files that won't be dlpreopened 34826df26cacSmrg old_dlfiles="$dlfiles" 34836df26cacSmrg dlfiles= 34846df26cacSmrg for lib in $old_dlfiles; do 34856df26cacSmrg case " $dlprefiles $dlfiles " in 34866df26cacSmrg *" $lib "*) ;; 34876df26cacSmrg *) dlfiles="$dlfiles $lib" ;; 34886df26cacSmrg esac 34896df26cacSmrg done 34906df26cacSmrg 34916df26cacSmrg # Make sure dlprefiles contains only unique files 34926df26cacSmrg old_dlprefiles="$dlprefiles" 34936df26cacSmrg dlprefiles= 34946df26cacSmrg for lib in $old_dlprefiles; do 34956df26cacSmrg case "$dlprefiles " in 34966df26cacSmrg *" $lib "*) ;; 34976df26cacSmrg *) dlprefiles="$dlprefiles $lib" ;; 34986df26cacSmrg esac 34996df26cacSmrg done 35006df26cacSmrg 35016df26cacSmrg if test "$build_libtool_libs" = yes; then 35026df26cacSmrg if test -n "$rpath"; then 35036df26cacSmrg case $host in 35046df26cacSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 35056df26cacSmrg # these systems don't actually have a c library (as such)! 35066df26cacSmrg ;; 35076df26cacSmrg *-*-rhapsody* | *-*-darwin1.[012]) 35086df26cacSmrg # Rhapsody C library is in the System framework 35096df26cacSmrg deplibs="$deplibs -framework System" 35106df26cacSmrg ;; 35116df26cacSmrg *-*-netbsd*) 35126df26cacSmrg # Don't link with libc until the a.out ld.so is fixed. 35136df26cacSmrg ;; 35146df26cacSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 35156df26cacSmrg # Do not include libc due to us having libc/libc_r. 35166df26cacSmrg ;; 35176df26cacSmrg *-*-sco3.2v5* | *-*-sco5v6*) 35186df26cacSmrg # Causes problems with __ctype 35196df26cacSmrg ;; 35206df26cacSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 35216df26cacSmrg # Compiler inserts libc in the correct place for threads to work 35226df26cacSmrg ;; 35236df26cacSmrg *) 35246df26cacSmrg # Add libc to deplibs on all other systems if necessary. 35256df26cacSmrg if test "$build_libtool_need_lc" = "yes"; then 35266df26cacSmrg deplibs="$deplibs -lc" 35276df26cacSmrg fi 35286df26cacSmrg ;; 35296df26cacSmrg esac 35306df26cacSmrg fi 35316df26cacSmrg 35326df26cacSmrg # Transform deplibs into only deplibs that can be linked in shared. 35336df26cacSmrg name_save=$name 35346df26cacSmrg libname_save=$libname 35356df26cacSmrg release_save=$release 35366df26cacSmrg versuffix_save=$versuffix 35376df26cacSmrg major_save=$major 35386df26cacSmrg # I'm not sure if I'm treating the release correctly. I think 35396df26cacSmrg # release should show up in the -l (ie -lgmp5) so we don't want to 35406df26cacSmrg # add it in twice. Is that correct? 35416df26cacSmrg release="" 35426df26cacSmrg versuffix="" 35436df26cacSmrg major="" 35446df26cacSmrg newdeplibs= 35456df26cacSmrg droppeddeps=no 35466df26cacSmrg case $deplibs_check_method in 35476df26cacSmrg pass_all) 35486df26cacSmrg # Don't check for shared/static. Everything works. 35496df26cacSmrg # This might be a little naive. We might want to check 35506df26cacSmrg # whether the library exists or not. But this is on 35516df26cacSmrg # osf3 & osf4 and I'm not really sure... Just 35526df26cacSmrg # implementing what was already the behavior. 35536df26cacSmrg newdeplibs=$deplibs 35546df26cacSmrg ;; 35556df26cacSmrg test_compile) 35566df26cacSmrg # This code stresses the "libraries are programs" paradigm to its 35576df26cacSmrg # limits. Maybe even breaks it. We compile a program, linking it 35586df26cacSmrg # against the deplibs as a proxy for the library. Then we can check 35596df26cacSmrg # whether they linked in statically or dynamically with ldd. 35606df26cacSmrg $rm conftest.c 35616df26cacSmrg cat > conftest.c <<EOF 35626df26cacSmrg int main() { return 0; } 35636df26cacSmrgEOF 35646df26cacSmrg $rm conftest 356516fd1166Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 35666df26cacSmrg ldd_output=`ldd conftest` 35676df26cacSmrg for i in $deplibs; do 35686df26cacSmrg name=`expr $i : '-l\(.*\)'` 35696df26cacSmrg # If $name is empty we are operating on a -L argument. 357016fd1166Smrg if test "$name" != "" && test "$name" != "0"; then 35716df26cacSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 35726df26cacSmrg case " $predeps $postdeps " in 35736df26cacSmrg *" $i "*) 35746df26cacSmrg newdeplibs="$newdeplibs $i" 35756df26cacSmrg i="" 35766df26cacSmrg ;; 35776df26cacSmrg esac 35786df26cacSmrg fi 35796df26cacSmrg if test -n "$i" ; then 35806df26cacSmrg libname=`eval \\$echo \"$libname_spec\"` 35816df26cacSmrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 35826df26cacSmrg set dummy $deplib_matches 35836df26cacSmrg deplib_match=$2 35846df26cacSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 35856df26cacSmrg newdeplibs="$newdeplibs $i" 35866df26cacSmrg else 35876df26cacSmrg droppeddeps=yes 35886df26cacSmrg $echo 35896df26cacSmrg $echo "*** Warning: dynamic linker does not accept needed library $i." 35906df26cacSmrg $echo "*** I have the capability to make that library automatically link in when" 35916df26cacSmrg $echo "*** you link to this library. But I can only do this if you have a" 35926df26cacSmrg $echo "*** shared version of the library, which I believe you do not have" 35936df26cacSmrg $echo "*** because a test_compile did reveal that the linker did not use it for" 35946df26cacSmrg $echo "*** its dynamic dependency list that programs get resolved with at runtime." 35956df26cacSmrg fi 35966df26cacSmrg fi 35976df26cacSmrg else 35986df26cacSmrg newdeplibs="$newdeplibs $i" 35996df26cacSmrg fi 36006df26cacSmrg done 36016df26cacSmrg else 36026df26cacSmrg # Error occurred in the first compile. Let's try to salvage 36036df26cacSmrg # the situation: Compile a separate program for each library. 36046df26cacSmrg for i in $deplibs; do 36056df26cacSmrg name=`expr $i : '-l\(.*\)'` 36066df26cacSmrg # If $name is empty we are operating on a -L argument. 36076df26cacSmrg if test "$name" != "" && test "$name" != "0"; then 36086df26cacSmrg $rm conftest 360916fd1166Smrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 36106df26cacSmrg ldd_output=`ldd conftest` 36116df26cacSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36126df26cacSmrg case " $predeps $postdeps " in 36136df26cacSmrg *" $i "*) 36146df26cacSmrg newdeplibs="$newdeplibs $i" 36156df26cacSmrg i="" 36166df26cacSmrg ;; 36176df26cacSmrg esac 36186df26cacSmrg fi 36196df26cacSmrg if test -n "$i" ; then 36206df26cacSmrg libname=`eval \\$echo \"$libname_spec\"` 36216df26cacSmrg deplib_matches=`eval \\$echo \"$library_names_spec\"` 36226df26cacSmrg set dummy $deplib_matches 36236df26cacSmrg deplib_match=$2 36246df26cacSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 36256df26cacSmrg newdeplibs="$newdeplibs $i" 36266df26cacSmrg else 36276df26cacSmrg droppeddeps=yes 36286df26cacSmrg $echo 36296df26cacSmrg $echo "*** Warning: dynamic linker does not accept needed library $i." 36306df26cacSmrg $echo "*** I have the capability to make that library automatically link in when" 36316df26cacSmrg $echo "*** you link to this library. But I can only do this if you have a" 36326df26cacSmrg $echo "*** shared version of the library, which you do not appear to have" 36336df26cacSmrg $echo "*** because a test_compile did reveal that the linker did not use this one" 36346df26cacSmrg $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 36356df26cacSmrg fi 36366df26cacSmrg fi 36376df26cacSmrg else 36386df26cacSmrg droppeddeps=yes 36396df26cacSmrg $echo 36406df26cacSmrg $echo "*** Warning! Library $i is needed by this library but I was not able to" 364116fd1166Smrg $echo "*** make it link in! You will probably need to install it or some" 36426df26cacSmrg $echo "*** library that it depends on before this library will be fully" 36436df26cacSmrg $echo "*** functional. Installing it before continuing would be even better." 36446df26cacSmrg fi 36456df26cacSmrg else 36466df26cacSmrg newdeplibs="$newdeplibs $i" 36476df26cacSmrg fi 36486df26cacSmrg done 36496df26cacSmrg fi 36506df26cacSmrg ;; 36516df26cacSmrg file_magic*) 36526df26cacSmrg set dummy $deplibs_check_method 36536df26cacSmrg file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 36546df26cacSmrg for a_deplib in $deplibs; do 36556df26cacSmrg name=`expr $a_deplib : '-l\(.*\)'` 36566df26cacSmrg # If $name is empty we are operating on a -L argument. 36576df26cacSmrg if test "$name" != "" && test "$name" != "0"; then 36586df26cacSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 36596df26cacSmrg case " $predeps $postdeps " in 36606df26cacSmrg *" $a_deplib "*) 36616df26cacSmrg newdeplibs="$newdeplibs $a_deplib" 36626df26cacSmrg a_deplib="" 36636df26cacSmrg ;; 36646df26cacSmrg esac 36656df26cacSmrg fi 36666df26cacSmrg if test -n "$a_deplib" ; then 36676df26cacSmrg libname=`eval \\$echo \"$libname_spec\"` 36686df26cacSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 36696df26cacSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 36706df26cacSmrg for potent_lib in $potential_libs; do 36716df26cacSmrg # Follow soft links. 36726df26cacSmrg if ls -lLd "$potent_lib" 2>/dev/null \ 36736df26cacSmrg | grep " -> " >/dev/null; then 36746df26cacSmrg continue 36756df26cacSmrg fi 36766df26cacSmrg # The statement above tries to avoid entering an 36776df26cacSmrg # endless loop below, in case of cyclic links. 36786df26cacSmrg # We might still enter an endless loop, since a link 36796df26cacSmrg # loop can be closed while we follow links, 36806df26cacSmrg # but so what? 36816df26cacSmrg potlib="$potent_lib" 36826df26cacSmrg while test -h "$potlib" 2>/dev/null; do 36836df26cacSmrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 36846df26cacSmrg case $potliblink in 36856df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 36866df26cacSmrg *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 36876df26cacSmrg esac 36886df26cacSmrg done 36896df26cacSmrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 36906df26cacSmrg | ${SED} 10q \ 36916df26cacSmrg | $EGREP "$file_magic_regex" > /dev/null; then 36926df26cacSmrg newdeplibs="$newdeplibs $a_deplib" 36936df26cacSmrg a_deplib="" 36946df26cacSmrg break 2 36956df26cacSmrg fi 36966df26cacSmrg done 36976df26cacSmrg done 36986df26cacSmrg fi 36996df26cacSmrg if test -n "$a_deplib" ; then 37006df26cacSmrg droppeddeps=yes 37016df26cacSmrg $echo 37026df26cacSmrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 37036df26cacSmrg $echo "*** I have the capability to make that library automatically link in when" 37046df26cacSmrg $echo "*** you link to this library. But I can only do this if you have a" 37056df26cacSmrg $echo "*** shared version of the library, which you do not appear to have" 37066df26cacSmrg $echo "*** because I did check the linker path looking for a file starting" 37076df26cacSmrg if test -z "$potlib" ; then 37086df26cacSmrg $echo "*** with $libname but no candidates were found. (...for file magic test)" 37096df26cacSmrg else 37106df26cacSmrg $echo "*** with $libname and none of the candidates passed a file format test" 37116df26cacSmrg $echo "*** using a file magic. Last file checked: $potlib" 37126df26cacSmrg fi 37136df26cacSmrg fi 37146df26cacSmrg else 37156df26cacSmrg # Add a -L argument. 37166df26cacSmrg newdeplibs="$newdeplibs $a_deplib" 37176df26cacSmrg fi 37186df26cacSmrg done # Gone through all deplibs. 37196df26cacSmrg ;; 37206df26cacSmrg match_pattern*) 37216df26cacSmrg set dummy $deplibs_check_method 37226df26cacSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 37236df26cacSmrg for a_deplib in $deplibs; do 37246df26cacSmrg name=`expr $a_deplib : '-l\(.*\)'` 37256df26cacSmrg # If $name is empty we are operating on a -L argument. 37266df26cacSmrg if test -n "$name" && test "$name" != "0"; then 37276df26cacSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 37286df26cacSmrg case " $predeps $postdeps " in 37296df26cacSmrg *" $a_deplib "*) 37306df26cacSmrg newdeplibs="$newdeplibs $a_deplib" 37316df26cacSmrg a_deplib="" 37326df26cacSmrg ;; 37336df26cacSmrg esac 37346df26cacSmrg fi 37356df26cacSmrg if test -n "$a_deplib" ; then 37366df26cacSmrg libname=`eval \\$echo \"$libname_spec\"` 37376df26cacSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 37386df26cacSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 37396df26cacSmrg for potent_lib in $potential_libs; do 37406df26cacSmrg potlib="$potent_lib" # see symlink-check above in file_magic test 37416df26cacSmrg if eval $echo \"$potent_lib\" 2>/dev/null \ 37426df26cacSmrg | ${SED} 10q \ 37436df26cacSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 37446df26cacSmrg newdeplibs="$newdeplibs $a_deplib" 37456df26cacSmrg a_deplib="" 37466df26cacSmrg break 2 37476df26cacSmrg fi 37486df26cacSmrg done 37496df26cacSmrg done 37506df26cacSmrg fi 37516df26cacSmrg if test -n "$a_deplib" ; then 37526df26cacSmrg droppeddeps=yes 37536df26cacSmrg $echo 37546df26cacSmrg $echo "*** Warning: linker path does not have real file for library $a_deplib." 37556df26cacSmrg $echo "*** I have the capability to make that library automatically link in when" 37566df26cacSmrg $echo "*** you link to this library. But I can only do this if you have a" 37576df26cacSmrg $echo "*** shared version of the library, which you do not appear to have" 37586df26cacSmrg $echo "*** because I did check the linker path looking for a file starting" 37596df26cacSmrg if test -z "$potlib" ; then 37606df26cacSmrg $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 37616df26cacSmrg else 37626df26cacSmrg $echo "*** with $libname and none of the candidates passed a file format test" 37636df26cacSmrg $echo "*** using a regex pattern. Last file checked: $potlib" 37646df26cacSmrg fi 37656df26cacSmrg fi 37666df26cacSmrg else 37676df26cacSmrg # Add a -L argument. 37686df26cacSmrg newdeplibs="$newdeplibs $a_deplib" 37696df26cacSmrg fi 37706df26cacSmrg done # Gone through all deplibs. 37716df26cacSmrg ;; 37726df26cacSmrg none | unknown | *) 37736df26cacSmrg newdeplibs="" 37746df26cacSmrg tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 37756df26cacSmrg -e 's/ -[LR][^ ]*//g'` 37766df26cacSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 37776df26cacSmrg for i in $predeps $postdeps ; do 37786df26cacSmrg # can't use Xsed below, because $i might contain '/' 37796df26cacSmrg tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 37806df26cacSmrg done 37816df26cacSmrg fi 37826df26cacSmrg if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 37836df26cacSmrg | grep . >/dev/null; then 37846df26cacSmrg $echo 37856df26cacSmrg if test "X$deplibs_check_method" = "Xnone"; then 37866df26cacSmrg $echo "*** Warning: inter-library dependencies are not supported in this platform." 37876df26cacSmrg else 37886df26cacSmrg $echo "*** Warning: inter-library dependencies are not known to be supported." 37896df26cacSmrg fi 37906df26cacSmrg $echo "*** All declared inter-library dependencies are being dropped." 37916df26cacSmrg droppeddeps=yes 37926df26cacSmrg fi 37936df26cacSmrg ;; 37946df26cacSmrg esac 37956df26cacSmrg versuffix=$versuffix_save 37966df26cacSmrg major=$major_save 37976df26cacSmrg release=$release_save 37986df26cacSmrg libname=$libname_save 37996df26cacSmrg name=$name_save 38006df26cacSmrg 38016df26cacSmrg case $host in 38026df26cacSmrg *-*-rhapsody* | *-*-darwin1.[012]) 38036df26cacSmrg # On Rhapsody replace the C library is the System framework 38046df26cacSmrg newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 38056df26cacSmrg ;; 38066df26cacSmrg esac 38076df26cacSmrg 38086df26cacSmrg if test "$droppeddeps" = yes; then 38096df26cacSmrg if test "$module" = yes; then 38106df26cacSmrg $echo 38116df26cacSmrg $echo "*** Warning: libtool could not satisfy all declared inter-library" 38126df26cacSmrg $echo "*** dependencies of module $libname. Therefore, libtool will create" 38136df26cacSmrg $echo "*** a static module, that should work as long as the dlopening" 38146df26cacSmrg $echo "*** application is linked with the -dlopen flag." 38156df26cacSmrg if test -z "$global_symbol_pipe"; then 38166df26cacSmrg $echo 38176df26cacSmrg $echo "*** However, this would only work if libtool was able to extract symbol" 38186df26cacSmrg $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 38196df26cacSmrg $echo "*** not find such a program. So, this module is probably useless." 38206df26cacSmrg $echo "*** \`nm' from GNU binutils and a full rebuild may help." 38216df26cacSmrg fi 38226df26cacSmrg if test "$build_old_libs" = no; then 38236df26cacSmrg oldlibs="$output_objdir/$libname.$libext" 38246df26cacSmrg build_libtool_libs=module 38256df26cacSmrg build_old_libs=yes 38266df26cacSmrg else 38276df26cacSmrg build_libtool_libs=no 38286df26cacSmrg fi 38296df26cacSmrg else 38306df26cacSmrg $echo "*** The inter-library dependencies that have been dropped here will be" 38316df26cacSmrg $echo "*** automatically added whenever a program is linked with this library" 38326df26cacSmrg $echo "*** or is declared to -dlopen it." 38336df26cacSmrg 38346df26cacSmrg if test "$allow_undefined" = no; then 38356df26cacSmrg $echo 38366df26cacSmrg $echo "*** Since this library must not contain undefined symbols," 38376df26cacSmrg $echo "*** because either the platform does not support them or" 38386df26cacSmrg $echo "*** it was explicitly requested with -no-undefined," 38396df26cacSmrg $echo "*** libtool will only create a static version of it." 38406df26cacSmrg if test "$build_old_libs" = no; then 38416df26cacSmrg oldlibs="$output_objdir/$libname.$libext" 38426df26cacSmrg build_libtool_libs=module 38436df26cacSmrg build_old_libs=yes 38446df26cacSmrg else 38456df26cacSmrg build_libtool_libs=no 38466df26cacSmrg fi 38476df26cacSmrg fi 38486df26cacSmrg fi 38496df26cacSmrg fi 38506df26cacSmrg # Done checking deplibs! 38516df26cacSmrg deplibs=$newdeplibs 38526df26cacSmrg fi 38536df26cacSmrg 38546df26cacSmrg 38556df26cacSmrg # move library search paths that coincide with paths to not yet 38566df26cacSmrg # installed libraries to the beginning of the library search list 38576df26cacSmrg new_libs= 38586df26cacSmrg for path in $notinst_path; do 38596df26cacSmrg case " $new_libs " in 38606df26cacSmrg *" -L$path/$objdir "*) ;; 38616df26cacSmrg *) 38626df26cacSmrg case " $deplibs " in 38636df26cacSmrg *" -L$path/$objdir "*) 38646df26cacSmrg new_libs="$new_libs -L$path/$objdir" ;; 38656df26cacSmrg esac 38666df26cacSmrg ;; 38676df26cacSmrg esac 38686df26cacSmrg done 38696df26cacSmrg for deplib in $deplibs; do 38706df26cacSmrg case $deplib in 38716df26cacSmrg -L*) 38726df26cacSmrg case " $new_libs " in 38736df26cacSmrg *" $deplib "*) ;; 38746df26cacSmrg *) new_libs="$new_libs $deplib" ;; 38756df26cacSmrg esac 38766df26cacSmrg ;; 38776df26cacSmrg *) new_libs="$new_libs $deplib" ;; 38786df26cacSmrg esac 38796df26cacSmrg done 38806df26cacSmrg deplibs="$new_libs" 38816df26cacSmrg 38826df26cacSmrg 38836df26cacSmrg # All the library-specific variables (install_libdir is set above). 38846df26cacSmrg library_names= 38856df26cacSmrg old_library= 38866df26cacSmrg dlname= 38876df26cacSmrg 38886df26cacSmrg # Test again, we may have decided not to build it any more 38896df26cacSmrg if test "$build_libtool_libs" = yes; then 38906df26cacSmrg if test "$hardcode_into_libs" = yes; then 38916df26cacSmrg # Hardcode the library paths 38926df26cacSmrg hardcode_libdirs= 38936df26cacSmrg dep_rpath= 38946df26cacSmrg rpath="$finalize_rpath" 38956df26cacSmrg test "$mode" != relink && rpath="$compile_rpath$rpath" 38966df26cacSmrg for libdir in $rpath; do 38976df26cacSmrg if test -n "$hardcode_libdir_flag_spec"; then 38986df26cacSmrg if test -n "$hardcode_libdir_separator"; then 38996df26cacSmrg if test -z "$hardcode_libdirs"; then 39006df26cacSmrg hardcode_libdirs="$libdir" 39016df26cacSmrg else 39026df26cacSmrg # Just accumulate the unique libdirs. 39036df26cacSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 39046df26cacSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 39056df26cacSmrg ;; 39066df26cacSmrg *) 39076df26cacSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 39086df26cacSmrg ;; 39096df26cacSmrg esac 39106df26cacSmrg fi 39116df26cacSmrg else 39126df26cacSmrg eval flag=\"$hardcode_libdir_flag_spec\" 39136df26cacSmrg dep_rpath="$dep_rpath $flag" 39146df26cacSmrg fi 39156df26cacSmrg elif test -n "$runpath_var"; then 39166df26cacSmrg case "$perm_rpath " in 39176df26cacSmrg *" $libdir "*) ;; 39186df26cacSmrg *) perm_rpath="$perm_rpath $libdir" ;; 39196df26cacSmrg esac 39206df26cacSmrg fi 39216df26cacSmrg done 39226df26cacSmrg # Substitute the hardcoded libdirs into the rpath. 39236df26cacSmrg if test -n "$hardcode_libdir_separator" && 39246df26cacSmrg test -n "$hardcode_libdirs"; then 39256df26cacSmrg libdir="$hardcode_libdirs" 39266df26cacSmrg if test -n "$hardcode_libdir_flag_spec_ld"; then 392716fd1166Smrg case $archive_cmds in 392816fd1166Smrg *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 392916fd1166Smrg *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 393016fd1166Smrg esac 39316df26cacSmrg else 39326df26cacSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 39336df26cacSmrg fi 39346df26cacSmrg fi 39356df26cacSmrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 39366df26cacSmrg # We should set the runpath_var. 39376df26cacSmrg rpath= 39386df26cacSmrg for dir in $perm_rpath; do 39396df26cacSmrg rpath="$rpath$dir:" 39406df26cacSmrg done 39416df26cacSmrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 39426df26cacSmrg fi 39436df26cacSmrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 39446df26cacSmrg fi 39456df26cacSmrg 39466df26cacSmrg shlibpath="$finalize_shlibpath" 39476df26cacSmrg test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 39486df26cacSmrg if test -n "$shlibpath"; then 39496df26cacSmrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 39506df26cacSmrg fi 39516df26cacSmrg 39526df26cacSmrg # Get the real and link names of the library. 39536df26cacSmrg eval shared_ext=\"$shrext_cmds\" 39546df26cacSmrg eval library_names=\"$library_names_spec\" 39556df26cacSmrg set dummy $library_names 39566df26cacSmrg realname="$2" 39576df26cacSmrg shift; shift 39586df26cacSmrg 39596df26cacSmrg if test -n "$soname_spec"; then 39606df26cacSmrg eval soname=\"$soname_spec\" 39616df26cacSmrg else 39626df26cacSmrg soname="$realname" 39636df26cacSmrg fi 39646df26cacSmrg if test -z "$dlname"; then 39656df26cacSmrg dlname=$soname 39666df26cacSmrg fi 39676df26cacSmrg 39686df26cacSmrg lib="$output_objdir/$realname" 39696df26cacSmrg linknames= 39706df26cacSmrg for link 39716df26cacSmrg do 39726df26cacSmrg linknames="$linknames $link" 39736df26cacSmrg done 39746df26cacSmrg 39756df26cacSmrg # Use standard objects if they are pic 39766df26cacSmrg test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 39776df26cacSmrg 39786df26cacSmrg # Prepare the list of exported symbols 39796df26cacSmrg if test -z "$export_symbols"; then 39806df26cacSmrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 39816df26cacSmrg $show "generating symbol list for \`$libname.la'" 39826df26cacSmrg export_symbols="$output_objdir/$libname.exp" 39836df26cacSmrg $run $rm $export_symbols 39846df26cacSmrg cmds=$export_symbols_cmds 39856df26cacSmrg save_ifs="$IFS"; IFS='~' 39866df26cacSmrg for cmd in $cmds; do 39876df26cacSmrg IFS="$save_ifs" 39886df26cacSmrg eval cmd=\"$cmd\" 39896df26cacSmrg if len=`expr "X$cmd" : ".*"` && 39906df26cacSmrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 39916df26cacSmrg $show "$cmd" 39926df26cacSmrg $run eval "$cmd" || exit $? 39936df26cacSmrg skipped_export=false 39946df26cacSmrg else 39956df26cacSmrg # The command line is too long to execute in one step. 39966df26cacSmrg $show "using reloadable object file for export list..." 39976df26cacSmrg skipped_export=: 39986df26cacSmrg # Break out early, otherwise skipped_export may be 39996df26cacSmrg # set to false by a later but shorter cmd. 40006df26cacSmrg break 40016df26cacSmrg fi 40026df26cacSmrg done 40036df26cacSmrg IFS="$save_ifs" 40046df26cacSmrg if test -n "$export_symbols_regex"; then 40056df26cacSmrg $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 40066df26cacSmrg $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 40076df26cacSmrg $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 40086df26cacSmrg $run eval '$mv "${export_symbols}T" "$export_symbols"' 40096df26cacSmrg fi 40106df26cacSmrg fi 40116df26cacSmrg fi 40126df26cacSmrg 40136df26cacSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 40146df26cacSmrg $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 40156df26cacSmrg fi 40166df26cacSmrg 40176df26cacSmrg tmp_deplibs= 40186df26cacSmrg for test_deplib in $deplibs; do 40196df26cacSmrg case " $convenience " in 40206df26cacSmrg *" $test_deplib "*) ;; 40216df26cacSmrg *) 40226df26cacSmrg tmp_deplibs="$tmp_deplibs $test_deplib" 40236df26cacSmrg ;; 40246df26cacSmrg esac 40256df26cacSmrg done 40266df26cacSmrg deplibs="$tmp_deplibs" 40276df26cacSmrg 40286df26cacSmrg if test -n "$convenience"; then 40296df26cacSmrg if test -n "$whole_archive_flag_spec"; then 40306df26cacSmrg save_libobjs=$libobjs 40316df26cacSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 40326df26cacSmrg else 40336df26cacSmrg gentop="$output_objdir/${outputname}x" 40346df26cacSmrg generated="$generated $gentop" 40356df26cacSmrg 40366df26cacSmrg func_extract_archives $gentop $convenience 40376df26cacSmrg libobjs="$libobjs $func_extract_archives_result" 40386df26cacSmrg fi 40396df26cacSmrg fi 40406df26cacSmrg 40416df26cacSmrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 40426df26cacSmrg eval flag=\"$thread_safe_flag_spec\" 40436df26cacSmrg linker_flags="$linker_flags $flag" 40446df26cacSmrg fi 40456df26cacSmrg 40466df26cacSmrg # Make a backup of the uninstalled library when relinking 40476df26cacSmrg if test "$mode" = relink; then 40486df26cacSmrg $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 40496df26cacSmrg fi 40506df26cacSmrg 40516df26cacSmrg # Do each of the archive commands. 40526df26cacSmrg if test "$module" = yes && test -n "$module_cmds" ; then 40536df26cacSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 40546df26cacSmrg eval test_cmds=\"$module_expsym_cmds\" 40556df26cacSmrg cmds=$module_expsym_cmds 40566df26cacSmrg else 40576df26cacSmrg eval test_cmds=\"$module_cmds\" 40586df26cacSmrg cmds=$module_cmds 40596df26cacSmrg fi 40606df26cacSmrg else 40616df26cacSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 40626df26cacSmrg eval test_cmds=\"$archive_expsym_cmds\" 40636df26cacSmrg cmds=$archive_expsym_cmds 40646df26cacSmrg else 40656df26cacSmrg eval test_cmds=\"$archive_cmds\" 40666df26cacSmrg cmds=$archive_cmds 40676df26cacSmrg fi 40686df26cacSmrg fi 40696df26cacSmrg 40706df26cacSmrg if test "X$skipped_export" != "X:" && 40716df26cacSmrg len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 40726df26cacSmrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 40736df26cacSmrg : 40746df26cacSmrg else 40756df26cacSmrg # The command line is too long to link in one step, link piecewise. 40766df26cacSmrg $echo "creating reloadable object files..." 40776df26cacSmrg 40786df26cacSmrg # Save the value of $output and $libobjs because we want to 40796df26cacSmrg # use them later. If we have whole_archive_flag_spec, we 40806df26cacSmrg # want to use save_libobjs as it was before 40816df26cacSmrg # whole_archive_flag_spec was expanded, because we can't 40826df26cacSmrg # assume the linker understands whole_archive_flag_spec. 40836df26cacSmrg # This may have to be revisited, in case too many 40846df26cacSmrg # convenience libraries get linked in and end up exceeding 40856df26cacSmrg # the spec. 40866df26cacSmrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 40876df26cacSmrg save_libobjs=$libobjs 40886df26cacSmrg fi 40896df26cacSmrg save_output=$output 40906df26cacSmrg output_la=`$echo "X$output" | $Xsed -e "$basename"` 40916df26cacSmrg 40926df26cacSmrg # Clear the reloadable object creation command queue and 40936df26cacSmrg # initialize k to one. 40946df26cacSmrg test_cmds= 40956df26cacSmrg concat_cmds= 40966df26cacSmrg objlist= 40976df26cacSmrg delfiles= 40986df26cacSmrg last_robj= 40996df26cacSmrg k=1 41006df26cacSmrg output=$output_objdir/$output_la-${k}.$objext 41016df26cacSmrg # Loop over the list of objects to be linked. 41026df26cacSmrg for obj in $save_libobjs 41036df26cacSmrg do 41046df26cacSmrg eval test_cmds=\"$reload_cmds $objlist $last_robj\" 41056df26cacSmrg if test "X$objlist" = X || 41066df26cacSmrg { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 41076df26cacSmrg test "$len" -le "$max_cmd_len"; }; then 41086df26cacSmrg objlist="$objlist $obj" 41096df26cacSmrg else 41106df26cacSmrg # The command $test_cmds is almost too long, add a 41116df26cacSmrg # command to the queue. 41126df26cacSmrg if test "$k" -eq 1 ; then 41136df26cacSmrg # The first file doesn't have a previous command to add. 41146df26cacSmrg eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 41156df26cacSmrg else 41166df26cacSmrg # All subsequent reloadable object files will link in 41176df26cacSmrg # the last one created. 41186df26cacSmrg eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 41196df26cacSmrg fi 41206df26cacSmrg last_robj=$output_objdir/$output_la-${k}.$objext 41216df26cacSmrg k=`expr $k + 1` 41226df26cacSmrg output=$output_objdir/$output_la-${k}.$objext 41236df26cacSmrg objlist=$obj 41246df26cacSmrg len=1 41256df26cacSmrg fi 41266df26cacSmrg done 41276df26cacSmrg # Handle the remaining objects by creating one last 41286df26cacSmrg # reloadable object file. All subsequent reloadable object 41296df26cacSmrg # files will link in the last one created. 41306df26cacSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 41316df26cacSmrg eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 41326df26cacSmrg 41336df26cacSmrg if ${skipped_export-false}; then 41346df26cacSmrg $show "generating symbol list for \`$libname.la'" 41356df26cacSmrg export_symbols="$output_objdir/$libname.exp" 41366df26cacSmrg $run $rm $export_symbols 41376df26cacSmrg libobjs=$output 41386df26cacSmrg # Append the command to create the export file. 41396df26cacSmrg eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 41406df26cacSmrg fi 41416df26cacSmrg 41426df26cacSmrg # Set up a command to remove the reloadable object files 41436df26cacSmrg # after they are used. 41446df26cacSmrg i=0 41456df26cacSmrg while test "$i" -lt "$k" 41466df26cacSmrg do 41476df26cacSmrg i=`expr $i + 1` 41486df26cacSmrg delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 41496df26cacSmrg done 41506df26cacSmrg 41516df26cacSmrg $echo "creating a temporary reloadable object file: $output" 41526df26cacSmrg 41536df26cacSmrg # Loop through the commands generated above and execute them. 41546df26cacSmrg save_ifs="$IFS"; IFS='~' 41556df26cacSmrg for cmd in $concat_cmds; do 41566df26cacSmrg IFS="$save_ifs" 41576df26cacSmrg $show "$cmd" 41586df26cacSmrg $run eval "$cmd" || exit $? 41596df26cacSmrg done 41606df26cacSmrg IFS="$save_ifs" 41616df26cacSmrg 41626df26cacSmrg libobjs=$output 41636df26cacSmrg # Restore the value of output. 41646df26cacSmrg output=$save_output 41656df26cacSmrg 41666df26cacSmrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 41676df26cacSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 41686df26cacSmrg fi 41696df26cacSmrg # Expand the library linking commands again to reset the 41706df26cacSmrg # value of $libobjs for piecewise linking. 41716df26cacSmrg 41726df26cacSmrg # Do each of the archive commands. 41736df26cacSmrg if test "$module" = yes && test -n "$module_cmds" ; then 41746df26cacSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 41756df26cacSmrg cmds=$module_expsym_cmds 41766df26cacSmrg else 41776df26cacSmrg cmds=$module_cmds 41786df26cacSmrg fi 41796df26cacSmrg else 41806df26cacSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 41816df26cacSmrg cmds=$archive_expsym_cmds 41826df26cacSmrg else 41836df26cacSmrg cmds=$archive_cmds 41846df26cacSmrg fi 41856df26cacSmrg fi 41866df26cacSmrg 41876df26cacSmrg # Append the command to remove the reloadable object files 41886df26cacSmrg # to the just-reset $cmds. 41896df26cacSmrg eval cmds=\"\$cmds~\$rm $delfiles\" 41906df26cacSmrg fi 41916df26cacSmrg save_ifs="$IFS"; IFS='~' 41926df26cacSmrg for cmd in $cmds; do 41936df26cacSmrg IFS="$save_ifs" 41946df26cacSmrg eval cmd=\"$cmd\" 41956df26cacSmrg $show "$cmd" 41966df26cacSmrg $run eval "$cmd" || { 41976df26cacSmrg lt_exit=$? 41986df26cacSmrg 41996df26cacSmrg # Restore the uninstalled library and exit 42006df26cacSmrg if test "$mode" = relink; then 42016df26cacSmrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 42026df26cacSmrg fi 42036df26cacSmrg 42046df26cacSmrg exit $lt_exit 42056df26cacSmrg } 42066df26cacSmrg done 42076df26cacSmrg IFS="$save_ifs" 42086df26cacSmrg 42096df26cacSmrg # Restore the uninstalled library and exit 42106df26cacSmrg if test "$mode" = relink; then 42116df26cacSmrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 42126df26cacSmrg 42136df26cacSmrg if test -n "$convenience"; then 42146df26cacSmrg if test -z "$whole_archive_flag_spec"; then 42156df26cacSmrg $show "${rm}r $gentop" 42166df26cacSmrg $run ${rm}r "$gentop" 42176df26cacSmrg fi 42186df26cacSmrg fi 42196df26cacSmrg 42206df26cacSmrg exit $EXIT_SUCCESS 42216df26cacSmrg fi 42226df26cacSmrg 42236df26cacSmrg # Create links to the real library. 42246df26cacSmrg for linkname in $linknames; do 42256df26cacSmrg if test "$realname" != "$linkname"; then 42266df26cacSmrg $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 42276df26cacSmrg $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 42286df26cacSmrg fi 42296df26cacSmrg done 42306df26cacSmrg 42316df26cacSmrg # If -module or -export-dynamic was specified, set the dlname. 42326df26cacSmrg if test "$module" = yes || test "$export_dynamic" = yes; then 42336df26cacSmrg # On all known operating systems, these are identical. 42346df26cacSmrg dlname="$soname" 42356df26cacSmrg fi 42366df26cacSmrg fi 42376df26cacSmrg ;; 42386df26cacSmrg 42396df26cacSmrg obj) 42406df26cacSmrg if test -n "$deplibs"; then 42416df26cacSmrg $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 42426df26cacSmrg fi 42436df26cacSmrg 42446df26cacSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 42456df26cacSmrg $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 42466df26cacSmrg fi 42476df26cacSmrg 42486df26cacSmrg if test -n "$rpath"; then 42496df26cacSmrg $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 42506df26cacSmrg fi 42516df26cacSmrg 42526df26cacSmrg if test -n "$xrpath"; then 42536df26cacSmrg $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 42546df26cacSmrg fi 42556df26cacSmrg 42566df26cacSmrg if test -n "$vinfo"; then 42576df26cacSmrg $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 42586df26cacSmrg fi 42596df26cacSmrg 42606df26cacSmrg if test -n "$release"; then 42616df26cacSmrg $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 42626df26cacSmrg fi 42636df26cacSmrg 42646df26cacSmrg case $output in 42656df26cacSmrg *.lo) 42666df26cacSmrg if test -n "$objs$old_deplibs"; then 42676df26cacSmrg $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 42686df26cacSmrg exit $EXIT_FAILURE 42696df26cacSmrg fi 42706df26cacSmrg libobj="$output" 42716df26cacSmrg obj=`$echo "X$output" | $Xsed -e "$lo2o"` 42726df26cacSmrg ;; 42736df26cacSmrg *) 42746df26cacSmrg libobj= 42756df26cacSmrg obj="$output" 42766df26cacSmrg ;; 42776df26cacSmrg esac 42786df26cacSmrg 42796df26cacSmrg # Delete the old objects. 42806df26cacSmrg $run $rm $obj $libobj 42816df26cacSmrg 42826df26cacSmrg # Objects from convenience libraries. This assumes 42836df26cacSmrg # single-version convenience libraries. Whenever we create 42846df26cacSmrg # different ones for PIC/non-PIC, this we'll have to duplicate 42856df26cacSmrg # the extraction. 42866df26cacSmrg reload_conv_objs= 42876df26cacSmrg gentop= 42886df26cacSmrg # reload_cmds runs $LD directly, so let us get rid of 428916fd1166Smrg # -Wl from whole_archive_flag_spec and hope we can get by with 429016fd1166Smrg # turning comma into space.. 42916df26cacSmrg wl= 42926df26cacSmrg 42936df26cacSmrg if test -n "$convenience"; then 42946df26cacSmrg if test -n "$whole_archive_flag_spec"; then 429516fd1166Smrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 429616fd1166Smrg reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 42976df26cacSmrg else 42986df26cacSmrg gentop="$output_objdir/${obj}x" 42996df26cacSmrg generated="$generated $gentop" 43006df26cacSmrg 43016df26cacSmrg func_extract_archives $gentop $convenience 43026df26cacSmrg reload_conv_objs="$reload_objs $func_extract_archives_result" 43036df26cacSmrg fi 43046df26cacSmrg fi 43056df26cacSmrg 43066df26cacSmrg # Create the old-style object. 43076df26cacSmrg 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 43086df26cacSmrg 43096df26cacSmrg output="$obj" 43106df26cacSmrg cmds=$reload_cmds 43116df26cacSmrg save_ifs="$IFS"; IFS='~' 43126df26cacSmrg for cmd in $cmds; do 43136df26cacSmrg IFS="$save_ifs" 43146df26cacSmrg eval cmd=\"$cmd\" 43156df26cacSmrg $show "$cmd" 43166df26cacSmrg $run eval "$cmd" || exit $? 43176df26cacSmrg done 43186df26cacSmrg IFS="$save_ifs" 43196df26cacSmrg 43206df26cacSmrg # Exit if we aren't doing a library object file. 43216df26cacSmrg if test -z "$libobj"; then 43226df26cacSmrg if test -n "$gentop"; then 43236df26cacSmrg $show "${rm}r $gentop" 43246df26cacSmrg $run ${rm}r $gentop 43256df26cacSmrg fi 43266df26cacSmrg 43276df26cacSmrg exit $EXIT_SUCCESS 43286df26cacSmrg fi 43296df26cacSmrg 43306df26cacSmrg if test "$build_libtool_libs" != yes; then 43316df26cacSmrg if test -n "$gentop"; then 43326df26cacSmrg $show "${rm}r $gentop" 43336df26cacSmrg $run ${rm}r $gentop 43346df26cacSmrg fi 43356df26cacSmrg 43366df26cacSmrg # Create an invalid libtool object if no PIC, so that we don't 43376df26cacSmrg # accidentally link it into a program. 43386df26cacSmrg # $show "echo timestamp > $libobj" 43396df26cacSmrg # $run eval "echo timestamp > $libobj" || exit $? 43406df26cacSmrg exit $EXIT_SUCCESS 43416df26cacSmrg fi 43426df26cacSmrg 43436df26cacSmrg if test -n "$pic_flag" || test "$pic_mode" != default; then 43446df26cacSmrg # Only do commands if we really have different PIC objects. 43456df26cacSmrg reload_objs="$libobjs $reload_conv_objs" 43466df26cacSmrg output="$libobj" 43476df26cacSmrg cmds=$reload_cmds 43486df26cacSmrg save_ifs="$IFS"; IFS='~' 43496df26cacSmrg for cmd in $cmds; do 43506df26cacSmrg IFS="$save_ifs" 43516df26cacSmrg eval cmd=\"$cmd\" 43526df26cacSmrg $show "$cmd" 43536df26cacSmrg $run eval "$cmd" || exit $? 43546df26cacSmrg done 43556df26cacSmrg IFS="$save_ifs" 43566df26cacSmrg fi 43576df26cacSmrg 43586df26cacSmrg if test -n "$gentop"; then 43596df26cacSmrg $show "${rm}r $gentop" 43606df26cacSmrg $run ${rm}r $gentop 43616df26cacSmrg fi 43626df26cacSmrg 43636df26cacSmrg exit $EXIT_SUCCESS 43646df26cacSmrg ;; 43656df26cacSmrg 43666df26cacSmrg prog) 43676df26cacSmrg case $host in 43686df26cacSmrg *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 43696df26cacSmrg esac 43706df26cacSmrg if test -n "$vinfo"; then 43716df26cacSmrg $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 43726df26cacSmrg fi 43736df26cacSmrg 43746df26cacSmrg if test -n "$release"; then 43756df26cacSmrg $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 43766df26cacSmrg fi 43776df26cacSmrg 43786df26cacSmrg if test "$preload" = yes; then 43796df26cacSmrg if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 43806df26cacSmrg test "$dlopen_self_static" = unknown; then 43816df26cacSmrg $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 43826df26cacSmrg fi 43836df26cacSmrg fi 43846df26cacSmrg 43856df26cacSmrg case $host in 43866df26cacSmrg *-*-rhapsody* | *-*-darwin1.[012]) 43876df26cacSmrg # On Rhapsody replace the C library is the System framework 43886df26cacSmrg compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 43896df26cacSmrg finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 43906df26cacSmrg ;; 43916df26cacSmrg esac 43926df26cacSmrg 43936df26cacSmrg case $host in 43946df26cacSmrg *darwin*) 43956df26cacSmrg # Don't allow lazy linking, it breaks C++ global constructors 43966df26cacSmrg if test "$tagname" = CXX ; then 43976df26cacSmrg compile_command="$compile_command ${wl}-bind_at_load" 43986df26cacSmrg finalize_command="$finalize_command ${wl}-bind_at_load" 43996df26cacSmrg fi 44006df26cacSmrg ;; 44016df26cacSmrg esac 44026df26cacSmrg 44036df26cacSmrg 44046df26cacSmrg # move library search paths that coincide with paths to not yet 44056df26cacSmrg # installed libraries to the beginning of the library search list 44066df26cacSmrg new_libs= 44076df26cacSmrg for path in $notinst_path; do 44086df26cacSmrg case " $new_libs " in 44096df26cacSmrg *" -L$path/$objdir "*) ;; 44106df26cacSmrg *) 44116df26cacSmrg case " $compile_deplibs " in 44126df26cacSmrg *" -L$path/$objdir "*) 44136df26cacSmrg new_libs="$new_libs -L$path/$objdir" ;; 44146df26cacSmrg esac 44156df26cacSmrg ;; 44166df26cacSmrg esac 44176df26cacSmrg done 44186df26cacSmrg for deplib in $compile_deplibs; do 44196df26cacSmrg case $deplib in 44206df26cacSmrg -L*) 44216df26cacSmrg case " $new_libs " in 44226df26cacSmrg *" $deplib "*) ;; 44236df26cacSmrg *) new_libs="$new_libs $deplib" ;; 44246df26cacSmrg esac 44256df26cacSmrg ;; 44266df26cacSmrg *) new_libs="$new_libs $deplib" ;; 44276df26cacSmrg esac 44286df26cacSmrg done 44296df26cacSmrg compile_deplibs="$new_libs" 44306df26cacSmrg 44316df26cacSmrg 44326df26cacSmrg compile_command="$compile_command $compile_deplibs" 44336df26cacSmrg finalize_command="$finalize_command $finalize_deplibs" 44346df26cacSmrg 44356df26cacSmrg if test -n "$rpath$xrpath"; then 44366df26cacSmrg # If the user specified any rpath flags, then add them. 44376df26cacSmrg for libdir in $rpath $xrpath; do 44386df26cacSmrg # This is the magic to use -rpath. 44396df26cacSmrg case "$finalize_rpath " in 44406df26cacSmrg *" $libdir "*) ;; 44416df26cacSmrg *) finalize_rpath="$finalize_rpath $libdir" ;; 44426df26cacSmrg esac 44436df26cacSmrg done 44446df26cacSmrg fi 44456df26cacSmrg 44466df26cacSmrg # Now hardcode the library paths 44476df26cacSmrg rpath= 44486df26cacSmrg hardcode_libdirs= 44496df26cacSmrg for libdir in $compile_rpath $finalize_rpath; do 44506df26cacSmrg if test -n "$hardcode_libdir_flag_spec"; then 44516df26cacSmrg if test -n "$hardcode_libdir_separator"; then 44526df26cacSmrg if test -z "$hardcode_libdirs"; then 44536df26cacSmrg hardcode_libdirs="$libdir" 44546df26cacSmrg else 44556df26cacSmrg # Just accumulate the unique libdirs. 44566df26cacSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 44576df26cacSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 44586df26cacSmrg ;; 44596df26cacSmrg *) 44606df26cacSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 44616df26cacSmrg ;; 44626df26cacSmrg esac 44636df26cacSmrg fi 44646df26cacSmrg else 44656df26cacSmrg eval flag=\"$hardcode_libdir_flag_spec\" 44666df26cacSmrg rpath="$rpath $flag" 44676df26cacSmrg fi 44686df26cacSmrg elif test -n "$runpath_var"; then 44696df26cacSmrg case "$perm_rpath " in 44706df26cacSmrg *" $libdir "*) ;; 44716df26cacSmrg *) perm_rpath="$perm_rpath $libdir" ;; 44726df26cacSmrg esac 44736df26cacSmrg fi 44746df26cacSmrg case $host in 44756df26cacSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 44766df26cacSmrg testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 44776df26cacSmrg case :$dllsearchpath: in 44786df26cacSmrg *":$libdir:"*) ;; 44796df26cacSmrg *) dllsearchpath="$dllsearchpath:$libdir";; 44806df26cacSmrg esac 44816df26cacSmrg case :$dllsearchpath: in 44826df26cacSmrg *":$testbindir:"*) ;; 44836df26cacSmrg *) dllsearchpath="$dllsearchpath:$testbindir";; 44846df26cacSmrg esac 44856df26cacSmrg ;; 44866df26cacSmrg esac 44876df26cacSmrg done 44886df26cacSmrg # Substitute the hardcoded libdirs into the rpath. 44896df26cacSmrg if test -n "$hardcode_libdir_separator" && 44906df26cacSmrg test -n "$hardcode_libdirs"; then 44916df26cacSmrg libdir="$hardcode_libdirs" 44926df26cacSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 44936df26cacSmrg fi 44946df26cacSmrg compile_rpath="$rpath" 44956df26cacSmrg 44966df26cacSmrg rpath= 44976df26cacSmrg hardcode_libdirs= 44986df26cacSmrg for libdir in $finalize_rpath; do 44996df26cacSmrg if test -n "$hardcode_libdir_flag_spec"; then 45006df26cacSmrg if test -n "$hardcode_libdir_separator"; then 45016df26cacSmrg if test -z "$hardcode_libdirs"; then 45026df26cacSmrg hardcode_libdirs="$libdir" 45036df26cacSmrg else 45046df26cacSmrg # Just accumulate the unique libdirs. 45056df26cacSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 45066df26cacSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 45076df26cacSmrg ;; 45086df26cacSmrg *) 45096df26cacSmrg hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 45106df26cacSmrg ;; 45116df26cacSmrg esac 45126df26cacSmrg fi 45136df26cacSmrg else 45146df26cacSmrg eval flag=\"$hardcode_libdir_flag_spec\" 45156df26cacSmrg rpath="$rpath $flag" 45166df26cacSmrg fi 45176df26cacSmrg elif test -n "$runpath_var"; then 45186df26cacSmrg case "$finalize_perm_rpath " in 45196df26cacSmrg *" $libdir "*) ;; 45206df26cacSmrg *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 45216df26cacSmrg esac 45226df26cacSmrg fi 45236df26cacSmrg done 45246df26cacSmrg # Substitute the hardcoded libdirs into the rpath. 45256df26cacSmrg if test -n "$hardcode_libdir_separator" && 45266df26cacSmrg test -n "$hardcode_libdirs"; then 45276df26cacSmrg libdir="$hardcode_libdirs" 45286df26cacSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 45296df26cacSmrg fi 45306df26cacSmrg finalize_rpath="$rpath" 45316df26cacSmrg 45326df26cacSmrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 45336df26cacSmrg # Transform all the library objects into standard objects. 45346df26cacSmrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45356df26cacSmrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45366df26cacSmrg fi 45376df26cacSmrg 45386df26cacSmrg dlsyms= 45396df26cacSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 45406df26cacSmrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 45416df26cacSmrg dlsyms="${outputname}S.c" 45426df26cacSmrg else 45436df26cacSmrg $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 45446df26cacSmrg fi 45456df26cacSmrg fi 45466df26cacSmrg 45476df26cacSmrg if test -n "$dlsyms"; then 45486df26cacSmrg case $dlsyms in 45496df26cacSmrg "") ;; 45506df26cacSmrg *.c) 45516df26cacSmrg # Discover the nlist of each of the dlfiles. 45526df26cacSmrg nlist="$output_objdir/${outputname}.nm" 45536df26cacSmrg 45546df26cacSmrg $show "$rm $nlist ${nlist}S ${nlist}T" 45556df26cacSmrg $run $rm "$nlist" "${nlist}S" "${nlist}T" 45566df26cacSmrg 45576df26cacSmrg # Parse the name list into a source file. 45586df26cacSmrg $show "creating $output_objdir/$dlsyms" 45596df26cacSmrg 45606df26cacSmrg test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 45616df26cacSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 45626df26cacSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 45636df26cacSmrg 45646df26cacSmrg#ifdef __cplusplus 45656df26cacSmrgextern \"C\" { 45666df26cacSmrg#endif 45676df26cacSmrg 45686df26cacSmrg/* Prevent the only kind of declaration conflicts we can make. */ 45696df26cacSmrg#define lt_preloaded_symbols some_other_symbol 45706df26cacSmrg 45716df26cacSmrg/* External symbol declarations for the compiler. */\ 45726df26cacSmrg" 45736df26cacSmrg 45746df26cacSmrg if test "$dlself" = yes; then 45756df26cacSmrg $show "generating symbol list for \`$output'" 45766df26cacSmrg 45776df26cacSmrg test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 45786df26cacSmrg 45796df26cacSmrg # Add our own program objects to the symbol list. 45806df26cacSmrg progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 45816df26cacSmrg for arg in $progfiles; do 45826df26cacSmrg $show "extracting global C symbols from \`$arg'" 45836df26cacSmrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 45846df26cacSmrg done 45856df26cacSmrg 45866df26cacSmrg if test -n "$exclude_expsyms"; then 45876df26cacSmrg $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 45886df26cacSmrg $run eval '$mv "$nlist"T "$nlist"' 45896df26cacSmrg fi 45906df26cacSmrg 45916df26cacSmrg if test -n "$export_symbols_regex"; then 45926df26cacSmrg $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 45936df26cacSmrg $run eval '$mv "$nlist"T "$nlist"' 45946df26cacSmrg fi 45956df26cacSmrg 45966df26cacSmrg # Prepare the list of exported symbols 45976df26cacSmrg if test -z "$export_symbols"; then 45986df26cacSmrg export_symbols="$output_objdir/$outputname.exp" 45996df26cacSmrg $run $rm $export_symbols 46006df26cacSmrg $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 46016df26cacSmrg case $host in 46026df26cacSmrg *cygwin* | *mingw* ) 46036df26cacSmrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 46046df26cacSmrg $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 46056df26cacSmrg ;; 46066df26cacSmrg esac 46076df26cacSmrg else 46086df26cacSmrg $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 46096df26cacSmrg $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 46106df26cacSmrg $run eval 'mv "$nlist"T "$nlist"' 46116df26cacSmrg case $host in 46126df26cacSmrg *cygwin* | *mingw* ) 46136df26cacSmrg $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 46146df26cacSmrg $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 46156df26cacSmrg ;; 46166df26cacSmrg esac 46176df26cacSmrg fi 46186df26cacSmrg fi 46196df26cacSmrg 46206df26cacSmrg for arg in $dlprefiles; do 46216df26cacSmrg $show "extracting global C symbols from \`$arg'" 46226df26cacSmrg name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 46236df26cacSmrg $run eval '$echo ": $name " >> "$nlist"' 46246df26cacSmrg $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 46256df26cacSmrg done 46266df26cacSmrg 46276df26cacSmrg if test -z "$run"; then 46286df26cacSmrg # Make sure we have at least an empty file. 46296df26cacSmrg test -f "$nlist" || : > "$nlist" 46306df26cacSmrg 46316df26cacSmrg if test -n "$exclude_expsyms"; then 46326df26cacSmrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 46336df26cacSmrg $mv "$nlist"T "$nlist" 46346df26cacSmrg fi 46356df26cacSmrg 46366df26cacSmrg # Try sorting and uniquifying the output. 46376df26cacSmrg if grep -v "^: " < "$nlist" | 46386df26cacSmrg if sort -k 3 </dev/null >/dev/null 2>&1; then 46396df26cacSmrg sort -k 3 46406df26cacSmrg else 46416df26cacSmrg sort +2 46426df26cacSmrg fi | 46436df26cacSmrg uniq > "$nlist"S; then 46446df26cacSmrg : 46456df26cacSmrg else 46466df26cacSmrg grep -v "^: " < "$nlist" > "$nlist"S 46476df26cacSmrg fi 46486df26cacSmrg 46496df26cacSmrg if test -f "$nlist"S; then 46506df26cacSmrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 46516df26cacSmrg else 46526df26cacSmrg $echo '/* NONE */' >> "$output_objdir/$dlsyms" 46536df26cacSmrg fi 46546df26cacSmrg 46556df26cacSmrg $echo >> "$output_objdir/$dlsyms" "\ 46566df26cacSmrg 46576df26cacSmrg#undef lt_preloaded_symbols 46586df26cacSmrg 46596df26cacSmrg#if defined (__STDC__) && __STDC__ 46606df26cacSmrg# define lt_ptr void * 46616df26cacSmrg#else 46626df26cacSmrg# define lt_ptr char * 46636df26cacSmrg# define const 46646df26cacSmrg#endif 46656df26cacSmrg 46666df26cacSmrg/* The mapping between symbol names and symbols. */ 46676df26cacSmrg" 46686df26cacSmrg 46696df26cacSmrg case $host in 46706df26cacSmrg *cygwin* | *mingw* ) 46716df26cacSmrg $echo >> "$output_objdir/$dlsyms" "\ 46726df26cacSmrg/* DATA imports from DLLs on WIN32 can't be const, because 46736df26cacSmrg runtime relocations are performed -- see ld's documentation 46746df26cacSmrg on pseudo-relocs */ 46756df26cacSmrgstruct { 46766df26cacSmrg" 46776df26cacSmrg ;; 46786df26cacSmrg * ) 46796df26cacSmrg $echo >> "$output_objdir/$dlsyms" "\ 46806df26cacSmrgconst struct { 46816df26cacSmrg" 46826df26cacSmrg ;; 46836df26cacSmrg esac 46846df26cacSmrg 46856df26cacSmrg 46866df26cacSmrg $echo >> "$output_objdir/$dlsyms" "\ 46876df26cacSmrg const char *name; 46886df26cacSmrg lt_ptr address; 46896df26cacSmrg} 46906df26cacSmrglt_preloaded_symbols[] = 46916df26cacSmrg{\ 46926df26cacSmrg" 46936df26cacSmrg 46946df26cacSmrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 46956df26cacSmrg 46966df26cacSmrg $echo >> "$output_objdir/$dlsyms" "\ 46976df26cacSmrg {0, (lt_ptr) 0} 46986df26cacSmrg}; 46996df26cacSmrg 47006df26cacSmrg/* This works around a problem in FreeBSD linker */ 47016df26cacSmrg#ifdef FREEBSD_WORKAROUND 47026df26cacSmrgstatic const void *lt_preloaded_setup() { 47036df26cacSmrg return lt_preloaded_symbols; 47046df26cacSmrg} 47056df26cacSmrg#endif 47066df26cacSmrg 47076df26cacSmrg#ifdef __cplusplus 47086df26cacSmrg} 47096df26cacSmrg#endif\ 47106df26cacSmrg" 47116df26cacSmrg fi 47126df26cacSmrg 47136df26cacSmrg pic_flag_for_symtable= 47146df26cacSmrg case $host in 47156df26cacSmrg # compiling the symbol table file with pic_flag works around 47166df26cacSmrg # a FreeBSD bug that causes programs to crash when -lm is 47176df26cacSmrg # linked before any other PIC object. But we must not use 47186df26cacSmrg # pic_flag when linking with -static. The problem exists in 47196df26cacSmrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 47206df26cacSmrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 47216df26cacSmrg case "$compile_command " in 47226df26cacSmrg *" -static "*) ;; 47236df26cacSmrg *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 47246df26cacSmrg esac;; 47256df26cacSmrg *-*-hpux*) 47266df26cacSmrg case "$compile_command " in 47276df26cacSmrg *" -static "*) ;; 47286df26cacSmrg *) pic_flag_for_symtable=" $pic_flag";; 47296df26cacSmrg esac 47306df26cacSmrg esac 47316df26cacSmrg 47326df26cacSmrg # Now compile the dynamic symbol file. 47336df26cacSmrg $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 47346df26cacSmrg $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 47356df26cacSmrg 47366df26cacSmrg # Clean up the generated files. 47376df26cacSmrg $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 47386df26cacSmrg $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 47396df26cacSmrg 47406df26cacSmrg # Transform the symbol file into the correct name. 47416df26cacSmrg case $host in 47426df26cacSmrg *cygwin* | *mingw* ) 47436df26cacSmrg if test -f "$output_objdir/${outputname}.def" ; then 474416fd1166Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 474516fd1166Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 47466df26cacSmrg else 474716fd1166Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 474816fd1166Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47496df26cacSmrg fi 47506df26cacSmrg ;; 47516df26cacSmrg * ) 475216fd1166Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 475316fd1166Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 47546df26cacSmrg ;; 47556df26cacSmrg esac 47566df26cacSmrg ;; 47576df26cacSmrg *) 47586df26cacSmrg $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 47596df26cacSmrg exit $EXIT_FAILURE 47606df26cacSmrg ;; 47616df26cacSmrg esac 47626df26cacSmrg else 47636df26cacSmrg # We keep going just in case the user didn't refer to 47646df26cacSmrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 47656df26cacSmrg # really was required. 47666df26cacSmrg 47676df26cacSmrg # Nullify the symbol file. 476816fd1166Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 476916fd1166Smrg finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 47706df26cacSmrg fi 47716df26cacSmrg 47726df26cacSmrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 47736df26cacSmrg # Replace the output file specification. 477416fd1166Smrg compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 47756df26cacSmrg link_command="$compile_command$compile_rpath" 47766df26cacSmrg 47776df26cacSmrg # We have no uninstalled library dependencies, so finalize right now. 47786df26cacSmrg $show "$link_command" 47796df26cacSmrg $run eval "$link_command" 47806df26cacSmrg exit_status=$? 47816df26cacSmrg 47826df26cacSmrg # Delete the generated files. 47836df26cacSmrg if test -n "$dlsyms"; then 47846df26cacSmrg $show "$rm $output_objdir/${outputname}S.${objext}" 47856df26cacSmrg $run $rm "$output_objdir/${outputname}S.${objext}" 47866df26cacSmrg fi 47876df26cacSmrg 47886df26cacSmrg exit $exit_status 47896df26cacSmrg fi 47906df26cacSmrg 47916df26cacSmrg if test -n "$shlibpath_var"; then 47926df26cacSmrg # We should set the shlibpath_var 47936df26cacSmrg rpath= 47946df26cacSmrg for dir in $temp_rpath; do 47956df26cacSmrg case $dir in 47966df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) 47976df26cacSmrg # Absolute path. 47986df26cacSmrg rpath="$rpath$dir:" 47996df26cacSmrg ;; 48006df26cacSmrg *) 48016df26cacSmrg # Relative path: add a thisdir entry. 48026df26cacSmrg rpath="$rpath\$thisdir/$dir:" 48036df26cacSmrg ;; 48046df26cacSmrg esac 48056df26cacSmrg done 48066df26cacSmrg temp_rpath="$rpath" 48076df26cacSmrg fi 48086df26cacSmrg 48096df26cacSmrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 48106df26cacSmrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 48116df26cacSmrg fi 48126df26cacSmrg if test -n "$finalize_shlibpath"; then 48136df26cacSmrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 48146df26cacSmrg fi 48156df26cacSmrg 48166df26cacSmrg compile_var= 48176df26cacSmrg finalize_var= 48186df26cacSmrg if test -n "$runpath_var"; then 48196df26cacSmrg if test -n "$perm_rpath"; then 48206df26cacSmrg # We should set the runpath_var. 48216df26cacSmrg rpath= 48226df26cacSmrg for dir in $perm_rpath; do 48236df26cacSmrg rpath="$rpath$dir:" 48246df26cacSmrg done 48256df26cacSmrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 48266df26cacSmrg fi 48276df26cacSmrg if test -n "$finalize_perm_rpath"; then 48286df26cacSmrg # We should set the runpath_var. 48296df26cacSmrg rpath= 48306df26cacSmrg for dir in $finalize_perm_rpath; do 48316df26cacSmrg rpath="$rpath$dir:" 48326df26cacSmrg done 48336df26cacSmrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 48346df26cacSmrg fi 48356df26cacSmrg fi 48366df26cacSmrg 48376df26cacSmrg if test "$no_install" = yes; then 48386df26cacSmrg # We don't need to create a wrapper script. 48396df26cacSmrg link_command="$compile_var$compile_command$compile_rpath" 48406df26cacSmrg # Replace the output file specification. 48416df26cacSmrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 48426df26cacSmrg # Delete the old output file. 48436df26cacSmrg $run $rm $output 48446df26cacSmrg # Link the executable and exit 48456df26cacSmrg $show "$link_command" 48466df26cacSmrg $run eval "$link_command" || exit $? 48476df26cacSmrg exit $EXIT_SUCCESS 48486df26cacSmrg fi 48496df26cacSmrg 48506df26cacSmrg if test "$hardcode_action" = relink; then 48516df26cacSmrg # Fast installation is not supported 48526df26cacSmrg link_command="$compile_var$compile_command$compile_rpath" 48536df26cacSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 48546df26cacSmrg 48556df26cacSmrg $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 48566df26cacSmrg $echo "$modename: \`$output' will be relinked during installation" 1>&2 48576df26cacSmrg else 48586df26cacSmrg if test "$fast_install" != no; then 48596df26cacSmrg link_command="$finalize_var$compile_command$finalize_rpath" 48606df26cacSmrg if test "$fast_install" = yes; then 486116fd1166Smrg relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 48626df26cacSmrg else 48636df26cacSmrg # fast_install is set to needless 48646df26cacSmrg relink_command= 48656df26cacSmrg fi 48666df26cacSmrg else 48676df26cacSmrg link_command="$compile_var$compile_command$compile_rpath" 48686df26cacSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 48696df26cacSmrg fi 48706df26cacSmrg fi 48716df26cacSmrg 48726df26cacSmrg # Replace the output file specification. 48736df26cacSmrg link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 48746df26cacSmrg 48756df26cacSmrg # Delete the old output files. 48766df26cacSmrg $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 48776df26cacSmrg 48786df26cacSmrg $show "$link_command" 48796df26cacSmrg $run eval "$link_command" || exit $? 48806df26cacSmrg 48816df26cacSmrg # Now create the wrapper script. 48826df26cacSmrg $show "creating $output" 48836df26cacSmrg 48846df26cacSmrg # Quote the relink command for shipping. 48856df26cacSmrg if test -n "$relink_command"; then 48866df26cacSmrg # Preserve any variables that may affect compiler behavior 48876df26cacSmrg for var in $variables_saved_for_relink; do 48886df26cacSmrg if eval test -z \"\${$var+set}\"; then 48896df26cacSmrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 48906df26cacSmrg elif eval var_value=\$$var; test -z "$var_value"; then 48916df26cacSmrg relink_command="$var=; export $var; $relink_command" 48926df26cacSmrg else 48936df26cacSmrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 48946df26cacSmrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 48956df26cacSmrg fi 48966df26cacSmrg done 48976df26cacSmrg relink_command="(cd `pwd`; $relink_command)" 489816fd1166Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 48996df26cacSmrg fi 49006df26cacSmrg 49016df26cacSmrg # Quote $echo for shipping. 49026df26cacSmrg if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 49036df26cacSmrg case $progpath in 49046df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 49056df26cacSmrg *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 49066df26cacSmrg esac 49076df26cacSmrg qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 49086df26cacSmrg else 49096df26cacSmrg qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 49106df26cacSmrg fi 49116df26cacSmrg 49126df26cacSmrg # Only actually do things if our run command is non-null. 49136df26cacSmrg if test -z "$run"; then 49146df26cacSmrg # win32 will think the script is a binary if it has 49156df26cacSmrg # a .exe suffix, so we strip it off here. 49166df26cacSmrg case $output in 49176df26cacSmrg *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 49186df26cacSmrg esac 49196df26cacSmrg # test for cygwin because mv fails w/o .exe extensions 49206df26cacSmrg case $host in 49216df26cacSmrg *cygwin*) 49226df26cacSmrg exeext=.exe 49236df26cacSmrg outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 49246df26cacSmrg *) exeext= ;; 49256df26cacSmrg esac 49266df26cacSmrg case $host in 49276df26cacSmrg *cygwin* | *mingw* ) 49286df26cacSmrg output_name=`basename $output` 49296df26cacSmrg output_path=`dirname $output` 49306df26cacSmrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 49316df26cacSmrg cwrapper="$output_path/$output_name.exe" 49326df26cacSmrg $rm $cwrappersource $cwrapper 49336df26cacSmrg trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 49346df26cacSmrg 49356df26cacSmrg cat > $cwrappersource <<EOF 49366df26cacSmrg 49376df26cacSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 49386df26cacSmrg Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 49396df26cacSmrg 49406df26cacSmrg The $output program cannot be directly executed until all the libtool 49416df26cacSmrg libraries that it depends on are installed. 49426df26cacSmrg 49436df26cacSmrg This wrapper executable should never be moved out of the build directory. 49446df26cacSmrg If it is, it will not operate correctly. 49456df26cacSmrg 49466df26cacSmrg Currently, it simply execs the wrapper *script* "/bin/sh $output", 49476df26cacSmrg but could eventually absorb all of the scripts functionality and 49486df26cacSmrg exec $objdir/$outputname directly. 49496df26cacSmrg*/ 49506df26cacSmrgEOF 49516df26cacSmrg cat >> $cwrappersource<<"EOF" 49526df26cacSmrg#include <stdio.h> 49536df26cacSmrg#include <stdlib.h> 49546df26cacSmrg#include <unistd.h> 49556df26cacSmrg#include <malloc.h> 49566df26cacSmrg#include <stdarg.h> 49576df26cacSmrg#include <assert.h> 49586df26cacSmrg#include <string.h> 49596df26cacSmrg#include <ctype.h> 49606df26cacSmrg#include <sys/stat.h> 49616df26cacSmrg 49626df26cacSmrg#if defined(PATH_MAX) 49636df26cacSmrg# define LT_PATHMAX PATH_MAX 49646df26cacSmrg#elif defined(MAXPATHLEN) 49656df26cacSmrg# define LT_PATHMAX MAXPATHLEN 49666df26cacSmrg#else 49676df26cacSmrg# define LT_PATHMAX 1024 49686df26cacSmrg#endif 49696df26cacSmrg 49706df26cacSmrg#ifndef DIR_SEPARATOR 49716df26cacSmrg# define DIR_SEPARATOR '/' 49726df26cacSmrg# define PATH_SEPARATOR ':' 49736df26cacSmrg#endif 49746df26cacSmrg 49756df26cacSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 49766df26cacSmrg defined (__OS2__) 49776df26cacSmrg# define HAVE_DOS_BASED_FILE_SYSTEM 49786df26cacSmrg# ifndef DIR_SEPARATOR_2 49796df26cacSmrg# define DIR_SEPARATOR_2 '\\' 49806df26cacSmrg# endif 49816df26cacSmrg# ifndef PATH_SEPARATOR_2 49826df26cacSmrg# define PATH_SEPARATOR_2 ';' 49836df26cacSmrg# endif 49846df26cacSmrg#endif 49856df26cacSmrg 49866df26cacSmrg#ifndef DIR_SEPARATOR_2 49876df26cacSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 49886df26cacSmrg#else /* DIR_SEPARATOR_2 */ 49896df26cacSmrg# define IS_DIR_SEPARATOR(ch) \ 49906df26cacSmrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 49916df26cacSmrg#endif /* DIR_SEPARATOR_2 */ 49926df26cacSmrg 49936df26cacSmrg#ifndef PATH_SEPARATOR_2 49946df26cacSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 49956df26cacSmrg#else /* PATH_SEPARATOR_2 */ 49966df26cacSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 49976df26cacSmrg#endif /* PATH_SEPARATOR_2 */ 49986df26cacSmrg 49996df26cacSmrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 50006df26cacSmrg#define XFREE(stale) do { \ 50016df26cacSmrg if (stale) { free ((void *) stale); stale = 0; } \ 50026df26cacSmrg} while (0) 50036df26cacSmrg 50046df26cacSmrg/* -DDEBUG is fairly common in CFLAGS. */ 50056df26cacSmrg#undef DEBUG 50066df26cacSmrg#if defined DEBUGWRAPPER 50076df26cacSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 50086df26cacSmrg#else 50096df26cacSmrg# define DEBUG(format, ...) 50106df26cacSmrg#endif 50116df26cacSmrg 50126df26cacSmrgconst char *program_name = NULL; 50136df26cacSmrg 50146df26cacSmrgvoid * xmalloc (size_t num); 50156df26cacSmrgchar * xstrdup (const char *string); 50166df26cacSmrgconst char * base_name (const char *name); 50176df26cacSmrgchar * find_executable(const char *wrapper); 50186df26cacSmrgint check_executable(const char *path); 50196df26cacSmrgchar * strendzap(char *str, const char *pat); 50206df26cacSmrgvoid lt_fatal (const char *message, ...); 50216df26cacSmrg 50226df26cacSmrgint 50236df26cacSmrgmain (int argc, char *argv[]) 50246df26cacSmrg{ 50256df26cacSmrg char **newargz; 50266df26cacSmrg int i; 50276df26cacSmrg 50286df26cacSmrg program_name = (char *) xstrdup (base_name (argv[0])); 50296df26cacSmrg DEBUG("(main) argv[0] : %s\n",argv[0]); 50306df26cacSmrg DEBUG("(main) program_name : %s\n",program_name); 50316df26cacSmrg newargz = XMALLOC(char *, argc+2); 50326df26cacSmrgEOF 50336df26cacSmrg 50346df26cacSmrg cat >> $cwrappersource <<EOF 50356df26cacSmrg newargz[0] = (char *) xstrdup("$SHELL"); 50366df26cacSmrgEOF 50376df26cacSmrg 50386df26cacSmrg cat >> $cwrappersource <<"EOF" 50396df26cacSmrg newargz[1] = find_executable(argv[0]); 50406df26cacSmrg if (newargz[1] == NULL) 50416df26cacSmrg lt_fatal("Couldn't find %s", argv[0]); 50426df26cacSmrg DEBUG("(main) found exe at : %s\n",newargz[1]); 50436df26cacSmrg /* we know the script has the same name, without the .exe */ 50446df26cacSmrg /* so make sure newargz[1] doesn't end in .exe */ 50456df26cacSmrg strendzap(newargz[1],".exe"); 50466df26cacSmrg for (i = 1; i < argc; i++) 50476df26cacSmrg newargz[i+1] = xstrdup(argv[i]); 50486df26cacSmrg newargz[argc+1] = NULL; 50496df26cacSmrg 50506df26cacSmrg for (i=0; i<argc+1; i++) 50516df26cacSmrg { 50526df26cacSmrg DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 50536df26cacSmrg ; 50546df26cacSmrg } 50556df26cacSmrg 50566df26cacSmrgEOF 50576df26cacSmrg 50586df26cacSmrg case $host_os in 50596df26cacSmrg mingw*) 50606df26cacSmrg cat >> $cwrappersource <<EOF 50616df26cacSmrg execv("$SHELL",(char const **)newargz); 50626df26cacSmrgEOF 50636df26cacSmrg ;; 50646df26cacSmrg *) 50656df26cacSmrg cat >> $cwrappersource <<EOF 50666df26cacSmrg execv("$SHELL",newargz); 50676df26cacSmrgEOF 50686df26cacSmrg ;; 50696df26cacSmrg esac 50706df26cacSmrg 50716df26cacSmrg cat >> $cwrappersource <<"EOF" 50726df26cacSmrg return 127; 50736df26cacSmrg} 50746df26cacSmrg 50756df26cacSmrgvoid * 50766df26cacSmrgxmalloc (size_t num) 50776df26cacSmrg{ 50786df26cacSmrg void * p = (void *) malloc (num); 50796df26cacSmrg if (!p) 50806df26cacSmrg lt_fatal ("Memory exhausted"); 50816df26cacSmrg 50826df26cacSmrg return p; 50836df26cacSmrg} 50846df26cacSmrg 50856df26cacSmrgchar * 50866df26cacSmrgxstrdup (const char *string) 50876df26cacSmrg{ 50886df26cacSmrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 50896df26cacSmrg; 50906df26cacSmrg} 50916df26cacSmrg 50926df26cacSmrgconst char * 50936df26cacSmrgbase_name (const char *name) 50946df26cacSmrg{ 50956df26cacSmrg const char *base; 50966df26cacSmrg 50976df26cacSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 50986df26cacSmrg /* Skip over the disk name in MSDOS pathnames. */ 50996df26cacSmrg if (isalpha ((unsigned char)name[0]) && name[1] == ':') 51006df26cacSmrg name += 2; 51016df26cacSmrg#endif 51026df26cacSmrg 51036df26cacSmrg for (base = name; *name; name++) 51046df26cacSmrg if (IS_DIR_SEPARATOR (*name)) 51056df26cacSmrg base = name + 1; 51066df26cacSmrg return base; 51076df26cacSmrg} 51086df26cacSmrg 51096df26cacSmrgint 51106df26cacSmrgcheck_executable(const char * path) 51116df26cacSmrg{ 51126df26cacSmrg struct stat st; 51136df26cacSmrg 51146df26cacSmrg DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 51156df26cacSmrg if ((!path) || (!*path)) 51166df26cacSmrg return 0; 51176df26cacSmrg 51186df26cacSmrg if ((stat (path, &st) >= 0) && 51196df26cacSmrg ( 51206df26cacSmrg /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 51216df26cacSmrg#if defined (S_IXOTH) 51226df26cacSmrg ((st.st_mode & S_IXOTH) == S_IXOTH) || 51236df26cacSmrg#endif 51246df26cacSmrg#if defined (S_IXGRP) 51256df26cacSmrg ((st.st_mode & S_IXGRP) == S_IXGRP) || 51266df26cacSmrg#endif 51276df26cacSmrg ((st.st_mode & S_IXUSR) == S_IXUSR)) 51286df26cacSmrg ) 51296df26cacSmrg return 1; 51306df26cacSmrg else 51316df26cacSmrg return 0; 51326df26cacSmrg} 51336df26cacSmrg 51346df26cacSmrg/* Searches for the full path of the wrapper. Returns 51356df26cacSmrg newly allocated full path name if found, NULL otherwise */ 51366df26cacSmrgchar * 51376df26cacSmrgfind_executable (const char* wrapper) 51386df26cacSmrg{ 51396df26cacSmrg int has_slash = 0; 51406df26cacSmrg const char* p; 51416df26cacSmrg const char* p_next; 51426df26cacSmrg /* static buffer for getcwd */ 51436df26cacSmrg char tmp[LT_PATHMAX + 1]; 51446df26cacSmrg int tmp_len; 51456df26cacSmrg char* concat_name; 51466df26cacSmrg 51476df26cacSmrg DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 51486df26cacSmrg 51496df26cacSmrg if ((wrapper == NULL) || (*wrapper == '\0')) 51506df26cacSmrg return NULL; 51516df26cacSmrg 51526df26cacSmrg /* Absolute path? */ 51536df26cacSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51546df26cacSmrg if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 51556df26cacSmrg { 51566df26cacSmrg concat_name = xstrdup (wrapper); 51576df26cacSmrg if (check_executable(concat_name)) 51586df26cacSmrg return concat_name; 51596df26cacSmrg XFREE(concat_name); 51606df26cacSmrg } 51616df26cacSmrg else 51626df26cacSmrg { 51636df26cacSmrg#endif 51646df26cacSmrg if (IS_DIR_SEPARATOR (wrapper[0])) 51656df26cacSmrg { 51666df26cacSmrg concat_name = xstrdup (wrapper); 51676df26cacSmrg if (check_executable(concat_name)) 51686df26cacSmrg return concat_name; 51696df26cacSmrg XFREE(concat_name); 51706df26cacSmrg } 51716df26cacSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 51726df26cacSmrg } 51736df26cacSmrg#endif 51746df26cacSmrg 51756df26cacSmrg for (p = wrapper; *p; p++) 51766df26cacSmrg if (*p == '/') 51776df26cacSmrg { 51786df26cacSmrg has_slash = 1; 51796df26cacSmrg break; 51806df26cacSmrg } 51816df26cacSmrg if (!has_slash) 51826df26cacSmrg { 51836df26cacSmrg /* no slashes; search PATH */ 51846df26cacSmrg const char* path = getenv ("PATH"); 51856df26cacSmrg if (path != NULL) 51866df26cacSmrg { 51876df26cacSmrg for (p = path; *p; p = p_next) 51886df26cacSmrg { 51896df26cacSmrg const char* q; 51906df26cacSmrg size_t p_len; 51916df26cacSmrg for (q = p; *q; q++) 51926df26cacSmrg if (IS_PATH_SEPARATOR(*q)) 51936df26cacSmrg break; 51946df26cacSmrg p_len = q - p; 51956df26cacSmrg p_next = (*q == '\0' ? q : q + 1); 51966df26cacSmrg if (p_len == 0) 51976df26cacSmrg { 51986df26cacSmrg /* empty path: current directory */ 51996df26cacSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 52006df26cacSmrg lt_fatal ("getcwd failed"); 52016df26cacSmrg tmp_len = strlen(tmp); 52026df26cacSmrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 52036df26cacSmrg memcpy (concat_name, tmp, tmp_len); 52046df26cacSmrg concat_name[tmp_len] = '/'; 52056df26cacSmrg strcpy (concat_name + tmp_len + 1, wrapper); 52066df26cacSmrg } 52076df26cacSmrg else 52086df26cacSmrg { 52096df26cacSmrg concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 52106df26cacSmrg memcpy (concat_name, p, p_len); 52116df26cacSmrg concat_name[p_len] = '/'; 52126df26cacSmrg strcpy (concat_name + p_len + 1, wrapper); 52136df26cacSmrg } 52146df26cacSmrg if (check_executable(concat_name)) 52156df26cacSmrg return concat_name; 52166df26cacSmrg XFREE(concat_name); 52176df26cacSmrg } 52186df26cacSmrg } 52196df26cacSmrg /* not found in PATH; assume curdir */ 52206df26cacSmrg } 52216df26cacSmrg /* Relative path | not found in path: prepend cwd */ 52226df26cacSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 52236df26cacSmrg lt_fatal ("getcwd failed"); 52246df26cacSmrg tmp_len = strlen(tmp); 52256df26cacSmrg concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 52266df26cacSmrg memcpy (concat_name, tmp, tmp_len); 52276df26cacSmrg concat_name[tmp_len] = '/'; 52286df26cacSmrg strcpy (concat_name + tmp_len + 1, wrapper); 52296df26cacSmrg 52306df26cacSmrg if (check_executable(concat_name)) 52316df26cacSmrg return concat_name; 52326df26cacSmrg XFREE(concat_name); 52336df26cacSmrg return NULL; 52346df26cacSmrg} 52356df26cacSmrg 52366df26cacSmrgchar * 52376df26cacSmrgstrendzap(char *str, const char *pat) 52386df26cacSmrg{ 52396df26cacSmrg size_t len, patlen; 52406df26cacSmrg 52416df26cacSmrg assert(str != NULL); 52426df26cacSmrg assert(pat != NULL); 52436df26cacSmrg 52446df26cacSmrg len = strlen(str); 52456df26cacSmrg patlen = strlen(pat); 52466df26cacSmrg 52476df26cacSmrg if (patlen <= len) 52486df26cacSmrg { 52496df26cacSmrg str += len - patlen; 52506df26cacSmrg if (strcmp(str, pat) == 0) 52516df26cacSmrg *str = '\0'; 52526df26cacSmrg } 52536df26cacSmrg return str; 52546df26cacSmrg} 52556df26cacSmrg 52566df26cacSmrgstatic void 52576df26cacSmrglt_error_core (int exit_status, const char * mode, 52586df26cacSmrg const char * message, va_list ap) 52596df26cacSmrg{ 52606df26cacSmrg fprintf (stderr, "%s: %s: ", program_name, mode); 52616df26cacSmrg vfprintf (stderr, message, ap); 52626df26cacSmrg fprintf (stderr, ".\n"); 52636df26cacSmrg 52646df26cacSmrg if (exit_status >= 0) 52656df26cacSmrg exit (exit_status); 52666df26cacSmrg} 52676df26cacSmrg 52686df26cacSmrgvoid 52696df26cacSmrglt_fatal (const char *message, ...) 52706df26cacSmrg{ 52716df26cacSmrg va_list ap; 52726df26cacSmrg va_start (ap, message); 52736df26cacSmrg lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 52746df26cacSmrg va_end (ap); 52756df26cacSmrg} 52766df26cacSmrgEOF 52776df26cacSmrg # we should really use a build-platform specific compiler 52786df26cacSmrg # here, but OTOH, the wrappers (shell script and this C one) 52796df26cacSmrg # are only useful if you want to execute the "real" binary. 52806df26cacSmrg # Since the "real" binary is built for $host, then this 52816df26cacSmrg # wrapper might as well be built for $host, too. 52826df26cacSmrg $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 52836df26cacSmrg ;; 52846df26cacSmrg esac 52856df26cacSmrg $rm $output 52866df26cacSmrg trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 52876df26cacSmrg 52886df26cacSmrg $echo > $output "\ 52896df26cacSmrg#! $SHELL 52906df26cacSmrg 52916df26cacSmrg# $output - temporary wrapper script for $objdir/$outputname 52926df26cacSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 52936df26cacSmrg# 52946df26cacSmrg# The $output program cannot be directly executed until all the libtool 52956df26cacSmrg# libraries that it depends on are installed. 52966df26cacSmrg# 52976df26cacSmrg# This wrapper script should never be moved out of the build directory. 52986df26cacSmrg# If it is, it will not operate correctly. 52996df26cacSmrg 53006df26cacSmrg# Sed substitution that helps us do robust quoting. It backslashifies 53016df26cacSmrg# metacharacters that are still active within double-quoted strings. 53026df26cacSmrgXsed='${SED} -e 1s/^X//' 53036df26cacSmrgsed_quote_subst='$sed_quote_subst' 53046df26cacSmrg 530516fd1166Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 530616fd1166Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 530716fd1166Smrg emulate sh 530816fd1166Smrg NULLCMD=: 530916fd1166Smrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 531016fd1166Smrg # is contrary to our usage. Disable this feature. 531116fd1166Smrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 531216fd1166Smrg setopt NO_GLOB_SUBST 531316fd1166Smrgelse 531416fd1166Smrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 531516fd1166Smrgfi 531616fd1166SmrgBIN_SH=xpg4; export BIN_SH # for Tru64 531716fd1166SmrgDUALCASE=1; export DUALCASE # for MKS sh 531816fd1166Smrg 53196df26cacSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout 53206df26cacSmrg# if CDPATH is set. 53216df26cacSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 53226df26cacSmrg 53236df26cacSmrgrelink_command=\"$relink_command\" 53246df26cacSmrg 53256df26cacSmrg# This environment variable determines our operation mode. 53266df26cacSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then 53276df26cacSmrg # install mode needs the following variable: 53286df26cacSmrg notinst_deplibs='$notinst_deplibs' 53296df26cacSmrgelse 53306df26cacSmrg # When we are sourced in execute mode, \$file and \$echo are already set. 53316df26cacSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 53326df26cacSmrg echo=\"$qecho\" 53336df26cacSmrg file=\"\$0\" 53346df26cacSmrg # Make sure echo works. 53356df26cacSmrg if test \"X\$1\" = X--no-reexec; then 53366df26cacSmrg # Discard the --no-reexec flag, and continue. 53376df26cacSmrg shift 53386df26cacSmrg elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 53396df26cacSmrg # Yippee, \$echo works! 53406df26cacSmrg : 53416df26cacSmrg else 53426df26cacSmrg # Restart under the correct shell, and then maybe \$echo will work. 53436df26cacSmrg exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 53446df26cacSmrg fi 53456df26cacSmrg fi\ 53466df26cacSmrg" 53476df26cacSmrg $echo >> $output "\ 53486df26cacSmrg 53496df26cacSmrg # Find the directory that this script lives in. 53506df26cacSmrg thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 53516df26cacSmrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 53526df26cacSmrg 53536df26cacSmrg # Follow symbolic links until we get to the real thisdir. 53546df26cacSmrg file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 53556df26cacSmrg while test -n \"\$file\"; do 53566df26cacSmrg destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 53576df26cacSmrg 53586df26cacSmrg # If there was a directory component, then change thisdir. 53596df26cacSmrg if test \"x\$destdir\" != \"x\$file\"; then 53606df26cacSmrg case \"\$destdir\" in 53616df26cacSmrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 53626df26cacSmrg *) thisdir=\"\$thisdir/\$destdir\" ;; 53636df26cacSmrg esac 53646df26cacSmrg fi 53656df26cacSmrg 53666df26cacSmrg file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 53676df26cacSmrg file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 53686df26cacSmrg done 53696df26cacSmrg 53706df26cacSmrg # Try to get the absolute directory name. 53716df26cacSmrg absdir=\`cd \"\$thisdir\" && pwd\` 53726df26cacSmrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 53736df26cacSmrg" 53746df26cacSmrg 53756df26cacSmrg if test "$fast_install" = yes; then 53766df26cacSmrg $echo >> $output "\ 53776df26cacSmrg program=lt-'$outputname'$exeext 53786df26cacSmrg progdir=\"\$thisdir/$objdir\" 53796df26cacSmrg 53806df26cacSmrg if test ! -f \"\$progdir/\$program\" || \\ 53816df26cacSmrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 53826df26cacSmrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 53836df26cacSmrg 53846df26cacSmrg file=\"\$\$-\$program\" 53856df26cacSmrg 53866df26cacSmrg if test ! -d \"\$progdir\"; then 53876df26cacSmrg $mkdir \"\$progdir\" 53886df26cacSmrg else 53896df26cacSmrg $rm \"\$progdir/\$file\" 53906df26cacSmrg fi" 53916df26cacSmrg 53926df26cacSmrg $echo >> $output "\ 53936df26cacSmrg 53946df26cacSmrg # relink executable if necessary 53956df26cacSmrg if test -n \"\$relink_command\"; then 53966df26cacSmrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 53976df26cacSmrg else 53986df26cacSmrg $echo \"\$relink_command_output\" >&2 53996df26cacSmrg $rm \"\$progdir/\$file\" 54006df26cacSmrg exit $EXIT_FAILURE 54016df26cacSmrg fi 54026df26cacSmrg fi 54036df26cacSmrg 54046df26cacSmrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 54056df26cacSmrg { $rm \"\$progdir/\$program\"; 54066df26cacSmrg $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 54076df26cacSmrg $rm \"\$progdir/\$file\" 54086df26cacSmrg fi" 54096df26cacSmrg else 54106df26cacSmrg $echo >> $output "\ 54116df26cacSmrg program='$outputname' 54126df26cacSmrg progdir=\"\$thisdir/$objdir\" 54136df26cacSmrg" 54146df26cacSmrg fi 54156df26cacSmrg 54166df26cacSmrg $echo >> $output "\ 54176df26cacSmrg 54186df26cacSmrg if test -f \"\$progdir/\$program\"; then" 54196df26cacSmrg 54206df26cacSmrg # Export our shlibpath_var if we have one. 54216df26cacSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 54226df26cacSmrg $echo >> $output "\ 54236df26cacSmrg # Add our own library path to $shlibpath_var 54246df26cacSmrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 54256df26cacSmrg 54266df26cacSmrg # Some systems cannot cope with colon-terminated $shlibpath_var 54276df26cacSmrg # The second colon is a workaround for a bug in BeOS R4 sed 54286df26cacSmrg $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 54296df26cacSmrg 54306df26cacSmrg export $shlibpath_var 54316df26cacSmrg" 54326df26cacSmrg fi 54336df26cacSmrg 54346df26cacSmrg # fixup the dll searchpath if we need to. 54356df26cacSmrg if test -n "$dllsearchpath"; then 54366df26cacSmrg $echo >> $output "\ 54376df26cacSmrg # Add the dll search path components to the executable PATH 54386df26cacSmrg PATH=$dllsearchpath:\$PATH 54396df26cacSmrg" 54406df26cacSmrg fi 54416df26cacSmrg 54426df26cacSmrg $echo >> $output "\ 54436df26cacSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 54446df26cacSmrg # Run the actual program with our arguments. 54456df26cacSmrg" 54466df26cacSmrg case $host in 54476df26cacSmrg # Backslashes separate directories on plain windows 54486df26cacSmrg *-*-mingw | *-*-os2*) 54496df26cacSmrg $echo >> $output "\ 54506df26cacSmrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 54516df26cacSmrg" 54526df26cacSmrg ;; 54536df26cacSmrg 54546df26cacSmrg *) 54556df26cacSmrg $echo >> $output "\ 54566df26cacSmrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 54576df26cacSmrg" 54586df26cacSmrg ;; 54596df26cacSmrg esac 54606df26cacSmrg $echo >> $output "\ 546116fd1166Smrg \$echo \"\$0: cannot exec \$program \$*\" 54626df26cacSmrg exit $EXIT_FAILURE 54636df26cacSmrg fi 54646df26cacSmrg else 54656df26cacSmrg # The program doesn't exist. 54666df26cacSmrg \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 54676df26cacSmrg \$echo \"This script is just a wrapper for \$program.\" 1>&2 54686df26cacSmrg $echo \"See the $PACKAGE documentation for more information.\" 1>&2 54696df26cacSmrg exit $EXIT_FAILURE 54706df26cacSmrg fi 54716df26cacSmrgfi\ 54726df26cacSmrg" 54736df26cacSmrg chmod +x $output 54746df26cacSmrg fi 54756df26cacSmrg exit $EXIT_SUCCESS 54766df26cacSmrg ;; 54776df26cacSmrg esac 54786df26cacSmrg 54796df26cacSmrg # See if we need to build an old-fashioned archive. 54806df26cacSmrg for oldlib in $oldlibs; do 54816df26cacSmrg 54826df26cacSmrg if test "$build_libtool_libs" = convenience; then 54836df26cacSmrg oldobjs="$libobjs_save" 54846df26cacSmrg addlibs="$convenience" 54856df26cacSmrg build_libtool_libs=no 54866df26cacSmrg else 54876df26cacSmrg if test "$build_libtool_libs" = module; then 54886df26cacSmrg oldobjs="$libobjs_save" 54896df26cacSmrg build_libtool_libs=no 54906df26cacSmrg else 54916df26cacSmrg oldobjs="$old_deplibs $non_pic_objects" 54926df26cacSmrg fi 54936df26cacSmrg addlibs="$old_convenience" 54946df26cacSmrg fi 54956df26cacSmrg 54966df26cacSmrg if test -n "$addlibs"; then 54976df26cacSmrg gentop="$output_objdir/${outputname}x" 54986df26cacSmrg generated="$generated $gentop" 54996df26cacSmrg 55006df26cacSmrg func_extract_archives $gentop $addlibs 55016df26cacSmrg oldobjs="$oldobjs $func_extract_archives_result" 55026df26cacSmrg fi 55036df26cacSmrg 55046df26cacSmrg # Do each command in the archive commands. 55056df26cacSmrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 55066df26cacSmrg cmds=$old_archive_from_new_cmds 55076df26cacSmrg else 55086df26cacSmrg # POSIX demands no paths to be encoded in archives. We have 55096df26cacSmrg # to avoid creating archives with duplicate basenames if we 55106df26cacSmrg # might have to extract them afterwards, e.g., when creating a 55116df26cacSmrg # static archive out of a convenience library, or when linking 55126df26cacSmrg # the entirety of a libtool archive into another (currently 55136df26cacSmrg # not supported by libtool). 55146df26cacSmrg if (for obj in $oldobjs 55156df26cacSmrg do 55166df26cacSmrg $echo "X$obj" | $Xsed -e 's%^.*/%%' 55176df26cacSmrg done | sort | sort -uc >/dev/null 2>&1); then 55186df26cacSmrg : 55196df26cacSmrg else 55206df26cacSmrg $echo "copying selected object files to avoid basename conflicts..." 55216df26cacSmrg 55226df26cacSmrg if test -z "$gentop"; then 55236df26cacSmrg gentop="$output_objdir/${outputname}x" 55246df26cacSmrg generated="$generated $gentop" 55256df26cacSmrg 55266df26cacSmrg $show "${rm}r $gentop" 55276df26cacSmrg $run ${rm}r "$gentop" 55286df26cacSmrg $show "$mkdir $gentop" 55296df26cacSmrg $run $mkdir "$gentop" 55306df26cacSmrg exit_status=$? 55316df26cacSmrg if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 55326df26cacSmrg exit $exit_status 55336df26cacSmrg fi 55346df26cacSmrg fi 55356df26cacSmrg 55366df26cacSmrg save_oldobjs=$oldobjs 55376df26cacSmrg oldobjs= 55386df26cacSmrg counter=1 55396df26cacSmrg for obj in $save_oldobjs 55406df26cacSmrg do 55416df26cacSmrg objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 55426df26cacSmrg case " $oldobjs " in 55436df26cacSmrg " ") oldobjs=$obj ;; 55446df26cacSmrg *[\ /]"$objbase "*) 55456df26cacSmrg while :; do 55466df26cacSmrg # Make sure we don't pick an alternate name that also 55476df26cacSmrg # overlaps. 55486df26cacSmrg newobj=lt$counter-$objbase 55496df26cacSmrg counter=`expr $counter + 1` 55506df26cacSmrg case " $oldobjs " in 55516df26cacSmrg *[\ /]"$newobj "*) ;; 55526df26cacSmrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 55536df26cacSmrg esac 55546df26cacSmrg done 55556df26cacSmrg $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 55566df26cacSmrg $run ln "$obj" "$gentop/$newobj" || 55576df26cacSmrg $run cp "$obj" "$gentop/$newobj" 55586df26cacSmrg oldobjs="$oldobjs $gentop/$newobj" 55596df26cacSmrg ;; 55606df26cacSmrg *) oldobjs="$oldobjs $obj" ;; 55616df26cacSmrg esac 55626df26cacSmrg done 55636df26cacSmrg fi 55646df26cacSmrg 55656df26cacSmrg eval cmds=\"$old_archive_cmds\" 55666df26cacSmrg 55676df26cacSmrg if len=`expr "X$cmds" : ".*"` && 55686df26cacSmrg test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 55696df26cacSmrg cmds=$old_archive_cmds 55706df26cacSmrg else 55716df26cacSmrg # the command line is too long to link in one step, link in parts 55726df26cacSmrg $echo "using piecewise archive linking..." 55736df26cacSmrg save_RANLIB=$RANLIB 55746df26cacSmrg RANLIB=: 55756df26cacSmrg objlist= 55766df26cacSmrg concat_cmds= 55776df26cacSmrg save_oldobjs=$oldobjs 55786df26cacSmrg 55796df26cacSmrg # Is there a better way of finding the last object in the list? 55806df26cacSmrg for obj in $save_oldobjs 55816df26cacSmrg do 55826df26cacSmrg last_oldobj=$obj 55836df26cacSmrg done 55846df26cacSmrg for obj in $save_oldobjs 55856df26cacSmrg do 55866df26cacSmrg oldobjs="$objlist $obj" 55876df26cacSmrg objlist="$objlist $obj" 55886df26cacSmrg eval test_cmds=\"$old_archive_cmds\" 55896df26cacSmrg if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 55906df26cacSmrg test "$len" -le "$max_cmd_len"; then 55916df26cacSmrg : 55926df26cacSmrg else 55936df26cacSmrg # the above command should be used before it gets too long 55946df26cacSmrg oldobjs=$objlist 55956df26cacSmrg if test "$obj" = "$last_oldobj" ; then 55966df26cacSmrg RANLIB=$save_RANLIB 55976df26cacSmrg fi 55986df26cacSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 55996df26cacSmrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 56006df26cacSmrg objlist= 56016df26cacSmrg fi 56026df26cacSmrg done 56036df26cacSmrg RANLIB=$save_RANLIB 56046df26cacSmrg oldobjs=$objlist 56056df26cacSmrg if test "X$oldobjs" = "X" ; then 56066df26cacSmrg eval cmds=\"\$concat_cmds\" 56076df26cacSmrg else 56086df26cacSmrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 56096df26cacSmrg fi 56106df26cacSmrg fi 56116df26cacSmrg fi 56126df26cacSmrg save_ifs="$IFS"; IFS='~' 56136df26cacSmrg for cmd in $cmds; do 56146df26cacSmrg eval cmd=\"$cmd\" 56156df26cacSmrg IFS="$save_ifs" 56166df26cacSmrg $show "$cmd" 56176df26cacSmrg $run eval "$cmd" || exit $? 56186df26cacSmrg done 56196df26cacSmrg IFS="$save_ifs" 56206df26cacSmrg done 56216df26cacSmrg 56226df26cacSmrg if test -n "$generated"; then 56236df26cacSmrg $show "${rm}r$generated" 56246df26cacSmrg $run ${rm}r$generated 56256df26cacSmrg fi 56266df26cacSmrg 56276df26cacSmrg # Now create the libtool archive. 56286df26cacSmrg case $output in 56296df26cacSmrg *.la) 56306df26cacSmrg old_library= 56316df26cacSmrg test "$build_old_libs" = yes && old_library="$libname.$libext" 56326df26cacSmrg $show "creating $output" 56336df26cacSmrg 56346df26cacSmrg # Preserve any variables that may affect compiler behavior 56356df26cacSmrg for var in $variables_saved_for_relink; do 56366df26cacSmrg if eval test -z \"\${$var+set}\"; then 56376df26cacSmrg relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 56386df26cacSmrg elif eval var_value=\$$var; test -z "$var_value"; then 56396df26cacSmrg relink_command="$var=; export $var; $relink_command" 56406df26cacSmrg else 56416df26cacSmrg var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 56426df26cacSmrg relink_command="$var=\"$var_value\"; export $var; $relink_command" 56436df26cacSmrg fi 56446df26cacSmrg done 56456df26cacSmrg # Quote the link command for shipping. 56466df26cacSmrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 564716fd1166Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 56486df26cacSmrg if test "$hardcode_automatic" = yes ; then 56496df26cacSmrg relink_command= 56506df26cacSmrg fi 56516df26cacSmrg 56526df26cacSmrg 56536df26cacSmrg # Only create the output if not a dry run. 56546df26cacSmrg if test -z "$run"; then 56556df26cacSmrg for installed in no yes; do 56566df26cacSmrg if test "$installed" = yes; then 56576df26cacSmrg if test -z "$install_libdir"; then 56586df26cacSmrg break 56596df26cacSmrg fi 56606df26cacSmrg output="$output_objdir/$outputname"i 56616df26cacSmrg # Replace all uninstalled libtool libraries with the installed ones 56626df26cacSmrg newdependency_libs= 56636df26cacSmrg for deplib in $dependency_libs; do 56646df26cacSmrg case $deplib in 56656df26cacSmrg *.la) 56666df26cacSmrg name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 56676df26cacSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 56686df26cacSmrg if test -z "$libdir"; then 56696df26cacSmrg $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 56706df26cacSmrg exit $EXIT_FAILURE 56716df26cacSmrg fi 56726df26cacSmrg newdependency_libs="$newdependency_libs $libdir/$name" 56736df26cacSmrg ;; 56746df26cacSmrg *) newdependency_libs="$newdependency_libs $deplib" ;; 56756df26cacSmrg esac 56766df26cacSmrg done 56776df26cacSmrg dependency_libs="$newdependency_libs" 56786df26cacSmrg newdlfiles= 56796df26cacSmrg for lib in $dlfiles; do 56806df26cacSmrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 56816df26cacSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 56826df26cacSmrg if test -z "$libdir"; then 56836df26cacSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 56846df26cacSmrg exit $EXIT_FAILURE 56856df26cacSmrg fi 56866df26cacSmrg newdlfiles="$newdlfiles $libdir/$name" 56876df26cacSmrg done 56886df26cacSmrg dlfiles="$newdlfiles" 56896df26cacSmrg newdlprefiles= 56906df26cacSmrg for lib in $dlprefiles; do 56916df26cacSmrg name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 56926df26cacSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 56936df26cacSmrg if test -z "$libdir"; then 56946df26cacSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 56956df26cacSmrg exit $EXIT_FAILURE 56966df26cacSmrg fi 56976df26cacSmrg newdlprefiles="$newdlprefiles $libdir/$name" 56986df26cacSmrg done 56996df26cacSmrg dlprefiles="$newdlprefiles" 57006df26cacSmrg else 57016df26cacSmrg newdlfiles= 57026df26cacSmrg for lib in $dlfiles; do 57036df26cacSmrg case $lib in 57046df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 57056df26cacSmrg *) abs=`pwd`"/$lib" ;; 57066df26cacSmrg esac 57076df26cacSmrg newdlfiles="$newdlfiles $abs" 57086df26cacSmrg done 57096df26cacSmrg dlfiles="$newdlfiles" 57106df26cacSmrg newdlprefiles= 57116df26cacSmrg for lib in $dlprefiles; do 57126df26cacSmrg case $lib in 57136df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 57146df26cacSmrg *) abs=`pwd`"/$lib" ;; 57156df26cacSmrg esac 57166df26cacSmrg newdlprefiles="$newdlprefiles $abs" 57176df26cacSmrg done 57186df26cacSmrg dlprefiles="$newdlprefiles" 57196df26cacSmrg fi 57206df26cacSmrg $rm $output 57216df26cacSmrg # place dlname in correct position for cygwin 57226df26cacSmrg tdlname=$dlname 57236df26cacSmrg case $host,$output,$installed,$module,$dlname in 57246df26cacSmrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 57256df26cacSmrg esac 57266df26cacSmrg $echo > $output "\ 57276df26cacSmrg# $outputname - a libtool library file 57286df26cacSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 57296df26cacSmrg# 57306df26cacSmrg# Please DO NOT delete this file! 57316df26cacSmrg# It is necessary for linking the library. 57326df26cacSmrg 57336df26cacSmrg# The name that we can dlopen(3). 57346df26cacSmrgdlname='$tdlname' 57356df26cacSmrg 57366df26cacSmrg# Names of this library. 57376df26cacSmrglibrary_names='$library_names' 57386df26cacSmrg 57396df26cacSmrg# The name of the static archive. 57406df26cacSmrgold_library='$old_library' 57416df26cacSmrg 57426df26cacSmrg# Libraries that this one depends upon. 57436df26cacSmrgdependency_libs='$dependency_libs' 57446df26cacSmrg 57456df26cacSmrg# Version information for $libname. 57466df26cacSmrgcurrent=$current 57476df26cacSmrgage=$age 57486df26cacSmrgrevision=$revision 57496df26cacSmrg 57506df26cacSmrg# Is this an already installed library? 57516df26cacSmrginstalled=$installed 57526df26cacSmrg 57536df26cacSmrg# Should we warn about portability when linking against -modules? 57546df26cacSmrgshouldnotlink=$module 57556df26cacSmrg 57566df26cacSmrg# Files to dlopen/dlpreopen 57576df26cacSmrgdlopen='$dlfiles' 57586df26cacSmrgdlpreopen='$dlprefiles' 57596df26cacSmrg 57606df26cacSmrg# Directory that this library needs to be installed in: 57616df26cacSmrglibdir='$install_libdir'" 57626df26cacSmrg if test "$installed" = no && test "$need_relink" = yes; then 57636df26cacSmrg $echo >> $output "\ 57646df26cacSmrgrelink_command=\"$relink_command\"" 57656df26cacSmrg fi 57666df26cacSmrg done 57676df26cacSmrg fi 57686df26cacSmrg 57696df26cacSmrg # Do a symbolic link so that the libtool archive can be found in 57706df26cacSmrg # LD_LIBRARY_PATH before the program is installed. 57716df26cacSmrg $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 57726df26cacSmrg $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 57736df26cacSmrg ;; 57746df26cacSmrg esac 57756df26cacSmrg exit $EXIT_SUCCESS 57766df26cacSmrg ;; 57776df26cacSmrg 57786df26cacSmrg # libtool install mode 57796df26cacSmrg install) 57806df26cacSmrg modename="$modename: install" 57816df26cacSmrg 57826df26cacSmrg # There may be an optional sh(1) argument at the beginning of 57836df26cacSmrg # install_prog (especially on Windows NT). 57846df26cacSmrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 57856df26cacSmrg # Allow the use of GNU shtool's install command. 57866df26cacSmrg $echo "X$nonopt" | grep shtool > /dev/null; then 57876df26cacSmrg # Aesthetically quote it. 57886df26cacSmrg arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 57896df26cacSmrg case $arg in 57906df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 57916df26cacSmrg arg="\"$arg\"" 57926df26cacSmrg ;; 57936df26cacSmrg esac 57946df26cacSmrg install_prog="$arg " 57956df26cacSmrg arg="$1" 57966df26cacSmrg shift 57976df26cacSmrg else 57986df26cacSmrg install_prog= 57996df26cacSmrg arg=$nonopt 58006df26cacSmrg fi 58016df26cacSmrg 58026df26cacSmrg # The real first argument should be the name of the installation program. 58036df26cacSmrg # Aesthetically quote it. 58046df26cacSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 58056df26cacSmrg case $arg in 58066df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58076df26cacSmrg arg="\"$arg\"" 58086df26cacSmrg ;; 58096df26cacSmrg esac 58106df26cacSmrg install_prog="$install_prog$arg" 58116df26cacSmrg 58126df26cacSmrg # We need to accept at least all the BSD install flags. 58136df26cacSmrg dest= 58146df26cacSmrg files= 58156df26cacSmrg opts= 58166df26cacSmrg prev= 58176df26cacSmrg install_type= 58186df26cacSmrg isdir=no 58196df26cacSmrg stripme= 58206df26cacSmrg for arg 58216df26cacSmrg do 58226df26cacSmrg if test -n "$dest"; then 58236df26cacSmrg files="$files $dest" 58246df26cacSmrg dest=$arg 58256df26cacSmrg continue 58266df26cacSmrg fi 58276df26cacSmrg 58286df26cacSmrg case $arg in 58296df26cacSmrg -d) isdir=yes ;; 58306df26cacSmrg -f) 58316df26cacSmrg case " $install_prog " in 58326df26cacSmrg *[\\\ /]cp\ *) ;; 58336df26cacSmrg *) prev=$arg ;; 58346df26cacSmrg esac 58356df26cacSmrg ;; 58366df26cacSmrg -g | -m | -o) prev=$arg ;; 58376df26cacSmrg -s) 58386df26cacSmrg stripme=" -s" 58396df26cacSmrg continue 58406df26cacSmrg ;; 58416df26cacSmrg -*) 58426df26cacSmrg ;; 58436df26cacSmrg *) 58446df26cacSmrg # If the previous option needed an argument, then skip it. 58456df26cacSmrg if test -n "$prev"; then 58466df26cacSmrg prev= 58476df26cacSmrg else 58486df26cacSmrg dest=$arg 58496df26cacSmrg continue 58506df26cacSmrg fi 58516df26cacSmrg ;; 58526df26cacSmrg esac 58536df26cacSmrg 58546df26cacSmrg # Aesthetically quote the argument. 58556df26cacSmrg arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 58566df26cacSmrg case $arg in 58576df26cacSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 58586df26cacSmrg arg="\"$arg\"" 58596df26cacSmrg ;; 58606df26cacSmrg esac 58616df26cacSmrg install_prog="$install_prog $arg" 58626df26cacSmrg done 58636df26cacSmrg 58646df26cacSmrg if test -z "$install_prog"; then 58656df26cacSmrg $echo "$modename: you must specify an install program" 1>&2 58666df26cacSmrg $echo "$help" 1>&2 58676df26cacSmrg exit $EXIT_FAILURE 58686df26cacSmrg fi 58696df26cacSmrg 58706df26cacSmrg if test -n "$prev"; then 58716df26cacSmrg $echo "$modename: the \`$prev' option requires an argument" 1>&2 58726df26cacSmrg $echo "$help" 1>&2 58736df26cacSmrg exit $EXIT_FAILURE 58746df26cacSmrg fi 58756df26cacSmrg 58766df26cacSmrg if test -z "$files"; then 58776df26cacSmrg if test -z "$dest"; then 58786df26cacSmrg $echo "$modename: no file or destination specified" 1>&2 58796df26cacSmrg else 58806df26cacSmrg $echo "$modename: you must specify a destination" 1>&2 58816df26cacSmrg fi 58826df26cacSmrg $echo "$help" 1>&2 58836df26cacSmrg exit $EXIT_FAILURE 58846df26cacSmrg fi 58856df26cacSmrg 58866df26cacSmrg # Strip any trailing slash from the destination. 58876df26cacSmrg dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 58886df26cacSmrg 58896df26cacSmrg # Check to see that the destination is a directory. 58906df26cacSmrg test -d "$dest" && isdir=yes 58916df26cacSmrg if test "$isdir" = yes; then 58926df26cacSmrg destdir="$dest" 58936df26cacSmrg destname= 58946df26cacSmrg else 58956df26cacSmrg destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 58966df26cacSmrg test "X$destdir" = "X$dest" && destdir=. 58976df26cacSmrg destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 58986df26cacSmrg 58996df26cacSmrg # Not a directory, so check to see that there is only one file specified. 59006df26cacSmrg set dummy $files 59016df26cacSmrg if test "$#" -gt 2; then 59026df26cacSmrg $echo "$modename: \`$dest' is not a directory" 1>&2 59036df26cacSmrg $echo "$help" 1>&2 59046df26cacSmrg exit $EXIT_FAILURE 59056df26cacSmrg fi 59066df26cacSmrg fi 59076df26cacSmrg case $destdir in 59086df26cacSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 59096df26cacSmrg *) 59106df26cacSmrg for file in $files; do 59116df26cacSmrg case $file in 59126df26cacSmrg *.lo) ;; 59136df26cacSmrg *) 59146df26cacSmrg $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 59156df26cacSmrg $echo "$help" 1>&2 59166df26cacSmrg exit $EXIT_FAILURE 59176df26cacSmrg ;; 59186df26cacSmrg esac 59196df26cacSmrg done 59206df26cacSmrg ;; 59216df26cacSmrg esac 59226df26cacSmrg 59236df26cacSmrg # This variable tells wrapper scripts just to set variables rather 59246df26cacSmrg # than running their programs. 59256df26cacSmrg libtool_install_magic="$magic" 59266df26cacSmrg 59276df26cacSmrg staticlibs= 59286df26cacSmrg future_libdirs= 59296df26cacSmrg current_libdirs= 59306df26cacSmrg for file in $files; do 59316df26cacSmrg 59326df26cacSmrg # Do each installation. 59336df26cacSmrg case $file in 59346df26cacSmrg *.$libext) 59356df26cacSmrg # Do the static libraries later. 59366df26cacSmrg staticlibs="$staticlibs $file" 59376df26cacSmrg ;; 59386df26cacSmrg 59396df26cacSmrg *.la) 59406df26cacSmrg # Check to see that this really is a libtool archive. 59416df26cacSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 59426df26cacSmrg else 59436df26cacSmrg $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 59446df26cacSmrg $echo "$help" 1>&2 59456df26cacSmrg exit $EXIT_FAILURE 59466df26cacSmrg fi 59476df26cacSmrg 59486df26cacSmrg library_names= 59496df26cacSmrg old_library= 59506df26cacSmrg relink_command= 59516df26cacSmrg # If there is no directory component, then add one. 59526df26cacSmrg case $file in 59536df26cacSmrg */* | *\\*) . $file ;; 59546df26cacSmrg *) . ./$file ;; 59556df26cacSmrg esac 59566df26cacSmrg 59576df26cacSmrg # Add the libdir to current_libdirs if it is the destination. 59586df26cacSmrg if test "X$destdir" = "X$libdir"; then 59596df26cacSmrg case "$current_libdirs " in 59606df26cacSmrg *" $libdir "*) ;; 59616df26cacSmrg *) current_libdirs="$current_libdirs $libdir" ;; 59626df26cacSmrg esac 59636df26cacSmrg else 59646df26cacSmrg # Note the libdir as a future libdir. 59656df26cacSmrg case "$future_libdirs " in 59666df26cacSmrg *" $libdir "*) ;; 59676df26cacSmrg *) future_libdirs="$future_libdirs $libdir" ;; 59686df26cacSmrg esac 59696df26cacSmrg fi 59706df26cacSmrg 59716df26cacSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 59726df26cacSmrg test "X$dir" = "X$file/" && dir= 59736df26cacSmrg dir="$dir$objdir" 59746df26cacSmrg 59756df26cacSmrg if test -n "$relink_command"; then 59766df26cacSmrg # Determine the prefix the user has applied to our future dir. 59776df26cacSmrg inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 59786df26cacSmrg 59796df26cacSmrg # Don't allow the user to place us outside of our expected 59806df26cacSmrg # location b/c this prevents finding dependent libraries that 59816df26cacSmrg # are installed to the same prefix. 59826df26cacSmrg # At present, this check doesn't affect windows .dll's that 59836df26cacSmrg # are installed into $libdir/../bin (currently, that works fine) 59846df26cacSmrg # but it's something to keep an eye on. 59856df26cacSmrg if test "$inst_prefix_dir" = "$destdir"; then 59866df26cacSmrg $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 59876df26cacSmrg exit $EXIT_FAILURE 59886df26cacSmrg fi 59896df26cacSmrg 59906df26cacSmrg if test -n "$inst_prefix_dir"; then 59916df26cacSmrg # Stick the inst_prefix_dir data into the link command. 599216fd1166Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 59936df26cacSmrg else 599416fd1166Smrg relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 59956df26cacSmrg fi 59966df26cacSmrg 59976df26cacSmrg $echo "$modename: warning: relinking \`$file'" 1>&2 59986df26cacSmrg $show "$relink_command" 59996df26cacSmrg if $run eval "$relink_command"; then : 60006df26cacSmrg else 60016df26cacSmrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 60026df26cacSmrg exit $EXIT_FAILURE 60036df26cacSmrg fi 60046df26cacSmrg fi 60056df26cacSmrg 60066df26cacSmrg # See the names of the shared library. 60076df26cacSmrg set dummy $library_names 60086df26cacSmrg if test -n "$2"; then 60096df26cacSmrg realname="$2" 60106df26cacSmrg shift 60116df26cacSmrg shift 60126df26cacSmrg 60136df26cacSmrg srcname="$realname" 60146df26cacSmrg test -n "$relink_command" && srcname="$realname"T 60156df26cacSmrg 60166df26cacSmrg # Install the shared library and build the symlinks. 60176df26cacSmrg $show "$install_prog $dir/$srcname $destdir/$realname" 60186df26cacSmrg $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 60196df26cacSmrg if test -n "$stripme" && test -n "$striplib"; then 60206df26cacSmrg $show "$striplib $destdir/$realname" 60216df26cacSmrg $run eval "$striplib $destdir/$realname" || exit $? 60226df26cacSmrg fi 60236df26cacSmrg 60246df26cacSmrg if test "$#" -gt 0; then 60256df26cacSmrg # Delete the old symlinks, and create new ones. 60266df26cacSmrg # Try `ln -sf' first, because the `ln' binary might depend on 60276df26cacSmrg # the symlink we replace! Solaris /bin/ln does not understand -f, 60286df26cacSmrg # so we also need to try rm && ln -s. 60296df26cacSmrg for linkname 60306df26cacSmrg do 60316df26cacSmrg if test "$linkname" != "$realname"; then 60326df26cacSmrg $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 60336df26cacSmrg $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 60346df26cacSmrg fi 60356df26cacSmrg done 60366df26cacSmrg fi 60376df26cacSmrg 60386df26cacSmrg # Do each command in the postinstall commands. 60396df26cacSmrg lib="$destdir/$realname" 60406df26cacSmrg cmds=$postinstall_cmds 60416df26cacSmrg save_ifs="$IFS"; IFS='~' 60426df26cacSmrg for cmd in $cmds; do 60436df26cacSmrg IFS="$save_ifs" 60446df26cacSmrg eval cmd=\"$cmd\" 60456df26cacSmrg $show "$cmd" 60466df26cacSmrg $run eval "$cmd" || { 60476df26cacSmrg lt_exit=$? 60486df26cacSmrg 60496df26cacSmrg # Restore the uninstalled library and exit 60506df26cacSmrg if test "$mode" = relink; then 60516df26cacSmrg $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 60526df26cacSmrg fi 60536df26cacSmrg 60546df26cacSmrg exit $lt_exit 60556df26cacSmrg } 60566df26cacSmrg done 60576df26cacSmrg IFS="$save_ifs" 60586df26cacSmrg fi 60596df26cacSmrg 60606df26cacSmrg # Install the pseudo-library for information purposes. 60616df26cacSmrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 60626df26cacSmrg instname="$dir/$name"i 60636df26cacSmrg $show "$install_prog $instname $destdir/$name" 60646df26cacSmrg $run eval "$install_prog $instname $destdir/$name" || exit $? 60656df26cacSmrg 60666df26cacSmrg # Maybe install the static library, too. 60676df26cacSmrg test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 60686df26cacSmrg ;; 60696df26cacSmrg 60706df26cacSmrg *.lo) 60716df26cacSmrg # Install (i.e. copy) a libtool object. 60726df26cacSmrg 60736df26cacSmrg # Figure out destination file name, if it wasn't already specified. 60746df26cacSmrg if test -n "$destname"; then 60756df26cacSmrg destfile="$destdir/$destname" 60766df26cacSmrg else 60776df26cacSmrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 60786df26cacSmrg destfile="$destdir/$destfile" 60796df26cacSmrg fi 60806df26cacSmrg 60816df26cacSmrg # Deduce the name of the destination old-style object file. 60826df26cacSmrg case $destfile in 60836df26cacSmrg *.lo) 60846df26cacSmrg staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 60856df26cacSmrg ;; 60866df26cacSmrg *.$objext) 60876df26cacSmrg staticdest="$destfile" 60886df26cacSmrg destfile= 60896df26cacSmrg ;; 60906df26cacSmrg *) 60916df26cacSmrg $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 60926df26cacSmrg $echo "$help" 1>&2 60936df26cacSmrg exit $EXIT_FAILURE 60946df26cacSmrg ;; 60956df26cacSmrg esac 60966df26cacSmrg 60976df26cacSmrg # Install the libtool object if requested. 60986df26cacSmrg if test -n "$destfile"; then 60996df26cacSmrg $show "$install_prog $file $destfile" 61006df26cacSmrg $run eval "$install_prog $file $destfile" || exit $? 61016df26cacSmrg fi 61026df26cacSmrg 61036df26cacSmrg # Install the old object if enabled. 61046df26cacSmrg if test "$build_old_libs" = yes; then 61056df26cacSmrg # Deduce the name of the old-style object file. 61066df26cacSmrg staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 61076df26cacSmrg 61086df26cacSmrg $show "$install_prog $staticobj $staticdest" 61096df26cacSmrg $run eval "$install_prog \$staticobj \$staticdest" || exit $? 61106df26cacSmrg fi 61116df26cacSmrg exit $EXIT_SUCCESS 61126df26cacSmrg ;; 61136df26cacSmrg 61146df26cacSmrg *) 61156df26cacSmrg # Figure out destination file name, if it wasn't already specified. 61166df26cacSmrg if test -n "$destname"; then 61176df26cacSmrg destfile="$destdir/$destname" 61186df26cacSmrg else 61196df26cacSmrg destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 61206df26cacSmrg destfile="$destdir/$destfile" 61216df26cacSmrg fi 61226df26cacSmrg 61236df26cacSmrg # If the file is missing, and there is a .exe on the end, strip it 61246df26cacSmrg # because it is most likely a libtool script we actually want to 61256df26cacSmrg # install 61266df26cacSmrg stripped_ext="" 61276df26cacSmrg case $file in 61286df26cacSmrg *.exe) 61296df26cacSmrg if test ! -f "$file"; then 61306df26cacSmrg file=`$echo $file|${SED} 's,.exe$,,'` 61316df26cacSmrg stripped_ext=".exe" 61326df26cacSmrg fi 61336df26cacSmrg ;; 61346df26cacSmrg esac 61356df26cacSmrg 61366df26cacSmrg # Do a test to see if this is really a libtool program. 61376df26cacSmrg case $host in 61386df26cacSmrg *cygwin*|*mingw*) 61396df26cacSmrg wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 61406df26cacSmrg ;; 61416df26cacSmrg *) 61426df26cacSmrg wrapper=$file 61436df26cacSmrg ;; 61446df26cacSmrg esac 61456df26cacSmrg if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 61466df26cacSmrg notinst_deplibs= 61476df26cacSmrg relink_command= 61486df26cacSmrg 61496df26cacSmrg # Note that it is not necessary on cygwin/mingw to append a dot to 61506df26cacSmrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 61516df26cacSmrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 61526df26cacSmrg # `FILE.' does not work on cygwin managed mounts. 61536df26cacSmrg # 61546df26cacSmrg # If there is no directory component, then add one. 61556df26cacSmrg case $wrapper in 61566df26cacSmrg */* | *\\*) . ${wrapper} ;; 61576df26cacSmrg *) . ./${wrapper} ;; 61586df26cacSmrg esac 61596df26cacSmrg 61606df26cacSmrg # Check the variables that should have been set. 61616df26cacSmrg if test -z "$notinst_deplibs"; then 61626df26cacSmrg $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 61636df26cacSmrg exit $EXIT_FAILURE 61646df26cacSmrg fi 61656df26cacSmrg 61666df26cacSmrg finalize=yes 61676df26cacSmrg for lib in $notinst_deplibs; do 61686df26cacSmrg # Check to see that each library is installed. 61696df26cacSmrg libdir= 61706df26cacSmrg if test -f "$lib"; then 61716df26cacSmrg # If there is no directory component, then add one. 61726df26cacSmrg case $lib in 61736df26cacSmrg */* | *\\*) . $lib ;; 61746df26cacSmrg *) . ./$lib ;; 61756df26cacSmrg esac 61766df26cacSmrg fi 61776df26cacSmrg libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 61786df26cacSmrg if test -n "$libdir" && test ! -f "$libfile"; then 61796df26cacSmrg $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 61806df26cacSmrg finalize=no 61816df26cacSmrg fi 61826df26cacSmrg done 61836df26cacSmrg 61846df26cacSmrg relink_command= 61856df26cacSmrg # Note that it is not necessary on cygwin/mingw to append a dot to 61866df26cacSmrg # foo even if both foo and FILE.exe exist: automatic-append-.exe 61876df26cacSmrg # behavior happens only for exec(3), not for open(2)! Also, sourcing 61886df26cacSmrg # `FILE.' does not work on cygwin managed mounts. 61896df26cacSmrg # 61906df26cacSmrg # If there is no directory component, then add one. 61916df26cacSmrg case $wrapper in 61926df26cacSmrg */* | *\\*) . ${wrapper} ;; 61936df26cacSmrg *) . ./${wrapper} ;; 61946df26cacSmrg esac 61956df26cacSmrg 61966df26cacSmrg outputname= 61976df26cacSmrg if test "$fast_install" = no && test -n "$relink_command"; then 61986df26cacSmrg if test "$finalize" = yes && test -z "$run"; then 61996df26cacSmrg tmpdir=`func_mktempdir` 62006df26cacSmrg file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 62016df26cacSmrg outputname="$tmpdir/$file" 62026df26cacSmrg # Replace the output file specification. 620316fd1166Smrg relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 62046df26cacSmrg 62056df26cacSmrg $show "$relink_command" 62066df26cacSmrg if $run eval "$relink_command"; then : 62076df26cacSmrg else 62086df26cacSmrg $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 62096df26cacSmrg ${rm}r "$tmpdir" 62106df26cacSmrg continue 62116df26cacSmrg fi 62126df26cacSmrg file="$outputname" 62136df26cacSmrg else 62146df26cacSmrg $echo "$modename: warning: cannot relink \`$file'" 1>&2 62156df26cacSmrg fi 62166df26cacSmrg else 62176df26cacSmrg # Install the binary that we compiled earlier. 62186df26cacSmrg file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 62196df26cacSmrg fi 62206df26cacSmrg fi 62216df26cacSmrg 62226df26cacSmrg # remove .exe since cygwin /usr/bin/install will append another 62236df26cacSmrg # one anyway 62246df26cacSmrg case $install_prog,$host in 62256df26cacSmrg */usr/bin/install*,*cygwin*) 62266df26cacSmrg case $file:$destfile in 62276df26cacSmrg *.exe:*.exe) 62286df26cacSmrg # this is ok 62296df26cacSmrg ;; 62306df26cacSmrg *.exe:*) 62316df26cacSmrg destfile=$destfile.exe 62326df26cacSmrg ;; 62336df26cacSmrg *:*.exe) 62346df26cacSmrg destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 62356df26cacSmrg ;; 62366df26cacSmrg esac 62376df26cacSmrg ;; 62386df26cacSmrg esac 62396df26cacSmrg $show "$install_prog$stripme $file $destfile" 62406df26cacSmrg $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 62416df26cacSmrg test -n "$outputname" && ${rm}r "$tmpdir" 62426df26cacSmrg ;; 62436df26cacSmrg esac 62446df26cacSmrg done 62456df26cacSmrg 62466df26cacSmrg for file in $staticlibs; do 62476df26cacSmrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 62486df26cacSmrg 62496df26cacSmrg # Set up the ranlib parameters. 62506df26cacSmrg oldlib="$destdir/$name" 62516df26cacSmrg 62526df26cacSmrg $show "$install_prog $file $oldlib" 62536df26cacSmrg $run eval "$install_prog \$file \$oldlib" || exit $? 62546df26cacSmrg 62556df26cacSmrg if test -n "$stripme" && test -n "$old_striplib"; then 62566df26cacSmrg $show "$old_striplib $oldlib" 62576df26cacSmrg $run eval "$old_striplib $oldlib" || exit $? 62586df26cacSmrg fi 62596df26cacSmrg 62606df26cacSmrg # Do each command in the postinstall commands. 62616df26cacSmrg cmds=$old_postinstall_cmds 62626df26cacSmrg save_ifs="$IFS"; IFS='~' 62636df26cacSmrg for cmd in $cmds; do 62646df26cacSmrg IFS="$save_ifs" 62656df26cacSmrg eval cmd=\"$cmd\" 62666df26cacSmrg $show "$cmd" 62676df26cacSmrg $run eval "$cmd" || exit $? 62686df26cacSmrg done 62696df26cacSmrg IFS="$save_ifs" 62706df26cacSmrg done 62716df26cacSmrg 62726df26cacSmrg if test -n "$future_libdirs"; then 62736df26cacSmrg $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 62746df26cacSmrg fi 62756df26cacSmrg 62766df26cacSmrg if test -n "$current_libdirs"; then 62776df26cacSmrg # Maybe just do a dry run. 62786df26cacSmrg test -n "$run" && current_libdirs=" -n$current_libdirs" 62796df26cacSmrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 62806df26cacSmrg else 62816df26cacSmrg exit $EXIT_SUCCESS 62826df26cacSmrg fi 62836df26cacSmrg ;; 62846df26cacSmrg 62856df26cacSmrg # libtool finish mode 62866df26cacSmrg finish) 62876df26cacSmrg modename="$modename: finish" 62886df26cacSmrg libdirs="$nonopt" 62896df26cacSmrg admincmds= 62906df26cacSmrg 62916df26cacSmrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 62926df26cacSmrg for dir 62936df26cacSmrg do 62946df26cacSmrg libdirs="$libdirs $dir" 62956df26cacSmrg done 62966df26cacSmrg 62976df26cacSmrg for libdir in $libdirs; do 62986df26cacSmrg if test -n "$finish_cmds"; then 62996df26cacSmrg # Do each command in the finish commands. 63006df26cacSmrg cmds=$finish_cmds 63016df26cacSmrg save_ifs="$IFS"; IFS='~' 63026df26cacSmrg for cmd in $cmds; do 63036df26cacSmrg IFS="$save_ifs" 63046df26cacSmrg eval cmd=\"$cmd\" 63056df26cacSmrg $show "$cmd" 63066df26cacSmrg $run eval "$cmd" || admincmds="$admincmds 63076df26cacSmrg $cmd" 63086df26cacSmrg done 63096df26cacSmrg IFS="$save_ifs" 63106df26cacSmrg fi 63116df26cacSmrg if test -n "$finish_eval"; then 63126df26cacSmrg # Do the single finish_eval. 63136df26cacSmrg eval cmds=\"$finish_eval\" 63146df26cacSmrg $run eval "$cmds" || admincmds="$admincmds 63156df26cacSmrg $cmds" 63166df26cacSmrg fi 63176df26cacSmrg done 63186df26cacSmrg fi 63196df26cacSmrg 63206df26cacSmrg # Exit here if they wanted silent mode. 63216df26cacSmrg test "$show" = : && exit $EXIT_SUCCESS 63226df26cacSmrg 63236df26cacSmrg $echo "X----------------------------------------------------------------------" | $Xsed 63246df26cacSmrg $echo "Libraries have been installed in:" 63256df26cacSmrg for libdir in $libdirs; do 63266df26cacSmrg $echo " $libdir" 63276df26cacSmrg done 63286df26cacSmrg $echo 63296df26cacSmrg $echo "If you ever happen to want to link against installed libraries" 63306df26cacSmrg $echo "in a given directory, LIBDIR, you must either use libtool, and" 63316df26cacSmrg $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 63326df26cacSmrg $echo "flag during linking and do at least one of the following:" 63336df26cacSmrg if test -n "$shlibpath_var"; then 63346df26cacSmrg $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 63356df26cacSmrg $echo " during execution" 63366df26cacSmrg fi 63376df26cacSmrg if test -n "$runpath_var"; then 63386df26cacSmrg $echo " - add LIBDIR to the \`$runpath_var' environment variable" 63396df26cacSmrg $echo " during linking" 63406df26cacSmrg fi 63416df26cacSmrg if test -n "$hardcode_libdir_flag_spec"; then 63426df26cacSmrg libdir=LIBDIR 63436df26cacSmrg eval flag=\"$hardcode_libdir_flag_spec\" 63446df26cacSmrg 63456df26cacSmrg $echo " - use the \`$flag' linker flag" 63466df26cacSmrg fi 63476df26cacSmrg if test -n "$admincmds"; then 63486df26cacSmrg $echo " - have your system administrator run these commands:$admincmds" 63496df26cacSmrg fi 63506df26cacSmrg if test -f /etc/ld.so.conf; then 63516df26cacSmrg $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 63526df26cacSmrg fi 63536df26cacSmrg $echo 63546df26cacSmrg $echo "See any operating system documentation about shared libraries for" 63556df26cacSmrg $echo "more information, such as the ld(1) and ld.so(8) manual pages." 63566df26cacSmrg $echo "X----------------------------------------------------------------------" | $Xsed 63576df26cacSmrg exit $EXIT_SUCCESS 63586df26cacSmrg ;; 63596df26cacSmrg 63606df26cacSmrg # libtool execute mode 63616df26cacSmrg execute) 63626df26cacSmrg modename="$modename: execute" 63636df26cacSmrg 63646df26cacSmrg # The first argument is the command name. 63656df26cacSmrg cmd="$nonopt" 63666df26cacSmrg if test -z "$cmd"; then 63676df26cacSmrg $echo "$modename: you must specify a COMMAND" 1>&2 63686df26cacSmrg $echo "$help" 63696df26cacSmrg exit $EXIT_FAILURE 63706df26cacSmrg fi 63716df26cacSmrg 63726df26cacSmrg # Handle -dlopen flags immediately. 63736df26cacSmrg for file in $execute_dlfiles; do 63746df26cacSmrg if test ! -f "$file"; then 63756df26cacSmrg $echo "$modename: \`$file' is not a file" 1>&2 63766df26cacSmrg $echo "$help" 1>&2 63776df26cacSmrg exit $EXIT_FAILURE 63786df26cacSmrg fi 63796df26cacSmrg 63806df26cacSmrg dir= 63816df26cacSmrg case $file in 63826df26cacSmrg *.la) 63836df26cacSmrg # Check to see that this really is a libtool archive. 63846df26cacSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 63856df26cacSmrg else 63866df26cacSmrg $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 63876df26cacSmrg $echo "$help" 1>&2 63886df26cacSmrg exit $EXIT_FAILURE 63896df26cacSmrg fi 63906df26cacSmrg 63916df26cacSmrg # Read the libtool library. 63926df26cacSmrg dlname= 63936df26cacSmrg library_names= 63946df26cacSmrg 63956df26cacSmrg # If there is no directory component, then add one. 63966df26cacSmrg case $file in 63976df26cacSmrg */* | *\\*) . $file ;; 63986df26cacSmrg *) . ./$file ;; 63996df26cacSmrg esac 64006df26cacSmrg 64016df26cacSmrg # Skip this library if it cannot be dlopened. 64026df26cacSmrg if test -z "$dlname"; then 64036df26cacSmrg # Warn if it was a shared library. 64046df26cacSmrg test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 64056df26cacSmrg continue 64066df26cacSmrg fi 64076df26cacSmrg 64086df26cacSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 64096df26cacSmrg test "X$dir" = "X$file" && dir=. 64106df26cacSmrg 64116df26cacSmrg if test -f "$dir/$objdir/$dlname"; then 64126df26cacSmrg dir="$dir/$objdir" 64136df26cacSmrg else 641416fd1166Smrg if test ! -f "$dir/$dlname"; then 641516fd1166Smrg $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 641616fd1166Smrg exit $EXIT_FAILURE 641716fd1166Smrg fi 64186df26cacSmrg fi 64196df26cacSmrg ;; 64206df26cacSmrg 64216df26cacSmrg *.lo) 64226df26cacSmrg # Just add the directory containing the .lo file. 64236df26cacSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 64246df26cacSmrg test "X$dir" = "X$file" && dir=. 64256df26cacSmrg ;; 64266df26cacSmrg 64276df26cacSmrg *) 64286df26cacSmrg $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 64296df26cacSmrg continue 64306df26cacSmrg ;; 64316df26cacSmrg esac 64326df26cacSmrg 64336df26cacSmrg # Get the absolute pathname. 64346df26cacSmrg absdir=`cd "$dir" && pwd` 64356df26cacSmrg test -n "$absdir" && dir="$absdir" 64366df26cacSmrg 64376df26cacSmrg # Now add the directory to shlibpath_var. 64386df26cacSmrg if eval "test -z \"\$$shlibpath_var\""; then 64396df26cacSmrg eval "$shlibpath_var=\"\$dir\"" 64406df26cacSmrg else 64416df26cacSmrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 64426df26cacSmrg fi 64436df26cacSmrg done 64446df26cacSmrg 64456df26cacSmrg # This variable tells wrapper scripts just to set shlibpath_var 64466df26cacSmrg # rather than running their programs. 64476df26cacSmrg libtool_execute_magic="$magic" 64486df26cacSmrg 64496df26cacSmrg # Check if any of the arguments is a wrapper script. 64506df26cacSmrg args= 64516df26cacSmrg for file 64526df26cacSmrg do 64536df26cacSmrg case $file in 64546df26cacSmrg -*) ;; 64556df26cacSmrg *) 64566df26cacSmrg # Do a test to see if this is really a libtool program. 64576df26cacSmrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 64586df26cacSmrg # If there is no directory component, then add one. 64596df26cacSmrg case $file in 64606df26cacSmrg */* | *\\*) . $file ;; 64616df26cacSmrg *) . ./$file ;; 64626df26cacSmrg esac 64636df26cacSmrg 64646df26cacSmrg # Transform arg to wrapped name. 64656df26cacSmrg file="$progdir/$program" 64666df26cacSmrg fi 64676df26cacSmrg ;; 64686df26cacSmrg esac 64696df26cacSmrg # Quote arguments (to preserve shell metacharacters). 64706df26cacSmrg file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 64716df26cacSmrg args="$args \"$file\"" 64726df26cacSmrg done 64736df26cacSmrg 64746df26cacSmrg if test -z "$run"; then 64756df26cacSmrg if test -n "$shlibpath_var"; then 64766df26cacSmrg # Export the shlibpath_var. 64776df26cacSmrg eval "export $shlibpath_var" 64786df26cacSmrg fi 64796df26cacSmrg 64806df26cacSmrg # Restore saved environment variables 648116fd1166Smrg for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 648216fd1166Smrg do 648316fd1166Smrg eval "if test \"\${save_$lt_var+set}\" = set; then 648416fd1166Smrg $lt_var=\$save_$lt_var; export $lt_var 648516fd1166Smrg fi" 648616fd1166Smrg done 64876df26cacSmrg 64886df26cacSmrg # Now prepare to actually exec the command. 64896df26cacSmrg exec_cmd="\$cmd$args" 64906df26cacSmrg else 64916df26cacSmrg # Display what would be done. 64926df26cacSmrg if test -n "$shlibpath_var"; then 64936df26cacSmrg eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 64946df26cacSmrg $echo "export $shlibpath_var" 64956df26cacSmrg fi 64966df26cacSmrg $echo "$cmd$args" 64976df26cacSmrg exit $EXIT_SUCCESS 64986df26cacSmrg fi 64996df26cacSmrg ;; 65006df26cacSmrg 65016df26cacSmrg # libtool clean and uninstall mode 65026df26cacSmrg clean | uninstall) 65036df26cacSmrg modename="$modename: $mode" 65046df26cacSmrg rm="$nonopt" 65056df26cacSmrg files= 65066df26cacSmrg rmforce= 65076df26cacSmrg exit_status=0 65086df26cacSmrg 65096df26cacSmrg # This variable tells wrapper scripts just to set variables rather 65106df26cacSmrg # than running their programs. 65116df26cacSmrg libtool_install_magic="$magic" 65126df26cacSmrg 65136df26cacSmrg for arg 65146df26cacSmrg do 65156df26cacSmrg case $arg in 65166df26cacSmrg -f) rm="$rm $arg"; rmforce=yes ;; 65176df26cacSmrg -*) rm="$rm $arg" ;; 65186df26cacSmrg *) files="$files $arg" ;; 65196df26cacSmrg esac 65206df26cacSmrg done 65216df26cacSmrg 65226df26cacSmrg if test -z "$rm"; then 65236df26cacSmrg $echo "$modename: you must specify an RM program" 1>&2 65246df26cacSmrg $echo "$help" 1>&2 65256df26cacSmrg exit $EXIT_FAILURE 65266df26cacSmrg fi 65276df26cacSmrg 65286df26cacSmrg rmdirs= 65296df26cacSmrg 65306df26cacSmrg origobjdir="$objdir" 65316df26cacSmrg for file in $files; do 65326df26cacSmrg dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 65336df26cacSmrg if test "X$dir" = "X$file"; then 65346df26cacSmrg dir=. 65356df26cacSmrg objdir="$origobjdir" 65366df26cacSmrg else 65376df26cacSmrg objdir="$dir/$origobjdir" 65386df26cacSmrg fi 65396df26cacSmrg name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 65406df26cacSmrg test "$mode" = uninstall && objdir="$dir" 65416df26cacSmrg 65426df26cacSmrg # Remember objdir for removal later, being careful to avoid duplicates 65436df26cacSmrg if test "$mode" = clean; then 65446df26cacSmrg case " $rmdirs " in 65456df26cacSmrg *" $objdir "*) ;; 65466df26cacSmrg *) rmdirs="$rmdirs $objdir" ;; 65476df26cacSmrg esac 65486df26cacSmrg fi 65496df26cacSmrg 65506df26cacSmrg # Don't error if the file doesn't exist and rm -f was used. 65516df26cacSmrg if (test -L "$file") >/dev/null 2>&1 \ 65526df26cacSmrg || (test -h "$file") >/dev/null 2>&1 \ 65536df26cacSmrg || test -f "$file"; then 65546df26cacSmrg : 65556df26cacSmrg elif test -d "$file"; then 65566df26cacSmrg exit_status=1 65576df26cacSmrg continue 65586df26cacSmrg elif test "$rmforce" = yes; then 65596df26cacSmrg continue 65606df26cacSmrg fi 65616df26cacSmrg 65626df26cacSmrg rmfiles="$file" 65636df26cacSmrg 65646df26cacSmrg case $name in 65656df26cacSmrg *.la) 65666df26cacSmrg # Possibly a libtool archive, so verify it. 65676df26cacSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 65686df26cacSmrg . $dir/$name 65696df26cacSmrg 65706df26cacSmrg # Delete the libtool libraries and symlinks. 65716df26cacSmrg for n in $library_names; do 65726df26cacSmrg rmfiles="$rmfiles $objdir/$n" 65736df26cacSmrg done 65746df26cacSmrg test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 65756df26cacSmrg 65766df26cacSmrg case "$mode" in 65776df26cacSmrg clean) 65786df26cacSmrg case " $library_names " in 65796df26cacSmrg # " " in the beginning catches empty $dlname 65806df26cacSmrg *" $dlname "*) ;; 65816df26cacSmrg *) rmfiles="$rmfiles $objdir/$dlname" ;; 65826df26cacSmrg esac 65836df26cacSmrg test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 65846df26cacSmrg ;; 65856df26cacSmrg uninstall) 65866df26cacSmrg if test -n "$library_names"; then 65876df26cacSmrg # Do each command in the postuninstall commands. 65886df26cacSmrg cmds=$postuninstall_cmds 65896df26cacSmrg save_ifs="$IFS"; IFS='~' 65906df26cacSmrg for cmd in $cmds; do 65916df26cacSmrg IFS="$save_ifs" 65926df26cacSmrg eval cmd=\"$cmd\" 65936df26cacSmrg $show "$cmd" 65946df26cacSmrg $run eval "$cmd" 65956df26cacSmrg if test "$?" -ne 0 && test "$rmforce" != yes; then 65966df26cacSmrg exit_status=1 65976df26cacSmrg fi 65986df26cacSmrg done 65996df26cacSmrg IFS="$save_ifs" 66006df26cacSmrg fi 66016df26cacSmrg 66026df26cacSmrg if test -n "$old_library"; then 66036df26cacSmrg # Do each command in the old_postuninstall commands. 66046df26cacSmrg cmds=$old_postuninstall_cmds 66056df26cacSmrg save_ifs="$IFS"; IFS='~' 66066df26cacSmrg for cmd in $cmds; do 66076df26cacSmrg IFS="$save_ifs" 66086df26cacSmrg eval cmd=\"$cmd\" 66096df26cacSmrg $show "$cmd" 66106df26cacSmrg $run eval "$cmd" 66116df26cacSmrg if test "$?" -ne 0 && test "$rmforce" != yes; then 66126df26cacSmrg exit_status=1 66136df26cacSmrg fi 66146df26cacSmrg done 66156df26cacSmrg IFS="$save_ifs" 66166df26cacSmrg fi 66176df26cacSmrg # FIXME: should reinstall the best remaining shared library. 66186df26cacSmrg ;; 66196df26cacSmrg esac 66206df26cacSmrg fi 66216df26cacSmrg ;; 66226df26cacSmrg 66236df26cacSmrg *.lo) 66246df26cacSmrg # Possibly a libtool object, so verify it. 66256df26cacSmrg if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66266df26cacSmrg 66276df26cacSmrg # Read the .lo file 66286df26cacSmrg . $dir/$name 66296df26cacSmrg 66306df26cacSmrg # Add PIC object to the list of files to remove. 66316df26cacSmrg if test -n "$pic_object" \ 66326df26cacSmrg && test "$pic_object" != none; then 66336df26cacSmrg rmfiles="$rmfiles $dir/$pic_object" 66346df26cacSmrg fi 66356df26cacSmrg 66366df26cacSmrg # Add non-PIC object to the list of files to remove. 66376df26cacSmrg if test -n "$non_pic_object" \ 66386df26cacSmrg && test "$non_pic_object" != none; then 66396df26cacSmrg rmfiles="$rmfiles $dir/$non_pic_object" 66406df26cacSmrg fi 66416df26cacSmrg fi 66426df26cacSmrg ;; 66436df26cacSmrg 66446df26cacSmrg *) 66456df26cacSmrg if test "$mode" = clean ; then 66466df26cacSmrg noexename=$name 66476df26cacSmrg case $file in 66486df26cacSmrg *.exe) 66496df26cacSmrg file=`$echo $file|${SED} 's,.exe$,,'` 66506df26cacSmrg noexename=`$echo $name|${SED} 's,.exe$,,'` 66516df26cacSmrg # $file with .exe has already been added to rmfiles, 66526df26cacSmrg # add $file without .exe 66536df26cacSmrg rmfiles="$rmfiles $file" 66546df26cacSmrg ;; 66556df26cacSmrg esac 66566df26cacSmrg # Do a test to see if this is a libtool program. 66576df26cacSmrg if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 66586df26cacSmrg relink_command= 66596df26cacSmrg . $dir/$noexename 66606df26cacSmrg 66616df26cacSmrg # note $name still contains .exe if it was in $file originally 66626df26cacSmrg # as does the version of $file that was added into $rmfiles 66636df26cacSmrg rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 66646df26cacSmrg if test "$fast_install" = yes && test -n "$relink_command"; then 66656df26cacSmrg rmfiles="$rmfiles $objdir/lt-$name" 66666df26cacSmrg fi 66676df26cacSmrg if test "X$noexename" != "X$name" ; then 66686df26cacSmrg rmfiles="$rmfiles $objdir/lt-${noexename}.c" 66696df26cacSmrg fi 66706df26cacSmrg fi 66716df26cacSmrg fi 66726df26cacSmrg ;; 66736df26cacSmrg esac 66746df26cacSmrg $show "$rm $rmfiles" 66756df26cacSmrg $run $rm $rmfiles || exit_status=1 66766df26cacSmrg done 66776df26cacSmrg objdir="$origobjdir" 66786df26cacSmrg 66796df26cacSmrg # Try to remove the ${objdir}s in the directories where we deleted files 66806df26cacSmrg for dir in $rmdirs; do 66816df26cacSmrg if test -d "$dir"; then 66826df26cacSmrg $show "rmdir $dir" 66836df26cacSmrg $run rmdir $dir >/dev/null 2>&1 66846df26cacSmrg fi 66856df26cacSmrg done 66866df26cacSmrg 66876df26cacSmrg exit $exit_status 66886df26cacSmrg ;; 66896df26cacSmrg 66906df26cacSmrg "") 66916df26cacSmrg $echo "$modename: you must specify a MODE" 1>&2 66926df26cacSmrg $echo "$generic_help" 1>&2 66936df26cacSmrg exit $EXIT_FAILURE 66946df26cacSmrg ;; 66956df26cacSmrg esac 66966df26cacSmrg 66976df26cacSmrg if test -z "$exec_cmd"; then 66986df26cacSmrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 66996df26cacSmrg $echo "$generic_help" 1>&2 67006df26cacSmrg exit $EXIT_FAILURE 67016df26cacSmrg fi 67026df26cacSmrgfi # test -z "$show_help" 67036df26cacSmrg 67046df26cacSmrgif test -n "$exec_cmd"; then 67056df26cacSmrg eval exec $exec_cmd 67066df26cacSmrg exit $EXIT_FAILURE 67076df26cacSmrgfi 67086df26cacSmrg 67096df26cacSmrg# We need to display help for each of the modes. 67106df26cacSmrgcase $mode in 67116df26cacSmrg"") $echo \ 67126df26cacSmrg"Usage: $modename [OPTION]... [MODE-ARG]... 67136df26cacSmrg 67146df26cacSmrgProvide generalized library-building support services. 67156df26cacSmrg 67166df26cacSmrg --config show all configuration variables 67176df26cacSmrg --debug enable verbose shell tracing 67186df26cacSmrg-n, --dry-run display commands without modifying any files 67196df26cacSmrg --features display basic configuration information and exit 67206df26cacSmrg --finish same as \`--mode=finish' 67216df26cacSmrg --help display this help message and exit 67226df26cacSmrg --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 67236df26cacSmrg --quiet same as \`--silent' 67246df26cacSmrg --silent don't print informational messages 67256df26cacSmrg --tag=TAG use configuration variables from tag TAG 67266df26cacSmrg --version print version information 67276df26cacSmrg 67286df26cacSmrgMODE must be one of the following: 67296df26cacSmrg 67306df26cacSmrg clean remove files from the build directory 67316df26cacSmrg compile compile a source file into a libtool object 67326df26cacSmrg execute automatically set library path, then run a program 67336df26cacSmrg finish complete the installation of libtool libraries 67346df26cacSmrg install install libraries or executables 67356df26cacSmrg link create a library or an executable 67366df26cacSmrg uninstall remove libraries from an installed directory 67376df26cacSmrg 67386df26cacSmrgMODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 67396df26cacSmrga more detailed description of MODE. 67406df26cacSmrg 67416df26cacSmrgReport bugs to <bug-libtool@gnu.org>." 67426df26cacSmrg exit $EXIT_SUCCESS 67436df26cacSmrg ;; 67446df26cacSmrg 67456df26cacSmrgclean) 67466df26cacSmrg $echo \ 67476df26cacSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 67486df26cacSmrg 67496df26cacSmrgRemove files from the build directory. 67506df26cacSmrg 67516df26cacSmrgRM is the name of the program to use to delete files associated with each FILE 67526df26cacSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 67536df26cacSmrgto RM. 67546df26cacSmrg 67556df26cacSmrgIf FILE is a libtool library, object or program, all the files associated 67566df26cacSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 67576df26cacSmrg ;; 67586df26cacSmrg 67596df26cacSmrgcompile) 67606df26cacSmrg $echo \ 67616df26cacSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 67626df26cacSmrg 67636df26cacSmrgCompile a source file into a libtool library object. 67646df26cacSmrg 67656df26cacSmrgThis mode accepts the following additional options: 67666df26cacSmrg 67676df26cacSmrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 67686df26cacSmrg -prefer-pic try to building PIC objects only 67696df26cacSmrg -prefer-non-pic try to building non-PIC objects only 67706df26cacSmrg -static always build a \`.o' file suitable for static linking 67716df26cacSmrg 67726df26cacSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 67736df26cacSmrgfrom the given SOURCEFILE. 67746df26cacSmrg 67756df26cacSmrgThe output file name is determined by removing the directory component from 67766df26cacSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 67776df26cacSmrglibrary object suffix, \`.lo'." 67786df26cacSmrg ;; 67796df26cacSmrg 67806df26cacSmrgexecute) 67816df26cacSmrg $echo \ 67826df26cacSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 67836df26cacSmrg 67846df26cacSmrgAutomatically set library path, then run a program. 67856df26cacSmrg 67866df26cacSmrgThis mode accepts the following additional options: 67876df26cacSmrg 67886df26cacSmrg -dlopen FILE add the directory containing FILE to the library path 67896df26cacSmrg 67906df26cacSmrgThis mode sets the library path environment variable according to \`-dlopen' 67916df26cacSmrgflags. 67926df26cacSmrg 67936df26cacSmrgIf any of the ARGS are libtool executable wrappers, then they are translated 67946df26cacSmrginto their corresponding uninstalled binary, and any of their required library 67956df26cacSmrgdirectories are added to the library path. 67966df26cacSmrg 67976df26cacSmrgThen, COMMAND is executed, with ARGS as arguments." 67986df26cacSmrg ;; 67996df26cacSmrg 68006df26cacSmrgfinish) 68016df26cacSmrg $echo \ 68026df26cacSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 68036df26cacSmrg 68046df26cacSmrgComplete the installation of libtool libraries. 68056df26cacSmrg 68066df26cacSmrgEach LIBDIR is a directory that contains libtool libraries. 68076df26cacSmrg 68086df26cacSmrgThe commands that this mode executes may require superuser privileges. Use 68096df26cacSmrgthe \`--dry-run' option if you just want to see what would be executed." 68106df26cacSmrg ;; 68116df26cacSmrg 68126df26cacSmrginstall) 68136df26cacSmrg $echo \ 68146df26cacSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 68156df26cacSmrg 68166df26cacSmrgInstall executables or libraries. 68176df26cacSmrg 68186df26cacSmrgINSTALL-COMMAND is the installation command. The first component should be 68196df26cacSmrgeither the \`install' or \`cp' program. 68206df26cacSmrg 68216df26cacSmrgThe rest of the components are interpreted as arguments to that command (only 68226df26cacSmrgBSD-compatible install options are recognized)." 68236df26cacSmrg ;; 68246df26cacSmrg 68256df26cacSmrglink) 68266df26cacSmrg $echo \ 68276df26cacSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 68286df26cacSmrg 68296df26cacSmrgLink object files or libraries together to form another library, or to 68306df26cacSmrgcreate an executable program. 68316df26cacSmrg 68326df26cacSmrgLINK-COMMAND is a command using the C compiler that you would use to create 68336df26cacSmrga program from several object files. 68346df26cacSmrg 68356df26cacSmrgThe following components of LINK-COMMAND are treated specially: 68366df26cacSmrg 68376df26cacSmrg -all-static do not do any dynamic linking at all 68386df26cacSmrg -avoid-version do not add a version suffix if possible 68396df26cacSmrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 68406df26cacSmrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 68416df26cacSmrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 68426df26cacSmrg -export-symbols SYMFILE 684316fd1166Smrg try to export only the symbols listed in SYMFILE 68446df26cacSmrg -export-symbols-regex REGEX 684516fd1166Smrg try to export only the symbols matching REGEX 68466df26cacSmrg -LLIBDIR search LIBDIR for required installed libraries 68476df26cacSmrg -lNAME OUTPUT-FILE requires the installed library libNAME 68486df26cacSmrg -module build a library that can dlopened 68496df26cacSmrg -no-fast-install disable the fast-install mode 68506df26cacSmrg -no-install link a not-installable executable 68516df26cacSmrg -no-undefined declare that a library does not refer to external symbols 68526df26cacSmrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 68536df26cacSmrg -objectlist FILE Use a list of object files found in FILE to specify objects 68546df26cacSmrg -precious-files-regex REGEX 68556df26cacSmrg don't remove output files matching REGEX 68566df26cacSmrg -release RELEASE specify package release information 68576df26cacSmrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 68586df26cacSmrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 685916fd1166Smrg -static do not do any dynamic linking of uninstalled libtool libraries 686016fd1166Smrg -static-libtool-libs 686116fd1166Smrg do not do any dynamic linking of libtool libraries 68626df26cacSmrg -version-info CURRENT[:REVISION[:AGE]] 686316fd1166Smrg specify library version info [each variable defaults to 0] 68646df26cacSmrg 68656df26cacSmrgAll other options (arguments beginning with \`-') are ignored. 68666df26cacSmrg 68676df26cacSmrgEvery other argument is treated as a filename. Files ending in \`.la' are 68686df26cacSmrgtreated as uninstalled libtool libraries, other files are standard or library 68696df26cacSmrgobject files. 68706df26cacSmrg 68716df26cacSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 68726df26cacSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 68736df26cacSmrgrequired, except when creating a convenience library. 68746df26cacSmrg 68756df26cacSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 68766df26cacSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 68776df26cacSmrg 68786df26cacSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 68796df26cacSmrgis created, otherwise an executable program is created." 68806df26cacSmrg ;; 68816df26cacSmrg 68826df26cacSmrguninstall) 68836df26cacSmrg $echo \ 68846df26cacSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 68856df26cacSmrg 68866df26cacSmrgRemove libraries from an installation directory. 68876df26cacSmrg 68886df26cacSmrgRM is the name of the program to use to delete files associated with each FILE 68896df26cacSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 68906df26cacSmrgto RM. 68916df26cacSmrg 68926df26cacSmrgIf FILE is a libtool library, all the files associated with it are deleted. 68936df26cacSmrgOtherwise, only FILE itself is deleted using RM." 68946df26cacSmrg ;; 68956df26cacSmrg 68966df26cacSmrg*) 68976df26cacSmrg $echo "$modename: invalid operation mode \`$mode'" 1>&2 68986df26cacSmrg $echo "$help" 1>&2 68996df26cacSmrg exit $EXIT_FAILURE 69006df26cacSmrg ;; 69016df26cacSmrgesac 69026df26cacSmrg 69036df26cacSmrg$echo 69046df26cacSmrg$echo "Try \`$modename --help' for more information about other modes." 69056df26cacSmrg 69066df26cacSmrgexit $? 69076df26cacSmrg 69086df26cacSmrg# The TAGs below are defined such that we never get into a situation 69096df26cacSmrg# in which we disable both kinds of libraries. Given conflicting 69106df26cacSmrg# choices, we go for a static library, that is the most portable, 69116df26cacSmrg# since we can't tell whether shared libraries were disabled because 69126df26cacSmrg# the user asked for that or because the platform doesn't support 69136df26cacSmrg# them. This is particularly important on AIX, because we don't 69146df26cacSmrg# support having both static and shared libraries enabled at the same 69156df26cacSmrg# time on that platform, so we default to a shared-only configuration. 69166df26cacSmrg# If a disable-shared tag is given, we'll fallback to a static-only 69176df26cacSmrg# configuration. But we'll never go from static-only to shared-only. 69186df26cacSmrg 69196df26cacSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 69206df26cacSmrgdisable_libs=shared 69216df26cacSmrg# ### END LIBTOOL TAG CONFIG: disable-shared 69226df26cacSmrg 69236df26cacSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 69246df26cacSmrgdisable_libs=static 69256df26cacSmrg# ### END LIBTOOL TAG CONFIG: disable-static 69266df26cacSmrg 69276df26cacSmrg# Local Variables: 69286df26cacSmrg# mode:shell-script 69296df26cacSmrg# sh-indentation:2 69306df26cacSmrg# End: 6931