1218822Sdim# Generated from ltmain.m4sh; do not edit by hand 2218822Sdim 3218822Sdim# ltmain.sh (GNU libtool 1.2435 2007/03/18 18:44:42) 2.1a 4218822Sdim# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 5218822Sdim 6218822Sdim# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 7218822Sdim# This is free software; see the source for copying conditions. There is NO 8218822Sdim# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9218822Sdim 1038889Sjdp# This program is free software; you can redistribute it and/or modify 1138889Sjdp# it under the terms of the GNU General Public License as published by 1238889Sjdp# the Free Software Foundation; either version 2 of the License, or 1338889Sjdp# (at your option) any later version. 1438889Sjdp# 1538889Sjdp# This program is distributed in the hope that it will be useful, but 1638889Sjdp# WITHOUT ANY WARRANTY; without even the implied warranty of 1738889Sjdp# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1838889Sjdp# General Public License for more details. 1938889Sjdp# 2038889Sjdp# You should have received a copy of the GNU General Public License 2138889Sjdp# along with this program; if not, write to the Free Software 22218822Sdim# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 2338889Sjdp# 2438889Sjdp# As a special exception to the GNU General Public License, if you 2538889Sjdp# distribute this file as part of a program that contains a 2638889Sjdp# configuration script generated by Autoconf, you may include it under 2738889Sjdp# the same distribution terms that you use for the rest of that program. 2838889Sjdp 29218822Sdim# Usage: $progname [OPTION]... [MODE-ARG]... 30218822Sdim# 31218822Sdim# Provide generalized library-building support services. 32218822Sdim# 33218822Sdim# --config show all configuration variables 34218822Sdim# --debug enable verbose shell tracing 35218822Sdim# -n, --dry-run display commands without modifying any files 36218822Sdim# --features display basic configuration information and exit 37218822Sdim# --mode=MODE use operation mode MODE 38218822Sdim# --preserve-dup-deps don't remove duplicate dependency libraries 39218822Sdim# --quiet, --silent don't print informational messages 40218822Sdim# --tag=TAG use configuration variables from tag TAG 41218822Sdim# -v, --verbose print informational messages (default) 42218822Sdim# --version print version information 43218822Sdim# -h, --help print short or long help message 44218822Sdim# 45218822Sdim# MODE must be one of the following: 46218822Sdim# 47218822Sdim# clean remove files from the build directory 48218822Sdim# compile compile a source file into a libtool object 49218822Sdim# execute automatically set library path, then run a program 50218822Sdim# finish complete the installation of libtool libraries 51218822Sdim# install install libraries or executables 52218822Sdim# link create a library or an executable 53218822Sdim# uninstall remove libraries from an installed directory 54218822Sdim# 55218822Sdim# MODE-ARGS vary depending on the MODE. 56218822Sdim# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 57218822Sdim# 58218822Sdim# When reporting a bug, please describe a test case to reproduce it and 59218822Sdim# include the following information: 60218822Sdim# 61218822Sdim# host-triplet: $host 62218822Sdim# shell: $SHELL 63218822Sdim# compiler: $LTCC 64218822Sdim# compiler flags: $LTCFLAGS 65218822Sdim# linker: $LD (gnu? $with_gnu_ld) 66218822Sdim# $progname: (GNU libtool 1.2435 2007/03/18 18:44:42) 2.1a 67218822Sdim# automake: $automake_version 68218822Sdim# autoconf: $autoconf_version 69218822Sdim# 70218822Sdim# Report bugs to <bug-libtool@gnu.org>. 71218822Sdim 72218822SdimPROGRAM=ltmain.sh 73218822SdimPACKAGE=libtool 74218822SdimVERSION=2.1a 75218822SdimTIMESTAMP=" 1.2435 2007/03/18 18:44:42" 76218822Sdimpackage_revision=1.2435 77218822Sdim 78218822Sdim# Be Bourne compatible 79218822Sdimif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 80218822Sdim emulate sh 81218822Sdim NULLCMD=: 82218822Sdim # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 83218822Sdim # is contrary to our usage. Disable this feature. 84218822Sdim alias -g '${1+"$@"}'='"$@"' 85218822Sdim setopt NO_GLOB_SUBST 86218822Sdimelse 87218822Sdim case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 88218822Sdimfi 89218822SdimBIN_SH=xpg4; export BIN_SH # for Tru64 90218822SdimDUALCASE=1; export DUALCASE # for MKS sh 91218822Sdim 92218822Sdim# NLS nuisances: We save the old values to restore during execute mode. 93218822Sdim# Only set LANG and LC_ALL to C if already set. 94218822Sdim# These must not be set unconditionally because not all systems understand 95218822Sdim# e.g. LANG=C (notably SCO). 96218822Sdimfor lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 97218822Sdimdo 98218822Sdim eval "if test \"\${$lt_var+set}\" = set; then 99218822Sdim save_$lt_var=\$$lt_var 100218822Sdim $lt_var=C 101218822Sdim export $lt_var 102218822Sdim fi" 103218822Sdimdone 104218822Sdim 105218822Sdim$lt_unset CDPATH 106218822Sdim 107218822Sdim 108218822Sdim 109218822Sdim 110218822Sdim 111218822Sdim: ${CP="cp -f"} 112218822Sdim: ${ECHO="echo"} 113218822Sdim: ${EGREP="/bin/grep -E"} 114218822Sdim: ${FGREP="/bin/grep -F"} 115218822Sdim: ${GREP="/bin/grep"} 116218822Sdim: ${LN_S="ln -s"} 117218822Sdim: ${MAKE="make"} 118218822Sdim: ${MKDIR="mkdir"} 119218822Sdim: ${MV="mv -f"} 120218822Sdim: ${RM="rm -f"} 121218822Sdim: ${SED="/bin/sed"} 122218822Sdim: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 123218822Sdim: ${Xsed="$SED -e 1s/^X//"} 124218822Sdim 125218822Sdim# Global variables: 126218822SdimEXIT_SUCCESS=0 127218822SdimEXIT_FAILURE=1 128218822SdimEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 129218822SdimEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 130218822Sdim 131218822Sdimexit_status=$EXIT_SUCCESS 132218822Sdim 133218822Sdim# Make sure IFS has a sensible default 134218822Sdimlt_nl=' 135218822Sdim' 136218822SdimIFS=" $lt_nl" 137218822Sdim 138218822Sdimdirname="s,/[^/]*$,," 139218822Sdimbasename="s,^.*/,," 140218822Sdim 141218822Sdim# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 142218822Sdim# is ksh but when the shell is invoked as "sh" and the current value of 143218822Sdim# the _XPG environment variable is not equal to 1 (one), the special 144218822Sdim# positional parameter $0, within a function call, is the name of the 145218822Sdim# function. 146218822Sdimprogpath="$0" 147218822Sdim 148218822Sdim# The name of this program: 149218822Sdim# In the unlikely event $progname began with a '-', it would play havoc with 150218822Sdim# func_echo (imagine progname=-n), so we prepend ./ in that case: 151218822Sdimprogname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'` 152218822Sdim 153218822Sdim# Make sure we have an absolute path for reexecution: 154218822Sdimcase $progpath in 155218822Sdim [\\/]*|[A-Za-z]:\\*) ;; 156218822Sdim *[\\/]*) 157218822Sdim progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"` 158218822Sdim progdir=`cd "$progdir" && pwd` 159218822Sdim progpath="$progdir/$progname" 160218822Sdim ;; 161218822Sdim *) 162218822Sdim save_IFS="$IFS" 163218822Sdim IFS=: 164218822Sdim for progdir in $PATH; do 165218822Sdim IFS="$save_IFS" 166218822Sdim test -x "$progdir/$progname" && break 167218822Sdim done 168218822Sdim IFS="$save_IFS" 169218822Sdim test -n "$progdir" || progdir=`pwd` 170218822Sdim progpath="$progdir/$progname" 171218822Sdim ;; 172218822Sdimesac 173218822Sdim 174218822Sdim# Sed substitution that helps us do robust quoting. It backslashifies 175218822Sdim# metacharacters that are still active within double-quoted strings. 176218822SdimXsed="${SED}"' -e 1s/^X//' 177218822Sdimsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 178218822Sdim 179218822Sdim# Same as above, but do not quote variable references. 180218822Sdimdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 181218822Sdim 182218822Sdim# Re-`\' parameter expansions in output of double_quote_subst that were 183218822Sdim# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 184218822Sdim# in input to double_quote_subst, that '$' was protected from expansion. 185218822Sdim# Since each input `\' is now two `\'s, look for any number of runs of 186218822Sdim# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 187218822Sdimbs='\\' 188218822Sdimbs2='\\\\' 189218822Sdimbs4='\\\\\\\\' 190218822Sdimdollar='\$' 191218822Sdimsed_double_backslash="\ 192218822Sdim s/$bs4/&\\ 193218822Sdim/g 194218822Sdim s/^$bs2$dollar/$bs&/ 195218822Sdim s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 196218822Sdim s/\n//g" 197218822Sdim 198218822Sdim# Standard options: 199218822Sdimopt_dry_run=false 200218822Sdimopt_help=false 201218822Sdimopt_quiet=false 202218822Sdimopt_verbose=false 203218822Sdim 204218822Sdim# func_echo arg... 205218822Sdim# Echo program name prefixed message, along with the current mode 206218822Sdim# name if it has been set yet. 207218822Sdimfunc_echo () 208218822Sdim{ 209218822Sdim $ECHO "$progname${mode+: }$mode: "${1+"$@"} 210218822Sdim} 211218822Sdim 212218822Sdim# func_verbose arg... 213218822Sdim# Echo program name prefixed message in verbose mode only. 214218822Sdimfunc_verbose () 215218822Sdim{ 216218822Sdim $opt_verbose && func_echo ${1+"$@"} 217218822Sdim 218218822Sdim # A bug in bash halts the script if the last line of a function 219218822Sdim # fails when set -e is in force, so we need another command to 220218822Sdim # work around that: 221218822Sdim : 222218822Sdim} 223218822Sdim 224218822Sdim# func_error arg... 225218822Sdim# Echo program name prefixed message to standard error. 226218822Sdimfunc_error () 227218822Sdim{ 228218822Sdim $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 229218822Sdim} 230218822Sdim 231218822Sdim# func_warning arg... 232218822Sdim# Echo program name prefixed warning message to standard error. 233218822Sdimfunc_warning () 234218822Sdim{ 235218822Sdim $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 236218822Sdim} 237218822Sdim 238218822Sdim# func_fatal_error arg... 239218822Sdim# Echo program name prefixed message to standard error, and exit. 240218822Sdimfunc_fatal_error () 241218822Sdim{ 242218822Sdim func_error ${1+"$@"} 243218822Sdim exit $EXIT_FAILURE 244218822Sdim} 245218822Sdim 246218822Sdim# func_fatal_help arg... 247218822Sdim# Echo program name prefixed message to standard error, followed by 248218822Sdim# a help hint, and exit. 249218822Sdimfunc_fatal_help () 250218822Sdim{ 251218822Sdim func_error ${1+"$@"} 252218822Sdim func_fatal_error "$help" 253218822Sdim} 254218822Sdimhelp="Try \`$progname --help' for more information." ## default 255218822Sdim 256218822Sdim 257218822Sdim# func_grep expression filename 258218822Sdim# Check whether EXPRESSION matches any line of FILENAME, without output. 259218822Sdimfunc_grep () 260218822Sdim{ 261218822Sdim $GREP "$1" "$2" >/dev/null 2>&1 262218822Sdim} 263218822Sdim 264218822Sdim 265218822Sdim# func_mkdir_p directory-path 266218822Sdim# Make sure the entire path to DIRECTORY-PATH is available. 267218822Sdimfunc_mkdir_p () 268218822Sdim{ 269218822Sdim my_directory_path="$1" 270218822Sdim my_dir_list= 271218822Sdim 272218822Sdim if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 273218822Sdim 274218822Sdim # Protect directory names starting with `-' 275218822Sdim case $my_directory_path in 276218822Sdim -*) my_directory_path="./$my_directory_path" ;; 277218822Sdim esac 278218822Sdim 279218822Sdim # While some portion of DIR does not yet exist... 280218822Sdim while test ! -d "$my_directory_path"; do 281218822Sdim # ...make a list in topmost first order. Use a colon delimited 282218822Sdim # list incase some portion of path contains whitespace. 283218822Sdim my_dir_list="$my_directory_path:$my_dir_list" 284218822Sdim 285218822Sdim # If the last portion added has no slash in it, the list is done 286218822Sdim case $my_directory_path in */*) ;; *) break ;; esac 287218822Sdim 288218822Sdim # ...otherwise throw away the child directory and loop 289218822Sdim my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` 290218822Sdim done 291218822Sdim my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` 292218822Sdim 293218822Sdim save_mkdir_p_IFS="$IFS"; IFS=':' 294218822Sdim for my_dir in $my_dir_list; do 295218822Sdim IFS="$save_mkdir_p_IFS" 296218822Sdim # mkdir can fail with a `File exist' error if two processes 297218822Sdim # try to create one of the directories concurrently. Don't 298218822Sdim # stop in that case! 299218822Sdim $MKDIR "$my_dir" 2>/dev/null || : 300218822Sdim done 301218822Sdim IFS="$save_mkdir_p_IFS" 302218822Sdim 303218822Sdim # Bail out if we (or some other process) failed to create a directory. 304218822Sdim test -d "$my_directory_path" || \ 305218822Sdim func_fatal_error "Failed to create \`$1'" 306218822Sdim fi 307218822Sdim} 308218822Sdim 309218822Sdim 310218822Sdim# func_mktempdir [string] 311218822Sdim# Make a temporary directory that won't clash with other running 312218822Sdim# libtool processes, and avoids race conditions if possible. If 313218822Sdim# given, STRING is the basename for that directory. 314218822Sdimfunc_mktempdir () 315218822Sdim{ 316218822Sdim my_template="${TMPDIR-/tmp}/${1-$progname}" 317218822Sdim 318218822Sdim if test "$opt_dry_run" = ":"; then 319218822Sdim # Return a directory name, but don't create it in dry-run mode 320218822Sdim my_tmpdir="${my_template}-$$" 321218822Sdim else 322218822Sdim 323218822Sdim # If mktemp works, use that first and foremost 324218822Sdim my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 325218822Sdim 326218822Sdim if test ! -d "$my_tmpdir"; then 327218822Sdim # Failing that, at least try and use $RANDOM to avoid a race 328218822Sdim my_tmpdir="${my_template}-${RANDOM-0}$$" 329218822Sdim 330218822Sdim save_mktempdir_umask=`umask` 331218822Sdim umask 0077 332218822Sdim $MKDIR "$my_tmpdir" 333218822Sdim umask $save_mktempdir_umask 334218822Sdim fi 335218822Sdim 336218822Sdim # If we're not in dry-run mode, bomb out on failure 337218822Sdim test -d "$my_tmpdir" || \ 338218822Sdim func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 339218822Sdim fi 340218822Sdim 341218822Sdim $ECHO "X$my_tmpdir" | $Xsed 342218822Sdim} 343218822Sdim 344218822Sdim 345218822Sdim# func_quote_for_eval arg 346218822Sdim# Aesthetically quote ARG to be evaled later. 347218822Sdim# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 348218822Sdim# is double-quoted, suitable for a subsequent eval, whereas 349218822Sdim# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 350218822Sdim# which are still active within double quotes backslashified. 351218822Sdimfunc_quote_for_eval () 352218822Sdim{ 353218822Sdim case $1 in 354218822Sdim *[\\\`\"\$]*) 355218822Sdim func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; 356218822Sdim *) 357218822Sdim func_quote_for_eval_unquoted_result="$1" ;; 358218822Sdim esac 359218822Sdim 360218822Sdim case $func_quote_for_eval_unquoted_result in 361218822Sdim # Double-quote args containing shell metacharacters to delay 362218822Sdim # word splitting, command substitution and and variable 363218822Sdim # expansion for a subsequent eval. 364218822Sdim # Many Bourne shells cannot handle close brackets correctly 365218822Sdim # in scan sets, so we specify it separately. 366218822Sdim *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 367218822Sdim func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 368218822Sdim ;; 369218822Sdim *) 370218822Sdim func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 371218822Sdim esac 372218822Sdim} 373218822Sdim 374218822Sdim 375218822Sdim# func_quote_for_expand arg 376218822Sdim# Aesthetically quote ARG to be evaled later; same as above, 377218822Sdim# but do not quote variable references. 378218822Sdimfunc_quote_for_expand () 379218822Sdim{ 380218822Sdim case $1 in 381218822Sdim *[\\\`\"]*) 382218822Sdim my_arg=`$ECHO "X$1" | $Xsed \ 383218822Sdim -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 384218822Sdim *) 385218822Sdim my_arg="$1" ;; 386218822Sdim esac 387218822Sdim 388218822Sdim case $my_arg in 389218822Sdim # Double-quote args containing shell metacharacters to delay 390218822Sdim # word splitting and command substitution for a subsequent eval. 391218822Sdim # Many Bourne shells cannot handle close brackets correctly 392218822Sdim # in scan sets, so we specify it separately. 393218822Sdim *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 394218822Sdim my_arg="\"$my_arg\"" 395218822Sdim ;; 396218822Sdim esac 397218822Sdim 398218822Sdim func_quote_for_expand_result="$my_arg" 399218822Sdim} 400218822Sdim 401218822Sdim 402218822Sdim# func_show_eval cmd [fail_exp] 403218822Sdim# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 404218822Sdim# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 405218822Sdim# is given, then evaluate it. 406218822Sdimfunc_show_eval () 407218822Sdim{ 408218822Sdim my_cmd="$1" 409218822Sdim my_fail_exp="${2-:}" 410218822Sdim 411218822Sdim ${opt_silent-false} || { 412218822Sdim func_quote_for_expand "$my_cmd" 413218822Sdim eval "func_echo $func_quote_for_expand_result" 414218822Sdim } 415218822Sdim 416218822Sdim if ${opt_dry_run-false}; then :; else 417218822Sdim eval "$my_cmd" 418218822Sdim my_status=$? 419218822Sdim if test "$my_status" -eq 0; then :; else 420218822Sdim eval "(exit $my_status); $my_fail_exp" 421218822Sdim fi 422218822Sdim fi 423218822Sdim} 424218822Sdim 425218822Sdim 426218822Sdim 427218822Sdim 428218822Sdim 429218822Sdim# func_version 430218822Sdim# Echo version message to standard output and exit. 431218822Sdimfunc_version () 432218822Sdim{ 433218822Sdim $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { 434218822Sdim s/^# // 435218822Sdim s/^# *$// 436218822Sdim s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 437218822Sdim p 438218822Sdim }' < "$progpath" 439218822Sdim exit $? 440218822Sdim} 441218822Sdim 442218822Sdim# func_usage 443218822Sdim# Echo short help message to standard output and exit. 444218822Sdimfunc_usage () 445218822Sdim{ 446218822Sdim $SED -n '/^# Usage:/,/# -h/ { 447218822Sdim s/^# // 448218822Sdim s/^# *$// 449218822Sdim s/\$progname/'$progname'/ 450218822Sdim p 451218822Sdim }' < "$progpath" 452218822Sdim $ECHO 453218822Sdim $ECHO "run \`$progname --help | more' for full usage" 454218822Sdim exit $? 455218822Sdim} 456218822Sdim 457218822Sdim# func_help 458218822Sdim# Echo long help message to standard output and exit. 459218822Sdimfunc_help () 460218822Sdim{ 461218822Sdim $SED -n '/^# Usage:/,/# Report bugs to/ { 462218822Sdim s/^# // 463218822Sdim s/^# *$// 464218822Sdim s*\$progname*'$progname'* 465218822Sdim s*\$host*'"$host"'* 466218822Sdim s*\$SHELL*'"$SHELL"'* 467218822Sdim s*\$LTCC*'"$LTCC"'* 468218822Sdim s*\$LTCFLAGS*'"$LTCFLAGS"'* 469218822Sdim s*\$LD*'"$LD"'* 470218822Sdim s/\$with_gnu_ld/'"$with_gnu_ld"'/ 471218822Sdim s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 472218822Sdim s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 473218822Sdim p 474218822Sdim }' < "$progpath" 475218822Sdim exit $? 476218822Sdim} 477218822Sdim 478218822Sdim# func_missing_arg argname 479218822Sdim# Echo program name prefixed message to standard error and set global 480218822Sdim# exit_cmd. 481218822Sdimfunc_missing_arg () 482218822Sdim{ 483218822Sdim func_error "missing argument for $1" 484218822Sdim exit_cmd=exit 485218822Sdim} 486218822Sdim 487218822Sdimexit_cmd=: 488218822Sdim 489218822Sdim 490218822Sdim 491218822Sdim 492218822Sdim 493218822Sdim# Check that we have a working $ECHO. 49460484Sobrienif test "X$1" = X--no-reexec; then 49560484Sobrien # Discard the --no-reexec flag, and continue. 49660484Sobrien shift 49760484Sobrienelif test "X$1" = X--fallback-echo; then 49860484Sobrien # Avoid inline document here, it may be left over 49960484Sobrien : 500218822Sdimelif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then 501218822Sdim # Yippee, $ECHO works! 50260484Sobrien : 50360484Sobrienelse 504218822Sdim # Restart under the correct shell, and then maybe $ECHO will work. 505218822Sdim exec $SHELL "$progpath" --no-reexec ${1+"$@"} 50660484Sobrienfi 50760484Sobrien 50860484Sobrienif test "X$1" = X--fallback-echo; then 50960484Sobrien # used as fallback echo 51060484Sobrien shift 51160484Sobrien cat <<EOF 51260484Sobrien$* 51360484SobrienEOF 514218822Sdim exit $EXIT_SUCCESS 51560484Sobrienfi 51660484Sobrien 51738889Sjdpmagic="%%%MAGIC variable%%%" 51838889Sjdp 51938889Sjdp 52038889Sjdp# Global variables. 521218822Sdim# $mode is unset 52238889Sjdpnonopt= 52338889Sjdpexecute_dlfiles= 524218822Sdimpreserve_args= 52560484Sobrienlo2o="s/\\.lo\$/.${objext}/" 52660484Sobrieno2lo="s/\\.${objext}\$/.lo/" 527218822Sdimextracted_archives= 528218822Sdimextracted_serial=0 52938889Sjdp 530218822Sdimopt_dry_run=false 531218822Sdimopt_duplicate_deps=false 532218822Sdimopt_silent=false 533218822Sdimopt_debug=: 53438889Sjdp 535218822Sdim# If this variable is set in any of the actions, the command in it 536218822Sdim# will be execed at the end. This prevents here-documents from being 537218822Sdim# left over by shells. 538218822Sdimexec_cmd= 53938889Sjdp 540218822Sdim# func_fatal_configuration arg... 541218822Sdim# Echo program name prefixed message to standard error, followed by 542218822Sdim# a configuration failure hint, and exit. 543218822Sdimfunc_fatal_configuration () 544218822Sdim{ 545218822Sdim func_error ${1+"$@"} 546218822Sdim func_error "See the $PACKAGE documentation for more information." 547218822Sdim func_fatal_error "Fatal configuration error." 548218822Sdim} 54977298Sobrien 55077298Sobrien 551218822Sdim# func_config 552218822Sdim# Display the configuration for all the tags in this script. 553218822Sdimfunc_config () 554218822Sdim{ 555218822Sdim re_begincf='^# ### BEGIN LIBTOOL' 556218822Sdim re_endcf='^# ### END LIBTOOL' 55738889Sjdp 558218822Sdim # Default configuration. 559218822Sdim $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 56038889Sjdp 56177298Sobrien # Now print the configurations for the tags. 56277298Sobrien for tagname in $taglist; do 563218822Sdim $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 56477298Sobrien done 56560484Sobrien 566218822Sdim exit $? 567218822Sdim} 56860484Sobrien 569218822Sdim# func_features 570218822Sdim# Display the features supported by this script. 571218822Sdimfunc_features () 572218822Sdim{ 573218822Sdim $ECHO "host: $host" 57438889Sjdp if test "$build_libtool_libs" = yes; then 575218822Sdim $ECHO "enable shared libraries" 57638889Sjdp else 577218822Sdim $ECHO "disable shared libraries" 57838889Sjdp fi 57938889Sjdp if test "$build_old_libs" = yes; then 580218822Sdim $ECHO "enable static libraries" 58138889Sjdp else 582218822Sdim $ECHO "disable static libraries" 58338889Sjdp fi 58438889Sjdp 585218822Sdim exit $? 586218822Sdim} 58738889Sjdp 588218822Sdim# func_enable_tag tagname 589218822Sdim# Verify that TAGNAME is valid, and either flag an error and exit, or 590218822Sdim# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 591218822Sdim# variable here. 592218822Sdimfunc_enable_tag () 593218822Sdim{ 594218822Sdim # Global variable: 595218822Sdim tagname="$1" 59638889Sjdp 597218822Sdim re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 598218822Sdim re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 599218822Sdim sed_extractcf="/$re_begincf/,/$re_endcf/p" 60038889Sjdp 601218822Sdim # Validate tagname. 602218822Sdim case $tagname in 603218822Sdim *[!-_A-Za-z0-9,/]*) 604218822Sdim func_fatal_error "invalid tag name: $tagname" 605218822Sdim ;; 606218822Sdim esac 60777298Sobrien 608218822Sdim # Don't test for the "default" C tag, as we know it's 609218822Sdim # there but not specially marked. 610218822Sdim case $tagname in 611218822Sdim CC) ;; 612218822Sdim *) 613218822Sdim if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 614218822Sdim taglist="$taglist $tagname" 61538889Sjdp 616218822Sdim # Evaluate the configuration. Be careful to quote the path 617218822Sdim # and the sed script, to avoid splitting on whitespace, but 618218822Sdim # also don't use non-portable quotes within backquotes within 619218822Sdim # quotes we have to do it in 2 steps: 620218822Sdim extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 621218822Sdim eval "$extractedcf" 622218822Sdim else 623218822Sdim func_error "ignoring unknown tag $tagname" 624218822Sdim fi 625218822Sdim ;; 626218822Sdim esac 627218822Sdim} 62838889Sjdp 629218822Sdim 630218822Sdimfunc_mode_help () 631218822Sdim{ 632218822Sdim # We need to display help for each of the modes. 633218822Sdim case $mode in 634218822Sdim "") 635218822Sdim # Generic help is extracted from the usage comments 636218822Sdim # at the start of this file. 637218822Sdim func_help 638218822Sdim ;; 639218822Sdim 640218822Sdim clean) 641218822Sdim $ECHO \ 642218822Sdim"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 643218822Sdim 644218822SdimRemove files from the build directory. 645218822Sdim 646218822SdimRM is the name of the program to use to delete files associated with each FILE 647218822Sdim(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 648218822Sdimto RM. 649218822Sdim 650218822SdimIf FILE is a libtool library, object or program, all the files associated 651218822Sdimwith it are deleted. Otherwise, only FILE itself is deleted using RM." 652218822Sdim ;; 653218822Sdim 654218822Sdim compile) 655218822Sdim $ECHO \ 656218822Sdim"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 657218822Sdim 658218822SdimCompile a source file into a libtool library object. 659218822Sdim 660218822SdimThis mode accepts the following additional options: 661218822Sdim 662218822Sdim -o OUTPUT-FILE set the output file name to OUTPUT-FILE 663218822Sdim -no-suppress do not suppress compiler output for multiple passes 664218822Sdim -prefer-pic try to building PIC objects only 665218822Sdim -prefer-non-pic try to building non-PIC objects only 666218822Sdim -shared do not build a \`.o' file suitable for static linking 667218822Sdim -static only build a \`.o' file suitable for static linking 668218822Sdim 669218822SdimCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 670218822Sdimfrom the given SOURCEFILE. 671218822Sdim 672218822SdimThe output file name is determined by removing the directory component from 673218822SdimSOURCEFILE, then substituting the C source code suffix \`.c' with the 674218822Sdimlibrary object suffix, \`.lo'." 675218822Sdim ;; 676218822Sdim 677218822Sdim execute) 678218822Sdim $ECHO \ 679218822Sdim"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 680218822Sdim 681218822SdimAutomatically set library path, then run a program. 682218822Sdim 683218822SdimThis mode accepts the following additional options: 684218822Sdim 685218822Sdim -dlopen FILE add the directory containing FILE to the library path 686218822Sdim 687218822SdimThis mode sets the library path environment variable according to \`-dlopen' 688218822Sdimflags. 689218822Sdim 690218822SdimIf any of the ARGS are libtool executable wrappers, then they are translated 691218822Sdiminto their corresponding uninstalled binary, and any of their required library 692218822Sdimdirectories are added to the library path. 693218822Sdim 694218822SdimThen, COMMAND is executed, with ARGS as arguments." 695218822Sdim ;; 696218822Sdim 697218822Sdim finish) 698218822Sdim $ECHO \ 699218822Sdim"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 700218822Sdim 701218822SdimComplete the installation of libtool libraries. 702218822Sdim 703218822SdimEach LIBDIR is a directory that contains libtool libraries. 704218822Sdim 705218822SdimThe commands that this mode executes may require superuser privileges. Use 706218822Sdimthe \`--dry-run' option if you just want to see what would be executed." 707218822Sdim ;; 708218822Sdim 709218822Sdim install) 710218822Sdim $ECHO \ 711218822Sdim"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 712218822Sdim 713218822SdimInstall executables or libraries. 714218822Sdim 715218822SdimINSTALL-COMMAND is the installation command. The first component should be 716218822Sdimeither the \`install' or \`cp' program. 717218822Sdim 718218822SdimThe following components of INSTALL-COMMAND are treated specially: 719218822Sdim 720218822Sdim -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation 721218822Sdim 722218822SdimThe rest of the components are interpreted as arguments to that command (only 723218822SdimBSD-compatible install options are recognized)." 724218822Sdim ;; 725218822Sdim 726218822Sdim link) 727218822Sdim $ECHO \ 728218822Sdim"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 729218822Sdim 730218822SdimLink object files or libraries together to form another library, or to 731218822Sdimcreate an executable program. 732218822Sdim 733218822SdimLINK-COMMAND is a command using the C compiler that you would use to create 734218822Sdima program from several object files. 735218822Sdim 736218822SdimThe following components of LINK-COMMAND are treated specially: 737218822Sdim 738218822Sdim -all-static do not do any dynamic linking at all 739218822Sdim -avoid-version do not add a version suffix if possible 740218822Sdim -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 741218822Sdim -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 742218822Sdim -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 743218822Sdim -export-symbols SYMFILE 744218822Sdim try to export only the symbols listed in SYMFILE 745218822Sdim -export-symbols-regex REGEX 746218822Sdim try to export only the symbols matching REGEX 747218822Sdim -LLIBDIR search LIBDIR for required installed libraries 748218822Sdim -lNAME OUTPUT-FILE requires the installed library libNAME 749218822Sdim -module build a library that can dlopened 750218822Sdim -no-fast-install disable the fast-install mode 751218822Sdim -no-install link a not-installable executable 752218822Sdim -no-undefined declare that a library does not refer to external symbols 753218822Sdim -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 754218822Sdim -objectlist FILE Use a list of object files found in FILE to specify objects 755218822Sdim -precious-files-regex REGEX 756218822Sdim don't remove output files matching REGEX 757218822Sdim -release RELEASE specify package release information 758218822Sdim -rpath LIBDIR the created library will eventually be installed in LIBDIR 759218822Sdim -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 760218822Sdim -shared only do dynamic linking of libtool libraries 761218822Sdim -shrext SUFFIX override the standard shared library file extension 762218822Sdim -static do not do any dynamic linking of uninstalled libtool libraries 763218822Sdim -static-libtool-libs 764218822Sdim do not do any dynamic linking of libtool libraries 765218822Sdim -version-info CURRENT[:REVISION[:AGE]] 766218822Sdim specify library version info [each variable defaults to 0] 767218822Sdim -weak LIBNAME declare that the target provides the LIBNAME interface 768218822Sdim 769218822SdimAll other options (arguments beginning with \`-') are ignored. 770218822Sdim 771218822SdimEvery other argument is treated as a filename. Files ending in \`.la' are 772218822Sdimtreated as uninstalled libtool libraries, other files are standard or library 773218822Sdimobject files. 774218822Sdim 775218822SdimIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 776218822Sdimonly library objects (\`.lo' files) may be specified, and \`-rpath' is 777218822Sdimrequired, except when creating a convenience library. 778218822Sdim 779218822SdimIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 780218822Sdimusing \`ar' and \`ranlib', or on Windows using \`lib'. 781218822Sdim 782218822SdimIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 783218822Sdimis created, otherwise an executable program is created." 784218822Sdim ;; 785218822Sdim 786218822Sdim uninstall) 787218822Sdim $ECHO \ 788218822Sdim"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 789218822Sdim 790218822SdimRemove libraries from an installation directory. 791218822Sdim 792218822SdimRM is the name of the program to use to delete files associated with each FILE 793218822Sdim(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 794218822Sdimto RM. 795218822Sdim 796218822SdimIf FILE is a libtool library, all the files associated with it are deleted. 797218822SdimOtherwise, only FILE itself is deleted using RM." 798218822Sdim ;; 799218822Sdim 800218822Sdim *) 801218822Sdim func_fatal_help "invalid operation mode \`$mode'" 802218822Sdim ;; 803218822Sdim esac 804218822Sdim 805218822Sdim $ECHO 806218822Sdim $ECHO "Try \`$progname --help' for more information about other modes." 807218822Sdim 808218822Sdim exit $? 809218822Sdim} 810218822Sdim 811218822Sdim# Generated shell functions inserted here. 812218822Sdim 813218822Sdim 814218822Sdim# Parse options once, thoroughly. This comes as soon as possible in 815218822Sdim# the script to make things like `libtool --version' happen quickly. 816218822Sdim{ 817218822Sdim 818218822Sdim # Shorthand for --mode=foo, only valid as the first argument 819218822Sdim case $1 in 820218822Sdim clean|clea|cle|cl) 821218822Sdim shift; set dummy --mode clean ${1+"$@"}; shift 82238889Sjdp ;; 823218822Sdim compile|compil|compi|comp|com|co|c) 824218822Sdim shift; set dummy --mode compile ${1+"$@"}; shift 825218822Sdim ;; 826218822Sdim execute|execut|execu|exec|exe|ex|e) 827218822Sdim shift; set dummy --mode execute ${1+"$@"}; shift 828218822Sdim ;; 829218822Sdim finish|finis|fini|fin|fi|f) 830218822Sdim shift; set dummy --mode finish ${1+"$@"}; shift 831218822Sdim ;; 832218822Sdim install|instal|insta|inst|ins|in|i) 833218822Sdim shift; set dummy --mode install ${1+"$@"}; shift 834218822Sdim ;; 835218822Sdim link|lin|li|l) 836218822Sdim shift; set dummy --mode link ${1+"$@"}; shift 837218822Sdim ;; 838218822Sdim uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 839218822Sdim shift; set dummy --mode uninstall ${1+"$@"}; shift 840218822Sdim ;; 84138889Sjdp esac 84238889Sjdp 843218822Sdim # Parse non-mode specific arguments: 844218822Sdim while test "$#" -gt 0; do 845218822Sdim opt="$1" 846218822Sdim shift 84738889Sjdp 848218822Sdim case $opt in 849218822Sdim --config) func_config ;; 85089857Sobrien 851218822Sdim --debug) preserve_args="$preserve_args $opt" 852218822Sdim func_echo "enabling shell trace mode" 853218822Sdim opt_debug='set -x' 854218822Sdim $opt_debug 855218822Sdim ;; 85638889Sjdp 857218822Sdim -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 858218822Sdim execute_dlfiles="$execute_dlfiles $1" 859218822Sdim shift 860218822Sdim ;; 861218822Sdim 862218822Sdim --dry-run | -n) opt_dry_run=: ;; 863218822Sdim --features) func_features ;; 864218822Sdim --finish) mode="finish" ;; 865218822Sdim 866218822Sdim --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 867218822Sdim case $1 in 868218822Sdim # Valid mode arguments: 869218822Sdim clean) ;; 870218822Sdim compile) ;; 871218822Sdim execute) ;; 872218822Sdim finish) ;; 873218822Sdim install) ;; 874218822Sdim link) ;; 875218822Sdim relink) ;; 876218822Sdim uninstall) ;; 877218822Sdim 878218822Sdim # Catch anything else as an error 879218822Sdim *) func_error "invalid argument for $opt" 880218822Sdim exit_cmd=exit 881218822Sdim break 882218822Sdim ;; 883218822Sdim esac 884218822Sdim 885218822Sdim mode="$1" 886218822Sdim shift 887218822Sdim ;; 888218822Sdim 889218822Sdim --preserve-dup-deps) 890218822Sdim opt_duplicate_deps=: ;; 891218822Sdim 892218822Sdim --quiet|--silent) preserve_args="$preserve_args $opt" 893218822Sdim opt_silent=: 894218822Sdim ;; 895218822Sdim 896218822Sdim --verbose| -v) preserve_args="$preserve_args $opt" 897218822Sdim opt_silent=false 898218822Sdim ;; 899218822Sdim 900218822Sdim --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 901218822Sdim preserve_args="$preserve_args $opt $1" 902218822Sdim func_enable_tag "$1" # tagname is set here 903218822Sdim shift 904218822Sdim ;; 905218822Sdim 906218822Sdim # Separate optargs to long options: 907218822Sdim -dlopen=*|--mode=*|--tag=*) 908218822Sdim func_opt_split "$opt" 909218822Sdim set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 910218822Sdim shift 911218822Sdim ;; 912218822Sdim 913218822Sdim -\?|-h) func_usage ;; 914218822Sdim --help) opt_help=: ;; 915218822Sdim --version) func_version ;; 916218822Sdim 917218822Sdim -*) func_fatal_help "unrecognized option \`$opt'" ;; 918218822Sdim 919218822Sdim *) nonopt="$opt" 920218822Sdim break 921218822Sdim ;; 922218822Sdim esac 923218822Sdim done 924218822Sdim 925218822Sdim # Now that we've collected a possible --mode arg, show help if necessary 926218822Sdim $opt_help && func_mode_help 927218822Sdim 928218822Sdim case $host in 929218822Sdim *cygwin* | *mingw* | *pw32*) 930218822Sdim # don't eliminate duplications in $postdeps and $predeps 931218822Sdim opt_duplicate_compiler_generated_deps=: 93238889Sjdp ;; 933218822Sdim *) 934218822Sdim opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 93538889Sjdp ;; 936218822Sdim esac 93738889Sjdp 938218822Sdim # Having warned about all mis-specified options, bail out if 939218822Sdim # anything was wrong. 940218822Sdim $exit_cmd $EXIT_FAILURE 941218822Sdim} 942218822Sdim 943218822Sdim# func_check_version_match 944218822Sdim# Ensure that we are using m4 macros, and libtool script from the same 945218822Sdim# release of libtool. 946218822Sdimfunc_check_version_match () 947218822Sdim{ 948218822Sdim if test "$package_revision" != "$macro_revision"; then 949218822Sdim if test "$VERSION" != "$macro_version"; then 950218822Sdim if test -z "$macro_version"; then 951218822Sdim cat >&2 <<_LT_EOF 952218822Sdim$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 953218822Sdim$progname: definition of this LT_INIT comes from an older release. 954218822Sdim$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 955218822Sdim$progname: and run autoconf again. 956218822Sdim_LT_EOF 957218822Sdim else 958218822Sdim cat >&2 <<_LT_EOF 959218822Sdim$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 960218822Sdim$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 961218822Sdim$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 962218822Sdim$progname: and run autoconf again. 963218822Sdim_LT_EOF 96438889Sjdp fi 965218822Sdim else 966218822Sdim cat >&2 <<_LT_EOF 967218822Sdim$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 968218822Sdim$progname: but the definition of this LT_INIT comes from revision $macro_revision. 969218822Sdim$progname: You should recreate aclocal.m4 with macros from revision $package_revision 970218822Sdim$progname: of $PACKAGE $VERSION and run autoconf again. 971218822Sdim_LT_EOF 972218822Sdim fi 973218822Sdim 974218822Sdim exit $EXIT_MISMATCH 97538889Sjdp fi 976218822Sdim} 97738889Sjdp 978218822Sdim 979218822Sdim## ----------- ## 980218822Sdim## Main. ## 981218822Sdim## ----------- ## 982218822Sdim 983218822Sdim{ 984218822Sdim # Sanity checks first: 985218822Sdim func_check_version_match 986218822Sdim 987218822Sdim if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 988218822Sdim func_fatal_configuration "not configured to build any kind of library" 989218822Sdim fi 990218822Sdim 991218822Sdim test -z "$mode" && func_fatal_error "error: you must specify a MODE." 992218822Sdim 993218822Sdim 994218822Sdim # Darwin sucks 995218822Sdim eval std_shrext=\"$shrext_cmds\" 996218822Sdim 997218822Sdim 99838889Sjdp # Only execute mode is allowed to have -dlopen flags. 99938889Sjdp if test -n "$execute_dlfiles" && test "$mode" != execute; then 1000218822Sdim func_error "unrecognized option \`-dlopen'" 1001218822Sdim $ECHO "$help" 1>&2 1002218822Sdim exit $EXIT_FAILURE 100338889Sjdp fi 100438889Sjdp 100538889Sjdp # Change the help message to a mode-specific one. 100638889Sjdp generic_help="$help" 1007218822Sdim help="Try \`$progname --help --mode=$mode' for more information." 1008218822Sdim} 100938889Sjdp 101038889Sjdp 1011218822Sdim# func_lalib_p file 1012218822Sdim# True iff FILE is a libtool `.la' library or `.lo' object file. 1013218822Sdim# This function is only a basic sanity check; it will hardly flush out 1014218822Sdim# determined imposters. 1015218822Sdimfunc_lalib_p () 1016218822Sdim{ 1017218822Sdim $SED -e 4q "$1" 2>/dev/null \ 1018218822Sdim | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 1019218822Sdim} 102077298Sobrien 1021218822Sdim# func_lalib_unsafe_p file 1022218822Sdim# True iff FILE is a libtool `.la' library or `.lo' object file. 1023218822Sdim# This function implements the same check as func_lalib_p without 1024218822Sdim# resorting to external programs. To this end, it redirects stdin and 1025218822Sdim# closes it afterwards, without saving the original file descriptor. 1026218822Sdim# As a safety measure, use it only where a negative result would be 1027218822Sdim# fatal anyway. Works if `file' does not exist. 1028218822Sdimfunc_lalib_unsafe_p () 1029218822Sdim{ 1030218822Sdim lalib_p=no 1031218822Sdim if test -r "$1" && exec 5<&1 <"$1"; then 1032218822Sdim for lalib_p_l in 1 2 3 4 1033218822Sdim do 1034218822Sdim read lalib_p_line 1035218822Sdim case "$lalib_p_line" in 1036218822Sdim \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 1037218822Sdim esac 1038218822Sdim done 1039218822Sdim exec 1<&5 5<&- 1040218822Sdim fi 1041218822Sdim test "$lalib_p" = yes 1042218822Sdim} 104377298Sobrien 1044218822Sdim# func_ltwrapper_p file 1045218822Sdim# True iff FILE is a libtool wrapper script. 1046218822Sdim# This function is only a basic sanity check; it will hardly flush out 1047218822Sdim# determined imposters. 1048218822Sdimfunc_ltwrapper_p () 1049218822Sdim{ 1050218822Sdim func_lalib_p "$1" 1051218822Sdim} 1052218822Sdim 1053218822Sdim 1054218822Sdim# func_execute_cmds commands fail_cmd 1055218822Sdim# Execute tilde-delimited COMMANDS. 1056218822Sdim# If FAIL_CMD is given, eval that upon failure. 1057218822Sdim# FAIL_CMD may read-access the current command in variable CMD! 1058218822Sdimfunc_execute_cmds () 1059218822Sdim{ 1060218822Sdim $opt_debug 1061218822Sdim save_ifs=$IFS; IFS='~' 1062218822Sdim for cmd in $1; do 1063218822Sdim IFS=$save_ifs 1064218822Sdim eval cmd=\"$cmd\" 1065218822Sdim func_show_eval "$cmd" "${2-:}" 1066218822Sdim done 1067218822Sdim IFS=$save_ifs 1068218822Sdim} 1069218822Sdim 1070218822Sdim 1071218822Sdim# func_source file 1072218822Sdim# Source FILE, adding directory component if necessary. 1073218822Sdim# Note that it is not necessary on cygwin/mingw to append a dot to 1074218822Sdim# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 1075218822Sdim# behavior happens only for exec(3), not for open(2)! Also, sourcing 1076218822Sdim# `FILE.' does not work on cygwin managed mounts. 1077218822Sdimfunc_source () 1078218822Sdim{ 1079218822Sdim $opt_debug 1080218822Sdim case $1 in 1081218822Sdim */* | *\\*) . "$1" ;; 1082218822Sdim *) . "./$1" ;; 1083218822Sdim esac 1084218822Sdim} 1085218822Sdim 1086218822Sdim 1087218822Sdim# func_win32_libid arg 1088218822Sdim# return the library type of file 'arg' 1089218822Sdim# 1090218822Sdim# Need a lot of goo to handle *both* DLLs and import libs 1091218822Sdim# Has to be a shell function in order to 'eat' the argument 1092218822Sdim# that is supplied when $file_magic_command is called. 1093218822Sdimfunc_win32_libid () 1094218822Sdim{ 1095218822Sdim $opt_debug 1096218822Sdim win32_libid_type="unknown" 1097218822Sdim win32_fileres=`file -L $1 2>/dev/null` 1098218822Sdim case $win32_fileres in 1099218822Sdim *ar\ archive\ import\ library*) # definitely import 1100218822Sdim win32_libid_type="x86 archive import" 1101218822Sdim ;; 1102218822Sdim *ar\ archive*) # could be an import, or static 1103218822Sdim if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 1104218822Sdim $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 1105218822Sdim win32_nmres=`eval $NM -f posix -A $1 | 1106218822Sdim $SED -n -e ' 1107218822Sdim 1,100{ 1108218822Sdim / I /{ 1109218822Sdim s,.*,import, 1110218822Sdim p 1111218822Sdim q 1112218822Sdim } 1113218822Sdim }'` 1114218822Sdim case $win32_nmres in 1115218822Sdim import*) win32_libid_type="x86 archive import";; 1116218822Sdim *) win32_libid_type="x86 archive static";; 1117218822Sdim esac 1118218822Sdim fi 1119218822Sdim ;; 1120218822Sdim *DLL*) 1121218822Sdim win32_libid_type="x86 DLL" 1122218822Sdim ;; 1123218822Sdim *executable*) # but shell scripts are "executable" too... 1124218822Sdim case $win32_fileres in 1125218822Sdim *MS\ Windows\ PE\ Intel*) 1126218822Sdim win32_libid_type="x86 DLL" 1127218822Sdim ;; 1128218822Sdim esac 1129218822Sdim ;; 1130218822Sdim esac 1131218822Sdim $ECHO "$win32_libid_type" 1132218822Sdim} 1133218822Sdim 1134218822Sdim 1135218822Sdim 1136218822Sdim# func_infer_tag arg 1137218822Sdim# Infer tagged configuration to use if any are available and 1138218822Sdim# if one wasn't chosen via the "--tag" command line option. 1139218822Sdim# Only attempt this if the compiler in the base compile 1140218822Sdim# command doesn't match the default compiler. 1141218822Sdim# arg is usually of the form 'gcc ...' 1142218822Sdimfunc_infer_tag () 1143218822Sdim{ 1144218822Sdim $opt_debug 1145218822Sdim if test -n "$available_tags" && test -z "$tagname"; then 1146218822Sdim CC_quoted= 1147218822Sdim for arg in $CC; do 1148218822Sdim func_quote_for_eval "$arg" 1149218822Sdim CC_quoted="$CC_quoted $func_quote_for_eval_result" 1150218822Sdim done 1151218822Sdim case $@ in 1152218822Sdim # Blanks in the command may have been stripped by the calling shell, 1153218822Sdim # but not from the CC environment variable when configure was run. 1154218822Sdim " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; 1155218822Sdim # Blanks at the start of $base_compile will cause this to fail 1156218822Sdim # if we don't check for them as well. 1157218822Sdim *) 1158218822Sdim for z in $available_tags; do 1159218822Sdim if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 1160218822Sdim # Evaluate the configuration. 1161218822Sdim eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 1162218822Sdim CC_quoted= 1163218822Sdim for arg in $CC; do 1164218822Sdim # Double-quote args containing other shell metacharacters. 1165218822Sdim func_quote_for_eval "$arg" 1166218822Sdim CC_quoted="$CC_quoted $func_quote_for_eval_result" 1167218822Sdim done 1168218822Sdim case "$@ " in 1169218822Sdim " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) 1170218822Sdim # The compiler in the base compile command matches 1171218822Sdim # the one in the tagged configuration. 1172218822Sdim # Assume this is the tagged configuration we want. 1173218822Sdim tagname=$z 1174218822Sdim break 1175218822Sdim ;; 1176218822Sdim esac 1177218822Sdim fi 1178218822Sdim done 1179218822Sdim # If $tagname still isn't set, then no tagged configuration 1180218822Sdim # was found and let the user know that the "--tag" command 1181218822Sdim # line option must be used. 1182218822Sdim if test -z "$tagname"; then 1183218822Sdim func_echo "unable to infer tagged configuration" 1184218822Sdim func_fatal_error "specify a tag with \`--tag'" 1185218822Sdim# else 1186218822Sdim# func_verbose "using $tagname tagged configuration" 118777298Sobrien fi 118877298Sobrien ;; 118977298Sobrien esac 1190218822Sdim fi 1191218822Sdim} 119277298Sobrien 1193218822Sdim 1194218822Sdim 1195218822Sdim# func_generate_dlsyms outputname originator pic_p 1196218822Sdim# Extract symbols from dlprefiles and create ${outputname}S.o with 1197218822Sdim# a dlpreopen symbol table. 1198218822Sdimfunc_generate_dlsyms () 1199218822Sdim{ 1200218822Sdim $opt_debug 1201218822Sdim my_outputname="$1" 1202218822Sdim my_originator="$2" 1203218822Sdim my_pic_p="${3-no}" 1204218822Sdim my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 1205218822Sdim my_dlsyms= 1206218822Sdim 1207218822Sdim if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 1208218822Sdim if test -n "$NM" && test -n "$global_symbol_pipe"; then 1209218822Sdim my_dlsyms="${my_outputname}S.c" 1210218822Sdim else 1211218822Sdim func_error "not configured to extract global symbols from dlpreopened files" 1212218822Sdim fi 1213218822Sdim fi 1214218822Sdim 1215218822Sdim if test -n "$my_dlsyms"; then 1216218822Sdim case $my_dlsyms in 1217218822Sdim "") ;; 1218218822Sdim *.c) 1219218822Sdim # Discover the nlist of each of the dlfiles. 1220218822Sdim nlist="$output_objdir/${my_outputname}.nm" 1221218822Sdim 1222218822Sdim func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 1223218822Sdim 1224218822Sdim # Parse the name list into a source file. 1225218822Sdim func_echo "creating $output_objdir/$my_dlsyms" 1226218822Sdim 1227218822Sdim $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 1228218822Sdim/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 1229218822Sdim/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 1230218822Sdim 1231218822Sdim#ifdef __cplusplus 1232218822Sdimextern \"C\" { 1233218822Sdim#endif 1234218822Sdim 1235218822Sdim/* External symbol declarations for the compiler. */\ 1236218822Sdim" 1237218822Sdim 1238218822Sdim if test "$dlself" = yes; then 1239218822Sdim func_echo "generating symbol list for \`$output'" 1240218822Sdim 1241218822Sdim $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 1242218822Sdim 1243218822Sdim # Add our own program objects to the symbol list. 1244218822Sdim progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 1245218822Sdim for progfile in $progfiles; do 1246218822Sdim func_echo "extracting global C symbols from \`$progfile'" 1247218822Sdim $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 1248218822Sdim done 1249218822Sdim 1250218822Sdim if test -n "$exclude_expsyms"; then 1251218822Sdim $opt_dry_run || { 1252218822Sdim eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 1253218822Sdim eval '$MV "$nlist"T "$nlist"' 1254218822Sdim } 1255218822Sdim fi 1256218822Sdim 1257218822Sdim if test -n "$export_symbols_regex"; then 1258218822Sdim $opt_dry_run || { 1259218822Sdim eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 1260218822Sdim eval '$MV "$nlist"T "$nlist"' 1261218822Sdim } 1262218822Sdim fi 1263218822Sdim 1264218822Sdim # Prepare the list of exported symbols 1265218822Sdim if test -z "$export_symbols"; then 1266218822Sdim export_symbols="$output_objdir/$outputname.exp" 1267218822Sdim $opt_dry_run || { 1268218822Sdim $RM $export_symbols 1269218822Sdim eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 1270218822Sdim case $host in 1271218822Sdim *cygwin* | *mingw* ) 1272218822Sdim eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 1273218822Sdim eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 1274218822Sdim ;; 1275218822Sdim esac 1276218822Sdim } 1277218822Sdim else 1278218822Sdim $opt_dry_run || { 1279218822Sdim eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 1280218822Sdim eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 1281218822Sdim eval '$MV "$nlist"T "$nlist"' 1282218822Sdim case $host in 1283218822Sdim *cygwin | *mingw* ) 1284218822Sdim eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 1285218822Sdim eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 1286218822Sdim ;; 1287218822Sdim esac 1288218822Sdim } 1289218822Sdim fi 129060484Sobrien fi 129138889Sjdp 1292218822Sdim for dlprefile in $dlprefiles; do 1293218822Sdim func_echo "extracting global C symbols from \`$dlprefile'" 1294218822Sdim func_basename "$dlprefile" 1295218822Sdim name="$func_basename_result" 1296218822Sdim $opt_dry_run || { 1297218822Sdim eval '$ECHO ": $name " >> "$nlist"' 1298218822Sdim eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 1299218822Sdim } 1300218822Sdim done 130177298Sobrien 1302218822Sdim $opt_dry_run || { 1303218822Sdim # Make sure we have at least an empty file. 1304218822Sdim test -f "$nlist" || : > "$nlist" 130577298Sobrien 1306218822Sdim if test -n "$exclude_expsyms"; then 1307218822Sdim $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 1308218822Sdim $MV "$nlist"T "$nlist" 1309218822Sdim fi 131077298Sobrien 1311218822Sdim # Try sorting and uniquifying the output. 1312218822Sdim if $GREP -v "^: " < "$nlist" | 1313218822Sdim if sort -k 3 </dev/null >/dev/null 2>&1; then 1314218822Sdim sort -k 3 1315218822Sdim else 1316218822Sdim sort +2 1317218822Sdim fi | 1318218822Sdim uniq > "$nlist"S; then 1319218822Sdim : 1320218822Sdim else 1321218822Sdim $GREP -v "^: " < "$nlist" > "$nlist"S 1322218822Sdim fi 132377298Sobrien 1324218822Sdim if test -f "$nlist"S; then 1325218822Sdim eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 1326218822Sdim else 1327218822Sdim $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" 1328218822Sdim fi 132977298Sobrien 1330218822Sdim $ECHO >> "$output_objdir/$my_dlsyms" "\ 1331218822Sdim 1332218822Sdim/* The mapping between symbol names and symbols. */ 1333218822Sdimtypedef struct { 1334218822Sdim const char *name; 1335218822Sdim void *address; 1336218822Sdim} lt_dlsymlist; 1337218822Sdim" 1338218822Sdim case $host in 1339218822Sdim *cygwin* | *mingw* ) 1340218822Sdim $ECHO >> "$output_objdir/$my_dlsyms" "\ 1341218822Sdim/* DATA imports from DLLs on WIN32 con't be const, because 1342218822Sdim runtime relocations are performed -- see ld's documentation 1343218822Sdim on pseudo-relocs. */" 1344218822Sdim lt_dlsym_const= ;; 1345218822Sdim *osf5*) 1346218822Sdim echo >> "$output_objdir/$my_dlsyms" "\ 1347218822Sdim/* This system does not cope well with relocations in const data */" 1348218822Sdim lt_dlsym_const= ;; 1349218822Sdim *) 1350218822Sdim lt_dlsym_const=const ;; 1351218822Sdim esac 1352218822Sdim 1353218822Sdim $ECHO >> "$output_objdir/$my_dlsyms" "\ 1354218822Sdimextern $lt_dlsym_const lt_dlsymlist 1355218822Sdimlt_${my_prefix}_LTX_preloaded_symbols[]; 1356218822Sdim$lt_dlsym_const lt_dlsymlist 1357218822Sdimlt_${my_prefix}_LTX_preloaded_symbols[] = 1358218822Sdim{\ 1359218822Sdim { \"$my_originator\", (void *) 0 }," 1360218822Sdim 1361218822Sdim eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 1362218822Sdim 1363218822Sdim $ECHO >> "$output_objdir/$my_dlsyms" "\ 1364218822Sdim {0, (void *) 0} 1365218822Sdim}; 1366218822Sdim 1367218822Sdim/* This works around a problem in FreeBSD linker */ 1368218822Sdim#ifdef FREEBSD_WORKAROUND 1369218822Sdimstatic const void *lt_preloaded_setup() { 1370218822Sdim return lt_${my_prefix}_LTX_preloaded_symbols; 1371218822Sdim} 1372218822Sdim#endif 1373218822Sdim 1374218822Sdim#ifdef __cplusplus 1375218822Sdim} 1376218822Sdim#endif\ 1377218822Sdim" 1378218822Sdim } # !$opt_dry_run 1379218822Sdim 1380218822Sdim pic_flag_for_symtable= 1381218822Sdim case "$compile_command " in 1382218822Sdim *" -static "*) ;; 1383218822Sdim *) 1384218822Sdim case $host in 1385218822Sdim # compiling the symbol table file with pic_flag works around 1386218822Sdim # a FreeBSD bug that causes programs to crash when -lm is 1387218822Sdim # linked before any other PIC object. But we must not use 1388218822Sdim # pic_flag when linking with -static. The problem exists in 1389218822Sdim # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 1390218822Sdim *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 1391218822Sdim pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 1392218822Sdim *-*-hpux*) 1393218822Sdim pic_flag_for_symtable=" $pic_flag" ;; 1394218822Sdim *) 1395218822Sdim if test "X$my_pic_p" != Xno; then 1396218822Sdim pic_flag_for_symtable=" $pic_flag" 1397218822Sdim fi 139877298Sobrien ;; 139977298Sobrien esac 1400218822Sdim ;; 1401218822Sdim esac 1402218822Sdim symtab_cflags= 1403218822Sdim for arg in $LTCFLAGS; do 1404218822Sdim case $arg in 1405218822Sdim -pie | -fpie | -fPIE) ;; 1406218822Sdim *) symtab_cflags="$symtab_cflags $arg" ;; 1407218822Sdim esac 140877298Sobrien done 140977298Sobrien 1410218822Sdim # Now compile the dynamic symbol file. 1411218822Sdim func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 1412218822Sdim 1413218822Sdim # Clean up the generated files. 1414218822Sdim func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 1415218822Sdim 1416218822Sdim # Transform the symbol file into the correct name. 1417218822Sdim symfileobj="$output_objdir/${my_outputname}S.$objext" 1418218822Sdim case $host in 1419218822Sdim *cygwin* | *mingw* ) 1420218822Sdim if test -f "$output_objdir/$my_outputname.def"; then 1421218822Sdim compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 1422218822Sdim finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 1423218822Sdim else 1424218822Sdim compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 1425218822Sdim finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 1426218822Sdim fi 1427218822Sdim ;; 1428218822Sdim *) 1429218822Sdim compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 1430218822Sdim finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 1431218822Sdim ;; 1432218822Sdim esac 143377298Sobrien ;; 1434218822Sdim *) 1435218822Sdim func_fatal_error "unknown suffix for \`$my_dlsyms'" 1436218822Sdim ;; 143738889Sjdp esac 1438218822Sdim else 1439218822Sdim # We keep going just in case the user didn't refer to 1440218822Sdim # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 1441218822Sdim # really was required. 144238889Sjdp 1443218822Sdim # Nullify the symbol file. 1444218822Sdim compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 1445218822Sdim finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 1446218822Sdim fi 1447218822Sdim} 1448218822Sdim 1449218822Sdim# func_extract_an_archive dir oldlib 1450218822Sdimfunc_extract_an_archive () 1451218822Sdim{ 1452218822Sdim $opt_debug 1453218822Sdim f_ex_an_ar_dir="$1"; shift 1454218822Sdim f_ex_an_ar_oldlib="$1" 1455218822Sdim func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" 'exit $?' 1456218822Sdim if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 1457218822Sdim : 1458218822Sdim else 1459218822Sdim func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1460218822Sdim fi 1461218822Sdim} 1462218822Sdim 1463218822Sdim 1464218822Sdim# func_extract_archives gentop oldlib ... 1465218822Sdimfunc_extract_archives () 1466218822Sdim{ 1467218822Sdim $opt_debug 1468218822Sdim my_gentop="$1"; shift 1469218822Sdim my_oldlibs=${1+"$@"} 1470218822Sdim my_oldobjs="" 1471218822Sdim my_xlib="" 1472218822Sdim my_xabs="" 1473218822Sdim my_xdir="" 1474218822Sdim 1475218822Sdim for my_xlib in $my_oldlibs; do 1476218822Sdim # Extract the objects. 1477218822Sdim case $my_xlib in 1478218822Sdim [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 1479218822Sdim *) my_xabs=`pwd`"/$my_xlib" ;; 1480218822Sdim esac 1481218822Sdim func_basename "$my_xlib" 1482218822Sdim my_xlib="$func_basename_result" 1483218822Sdim my_xlib_u=$my_xlib 1484218822Sdim while :; do 1485218822Sdim case " $extracted_archives " in 1486218822Sdim *" $my_xlib_u "*) 1487218822Sdim extracted_serial=`expr $extracted_serial + 1` 1488218822Sdim my_xlib_u=lt$extracted_serial-$my_xlib ;; 1489218822Sdim *) break ;; 1490218822Sdim esac 1491218822Sdim done 1492218822Sdim extracted_archives="$extracted_archives $my_xlib_u" 1493218822Sdim my_xdir="$my_gentop/$my_xlib_u" 1494218822Sdim 1495218822Sdim func_mkdir_p "$my_xdir" 1496218822Sdim 1497218822Sdim case $host in 1498218822Sdim *-darwin*) 1499218822Sdim func_echo "Extracting $my_xabs" 1500218822Sdim # Do not bother doing anything if just a dry run 1501218822Sdim $opt_dry_run || { 1502218822Sdim darwin_orig_dir=`pwd` 1503218822Sdim cd $my_xdir || exit $? 1504218822Sdim darwin_archive=$my_xabs 1505218822Sdim darwin_curdir=`pwd` 1506218822Sdim darwin_base_archive=`basename $darwin_archive` 1507218822Sdim darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 1508218822Sdim if test -n "$darwin_arches"; then 1509218822Sdim darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 1510218822Sdim darwin_arch= 1511218822Sdim func_echo "$darwin_base_archive has multiple architectures $darwin_arches" 1512218822Sdim for darwin_arch in $darwin_arches ; do 1513218822Sdim func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 1514218822Sdim lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 1515218822Sdim cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 1516218822Sdim func_extract_an_archive "`pwd`" "${darwin_base_archive}" 1517218822Sdim cd "$darwin_curdir" 1518218822Sdim $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 1519218822Sdim done # $darwin_arches 1520218822Sdim ## Okay now we've a bunch of thin objects, gotta fatten them up :) 1521218822Sdim darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 1522218822Sdim darwin_file= 1523218822Sdim darwin_files= 1524218822Sdim for darwin_file in $darwin_filelist; do 1525218822Sdim darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 1526218822Sdim lipo -create -output "$darwin_file" $darwin_files 1527218822Sdim done # $darwin_filelist 1528218822Sdim $RM -rf unfat-$$ 1529218822Sdim cd "$darwin_orig_dir" 1530218822Sdim else 1531218822Sdim cd $darwin_orig_dir 1532218822Sdim func_extract_an_archive "$my_xdir" "$my_xabs" 1533218822Sdim fi # $darwin_arches 1534218822Sdim } # !$opt_dry_run 153560484Sobrien ;; 1536218822Sdim *) 1537218822Sdim func_extract_an_archive "$my_xdir" "$my_xabs" 1538218822Sdim ;; 1539218822Sdim esac 1540218822Sdim my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 1541218822Sdim done 1542218822Sdim 1543218822Sdim func_extract_archives_result="$my_oldobjs" 1544218822Sdim} 1545218822Sdim 1546218822Sdim 1547218822Sdim 1548218822Sdim# func_write_libtool_object output_name pic_name nonpic_name 1549218822Sdim# Create a libtool object file (analogous to a ".la" file), 1550218822Sdim# but don't create it if we're doing a dry run. 1551218822Sdimfunc_write_libtool_object () 1552218822Sdim{ 1553218822Sdim write_libobj=${1} 1554218822Sdim if test "$build_libtool_libs" = yes; then 1555218822Sdim write_lobj=\'${2}\' 1556218822Sdim else 1557218822Sdim write_lobj=none 1558218822Sdim fi 1559218822Sdim 1560218822Sdim if test "$build_old_libs" = yes; then 1561218822Sdim write_oldobj=\'${3}\' 1562218822Sdim else 1563218822Sdim write_oldobj=none 1564218822Sdim fi 1565218822Sdim 1566218822Sdim $opt_dry_run || { 1567218822Sdim cat >${write_libobj}T <<EOF 1568218822Sdim# $write_libobj - a libtool object file 1569218822Sdim# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1570218822Sdim# 1571218822Sdim# Please DO NOT delete this file! 1572218822Sdim# It is necessary for linking the library. 1573218822Sdim 1574218822Sdim# Name of the PIC object. 1575218822Sdimpic_object=$write_lobj 1576218822Sdim 1577218822Sdim# Name of the non-PIC object 1578218822Sdimnon_pic_object=$write_oldobj 1579218822Sdim 1580218822SdimEOF 1581218822Sdim mv -f "${write_libobj}T" "${write_libobj}" 1582218822Sdim } 1583218822Sdim} 1584218822Sdim 1585218822Sdim# func_mode_compile arg... 1586218822Sdimfunc_mode_compile () 1587218822Sdim{ 1588218822Sdim $opt_debug 1589218822Sdim # Get the compilation command and the source file. 1590218822Sdim base_compile= 1591218822Sdim srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1592218822Sdim suppress_opt=yes 1593218822Sdim suppress_output= 1594218822Sdim arg_mode=normal 1595218822Sdim libobj= 1596218822Sdim later= 1597218822Sdim pie_flag= 1598218822Sdim 1599218822Sdim for arg 1600218822Sdim do 1601218822Sdim case $arg_mode in 1602218822Sdim arg ) 1603218822Sdim # do not "continue". Instead, add this to base_compile 1604218822Sdim lastarg="$arg" 1605218822Sdim arg_mode=normal 1606218822Sdim ;; 1607218822Sdim 1608218822Sdim target ) 160960484Sobrien libobj="$arg" 1610218822Sdim arg_mode=normal 161160484Sobrien continue 161260484Sobrien ;; 161360484Sobrien 1614218822Sdim normal ) 1615218822Sdim # Accept any command-line options. 1616218822Sdim case $arg in 1617218822Sdim -o) 1618218822Sdim test -n "$libobj" && \ 1619218822Sdim func_fatal_error "you cannot specify \`-o' more than once" 1620218822Sdim arg_mode=target 1621218822Sdim continue 1622218822Sdim ;; 162338889Sjdp 1624218822Sdim -pie | -fpie | -fPIE) 1625218822Sdim pie_flag="$pie_flag $arg" 1626218822Sdim continue 1627218822Sdim ;; 162838889Sjdp 1629218822Sdim -shared | -static | -prefer-pic | -prefer-non-pic) 1630218822Sdim later="$later $arg" 1631218822Sdim continue 1632218822Sdim ;; 163338889Sjdp 1634218822Sdim -no-suppress) 1635218822Sdim suppress_opt=no 1636218822Sdim continue 1637218822Sdim ;; 1638218822Sdim 1639218822Sdim -Xcompiler) 1640218822Sdim arg_mode=arg # the next one goes into the "base_compile" arg list 1641218822Sdim continue # The current "srcfile" will either be retained or 1642218822Sdim ;; # replaced later. I would guess that would be a bug. 1643218822Sdim 1644218822Sdim -Wc,*) 1645218822Sdim func_stripname '-Wc,' '' "$arg" 1646218822Sdim args=$func_stripname_result 1647218822Sdim lastarg= 1648218822Sdim save_ifs="$IFS"; IFS=',' 1649218822Sdim for arg in $args; do 1650218822Sdim IFS="$save_ifs" 1651218822Sdim func_quote_for_eval "$arg" 1652218822Sdim lastarg="$lastarg $func_quote_for_eval_result" 1653218822Sdim done 1654218822Sdim IFS="$save_ifs" 1655218822Sdim func_stripname ' ' '' "$lastarg" 1656218822Sdim lastarg=$func_stripname_result 1657218822Sdim 1658218822Sdim # Add the arguments to base_compile. 1659218822Sdim base_compile="$base_compile $lastarg" 1660218822Sdim continue 1661218822Sdim ;; 1662218822Sdim 1663218822Sdim *) 1664218822Sdim # Accept the current argument as the source file. 1665218822Sdim # The previous "srcfile" becomes the current argument. 1666218822Sdim # 1667218822Sdim lastarg="$srcfile" 1668218822Sdim srcfile="$arg" 1669218822Sdim ;; 1670218822Sdim esac # case $arg 167138889Sjdp ;; 1672218822Sdim esac # case $arg_mode 167338889Sjdp 1674218822Sdim # Aesthetically quote the previous argument. 1675218822Sdim func_quote_for_eval "$lastarg" 1676218822Sdim base_compile="$base_compile $func_quote_for_eval_result" 1677218822Sdim done # for arg 167838889Sjdp 1679218822Sdim case $arg_mode in 1680218822Sdim arg) 1681218822Sdim func_fatal_error "you must specify an argument for -Xcompile" 168260484Sobrien ;; 1683218822Sdim target) 1684218822Sdim func_fatal_error "you must specify a target with \`-o'" 168560484Sobrien ;; 168660484Sobrien *) 1687218822Sdim # Get the name of the library object. 1688218822Sdim test -z "$libobj" && { 1689218822Sdim func_basename "$srcfile" 1690218822Sdim libobj="$func_basename_result" 1691218822Sdim } 169260484Sobrien ;; 169360484Sobrien esac 169438889Sjdp 169538889Sjdp # Recognize several different file suffixes. 169660484Sobrien # If the user specifies -o file.o, it is replaced with file.lo 1697218822Sdim xform='[cCFSifmso]' 169889857Sobrien case $libobj in 169938889Sjdp *.ada) xform=ada ;; 170038889Sjdp *.adb) xform=adb ;; 170138889Sjdp *.ads) xform=ads ;; 170238889Sjdp *.asm) xform=asm ;; 170338889Sjdp *.c++) xform=c++ ;; 170438889Sjdp *.cc) xform=cc ;; 1705218822Sdim *.ii) xform=ii ;; 170677298Sobrien *.class) xform=class ;; 170738889Sjdp *.cpp) xform=cpp ;; 170838889Sjdp *.cxx) xform=cxx ;; 1709218822Sdim *.[fF][09]?) xform='[fF][09].' ;; 171038889Sjdp *.for) xform=for ;; 171177298Sobrien *.java) xform=java ;; 1712218822Sdim *.obj) xform=obj ;; 171338889Sjdp esac 171438889Sjdp 1715218822Sdim libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 171638889Sjdp 171789857Sobrien case $libobj in 1718218822Sdim *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 171938889Sjdp *) 1720218822Sdim func_fatal_error "cannot determine name of library object from \`$libobj'" 172138889Sjdp ;; 172238889Sjdp esac 172338889Sjdp 1724218822Sdim func_infer_tag $base_compile 1725218822Sdim 1726218822Sdim for arg in $later; do 1727218822Sdim case $arg in 1728218822Sdim -shared) 1729218822Sdim test "$build_libtool_libs" != yes && \ 1730218822Sdim func_fatal_configuration "can not build a shared library" 1731218822Sdim build_old_libs=no 1732218822Sdim continue 173377298Sobrien ;; 1734218822Sdim 1735218822Sdim -static) 1736218822Sdim build_libtool_libs=no 1737218822Sdim build_old_libs=yes 1738218822Sdim continue 1739218822Sdim ;; 1740218822Sdim 1741218822Sdim -prefer-pic) 1742218822Sdim pic_mode=yes 1743218822Sdim continue 1744218822Sdim ;; 1745218822Sdim 1746218822Sdim -prefer-non-pic) 1747218822Sdim pic_mode=no 1748218822Sdim continue 1749218822Sdim ;; 175077298Sobrien esac 1751218822Sdim done 175277298Sobrien 1753218822Sdim func_quote_for_eval "$libobj" 1754218822Sdim test "X$libobj" != "X$func_quote_for_eval_result" \ 1755218822Sdim && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 1756218822Sdim && func_warning "libobj name \`$libobj' may not contain shell special characters." 1757218822Sdim func_basename "$obj" 1758218822Sdim objname="$func_basename_result" 1759218822Sdim func_dirname "$obj" "/" "" 1760218822Sdim xdir="$func_dirname_result" 176177298Sobrien lobj=${xdir}$objdir/$objname 176277298Sobrien 1763218822Sdim test -z "$base_compile" && \ 1764218822Sdim func_fatal_help "you must specify a compilation command" 176538889Sjdp 176638889Sjdp # Delete any leftover library objects. 176738889Sjdp if test "$build_old_libs" = yes; then 176877298Sobrien removelist="$obj $lobj $libobj ${libobj}T" 176938889Sjdp else 177077298Sobrien removelist="$lobj $libobj ${libobj}T" 177138889Sjdp fi 177238889Sjdp 1773218822Sdim $opt_dry_run || $RM $removelist 1774218822Sdim trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15 177560484Sobrien 177677298Sobrien # On Cygwin there's no "real" PIC flag so we must build both object types 177789857Sobrien case $host_os in 177877298Sobrien cygwin* | mingw* | pw32* | os2*) 177977298Sobrien pic_mode=default 178077298Sobrien ;; 178177298Sobrien esac 1782218822Sdim if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 178377298Sobrien # non-PIC code in shared libraries is not supported 178477298Sobrien pic_mode=default 178577298Sobrien fi 178677298Sobrien 178760484Sobrien # Calculate the filename of the output object if compiler does 178860484Sobrien # not support -o with -c 178960484Sobrien if test "$compiler_c_o" = no; then 1790218822Sdim output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 179160484Sobrien lockfile="$output_obj.lock" 179260484Sobrien removelist="$removelist $output_obj $lockfile" 1793218822Sdim trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15 179460484Sobrien else 179577298Sobrien output_obj= 179660484Sobrien need_locks=no 179760484Sobrien lockfile= 179860484Sobrien fi 179960484Sobrien 180060484Sobrien # Lock this critical section if it is needed 180160484Sobrien # We use this script file to make the link, it avoids creating a new file 180260484Sobrien if test "$need_locks" = yes; then 1803218822Sdim until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 1804218822Sdim func_echo "Waiting for $lockfile to be removed" 180560484Sobrien sleep 2 180660484Sobrien done 180760484Sobrien elif test "$need_locks" = warn; then 180860484Sobrien if test -f "$lockfile"; then 1809218822Sdim $ECHO "\ 181060484Sobrien*** ERROR, $lockfile exists and contains: 181160484Sobrien`cat $lockfile 2>/dev/null` 181260484Sobrien 181360484SobrienThis indicates that another process is trying to use the same 181460484Sobrientemporary object file, and libtool could not work around it because 181560484Sobrienyour compiler does not support \`-c' and \`-o' together. If you 181660484Sobrienrepeat this compilation, it may succeed, by chance, but you had better 181760484Sobrienavoid parallel builds (make -j) in this platform, or get a better 181860484Sobriencompiler." 181960484Sobrien 1820218822Sdim $opt_dry_run || $RM $removelist 1821218822Sdim exit $EXIT_FAILURE 182260484Sobrien fi 1823218822Sdim $ECHO "$srcfile" > "$lockfile" 182460484Sobrien fi 182560484Sobrien 182660484Sobrien if test -n "$fix_srcfile_path"; then 182760484Sobrien eval srcfile=\"$fix_srcfile_path\" 182860484Sobrien fi 1829218822Sdim func_quote_for_eval "$srcfile" 1830218822Sdim qsrcfile=$func_quote_for_eval_result 183160484Sobrien 1832218822Sdim $opt_dry_run || $RM "$libobj" "${libobj}T" 183377298Sobrien 183438889Sjdp # Only build a PIC object if we are building libtool libraries. 183538889Sjdp if test "$build_libtool_libs" = yes; then 183638889Sjdp # Without this assignment, base_compile gets emptied. 183738889Sjdp fbsd_hideous_sh_bug=$base_compile 183838889Sjdp 183977298Sobrien if test "$pic_mode" != no; then 1840218822Sdim command="$base_compile $qsrcfile $pic_flag" 184177298Sobrien else 184277298Sobrien # Don't build PIC code 1843218822Sdim command="$base_compile $qsrcfile" 184477298Sobrien fi 184560484Sobrien 1846218822Sdim func_mkdir_p "$xdir$objdir" 184777298Sobrien 184877298Sobrien if test -z "$output_obj"; then 1849218822Sdim # Place PIC objects in $objdir 1850218822Sdim command="$command -o $lobj" 185160484Sobrien fi 185260484Sobrien 1853218822Sdim $opt_dry_run || $RM "$lobj" "$output_obj" 185477298Sobrien 1855218822Sdim func_show_eval "$command" \ 1856218822Sdim 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 185738889Sjdp 185860484Sobrien if test "$need_locks" = warn && 1859218822Sdim test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1860218822Sdim $ECHO "\ 186160484Sobrien*** ERROR, $lockfile contains: 186260484Sobrien`cat $lockfile 2>/dev/null` 186360484Sobrien 186460484Sobrienbut it should contain: 186560484Sobrien$srcfile 186660484Sobrien 186760484SobrienThis indicates that another process is trying to use the same 186860484Sobrientemporary object file, and libtool could not work around it because 186960484Sobrienyour compiler does not support \`-c' and \`-o' together. If you 187060484Sobrienrepeat this compilation, it may succeed, by chance, but you had better 187160484Sobrienavoid parallel builds (make -j) in this platform, or get a better 187260484Sobriencompiler." 187360484Sobrien 1874218822Sdim $opt_dry_run || $RM $removelist 1875218822Sdim exit $EXIT_FAILURE 187660484Sobrien fi 187760484Sobrien 187860484Sobrien # Just move the object if needed, then go on to compile the next one 1879218822Sdim if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 1880218822Sdim func_show_eval '$MV "$output_obj" "$lobj"' \ 1881218822Sdim 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 188260484Sobrien fi 188360484Sobrien 188438889Sjdp # Allow error messages only from the first compilation. 1885218822Sdim if test "$suppress_opt" = yes; then 1886218822Sdim suppress_output=' >/dev/null 2>&1' 1887218822Sdim fi 188838889Sjdp fi 188938889Sjdp 189038889Sjdp # Only build a position-dependent object if we build old libraries. 189138889Sjdp if test "$build_old_libs" = yes; then 189277298Sobrien if test "$pic_mode" != yes; then 189377298Sobrien # Don't build PIC code 1894218822Sdim command="$base_compile $qsrcfile$pie_flag" 189577298Sobrien else 1896218822Sdim command="$base_compile $qsrcfile $pic_flag" 189777298Sobrien fi 189860484Sobrien if test "$compiler_c_o" = yes; then 189960484Sobrien command="$command -o $obj" 190060484Sobrien fi 190160484Sobrien 190238889Sjdp # Suppress compiler output if we already did a PIC compilation. 190360484Sobrien command="$command$suppress_output" 1904218822Sdim $opt_dry_run || $RM "$obj" "$output_obj" 1905218822Sdim func_show_eval "$command" \ 1906218822Sdim '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 190760484Sobrien 190860484Sobrien if test "$need_locks" = warn && 1909218822Sdim test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1910218822Sdim $ECHO "\ 191160484Sobrien*** ERROR, $lockfile contains: 191260484Sobrien`cat $lockfile 2>/dev/null` 191360484Sobrien 191460484Sobrienbut it should contain: 191560484Sobrien$srcfile 191660484Sobrien 191760484SobrienThis indicates that another process is trying to use the same 191860484Sobrientemporary object file, and libtool could not work around it because 191960484Sobrienyour compiler does not support \`-c' and \`-o' together. If you 192060484Sobrienrepeat this compilation, it may succeed, by chance, but you had better 192160484Sobrienavoid parallel builds (make -j) in this platform, or get a better 192260484Sobriencompiler." 192360484Sobrien 1924218822Sdim $opt_dry_run || $RM $removelist 1925218822Sdim exit $EXIT_FAILURE 192660484Sobrien fi 192760484Sobrien 192860484Sobrien # Just move the object if needed 1929218822Sdim if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1930218822Sdim func_show_eval '$MV "$output_obj" "$obj"' \ 1931218822Sdim 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1932218822Sdim fi 1933218822Sdim fi 1934218822Sdim 1935218822Sdim $opt_dry_run || { 1936218822Sdim func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 1937218822Sdim 1938218822Sdim # Unlock the critical section if it was locked 1939218822Sdim if test "$need_locks" != no; then 1940218822Sdim $RM "$lockfile" 1941218822Sdim fi 1942218822Sdim } 1943218822Sdim 1944218822Sdim exit $EXIT_SUCCESS 1945218822Sdim} 1946218822Sdim 1947218822Sdimtest "$mode" = compile && func_mode_compile ${1+"$@"} 1948218822Sdim 1949218822Sdim 1950218822Sdim# func_mode_execute arg... 1951218822Sdimfunc_mode_execute () 1952218822Sdim{ 1953218822Sdim $opt_debug 1954218822Sdim # The first argument is the command name. 1955218822Sdim cmd="$nonopt" 1956218822Sdim test -z "$cmd" && \ 1957218822Sdim func_fatal_help "you must specify a COMMAND" 1958218822Sdim 1959218822Sdim # Handle -dlopen flags immediately. 1960218822Sdim for file in $execute_dlfiles; do 1961218822Sdim test -f "$file" \ 1962218822Sdim || func_fatal_help "\`$file' is not a file" 1963218822Sdim 1964218822Sdim dir= 1965218822Sdim case $file in 1966218822Sdim *.la) 1967218822Sdim # Check to see that this really is a libtool archive. 1968218822Sdim func_lalib_unsafe_p "$file" \ 1969218822Sdim || func_fatal_help "\`$lib' is not a valid libtool archive" 1970218822Sdim 1971218822Sdim # Read the libtool library. 1972218822Sdim dlname= 1973218822Sdim library_names= 1974218822Sdim func_source "$file" 1975218822Sdim 1976218822Sdim # Skip this library if it cannot be dlopened. 1977218822Sdim if test -z "$dlname"; then 1978218822Sdim # Warn if it was a shared library. 1979218822Sdim test -n "$library_names" && \ 1980218822Sdim func_warning "\`$file' was not linked with \`-export-dynamic'" 1981218822Sdim continue 1982218822Sdim fi 1983218822Sdim 1984218822Sdim func_dirname "$file" "" "." 1985218822Sdim dir="$func_dirname_result" 1986218822Sdim 1987218822Sdim if test -f "$dir/$objdir/$dlname"; then 1988218822Sdim dir="$dir/$objdir" 198960484Sobrien else 1990218822Sdim if test ! -f "$dir/$dlname"; then 1991218822Sdim func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1992218822Sdim fi 199360484Sobrien fi 1994218822Sdim ;; 1995218822Sdim 1996218822Sdim *.lo) 1997218822Sdim # Just add the directory containing the .lo file. 1998218822Sdim func_dirname "$file" "" "." 1999218822Sdim dir="$func_dirname_result" 2000218822Sdim ;; 2001218822Sdim 2002218822Sdim *) 2003218822Sdim func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 2004218822Sdim continue 2005218822Sdim ;; 2006218822Sdim esac 2007218822Sdim 2008218822Sdim # Get the absolute pathname. 2009218822Sdim absdir=`cd "$dir" && pwd` 2010218822Sdim test -n "$absdir" && dir="$absdir" 2011218822Sdim 2012218822Sdim # Now add the directory to shlibpath_var. 2013218822Sdim if eval "test -z \"\$$shlibpath_var\""; then 2014218822Sdim eval "$shlibpath_var=\"\$dir\"" 2015218822Sdim else 2016218822Sdim eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 201760484Sobrien fi 2018218822Sdim done 201960484Sobrien 2020218822Sdim # This variable tells wrapper scripts just to set shlibpath_var 2021218822Sdim # rather than running their programs. 2022218822Sdim libtool_execute_magic="$magic" 202377298Sobrien 2024218822Sdim # Check if any of the arguments is a wrapper script. 2025218822Sdim args= 2026218822Sdim for file 2027218822Sdim do 2028218822Sdim case $file in 2029218822Sdim -*) ;; 2030218822Sdim *) 2031218822Sdim # Do a test to see if this is really a libtool program. 2032218822Sdim if func_ltwrapper_p "$file"; then 2033218822Sdim func_source "$file" 2034218822Sdim 2035218822Sdim # Transform arg to wrapped name. 2036218822Sdim file="$progdir/$program" 2037218822Sdim fi 2038218822Sdim ;; 2039218822Sdim esac 2040218822Sdim # Quote arguments (to preserve shell metacharacters). 2041218822Sdim func_quote_for_eval "$file" 2042218822Sdim args="$args $func_quote_for_eval_result" 2043218822Sdim done 2044218822Sdim 2045218822Sdim if test "X$opt_dry_run" = Xfalse; then 2046218822Sdim if test -n "$shlibpath_var"; then 2047218822Sdim # Export the shlibpath_var. 2048218822Sdim eval "export $shlibpath_var" 2049218822Sdim fi 2050218822Sdim 2051218822Sdim # Restore saved environment variables 2052218822Sdim for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 2053218822Sdim do 2054218822Sdim eval "if test \"\${save_$lt_var+set}\" = set; then 2055218822Sdim $lt_var=\$save_$lt_var; export $lt_var 2056218822Sdim else 2057218822Sdim $lt_unset $lt_var 2058218822Sdim fi" 2059218822Sdim done 2060218822Sdim 2061218822Sdim # Now prepare to actually exec the command. 2062218822Sdim exec_cmd="\$cmd$args" 206377298Sobrien else 2064218822Sdim # Display what would be done. 2065218822Sdim if test -n "$shlibpath_var"; then 2066218822Sdim eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 2067218822Sdim $ECHO "export $shlibpath_var" 2068218822Sdim fi 2069218822Sdim $ECHO "$cmd$args" 2070218822Sdim exit $EXIT_SUCCESS 2071218822Sdim fi 2072218822Sdim} 207377298Sobrien 2074218822Sdimtest "$mode" = execute && func_mode_execute ${1+"$@"} 2075218822Sdim 2076218822Sdim 2077218822Sdim# func_mode_finish arg... 2078218822Sdimfunc_mode_finish () 2079218822Sdim{ 2080218822Sdim $opt_debug 2081218822Sdim libdirs="$nonopt" 2082218822Sdim admincmds= 2083218822Sdim 2084218822Sdim if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2085218822Sdim for dir 2086218822Sdim do 2087218822Sdim libdirs="$libdirs $dir" 2088218822Sdim done 2089218822Sdim 2090218822Sdim for libdir in $libdirs; do 2091218822Sdim if test -n "$finish_cmds"; then 2092218822Sdim # Do each command in the finish commands. 2093218822Sdim func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 2094218822Sdim'"$cmd"'"' 2095218822Sdim fi 2096218822Sdim if test -n "$finish_eval"; then 2097218822Sdim # Do the single finish_eval. 2098218822Sdim eval cmds=\"$finish_eval\" 2099218822Sdim $opt_dry_run || eval "$cmds" || admincmds="$admincmds 2100218822Sdim $cmds" 2101218822Sdim fi 2102218822Sdim done 210338889Sjdp fi 210438889Sjdp 2105218822Sdim # Exit here if they wanted silent mode. 2106218822Sdim $opt_silent && exit $EXIT_SUCCESS 210777298Sobrien 2108218822Sdim $ECHO "X----------------------------------------------------------------------" | $Xsed 2109218822Sdim $ECHO "Libraries have been installed in:" 2110218822Sdim for libdir in $libdirs; do 2111218822Sdim $ECHO " $libdir" 2112218822Sdim done 2113218822Sdim $ECHO 2114218822Sdim $ECHO "If you ever happen to want to link against installed libraries" 2115218822Sdim $ECHO "in a given directory, LIBDIR, you must either use libtool, and" 2116218822Sdim $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" 2117218822Sdim $ECHO "flag during linking and do at least one of the following:" 2118218822Sdim if test -n "$shlibpath_var"; then 2119218822Sdim $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" 2120218822Sdim $ECHO " during execution" 212138889Sjdp fi 2122218822Sdim if test -n "$runpath_var"; then 2123218822Sdim $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" 2124218822Sdim $ECHO " during linking" 2125218822Sdim fi 2126218822Sdim if test -n "$hardcode_libdir_flag_spec"; then 2127218822Sdim libdir=LIBDIR 2128218822Sdim eval flag=\"$hardcode_libdir_flag_spec\" 212938889Sjdp 2130218822Sdim $ECHO " - use the \`$flag' linker flag" 2131218822Sdim fi 2132218822Sdim if test -n "$admincmds"; then 2133218822Sdim $ECHO " - have your system administrator run these commands:$admincmds" 2134218822Sdim fi 2135218822Sdim if test -f /etc/ld.so.conf; then 2136218822Sdim $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 2137218822Sdim fi 2138218822Sdim $ECHO 213938889Sjdp 2140218822Sdim $ECHO "See any operating system documentation about shared libraries for" 214189857Sobrien case $host in 2142218822Sdim solaris2.[6789]|solaris2.1[0-9]) 2143218822Sdim $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" 2144218822Sdim $ECHO "pages." 2145218822Sdim ;; 2146218822Sdim *) 2147218822Sdim $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." 2148218822Sdim ;; 2149218822Sdim esac 2150218822Sdim $ECHO "X----------------------------------------------------------------------" | $Xsed 2151218822Sdim exit $EXIT_SUCCESS 2152218822Sdim} 2153218822Sdim 2154218822Sdimtest "$mode" = finish && func_mode_finish ${1+"$@"} 2155218822Sdim 2156218822Sdim 2157218822Sdim# func_mode_install arg... 2158218822Sdimfunc_mode_install () 2159218822Sdim{ 2160218822Sdim $opt_debug 2161218822Sdim # There may be an optional sh(1) argument at the beginning of 2162218822Sdim # install_prog (especially on Windows NT). 2163218822Sdim if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 2164218822Sdim # Allow the use of GNU shtool's install command. 2165218822Sdim $ECHO "X$nonopt" | $GREP shtool >/dev/null; then 2166218822Sdim # Aesthetically quote it. 2167218822Sdim func_quote_for_eval "$nonopt" 2168218822Sdim install_prog="$func_quote_for_eval_result " 2169218822Sdim arg=$1 2170218822Sdim shift 2171218822Sdim else 2172218822Sdim install_prog= 2173218822Sdim arg=$nonopt 2174218822Sdim fi 2175218822Sdim 2176218822Sdim # The real first argument should be the name of the installation program. 2177218822Sdim # Aesthetically quote it. 2178218822Sdim func_quote_for_eval "$arg" 2179218822Sdim install_prog="$install_prog$func_quote_for_eval_result" 2180218822Sdim 2181218822Sdim # We need to accept at least all the BSD install flags. 2182218822Sdim dest= 2183218822Sdim files= 2184218822Sdim opts= 2185218822Sdim prev= 2186218822Sdim install_type= 2187218822Sdim isdir=no 2188218822Sdim stripme= 2189218822Sdim for arg 2190218822Sdim do 2191218822Sdim if test -n "$dest"; then 2192218822Sdim files="$files $dest" 2193218822Sdim dest=$arg 2194218822Sdim continue 2195218822Sdim fi 2196218822Sdim 2197218822Sdim case $arg in 2198218822Sdim -d) isdir=yes ;; 2199218822Sdim -f) 2200218822Sdim case " $install_prog " in 2201218822Sdim *[\\\ /]cp\ *) ;; 2202218822Sdim *) prev=$arg ;; 2203218822Sdim esac 2204218822Sdim ;; 2205218822Sdim -g | -m | -o) 2206218822Sdim prev=$arg 2207218822Sdim ;; 2208218822Sdim -s) 2209218822Sdim stripme=" -s" 2210218822Sdim continue 2211218822Sdim ;; 2212218822Sdim -*) 2213218822Sdim ;; 2214218822Sdim *) 2215218822Sdim # If the previous option needed an argument, then skip it. 2216218822Sdim if test -n "$prev"; then 2217218822Sdim prev= 2218218822Sdim else 2219218822Sdim dest=$arg 2220218822Sdim continue 2221218822Sdim fi 2222218822Sdim ;; 2223218822Sdim esac 2224218822Sdim 2225218822Sdim # Aesthetically quote the argument. 2226218822Sdim func_quote_for_eval "$arg" 2227218822Sdim install_prog="$install_prog $func_quote_for_eval_result" 2228218822Sdim done 2229218822Sdim 2230218822Sdim test -z "$install_prog" && \ 2231218822Sdim func_fatal_help "you must specify an install program" 2232218822Sdim 2233218822Sdim test -n "$prev" && \ 2234218822Sdim func_fatal_help "the \`$prev' option requires an argument" 2235218822Sdim 2236218822Sdim if test -z "$files"; then 2237218822Sdim if test -z "$dest"; then 2238218822Sdim func_fatal_help "no file or destination specified" 2239218822Sdim else 2240218822Sdim func_fatal_help "you must specify a destination" 2241218822Sdim fi 2242218822Sdim fi 2243218822Sdim 2244218822Sdim # Strip any trailing slash from the destination. 2245218822Sdim func_stripname '' '/' "$dest" 2246218822Sdim dest=$func_stripname_result 2247218822Sdim 2248218822Sdim # Check to see that the destination is a directory. 2249218822Sdim test -d "$dest" && isdir=yes 2250218822Sdim if test "$isdir" = yes; then 2251218822Sdim destdir="$dest" 2252218822Sdim destname= 2253218822Sdim else 2254218822Sdim func_dirname "$dest" "" "." 2255218822Sdim destdir="$func_dirname_result" 2256218822Sdim func_basename "$dest" 2257218822Sdim destname="$func_basename_result" 2258218822Sdim 2259218822Sdim # Not a directory, so check to see that there is only one file specified. 2260218822Sdim set dummy $files; shift 2261218822Sdim test "$#" -gt 1 && \ 2262218822Sdim func_fatal_help "\`$dest' is not a directory" 2263218822Sdim fi 2264218822Sdim case $destdir in 2265218822Sdim [\\/]* | [A-Za-z]:[\\/]*) ;; 2266218822Sdim *) 2267218822Sdim for file in $files; do 2268218822Sdim case $file in 2269218822Sdim *.lo) ;; 2270218822Sdim *) 2271218822Sdim func_fatal_help "\`$destdir' must be an absolute directory name" 2272218822Sdim ;; 2273218822Sdim esac 2274218822Sdim done 2275218822Sdim ;; 2276218822Sdim esac 2277218822Sdim 2278218822Sdim # This variable tells wrapper scripts just to set variables rather 2279218822Sdim # than running their programs. 2280218822Sdim libtool_install_magic="$magic" 2281218822Sdim 2282218822Sdim staticlibs= 2283218822Sdim future_libdirs= 2284218822Sdim current_libdirs= 2285218822Sdim for file in $files; do 2286218822Sdim 2287218822Sdim # Do each installation. 2288218822Sdim case $file in 2289218822Sdim *.$libext) 2290218822Sdim # Do the static libraries later. 2291218822Sdim staticlibs="$staticlibs $file" 2292218822Sdim ;; 2293218822Sdim 2294218822Sdim *.la) 2295218822Sdim # Check to see that this really is a libtool archive. 2296218822Sdim func_lalib_unsafe_p "$file" \ 2297218822Sdim || func_fatal_help "\`$file' is not a valid libtool archive" 2298218822Sdim 2299218822Sdim library_names= 2300218822Sdim old_library= 2301218822Sdim relink_command= 2302218822Sdim func_source "$file" 2303218822Sdim 2304218822Sdim # Add the libdir to current_libdirs if it is the destination. 2305218822Sdim if test "X$destdir" = "X$libdir"; then 2306218822Sdim case "$current_libdirs " in 2307218822Sdim *" $libdir "*) ;; 2308218822Sdim *) current_libdirs="$current_libdirs $libdir" ;; 2309218822Sdim esac 2310218822Sdim else 2311218822Sdim # Note the libdir as a future libdir. 2312218822Sdim case "$future_libdirs " in 2313218822Sdim *" $libdir "*) ;; 2314218822Sdim *) future_libdirs="$future_libdirs $libdir" ;; 2315218822Sdim esac 2316218822Sdim fi 2317218822Sdim 2318218822Sdim func_dirname "$file" "/" "" 2319218822Sdim dir="$func_dirname_result" 2320218822Sdim dir="$dir$objdir" 2321218822Sdim 2322218822Sdim if test -n "$relink_command"; then 2323218822Sdim # Determine the prefix the user has applied to our future dir. 2324218822Sdim inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` 2325218822Sdim 2326218822Sdim # Don't allow the user to place us outside of our expected 2327218822Sdim # location b/c this prevents finding dependent libraries that 2328218822Sdim # are installed to the same prefix. 2329218822Sdim # At present, this check doesn't affect windows .dll's that 2330218822Sdim # are installed into $libdir/../bin (currently, that works fine) 2331218822Sdim # but it's something to keep an eye on. 2332218822Sdim test "$inst_prefix_dir" = "$destdir" && \ 2333218822Sdim func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2334218822Sdim 2335218822Sdim if test -n "$inst_prefix_dir"; then 2336218822Sdim # Stick the inst_prefix_dir data into the link command. 2337218822Sdim relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2338218822Sdim else 2339218822Sdim relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` 2340218822Sdim fi 2341218822Sdim 2342218822Sdim func_warning "relinking \`$file'" 2343218822Sdim func_show_eval "$relink_command" \ 2344218822Sdim 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2345218822Sdim fi 2346218822Sdim 2347218822Sdim # See the names of the shared library. 2348218822Sdim set dummy $library_names; shift 2349218822Sdim if test -n "$1"; then 2350218822Sdim realname="$1" 2351218822Sdim shift 2352218822Sdim 2353218822Sdim srcname="$realname" 2354218822Sdim test -n "$relink_command" && srcname="$realname"T 2355218822Sdim 2356218822Sdim # Install the shared library and build the symlinks. 2357218822Sdim func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 2358218822Sdim 'exit $?' 2359218822Sdim tstripme="$stripme" 2360218822Sdim case $host_os in 2361218822Sdim cygwin* | mingw* | pw32*) 2362218822Sdim case $realname in 2363218822Sdim *.dll.a) 2364218822Sdim tstripme="" 2365218822Sdim ;; 2366218822Sdim esac 2367218822Sdim ;; 2368218822Sdim esac 2369218822Sdim if test -n "$tstripme" && test -n "$striplib"; then 2370218822Sdim func_show_eval "$striplib $destdir/$realname" 'exit $?' 2371218822Sdim fi 2372218822Sdim 2373218822Sdim if test "$#" -gt 0; then 2374218822Sdim # Delete the old symlinks, and create new ones. 2375218822Sdim # Try `ln -sf' first, because the `ln' binary might depend on 2376218822Sdim # the symlink we replace! Solaris /bin/ln does not understand -f, 2377218822Sdim # so we also need to try rm && ln -s. 2378218822Sdim for linkname 2379218822Sdim do 2380218822Sdim test "$linkname" != "$realname" \ 2381218822Sdim && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 2382218822Sdim done 2383218822Sdim fi 2384218822Sdim 2385218822Sdim # Do each command in the postinstall commands. 2386218822Sdim lib="$destdir/$realname" 2387218822Sdim func_execute_cmds "$postinstall_cmds" 'exit $?' 2388218822Sdim fi 2389218822Sdim 2390218822Sdim # Install the pseudo-library for information purposes. 2391218822Sdim func_basename "$file" 2392218822Sdim name="$func_basename_result" 2393218822Sdim instname="$dir/$name"i 2394218822Sdim func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 2395218822Sdim 2396218822Sdim # Maybe install the static library, too. 2397218822Sdim test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 2398218822Sdim ;; 2399218822Sdim 2400218822Sdim *.lo) 2401218822Sdim # Install (i.e. copy) a libtool object. 2402218822Sdim 2403218822Sdim # Figure out destination file name, if it wasn't already specified. 2404218822Sdim if test -n "$destname"; then 2405218822Sdim destfile="$destdir/$destname" 2406218822Sdim else 2407218822Sdim func_basename "$file" 2408218822Sdim destfile="$func_basename_result" 2409218822Sdim destfile="$destdir/$destfile" 2410218822Sdim fi 2411218822Sdim 2412218822Sdim # Deduce the name of the destination old-style object file. 2413218822Sdim case $destfile in 2414218822Sdim *.lo) 2415218822Sdim func_lo2o "$destfile" 2416218822Sdim staticdest=$func_lo2o_result 2417218822Sdim ;; 2418218822Sdim *.$objext) 2419218822Sdim staticdest="$destfile" 2420218822Sdim destfile= 2421218822Sdim ;; 2422218822Sdim *) 2423218822Sdim func_fatal_help "cannot copy a libtool object to \`$destfile'" 2424218822Sdim ;; 2425218822Sdim esac 2426218822Sdim 2427218822Sdim # Install the libtool object if requested. 2428218822Sdim test -n "$destfile" && \ 2429218822Sdim func_show_eval "$install_prog $file $destfile" 'exit $?' 2430218822Sdim 2431218822Sdim # Install the old object if enabled. 2432218822Sdim if test "$build_old_libs" = yes; then 2433218822Sdim # Deduce the name of the old-style object file. 2434218822Sdim func_lo2o "$file" 2435218822Sdim staticobj=$func_lo2o_result 2436218822Sdim func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 2437218822Sdim fi 2438218822Sdim exit $EXIT_SUCCESS 2439218822Sdim ;; 2440218822Sdim 2441218822Sdim *) 2442218822Sdim # Figure out destination file name, if it wasn't already specified. 2443218822Sdim if test -n "$destname"; then 2444218822Sdim destfile="$destdir/$destname" 2445218822Sdim else 2446218822Sdim func_basename "$file" 2447218822Sdim destfile="$func_basename_result" 2448218822Sdim destfile="$destdir/$destfile" 2449218822Sdim fi 2450218822Sdim 2451218822Sdim # If the file is missing, and there is a .exe on the end, strip it 2452218822Sdim # because it is most likely a libtool script we actually want to 2453218822Sdim # install 2454218822Sdim stripped_ext="" 2455218822Sdim case $file in 2456218822Sdim *.exe) 2457218822Sdim if test ! -f "$file"; then 2458218822Sdim func_stripname '' '.exe' "$file" 2459218822Sdim file=$func_stripname_result 2460218822Sdim stripped_ext=".exe" 2461218822Sdim fi 2462218822Sdim ;; 2463218822Sdim esac 2464218822Sdim 2465218822Sdim # Do a test to see if this is really a libtool program. 2466218822Sdim case $host in 2467218822Sdim *cygwin*|*mingw*) 2468218822Sdim func_stripname '' '.exe' "$file" 2469218822Sdim wrapper=$func_stripname_result 2470218822Sdim ;; 2471218822Sdim *) 2472218822Sdim wrapper=$file 2473218822Sdim ;; 2474218822Sdim esac 2475218822Sdim if func_ltwrapper_p "$wrapper"; then 2476218822Sdim notinst_deplibs= 2477218822Sdim relink_command= 2478218822Sdim 2479218822Sdim func_source "$wrapper" 2480218822Sdim 2481218822Sdim # Check the variables that should have been set. 2482218822Sdim test -z "$generated_by_libtool_version" && \ 2483218822Sdim func_fatal_error "invalid libtool wrapper script \`$wrapper'" 2484218822Sdim 2485218822Sdim finalize=yes 2486218822Sdim for lib in $notinst_deplibs; do 2487218822Sdim # Check to see that each library is installed. 2488218822Sdim libdir= 2489218822Sdim if test -f "$lib"; then 2490218822Sdim func_source "$lib" 2491218822Sdim fi 2492218822Sdim libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 2493218822Sdim if test -n "$libdir" && test ! -f "$libfile"; then 2494218822Sdim func_warning "\`$lib' has not been installed in \`$libdir'" 2495218822Sdim finalize=no 2496218822Sdim fi 2497218822Sdim done 2498218822Sdim 2499218822Sdim relink_command= 2500218822Sdim func_source "$wrapper" 2501218822Sdim 2502218822Sdim outputname= 2503218822Sdim if test "$fast_install" = no && test -n "$relink_command"; then 2504218822Sdim $opt_dry_run || { 2505218822Sdim if test "$finalize" = yes; then 2506218822Sdim tmpdir=`func_mktempdir` 2507218822Sdim func_basename "$file$stripped_ext" 2508218822Sdim file="$func_basename_result" 2509218822Sdim outputname="$tmpdir/$file" 2510218822Sdim # Replace the output file specification. 2511218822Sdim relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 2512218822Sdim 2513218822Sdim $opt_silent || { 2514218822Sdim func_quote_for_expand "$relink_command" 2515218822Sdim eval "func_echo $func_quote_for_expand_result" 2516218822Sdim } 2517218822Sdim if eval "$relink_command"; then : 2518218822Sdim else 2519218822Sdim func_error "error: relink \`$file' with the above command before installing it" 2520218822Sdim $opt_dry_run || ${RM}r "$tmpdir" 2521218822Sdim continue 2522218822Sdim fi 2523218822Sdim file="$outputname" 2524218822Sdim else 2525218822Sdim func_warning "cannot relink \`$file'" 2526218822Sdim fi 2527218822Sdim } 2528218822Sdim else 2529218822Sdim # Install the binary that we compiled earlier. 2530218822Sdim file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 2531218822Sdim fi 2532218822Sdim fi 2533218822Sdim 2534218822Sdim # remove .exe since cygwin /usr/bin/install will append another 2535218822Sdim # one anyway 2536218822Sdim case $install_prog,$host in 2537218822Sdim */usr/bin/install*,*cygwin*) 2538218822Sdim case $file:$destfile in 2539218822Sdim *.exe:*.exe) 2540218822Sdim # this is ok 2541218822Sdim ;; 2542218822Sdim *.exe:*) 2543218822Sdim destfile=$destfile.exe 2544218822Sdim ;; 2545218822Sdim *:*.exe) 2546218822Sdim func_stripname '' '.exe' "$destfile" 2547218822Sdim destfile=$func_stripname_result 2548218822Sdim ;; 2549218822Sdim esac 2550218822Sdim ;; 2551218822Sdim esac 2552218822Sdim func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 2553218822Sdim $opt_dry_run || if test -n "$outputname"; then 2554218822Sdim ${RM}r "$tmpdir" 2555218822Sdim fi 2556218822Sdim ;; 2557218822Sdim esac 2558218822Sdim done 2559218822Sdim 2560218822Sdim for file in $staticlibs; do 2561218822Sdim func_basename "$file" 2562218822Sdim name="$func_basename_result" 2563218822Sdim 2564218822Sdim # Set up the ranlib parameters. 2565218822Sdim oldlib="$destdir/$name" 2566218822Sdim 2567218822Sdim func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 2568218822Sdim 2569218822Sdim if test -n "$stripme" && test -n "$old_striplib"; then 2570218822Sdim func_show_eval "$old_striplib $oldlib" 'exit $?' 2571218822Sdim fi 2572218822Sdim 2573218822Sdim # Do each command in the postinstall commands. 2574218822Sdim func_execute_cmds "$old_postinstall_cmds" 'exit $?' 2575218822Sdim done 2576218822Sdim 2577218822Sdim test -n "$future_libdirs" && \ 2578218822Sdim func_warning "remember to run \`$progname --finish$future_libdirs'" 2579218822Sdim 2580218822Sdim if test -n "$current_libdirs"; then 2581218822Sdim # Maybe just do a dry run. 2582218822Sdim $opt_dry_run && current_libdirs=" -n$current_libdirs" 2583218822Sdim exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 2584218822Sdim else 2585218822Sdim exit $EXIT_SUCCESS 2586218822Sdim fi 2587218822Sdim} 2588218822Sdim 2589218822Sdimtest "$mode" = install && func_mode_install ${1+"$@"} 2590218822Sdim 2591218822Sdim 2592218822Sdim# func_mode_link arg... 2593218822Sdimfunc_mode_link () 2594218822Sdim{ 2595218822Sdim $opt_debug 2596218822Sdim case $host in 259777298Sobrien *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 259860484Sobrien # It is impossible to link a dll without this setting, and 259960484Sobrien # we shouldn't force the makefile maintainer to figure out 260060484Sobrien # which system we are compiling for in order to pass an extra 2601218822Sdim # flag for every libtool invocation. 260260484Sobrien # allow_undefined=no 260338889Sjdp 260460484Sobrien # FIXME: Unfortunately, there are problems with the above when trying 260560484Sobrien # to make a dll which has undefined symbols, in which case not 260660484Sobrien # even a static library is built. For now, we need to specify 260760484Sobrien # -no-undefined on the libtool link line when we can be certain 260860484Sobrien # that all symbols are satisfied, otherwise we get a static library. 260960484Sobrien allow_undefined=yes 261060484Sobrien ;; 261160484Sobrien *) 261260484Sobrien allow_undefined=yes 261360484Sobrien ;; 261460484Sobrien esac 2615218822Sdim libtool_args=$nonopt 2616218822Sdim base_compile="$nonopt $@" 2617218822Sdim compile_command=$nonopt 2618218822Sdim finalize_command=$nonopt 261960484Sobrien 262060484Sobrien compile_rpath= 262160484Sobrien finalize_rpath= 262238889Sjdp compile_shlibpath= 262338889Sjdp finalize_shlibpath= 262460484Sobrien convenience= 262560484Sobrien old_convenience= 262638889Sjdp deplibs= 262777298Sobrien old_deplibs= 262877298Sobrien compiler_flags= 262977298Sobrien linker_flags= 263077298Sobrien dllsearchpath= 263177298Sobrien lib_search_path=`pwd` 2632218822Sdim inst_prefix_dir= 2633218822Sdim new_inherited_linker_flags= 263460484Sobrien 263560484Sobrien avoid_version=no 263638889Sjdp dlfiles= 263738889Sjdp dlprefiles= 263860484Sobrien dlself=no 263938889Sjdp export_dynamic=no 264060484Sobrien export_symbols= 264160484Sobrien export_symbols_regex= 264260484Sobrien generated= 264338889Sjdp libobjs= 264438889Sjdp ltlibs= 264560484Sobrien module=no 264677298Sobrien no_install=no 264738889Sjdp objs= 264877298Sobrien non_pic_objects= 2649218822Sdim precious_files_regex= 265060484Sobrien prefer_static_libs=no 265160484Sobrien preload=no 265238889Sjdp prev= 265338889Sjdp prevarg= 265438889Sjdp release= 265538889Sjdp rpath= 265660484Sobrien xrpath= 265738889Sjdp perm_rpath= 265838889Sjdp temp_rpath= 265960484Sobrien thread_safe=no 266038889Sjdp vinfo= 2661218822Sdim vinfo_number=no 2662218822Sdim weak_libs= 2663218822Sdim single_module="${wl}-single_module" 2664218822Sdim func_infer_tag $base_compile 266538889Sjdp 266638889Sjdp # We need to know -static, to get the right output filenames. 266738889Sjdp for arg 266838889Sjdp do 266989857Sobrien case $arg in 2670218822Sdim -shared) 2671218822Sdim test "$build_libtool_libs" != yes && \ 2672218822Sdim func_fatal_configuration "can not build a shared library" 2673218822Sdim build_old_libs=no 2674218822Sdim break 2675218822Sdim ;; 2676218822Sdim -all-static | -static | -static-libtool-libs) 2677218822Sdim case $arg in 2678218822Sdim -all-static) 267960484Sobrien if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 2680218822Sdim func_warning "complete static linking is impossible in this configuration" 268160484Sobrien fi 268260484Sobrien if test -n "$link_static_flag"; then 268360484Sobrien dlopen_self=$dlopen_self_static 2684218822Sdim # See comment for -static flag below, for more details. 2685218822Sdim func_append compile_command " $link_static_flag" 2686218822Sdim func_append finalize_command " $link_static_flag" 268760484Sobrien fi 2688218822Sdim prefer_static_libs=yes 2689218822Sdim ;; 2690218822Sdim -static) 269160484Sobrien if test -z "$pic_flag" && test -n "$link_static_flag"; then 269260484Sobrien dlopen_self=$dlopen_self_static 269360484Sobrien fi 2694218822Sdim prefer_static_libs=built 2695218822Sdim ;; 2696218822Sdim -static-libtool-libs) 2697218822Sdim if test -z "$pic_flag" && test -n "$link_static_flag"; then 2698218822Sdim dlopen_self=$dlopen_self_static 2699218822Sdim fi 2700218822Sdim prefer_static_libs=yes 2701218822Sdim ;; 2702218822Sdim esac 270360484Sobrien build_libtool_libs=no 270438889Sjdp build_old_libs=yes 270560484Sobrien break 270660484Sobrien ;; 270738889Sjdp esac 270838889Sjdp done 270938889Sjdp 271038889Sjdp # See if our shared archives depend on static archives. 271138889Sjdp test -n "$old_archive_from_new_cmds" && build_old_libs=yes 271238889Sjdp 271338889Sjdp # Go through the arguments, transforming them on the way. 2714218822Sdim while test "$#" -gt 0; do 271560484Sobrien arg="$1" 271660484Sobrien shift 2717218822Sdim func_quote_for_eval "$arg" 2718218822Sdim qarg=$func_quote_for_eval_unquoted_result 2719218822Sdim func_append libtool_args " $func_quote_for_eval_result" 272060484Sobrien 272138889Sjdp # If the previous option needs an argument, assign it. 272238889Sjdp if test -n "$prev"; then 272389857Sobrien case $prev in 272460484Sobrien output) 2725218822Sdim func_append compile_command " @OUTPUT@" 2726218822Sdim func_append finalize_command " @OUTPUT@" 272760484Sobrien ;; 272860484Sobrien esac 272938889Sjdp 273089857Sobrien case $prev in 273160484Sobrien dlfiles|dlprefiles) 273260484Sobrien if test "$preload" = no; then 273360484Sobrien # Add the symbol object into the linking commands. 2734218822Sdim func_append compile_command " @SYMFILE@" 2735218822Sdim func_append finalize_command " @SYMFILE@" 273660484Sobrien preload=yes 273760484Sobrien fi 273889857Sobrien case $arg in 273960484Sobrien *.la | *.lo) ;; # We handle these cases below. 274060484Sobrien force) 274160484Sobrien if test "$dlself" = no; then 274260484Sobrien dlself=needless 274360484Sobrien export_dynamic=yes 274460484Sobrien fi 274560484Sobrien prev= 274660484Sobrien continue 274760484Sobrien ;; 274860484Sobrien self) 274960484Sobrien if test "$prev" = dlprefiles; then 275060484Sobrien dlself=yes 275160484Sobrien elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 275260484Sobrien dlself=yes 275360484Sobrien else 275460484Sobrien dlself=needless 275560484Sobrien export_dynamic=yes 275660484Sobrien fi 275760484Sobrien prev= 275860484Sobrien continue 275960484Sobrien ;; 276060484Sobrien *) 276160484Sobrien if test "$prev" = dlfiles; then 276260484Sobrien dlfiles="$dlfiles $arg" 276360484Sobrien else 276460484Sobrien dlprefiles="$dlprefiles $arg" 276560484Sobrien fi 276660484Sobrien prev= 276777298Sobrien continue 276860484Sobrien ;; 276960484Sobrien esac 277060484Sobrien ;; 277160484Sobrien expsyms) 277260484Sobrien export_symbols="$arg" 2773218822Sdim test -f "$arg" \ 2774218822Sdim || func_fatal_error "symbol file \`$arg' does not exist" 277560484Sobrien prev= 277660484Sobrien continue 277760484Sobrien ;; 277860484Sobrien expsyms_regex) 277960484Sobrien export_symbols_regex="$arg" 278060484Sobrien prev= 278160484Sobrien continue 278260484Sobrien ;; 2783218822Sdim framework) 2784218822Sdim case $host in 2785218822Sdim *-*-darwin*) 2786218822Sdim case "$deplibs " in 2787218822Sdim *" $qarg.ltframework "*) ;; 2788218822Sdim *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 2789218822Sdim ;; 2790218822Sdim esac 2791218822Sdim ;; 2792218822Sdim esac 279338889Sjdp prev= 279438889Sjdp continue 279538889Sjdp ;; 2796218822Sdim inst_prefix) 2797218822Sdim inst_prefix_dir="$arg" 2798218822Sdim prev= 2799218822Sdim continue 2800218822Sdim ;; 280189857Sobrien objectlist) 280289857Sobrien if test -f "$arg"; then 2803218822Sdim save_arg=$arg 280489857Sobrien moreargs= 2805218822Sdim for fil in `cat "$save_arg"` 280689857Sobrien do 280789857Sobrien# moreargs="$moreargs $fil" 2808218822Sdim arg=$fil 2809218822Sdim # A libtool-controlled object. 281089857Sobrien 281189857Sobrien # Check to see that this really is a libtool object. 2812218822Sdim if func_lalib_unsafe_p "$arg"; then 2813218822Sdim pic_object= 2814218822Sdim non_pic_object= 281589857Sobrien 2816218822Sdim # Read the .lo file 2817218822Sdim func_source "$arg" 281889857Sobrien 2819218822Sdim if test -z "$pic_object" || 2820218822Sdim test -z "$non_pic_object" || 2821218822Sdim test "$pic_object" = none && 2822218822Sdim test "$non_pic_object" = none; then 2823218822Sdim func_fatal_error "cannot find name of object for \`$arg'" 2824218822Sdim fi 282589857Sobrien 2826218822Sdim # Extract subdirectory from the argument. 2827218822Sdim func_dirname "$arg" "/" "" 2828218822Sdim xdir="$func_dirname_result" 282989857Sobrien 2830218822Sdim if test "$pic_object" != none; then 2831218822Sdim # Prepend the subdirectory the object is found in. 2832218822Sdim pic_object="$xdir$pic_object" 283389857Sobrien 2834218822Sdim if test "$prev" = dlfiles; then 2835218822Sdim if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 2836218822Sdim dlfiles="$dlfiles $pic_object" 2837218822Sdim prev= 2838218822Sdim continue 2839218822Sdim else 2840218822Sdim # If libtool objects are unsupported, then we need to preload. 2841218822Sdim prev=dlprefiles 2842218822Sdim fi 2843218822Sdim fi 284489857Sobrien 2845218822Sdim # CHECK ME: I think I busted this. -Ossama 2846218822Sdim if test "$prev" = dlprefiles; then 2847218822Sdim # Preload the old-style object. 2848218822Sdim dlprefiles="$dlprefiles $pic_object" 2849218822Sdim prev= 2850218822Sdim fi 285189857Sobrien 2852218822Sdim # A PIC object. 2853218822Sdim func_append libobjs " $pic_object" 2854218822Sdim arg="$pic_object" 2855218822Sdim fi 285689857Sobrien 2857218822Sdim # Non-PIC object. 2858218822Sdim if test "$non_pic_object" != none; then 2859218822Sdim # Prepend the subdirectory the object is found in. 2860218822Sdim non_pic_object="$xdir$non_pic_object" 286189857Sobrien 2862218822Sdim # A standard non-PIC object 2863218822Sdim func_append non_pic_objects " $non_pic_object" 2864218822Sdim if test -z "$pic_object" || test "$pic_object" = none ; then 2865218822Sdim arg="$non_pic_object" 2866218822Sdim fi 2867218822Sdim else 2868218822Sdim # If the PIC object exists, use it instead. 2869218822Sdim # $xdir was prepended to $pic_object above. 2870218822Sdim non_pic_object="$pic_object" 2871218822Sdim func_append non_pic_objects " $non_pic_object" 2872218822Sdim fi 2873218822Sdim else 2874218822Sdim # Only an error if not doing a dry-run. 2875218822Sdim if $opt_dry_run; then 2876218822Sdim # Extract subdirectory from the argument. 2877218822Sdim func_dirname "$arg" "/" "" 2878218822Sdim xdir="$func_dirname_result" 287989857Sobrien 2880218822Sdim func_lo2o "$arg" 2881218822Sdim pic_object=$xdir$objdir/$func_lo2o_result 2882218822Sdim non_pic_object=$xdir$func_lo2o_result 2883218822Sdim func_append libobjs " $pic_object" 2884218822Sdim func_append non_pic_objects " $non_pic_object" 2885218822Sdim else 2886218822Sdim func_fatal_error "\`$arg' is not a valid libtool object" 2887218822Sdim fi 288889857Sobrien fi 288989857Sobrien done 289089857Sobrien else 2891218822Sdim func_fatal_error "link input file \`$arg' does not exist" 289289857Sobrien fi 2893218822Sdim arg=$save_arg 289489857Sobrien prev= 289589857Sobrien continue 289689857Sobrien ;; 2897218822Sdim precious_regex) 2898218822Sdim precious_files_regex="$arg" 2899218822Sdim prev= 2900218822Sdim continue 2901218822Sdim ;; 2902218822Sdim release) 2903218822Sdim release="-$arg" 2904218822Sdim prev= 2905218822Sdim continue 2906218822Sdim ;; 290760484Sobrien rpath | xrpath) 290860484Sobrien # We need an absolute path. 290989857Sobrien case $arg in 291060484Sobrien [\\/]* | [A-Za-z]:[\\/]*) ;; 291160484Sobrien *) 2912218822Sdim func_fatal_error "only absolute run-paths are allowed" 291360484Sobrien ;; 291460484Sobrien esac 291560484Sobrien if test "$prev" = rpath; then 291660484Sobrien case "$rpath " in 291760484Sobrien *" $arg "*) ;; 291860484Sobrien *) rpath="$rpath $arg" ;; 291960484Sobrien esac 292060484Sobrien else 292160484Sobrien case "$xrpath " in 292260484Sobrien *" $arg "*) ;; 292360484Sobrien *) xrpath="$xrpath $arg" ;; 292460484Sobrien esac 292560484Sobrien fi 292638889Sjdp prev= 292738889Sjdp continue 292838889Sjdp ;; 2929218822Sdim shrext) 2930218822Sdim shrext_cmds="$arg" 2931218822Sdim prev= 2932218822Sdim continue 2933218822Sdim ;; 2934218822Sdim weak) 2935218822Sdim weak_libs="$weak_libs $arg" 2936218822Sdim prev= 2937218822Sdim continue 2938218822Sdim ;; 2939218822Sdim xcclinker) 2940218822Sdim linker_flags="$linker_flags $qarg" 2941218822Sdim compiler_flags="$compiler_flags $qarg" 2942218822Sdim prev= 2943218822Sdim func_append compile_command " $qarg" 2944218822Sdim func_append finalize_command " $qarg" 2945218822Sdim continue 2946218822Sdim ;; 294777298Sobrien xcompiler) 294877298Sobrien compiler_flags="$compiler_flags $qarg" 294977298Sobrien prev= 2950218822Sdim func_append compile_command " $qarg" 2951218822Sdim func_append finalize_command " $qarg" 295277298Sobrien continue 295377298Sobrien ;; 295477298Sobrien xlinker) 295577298Sobrien linker_flags="$linker_flags $qarg" 295677298Sobrien compiler_flags="$compiler_flags $wl$qarg" 295777298Sobrien prev= 2958218822Sdim func_append compile_command " $wl$qarg" 2959218822Sdim func_append finalize_command " $wl$qarg" 296077298Sobrien continue 296177298Sobrien ;; 296260484Sobrien *) 296360484Sobrien eval "$prev=\"\$arg\"" 296460484Sobrien prev= 296560484Sobrien continue 296660484Sobrien ;; 296760484Sobrien esac 2968218822Sdim fi # test -n "$prev" 296938889Sjdp 297038889Sjdp prevarg="$arg" 297138889Sjdp 297289857Sobrien case $arg in 297338889Sjdp -all-static) 2974218822Sdim # The effects of -all-static are defined in a previous loop. 297560484Sobrien continue 297638889Sjdp ;; 297738889Sjdp 297838889Sjdp -allow-undefined) 297938889Sjdp # FIXME: remove this flag sometime in the future. 2980218822Sdim func_fatal_error "\`-allow-undefined' must not be used because it is the default" 298138889Sjdp ;; 298238889Sjdp 298360484Sobrien -avoid-version) 298460484Sobrien avoid_version=yes 298560484Sobrien continue 298660484Sobrien ;; 298760484Sobrien 298838889Sjdp -dlopen) 298960484Sobrien prev=dlfiles 299060484Sobrien continue 299160484Sobrien ;; 299238889Sjdp 299338889Sjdp -dlpreopen) 299460484Sobrien prev=dlprefiles 299560484Sobrien continue 299660484Sobrien ;; 299738889Sjdp 299838889Sjdp -export-dynamic) 299960484Sobrien export_dynamic=yes 300060484Sobrien continue 300160484Sobrien ;; 300238889Sjdp 300360484Sobrien -export-symbols | -export-symbols-regex) 300460484Sobrien if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3005218822Sdim func_fatal_error "more than one -exported-symbols argument is not allowed" 300660484Sobrien fi 300760484Sobrien if test "X$arg" = "X-export-symbols"; then 300860484Sobrien prev=expsyms 300960484Sobrien else 301060484Sobrien prev=expsyms_regex 301160484Sobrien fi 301260484Sobrien continue 301360484Sobrien ;; 301438889Sjdp 3015218822Sdim -framework) 3016218822Sdim prev=framework 3017218822Sdim continue 3018218822Sdim ;; 3019218822Sdim 3020218822Sdim -inst-prefix-dir) 3021218822Sdim prev=inst_prefix 3022218822Sdim continue 3023218822Sdim ;; 3024218822Sdim 302577298Sobrien # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 302677298Sobrien # so, if we see these flags be careful not to treat them like -L 302777298Sobrien -L[A-Z][A-Z]*:*) 302877298Sobrien case $with_gcc/$host in 3029218822Sdim no/*-*-irix* | /*-*-irix*) 3030218822Sdim func_append compile_command " $arg" 3031218822Sdim func_append finalize_command " $arg" 303277298Sobrien ;; 303377298Sobrien esac 303477298Sobrien continue 303577298Sobrien ;; 303689857Sobrien 303738889Sjdp -L*) 3038218822Sdim func_stripname '-L' '' "$arg" 3039218822Sdim dir=$func_stripname_result 304060484Sobrien # We need an absolute path. 304189857Sobrien case $dir in 304260484Sobrien [\\/]* | [A-Za-z]:[\\/]*) ;; 304360484Sobrien *) 304460484Sobrien absdir=`cd "$dir" && pwd` 3045218822Sdim test -z "$absdir" && \ 3046218822Sdim func_fatal_error "cannot determine absolute directory name of \`$dir'" 304760484Sobrien dir="$absdir" 304860484Sobrien ;; 304960484Sobrien esac 305077298Sobrien case "$deplibs " in 305177298Sobrien *" -L$dir "*) ;; 305277298Sobrien *) 305377298Sobrien deplibs="$deplibs -L$dir" 305477298Sobrien lib_search_path="$lib_search_path $dir" 305577298Sobrien ;; 305660484Sobrien esac 305789857Sobrien case $host in 305877298Sobrien *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 3059218822Sdim testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` 306089857Sobrien case :$dllsearchpath: in 306177298Sobrien *":$dir:"*) ;; 306277298Sobrien *) dllsearchpath="$dllsearchpath:$dir";; 306360484Sobrien esac 3064218822Sdim case :$dllsearchpath: in 3065218822Sdim *":$testbindir:"*) ;; 3066218822Sdim *) dllsearchpath="$dllsearchpath:$testbindir";; 3067218822Sdim esac 306860484Sobrien ;; 306960484Sobrien esac 307077298Sobrien continue 307160484Sobrien ;; 307238889Sjdp 307360484Sobrien -l*) 307489857Sobrien if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 307589857Sobrien case $host in 3076218822Sdim *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 307789857Sobrien # These systems don't actually have a C or math library (as such) 307860484Sobrien continue 307960484Sobrien ;; 3080218822Sdim *-*-os2*) 308189857Sobrien # These systems don't actually have a C library (as such) 308289857Sobrien test "X$arg" = "X-lc" && continue 308389857Sobrien ;; 3084218822Sdim *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3085218822Sdim # Do not include libc due to us having libc/libc_r. 3086218822Sdim test "X$arg" = "X-lc" && continue 3087218822Sdim ;; 3088218822Sdim *-*-rhapsody* | *-*-darwin1.[012]) 3089218822Sdim # Rhapsody C and math libraries are in the System framework 3090218822Sdim deplibs="$deplibs System.ltframework" 3091218822Sdim continue 3092218822Sdim ;; 3093218822Sdim *-*-sco3.2v5* | *-*-sco5v6*) 3094218822Sdim # Causes problems with __ctype 3095218822Sdim test "X$arg" = "X-lc" && continue 3096218822Sdim ;; 3097218822Sdim *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 3098218822Sdim # Compiler inserts libc in the correct place for threads to work 3099218822Sdim test "X$arg" = "X-lc" && continue 3100218822Sdim ;; 310160484Sobrien esac 3102218822Sdim elif test "X$arg" = "X-lc_r"; then 3103218822Sdim case $host in 3104218822Sdim *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3105218822Sdim # Do not include libc_r directly, use -pthread flag. 3106218822Sdim continue 3107218822Sdim ;; 3108218822Sdim esac 310960484Sobrien fi 311060484Sobrien deplibs="$deplibs $arg" 311177298Sobrien continue 311260484Sobrien ;; 311338889Sjdp 311460484Sobrien -module) 311560484Sobrien module=yes 311660484Sobrien continue 311760484Sobrien ;; 311860484Sobrien 3119218822Sdim # Tru64 UNIX uses -model [arg] to determine the layout of C++ 3120218822Sdim # classes, name mangling, and exception handling. 3121218822Sdim # Darwin uses the -arch flag to determine output architecture. 3122218822Sdim -model|-arch|-isysroot) 3123218822Sdim compiler_flags="$compiler_flags $arg" 3124218822Sdim func_append compile_command " $arg" 3125218822Sdim func_append finalize_command " $arg" 3126218822Sdim prev=xcompiler 3127218822Sdim continue 3128218822Sdim ;; 3129218822Sdim 3130218822Sdim -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 3131218822Sdim compiler_flags="$compiler_flags $arg" 3132218822Sdim func_append compile_command " $arg" 3133218822Sdim func_append finalize_command " $arg" 3134218822Sdim case "$new_inherited_linker_flags " in 3135218822Sdim *" $arg "*) ;; 3136218822Sdim * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 3137218822Sdim esac 3138218822Sdim continue 3139218822Sdim ;; 3140218822Sdim 3141218822Sdim -multi_module) 3142218822Sdim single_module="${wl}-multi_module" 3143218822Sdim continue 3144218822Sdim ;; 3145218822Sdim 314677298Sobrien -no-fast-install) 314777298Sobrien fast_install=no 314877298Sobrien continue 314977298Sobrien ;; 315077298Sobrien 315177298Sobrien -no-install) 315289857Sobrien case $host in 315377298Sobrien *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 315477298Sobrien # The PATH hackery in wrapper scripts is required on Windows 315577298Sobrien # in order for the loader to find any dlls it needs. 3156218822Sdim func_warning "\`-no-install' is ignored for $host" 3157218822Sdim func_warning "assuming \`-no-fast-install' instead" 315877298Sobrien fast_install=no 315977298Sobrien ;; 316089857Sobrien *) no_install=yes ;; 316177298Sobrien esac 316277298Sobrien continue 316377298Sobrien ;; 316477298Sobrien 316538889Sjdp -no-undefined) 316638889Sjdp allow_undefined=no 316738889Sjdp continue 316838889Sjdp ;; 316938889Sjdp 317089857Sobrien -objectlist) 317189857Sobrien prev=objectlist 317289857Sobrien continue 317389857Sobrien ;; 317489857Sobrien 317538889Sjdp -o) prev=output ;; 317638889Sjdp 3177218822Sdim -precious-files-regex) 3178218822Sdim prev=precious_regex 3179218822Sdim continue 3180218822Sdim ;; 3181218822Sdim 318238889Sjdp -release) 318338889Sjdp prev=release 318438889Sjdp continue 318538889Sjdp ;; 318638889Sjdp 318738889Sjdp -rpath) 318860484Sobrien prev=rpath 318960484Sobrien continue 319060484Sobrien ;; 319138889Sjdp 319260484Sobrien -R) 319360484Sobrien prev=xrpath 319460484Sobrien continue 319560484Sobrien ;; 319660484Sobrien 319760484Sobrien -R*) 3198218822Sdim func_stripname '-R' '' "$arg" 3199218822Sdim dir=$func_stripname_result 320060484Sobrien # We need an absolute path. 320189857Sobrien case $dir in 320260484Sobrien [\\/]* | [A-Za-z]:[\\/]*) ;; 320360484Sobrien *) 3204218822Sdim func_fatal_error "only absolute run-paths are allowed" 320560484Sobrien ;; 320660484Sobrien esac 320760484Sobrien case "$xrpath " in 320860484Sobrien *" $dir "*) ;; 320960484Sobrien *) xrpath="$xrpath $dir" ;; 321060484Sobrien esac 321160484Sobrien continue 321260484Sobrien ;; 321360484Sobrien 3214218822Sdim -shared) 3215218822Sdim # The effects of -shared are defined in a previous loop. 3216218822Sdim continue 3217218822Sdim ;; 3218218822Sdim 3219218822Sdim -shrext) 3220218822Sdim prev=shrext 3221218822Sdim continue 3222218822Sdim ;; 3223218822Sdim 3224218822Sdim -static | -static-libtool-libs) 322589857Sobrien # The effects of -static are defined in a previous loop. 322677298Sobrien # We used to do the same as -all-static on platforms that 322777298Sobrien # didn't have a PIC flag, but the assumption that the effects 322877298Sobrien # would be equivalent was wrong. It would break on at least 322977298Sobrien # Digital Unix and AIX. 323038889Sjdp continue 323138889Sjdp ;; 323238889Sjdp 323360484Sobrien -thread-safe) 323460484Sobrien thread_safe=yes 323560484Sobrien continue 323660484Sobrien ;; 323760484Sobrien 323838889Sjdp -version-info) 323960484Sobrien prev=vinfo 324060484Sobrien continue 324160484Sobrien ;; 324238889Sjdp 3243218822Sdim -version-number) 3244218822Sdim prev=vinfo 3245218822Sdim vinfo_number=yes 3246218822Sdim continue 3247218822Sdim ;; 3248218822Sdim 3249218822Sdim -weak) 3250218822Sdim prev=weak 3251218822Sdim continue 3252218822Sdim ;; 3253218822Sdim 325477298Sobrien -Wc,*) 3255218822Sdim func_stripname '-Wc,' '' "$arg" 3256218822Sdim args=$func_stripname_result 325777298Sobrien arg= 3258218822Sdim save_ifs="$IFS"; IFS=',' 325977298Sobrien for flag in $args; do 326077298Sobrien IFS="$save_ifs" 3261218822Sdim func_quote_for_eval "$flag" 3262218822Sdim arg="$arg $wl$func_quote_for_eval_result" 3263218822Sdim compiler_flags="$compiler_flags $func_quote_for_eval_result" 326477298Sobrien done 326577298Sobrien IFS="$save_ifs" 3266218822Sdim func_stripname ' ' '' "$arg" 3267218822Sdim arg=$func_stripname_result 326877298Sobrien ;; 326977298Sobrien 327077298Sobrien -Wl,*) 3271218822Sdim func_stripname '-Wl,' '' "$arg" 3272218822Sdim args=$func_stripname_result 327377298Sobrien arg= 3274218822Sdim save_ifs="$IFS"; IFS=',' 327577298Sobrien for flag in $args; do 327677298Sobrien IFS="$save_ifs" 3277218822Sdim func_quote_for_eval "$flag" 3278218822Sdim arg="$arg $wl$func_quote_for_eval_result" 3279218822Sdim compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 3280218822Sdim linker_flags="$linker_flags $func_quote_for_eval_result" 328177298Sobrien done 328277298Sobrien IFS="$save_ifs" 3283218822Sdim func_stripname ' ' '' "$arg" 3284218822Sdim arg=$func_stripname_result 328577298Sobrien ;; 328677298Sobrien 328777298Sobrien -Xcompiler) 328877298Sobrien prev=xcompiler 328977298Sobrien continue 329077298Sobrien ;; 329177298Sobrien 329277298Sobrien -Xlinker) 329377298Sobrien prev=xlinker 329477298Sobrien continue 329577298Sobrien ;; 329677298Sobrien 3297218822Sdim -XCClinker) 3298218822Sdim prev=xcclinker 3299218822Sdim continue 3300218822Sdim ;; 3301218822Sdim 3302218822Sdim # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 3303218822Sdim # -r[0-9][0-9]* specifies the processor on the SGI compiler 3304218822Sdim # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 3305218822Sdim # +DA*, +DD* enable 64-bit mode on the HP compiler 3306218822Sdim # -q* pass through compiler args for the IBM compiler 3307218822Sdim # -m*, -t[45]*, -txscale* pass through architecture-specific 3308218822Sdim # compiler args for GCC 3309218822Sdim # -F/path gives path to uninstalled frameworks, gcc on darwin 3310218822Sdim # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 3311218822Sdim # @file GCC response files 3312218822Sdim -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 3313218822Sdim -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 3314218822Sdim func_quote_for_eval "$arg" 3315218822Sdim arg="$func_quote_for_eval_result" 3316218822Sdim func_append compile_command " $arg" 3317218822Sdim func_append finalize_command " $arg" 3318218822Sdim compiler_flags="$compiler_flags $arg" 3319218822Sdim continue 3320218822Sdim ;; 3321218822Sdim 332238889Sjdp # Some other compiler flag. 332338889Sjdp -* | +*) 3324218822Sdim func_quote_for_eval "$arg" 3325218822Sdim arg="$func_quote_for_eval_result" 332660484Sobrien ;; 332738889Sjdp 332877298Sobrien *.$objext) 332960484Sobrien # A standard object. 333060484Sobrien objs="$objs $arg" 333160484Sobrien ;; 333238889Sjdp 333338889Sjdp *.lo) 333477298Sobrien # A libtool-controlled object. 333577298Sobrien 333677298Sobrien # Check to see that this really is a libtool object. 3337218822Sdim if func_lalib_unsafe_p "$arg"; then 3338218822Sdim pic_object= 3339218822Sdim non_pic_object= 334077298Sobrien 3341218822Sdim # Read the .lo file 3342218822Sdim func_source "$arg" 334377298Sobrien 3344218822Sdim if test -z "$pic_object" || 3345218822Sdim test -z "$non_pic_object" || 3346218822Sdim test "$pic_object" = none && 3347218822Sdim test "$non_pic_object" = none; then 3348218822Sdim func_fatal_error "cannot find name of object for \`$arg'" 3349218822Sdim fi 335077298Sobrien 335177298Sobrien # Extract subdirectory from the argument. 3352218822Sdim func_dirname "$arg" "/" "" 3353218822Sdim xdir="$func_dirname_result" 335438889Sjdp 3355218822Sdim if test "$pic_object" != none; then 3356218822Sdim # Prepend the subdirectory the object is found in. 335777298Sobrien pic_object="$xdir$pic_object" 335877298Sobrien 335977298Sobrien if test "$prev" = dlfiles; then 336077298Sobrien if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 3361218822Sdim dlfiles="$dlfiles $pic_object" 3362218822Sdim prev= 3363218822Sdim continue 336477298Sobrien else 3365218822Sdim # If libtool objects are unsupported, then we need to preload. 3366218822Sdim prev=dlprefiles 336777298Sobrien fi 336877298Sobrien fi 336977298Sobrien 337077298Sobrien # CHECK ME: I think I busted this. -Ossama 3371218822Sdim if test "$prev" = dlprefiles; then 337277298Sobrien # Preload the old-style object. 337377298Sobrien dlprefiles="$dlprefiles $pic_object" 337477298Sobrien prev= 3375218822Sdim fi 337677298Sobrien 3377218822Sdim # A PIC object. 3378218822Sdim func_append libobjs " $pic_object" 337977298Sobrien arg="$pic_object" 3380218822Sdim fi 338177298Sobrien 3382218822Sdim # Non-PIC object. 3383218822Sdim if test "$non_pic_object" != none; then 3384218822Sdim # Prepend the subdirectory the object is found in. 338577298Sobrien non_pic_object="$xdir$non_pic_object" 338677298Sobrien 3387218822Sdim # A standard non-PIC object 3388218822Sdim func_append non_pic_objects " $non_pic_object" 3389218822Sdim if test -z "$pic_object" || test "$pic_object" = none ; then 3390218822Sdim arg="$non_pic_object" 3391218822Sdim fi 3392218822Sdim else 3393218822Sdim # If the PIC object exists, use it instead. 3394218822Sdim # $xdir was prepended to $pic_object above. 3395218822Sdim non_pic_object="$pic_object" 3396218822Sdim func_append non_pic_objects " $non_pic_object" 3397218822Sdim fi 3398218822Sdim else 3399218822Sdim # Only an error if not doing a dry-run. 3400218822Sdim if $opt_dry_run; then 340177298Sobrien # Extract subdirectory from the argument. 3402218822Sdim func_dirname "$arg" "/" "" 3403218822Sdim xdir="$func_dirname_result" 340477298Sobrien 3405218822Sdim func_lo2o "$arg" 3406218822Sdim pic_object=$xdir$objdir/$func_lo2o_result 3407218822Sdim non_pic_object=$xdir$func_lo2o_result 3408218822Sdim func_append libobjs " $pic_object" 3409218822Sdim func_append non_pic_objects " $non_pic_object" 3410218822Sdim else 3411218822Sdim func_fatal_error "\`$arg' is not a valid libtool object" 3412218822Sdim fi 341338889Sjdp fi 341460484Sobrien ;; 341538889Sjdp 341677298Sobrien *.$libext) 341777298Sobrien # An archive. 341877298Sobrien deplibs="$deplibs $arg" 341977298Sobrien old_deplibs="$old_deplibs $arg" 342077298Sobrien continue 342177298Sobrien ;; 342277298Sobrien 342338889Sjdp *.la) 342460484Sobrien # A libtool-controlled library. 342538889Sjdp 342677298Sobrien if test "$prev" = dlfiles; then 342777298Sobrien # This library was specified with -dlopen. 342877298Sobrien dlfiles="$dlfiles $arg" 342977298Sobrien prev= 343077298Sobrien elif test "$prev" = dlprefiles; then 343177298Sobrien # The library was specified with -dlpreopen. 343277298Sobrien dlprefiles="$dlprefiles $arg" 343377298Sobrien prev= 343477298Sobrien else 343577298Sobrien deplibs="$deplibs $arg" 343677298Sobrien fi 343777298Sobrien continue 343877298Sobrien ;; 343938889Sjdp 344077298Sobrien # Some other compiler argument. 344177298Sobrien *) 344277298Sobrien # Unknown arguments in both finalize_command and compile_command need 344377298Sobrien # to be aesthetically quoted because they are evaled later. 3444218822Sdim func_quote_for_eval "$arg" 3445218822Sdim arg="$func_quote_for_eval_result" 344677298Sobrien ;; 344789857Sobrien esac # arg 344877298Sobrien 344977298Sobrien # Now actually substitute the argument into the commands. 345077298Sobrien if test -n "$arg"; then 3451218822Sdim func_append compile_command " $arg" 3452218822Sdim func_append finalize_command " $arg" 345377298Sobrien fi 345489857Sobrien done # argument parsing loop 345577298Sobrien 3456218822Sdim test -n "$prev" && \ 3457218822Sdim func_fatal_help "the \`$prevarg' option requires an argument" 345877298Sobrien 345977298Sobrien if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 346077298Sobrien eval arg=\"$export_dynamic_flag_spec\" 3461218822Sdim func_append compile_command " $arg" 3462218822Sdim func_append finalize_command " $arg" 346377298Sobrien fi 346477298Sobrien 3465218822Sdim oldlibs= 346677298Sobrien # calculate the name of the file, without its directory 3467218822Sdim func_basename "$output" 3468218822Sdim outputname="$func_basename_result" 346977298Sobrien libobjs_save="$libobjs" 347077298Sobrien 347177298Sobrien if test -n "$shlibpath_var"; then 347277298Sobrien # get the directories listed in $shlibpath_var 3473218822Sdim eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 347477298Sobrien else 347577298Sobrien shlib_search_path= 347677298Sobrien fi 347777298Sobrien eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 347877298Sobrien eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 347977298Sobrien 3480218822Sdim func_dirname "$output" "/" "" 3481218822Sdim output_objdir="$func_dirname_result$objdir" 348277298Sobrien # Create the object directory. 3483218822Sdim func_mkdir_p "$output_objdir" 348477298Sobrien 348577298Sobrien # Determine the type of output 348689857Sobrien case $output in 348777298Sobrien "") 3488218822Sdim func_fatal_help "you must specify an output file" 348977298Sobrien ;; 349077298Sobrien *.$libext) linkmode=oldlib ;; 349177298Sobrien *.lo | *.$objext) linkmode=obj ;; 349277298Sobrien *.la) linkmode=lib ;; 349377298Sobrien *) linkmode=prog ;; # Anything else should be a program. 349477298Sobrien esac 349577298Sobrien 349677298Sobrien specialdeplibs= 3497218822Sdim 349877298Sobrien libs= 349977298Sobrien # Find all interdependent deplibs by searching for libraries 350077298Sobrien # that are linked more than once (e.g. -la -lb -la) 350177298Sobrien for deplib in $deplibs; do 3502218822Sdim if $opt_duplicate_deps ; then 3503218822Sdim case "$libs " in 3504218822Sdim *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 3505218822Sdim esac 3506218822Sdim fi 350777298Sobrien libs="$libs $deplib" 350877298Sobrien done 350977298Sobrien 3510218822Sdim if test "$linkmode" = lib; then 351177298Sobrien libs="$predeps $libs $compiler_lib_search_path $postdeps" 351289857Sobrien 351389857Sobrien # Compute libraries that are listed more than once in $predeps 351489857Sobrien # $postdeps and mark them as special (i.e., whose duplicates are 351589857Sobrien # not to be eliminated). 351689857Sobrien pre_post_deps= 3517218822Sdim if $opt_duplicate_compiler_generated_deps; then 3518218822Sdim for pre_post_dep in $predeps $postdeps; do 3519218822Sdim case "$pre_post_deps " in 3520218822Sdim *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 3521218822Sdim esac 3522218822Sdim pre_post_deps="$pre_post_deps $pre_post_dep" 3523218822Sdim done 3524218822Sdim fi 352589857Sobrien pre_post_deps= 352677298Sobrien fi 352777298Sobrien 352877298Sobrien deplibs= 352977298Sobrien newdependency_libs= 353077298Sobrien newlib_search_path= 353177298Sobrien need_relink=no # whether we're linking any uninstalled libtool libraries 353289857Sobrien notinst_deplibs= # not-installed libtool libraries 353389857Sobrien notinst_path= # paths that contain not-installed libtool libraries 3534218822Sdim 353577298Sobrien case $linkmode in 353677298Sobrien lib) 3537218822Sdim passes="conv dlpreopen link" 353877298Sobrien for file in $dlfiles $dlprefiles; do 353989857Sobrien case $file in 354077298Sobrien *.la) ;; 354177298Sobrien *) 3542218822Sdim func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 354377298Sobrien ;; 354477298Sobrien esac 354577298Sobrien done 354677298Sobrien ;; 354777298Sobrien prog) 354877298Sobrien compile_deplibs= 354977298Sobrien finalize_deplibs= 355077298Sobrien alldeplibs=no 355177298Sobrien newdlfiles= 355277298Sobrien newdlprefiles= 355377298Sobrien passes="conv scan dlopen dlpreopen link" 355477298Sobrien ;; 355589857Sobrien *) passes="conv" 355677298Sobrien ;; 355777298Sobrien esac 3558218822Sdim 355977298Sobrien for pass in $passes; do 3560218822Sdim # The preopen pass in lib mode reverses $deplibs; put it back here 3561218822Sdim # so that -L comes before libs that need it for instance... 3562218822Sdim if test "$linkmode,$pass" = "lib,link"; then 3563218822Sdim ## FIXME: Find the place where the list is rebuilt in the wrong 3564218822Sdim ## order, and fix it there properly 3565218822Sdim tmp_deplibs= 3566218822Sdim for deplib in $deplibs; do 3567218822Sdim tmp_deplibs="$deplib $tmp_deplibs" 3568218822Sdim done 3569218822Sdim deplibs="$tmp_deplibs" 3570218822Sdim fi 3571218822Sdim 3572218822Sdim if test "$linkmode,$pass" = "lib,link" || 3573218822Sdim test "$linkmode,$pass" = "prog,scan"; then 3574218822Sdim libs="$deplibs" 3575218822Sdim deplibs= 3576218822Sdim fi 3577218822Sdim if test "$linkmode" = prog; then 357877298Sobrien case $pass in 3579218822Sdim dlopen) libs="$dlfiles" ;; 358077298Sobrien dlpreopen) libs="$dlprefiles" ;; 358177298Sobrien link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 358277298Sobrien esac 358377298Sobrien fi 3584218822Sdim if test "$linkmode,$pass" = "lib,dlpreopen"; then 3585218822Sdim # Collect and forward deplibs of preopened libtool libs 3586218822Sdim for lib in $dlprefiles; do 3587218822Sdim # Ignore non-libtool-libs 3588218822Sdim dependency_libs= 3589218822Sdim case $lib in 3590218822Sdim *.la) func_source "$lib" ;; 3591218822Sdim esac 3592218822Sdim 3593218822Sdim # Collect preopened libtool deplibs, except any this library 3594218822Sdim # has declared as weak libs 3595218822Sdim for deplib in $dependency_libs; do 3596218822Sdim deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` 3597218822Sdim case " $weak_libs " in 3598218822Sdim *" $deplib_base "*) ;; 3599218822Sdim *) deplibs="$deplibs $deplib" ;; 3600218822Sdim esac 3601218822Sdim done 3602218822Sdim done 3603218822Sdim libs="$dlprefiles" 3604218822Sdim fi 3605218822Sdim if test "$pass" = dlopen; then 3606218822Sdim # Collect dlpreopened libraries 3607218822Sdim save_deplibs="$deplibs" 3608218822Sdim deplibs= 3609218822Sdim fi 3610218822Sdim 361177298Sobrien for deplib in $libs; do 361277298Sobrien lib= 361377298Sobrien found=no 361489857Sobrien case $deplib in 3615218822Sdim -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 3616218822Sdim if test "$linkmode,$pass" = "prog,link"; then 3617218822Sdim compile_deplibs="$deplib $compile_deplibs" 3618218822Sdim finalize_deplibs="$deplib $finalize_deplibs" 3619218822Sdim else 3620218822Sdim compiler_flags="$compiler_flags $deplib" 3621218822Sdim if test "$linkmode" = lib ; then 3622218822Sdim case "$new_inherited_linker_flags " in 3623218822Sdim *" $deplib "*) ;; 3624218822Sdim * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 3625218822Sdim esac 3626218822Sdim fi 3627218822Sdim fi 3628218822Sdim continue 3629218822Sdim ;; 363077298Sobrien -l*) 3631218822Sdim if test "$linkmode" != lib && test "$linkmode" != prog; then 3632218822Sdim func_warning "\`-l' is ignored for archives/objects" 363377298Sobrien continue 363477298Sobrien fi 3635218822Sdim func_stripname '-l' '' "$deplib" 3636218822Sdim name=$func_stripname_result 363777298Sobrien for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 3638218822Sdim for search_ext in .la $std_shrext .so .a; do 3639218822Sdim # Search the libtool library 3640218822Sdim lib="$searchdir/lib${name}${search_ext}" 3641218822Sdim if test -f "$lib"; then 3642218822Sdim if test "$search_ext" = ".la"; then 3643218822Sdim found=yes 3644218822Sdim else 3645218822Sdim found=no 3646218822Sdim fi 3647218822Sdim break 2 3648218822Sdim fi 3649218822Sdim done 365077298Sobrien done 365177298Sobrien if test "$found" != yes; then 365289857Sobrien # deplib doesn't seem to be a libtool library 365377298Sobrien if test "$linkmode,$pass" = "prog,link"; then 365477298Sobrien compile_deplibs="$deplib $compile_deplibs" 365577298Sobrien finalize_deplibs="$deplib $finalize_deplibs" 365677298Sobrien else 365777298Sobrien deplibs="$deplib $deplibs" 3658218822Sdim test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 365977298Sobrien fi 366077298Sobrien continue 3661218822Sdim else # deplib is a libtool library 3662218822Sdim # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 3663218822Sdim # We need to do some special things here, and not later. 3664218822Sdim if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3665218822Sdim case " $predeps $postdeps " in 3666218822Sdim *" $deplib "*) 3667218822Sdim if func_lalib_p "$lib"; then 3668218822Sdim library_names= 3669218822Sdim old_library= 3670218822Sdim func_source "$lib" 3671218822Sdim for l in $old_library $library_names; do 3672218822Sdim ll="$l" 3673218822Sdim done 3674218822Sdim if test "X$ll" = "X$old_library" ; then # only static version available 3675218822Sdim found=no 3676218822Sdim func_dirname "$lib" "" "." 3677218822Sdim ladir="$func_dirname_result" 3678218822Sdim lib=$ladir/$old_library 3679218822Sdim if test "$linkmode,$pass" = "prog,link"; then 3680218822Sdim compile_deplibs="$deplib $compile_deplibs" 3681218822Sdim finalize_deplibs="$deplib $finalize_deplibs" 3682218822Sdim else 3683218822Sdim deplibs="$deplib $deplibs" 3684218822Sdim test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 3685218822Sdim fi 3686218822Sdim continue 3687218822Sdim fi 3688218822Sdim fi 3689218822Sdim ;; 3690218822Sdim *) ;; 3691218822Sdim esac 3692218822Sdim fi 369377298Sobrien fi 369489857Sobrien ;; # -l 3695218822Sdim *.ltframework) 3696218822Sdim if test "$linkmode,$pass" = "prog,link"; then 3697218822Sdim compile_deplibs="$deplib $compile_deplibs" 3698218822Sdim finalize_deplibs="$deplib $finalize_deplibs" 3699218822Sdim else 3700218822Sdim deplibs="$deplib $deplibs" 3701218822Sdim if test "$linkmode" = lib ; then 3702218822Sdim case "$new_inherited_linker_flags " in 3703218822Sdim *" $deplib "*) ;; 3704218822Sdim * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 3705218822Sdim esac 3706218822Sdim fi 3707218822Sdim fi 3708218822Sdim continue 3709218822Sdim ;; 371077298Sobrien -L*) 371177298Sobrien case $linkmode in 371277298Sobrien lib) 371377298Sobrien deplibs="$deplib $deplibs" 3714218822Sdim test "$pass" = conv && continue 371577298Sobrien newdependency_libs="$deplib $newdependency_libs" 3716218822Sdim func_stripname '-L' '' "$deplib" 3717218822Sdim newlib_search_path="$newlib_search_path $func_stripname_result" 371877298Sobrien ;; 371977298Sobrien prog) 3720218822Sdim if test "$pass" = conv; then 372177298Sobrien deplibs="$deplib $deplibs" 372277298Sobrien continue 372377298Sobrien fi 3724218822Sdim if test "$pass" = scan; then 372577298Sobrien deplibs="$deplib $deplibs" 372677298Sobrien else 372777298Sobrien compile_deplibs="$deplib $compile_deplibs" 372877298Sobrien finalize_deplibs="$deplib $finalize_deplibs" 372977298Sobrien fi 3730218822Sdim func_stripname '-L' '' "$deplib" 3731218822Sdim newlib_search_path="$newlib_search_path $func_stripname_result" 373277298Sobrien ;; 373377298Sobrien *) 3734218822Sdim func_warning "\`-L' is ignored for archives/objects" 373577298Sobrien ;; 373689857Sobrien esac # linkmode 373777298Sobrien continue 373889857Sobrien ;; # -L 373977298Sobrien -R*) 3740218822Sdim if test "$pass" = link; then 3741218822Sdim func_stripname '-R' '' "$deplib" 3742218822Sdim dir=$func_stripname_result 374377298Sobrien # Make sure the xrpath contains only unique directories. 374477298Sobrien case "$xrpath " in 374577298Sobrien *" $dir "*) ;; 374677298Sobrien *) xrpath="$xrpath $dir" ;; 374777298Sobrien esac 374877298Sobrien fi 374977298Sobrien deplibs="$deplib $deplibs" 375077298Sobrien continue 375177298Sobrien ;; 375277298Sobrien *.la) lib="$deplib" ;; 375377298Sobrien *.$libext) 3754218822Sdim if test "$pass" = conv; then 375577298Sobrien deplibs="$deplib $deplibs" 375677298Sobrien continue 375777298Sobrien fi 375877298Sobrien case $linkmode in 375977298Sobrien lib) 3760218822Sdim # Linking convenience modules into shared libraries is allowed, 3761218822Sdim # but linking other static libraries is non-portable. 3762218822Sdim case " $dlpreconveniencelibs " in 3763218822Sdim *" $deplib "*) ;; 3764218822Sdim *) 3765218822Sdim valid_a_lib=no 3766218822Sdim case $deplibs_check_method in 3767218822Sdim match_pattern*) 3768218822Sdim set dummy $deplibs_check_method; shift 3769218822Sdim match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 3770218822Sdim if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ 3771218822Sdim | $EGREP "$match_pattern_regex" > /dev/null; then 3772218822Sdim valid_a_lib=yes 3773218822Sdim fi 3774218822Sdim ;; 3775218822Sdim pass_all) 3776218822Sdim valid_a_lib=yes 3777218822Sdim ;; 3778218822Sdim esac 3779218822Sdim if test "$valid_a_lib" != yes; then 3780218822Sdim $ECHO 3781218822Sdim $ECHO "*** Warning: Trying to link with static lib archive $deplib." 3782218822Sdim $ECHO "*** I have the capability to make that library automatically link in when" 3783218822Sdim $ECHO "*** you link to this library. But I can only do this if you have a" 3784218822Sdim $ECHO "*** shared version of the library, which you do not appear to have" 3785218822Sdim $ECHO "*** because the file extensions .$libext of this argument makes me believe" 3786218822Sdim $ECHO "*** that it is just a static archive that I should not use here." 3787218822Sdim else 3788218822Sdim $ECHO 3789218822Sdim $ECHO "*** Warning: Linking the shared library $output against the" 3790218822Sdim $ECHO "*** static library $deplib is not portable!" 3791218822Sdim deplibs="$deplib $deplibs" 3792218822Sdim fi 3793218822Sdim ;; 3794218822Sdim esac 379577298Sobrien continue 379677298Sobrien ;; 379777298Sobrien prog) 3798218822Sdim if test "$pass" != link; then 379977298Sobrien deplibs="$deplib $deplibs" 380077298Sobrien else 380177298Sobrien compile_deplibs="$deplib $compile_deplibs" 380277298Sobrien finalize_deplibs="$deplib $finalize_deplibs" 380377298Sobrien fi 380477298Sobrien continue 380577298Sobrien ;; 380689857Sobrien esac # linkmode 380789857Sobrien ;; # *.$libext 380877298Sobrien *.lo | *.$objext) 3809218822Sdim if test "$pass" = conv; then 3810218822Sdim deplibs="$deplib $deplibs" 3811218822Sdim elif test "$linkmode" = prog; then 3812218822Sdim if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 3813218822Sdim # If there is no dlopen support or we're linking statically, 3814218822Sdim # we need to preload. 3815218822Sdim newdlprefiles="$newdlprefiles $deplib" 3816218822Sdim compile_deplibs="$deplib $compile_deplibs" 3817218822Sdim finalize_deplibs="$deplib $finalize_deplibs" 3818218822Sdim else 3819218822Sdim newdlfiles="$newdlfiles $deplib" 3820218822Sdim fi 382177298Sobrien fi 382277298Sobrien continue 382377298Sobrien ;; 382477298Sobrien %DEPLIBS%) 382577298Sobrien alldeplibs=yes 382677298Sobrien continue 382777298Sobrien ;; 382889857Sobrien esac # case $deplib 3829218822Sdim 3830218822Sdim if test "$found" = yes || test -f "$lib"; then : 383177298Sobrien else 3832218822Sdim func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 383377298Sobrien fi 383477298Sobrien 383560484Sobrien # Check to see that this really is a libtool archive. 3836218822Sdim func_lalib_unsafe_p "$lib" \ 3837218822Sdim || func_fatal_error "\`$lib' is not a valid libtool archive" 383838889Sjdp 3839218822Sdim func_dirname "$lib" "" "." 3840218822Sdim ladir="$func_dirname_result" 384177298Sobrien 384277298Sobrien dlname= 384377298Sobrien dlopen= 384477298Sobrien dlpreopen= 384577298Sobrien libdir= 384677298Sobrien library_names= 384777298Sobrien old_library= 3848218822Sdim inherited_linker_flags= 384960484Sobrien # If the library was installed with an old release of libtool, 3850218822Sdim # it will not redefine variables installed, or shouldnotlink 385160484Sobrien installed=yes 3852218822Sdim shouldnotlink=no 3853218822Sdim avoidtemprpath= 385438889Sjdp 3855218822Sdim 385660484Sobrien # Read the .la file 3857218822Sdim func_source "$lib" 385838889Sjdp 3859218822Sdim # Convert "-framework foo" to "foo.ltframework" 3860218822Sdim if test -n "$inherited_linker_flags"; then 3861218822Sdim tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` 3862218822Sdim for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 3863218822Sdim case " $new_inherited_linker_flags " in 3864218822Sdim *" $tmp_inherited_linker_flag "*) ;; 3865218822Sdim *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 3866218822Sdim esac 3867218822Sdim done 3868218822Sdim fi 3869218822Sdim dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 3870218822Sdim if test "$linkmode,$pass" = "prog,link"; then 3871218822Sdim compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 3872218822Sdim finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 3873218822Sdim else 3874218822Sdim compiler_flags="$compiler_flags $inherited_linker_flags" 3875218822Sdim fi 387677298Sobrien if test "$linkmode,$pass" = "lib,link" || 387777298Sobrien test "$linkmode,$pass" = "prog,scan" || 3878218822Sdim { test "$linkmode" != prog && test "$linkmode" != lib; }; then 387977298Sobrien test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 388077298Sobrien test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 388177298Sobrien fi 388277298Sobrien 3883218822Sdim if test "$pass" = conv; then 388489857Sobrien # Only check for convenience libraries 388577298Sobrien deplibs="$lib $deplibs" 388677298Sobrien if test -z "$libdir"; then 388777298Sobrien if test -z "$old_library"; then 3888218822Sdim func_fatal_error "cannot find name of link library for \`$lib'" 388977298Sobrien fi 389077298Sobrien # It is a libtool convenience library, so add in its objects. 389177298Sobrien convenience="$convenience $ladir/$objdir/$old_library" 389277298Sobrien old_convenience="$old_convenience $ladir/$objdir/$old_library" 3893218822Sdim elif test "$linkmode" != prog && test "$linkmode" != lib; then 3894218822Sdim func_fatal_error "\`$lib' is not a convenience library" 3895218822Sdim fi 3896218822Sdim tmp_libs= 3897218822Sdim for deplib in $dependency_libs; do 3898218822Sdim deplibs="$deplib $deplibs" 3899218822Sdim if $opt_duplicate_deps ; then 390077298Sobrien case "$tmp_libs " in 390177298Sobrien *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 390277298Sobrien esac 3903218822Sdim fi 3904218822Sdim tmp_libs="$tmp_libs $deplib" 3905218822Sdim done 390677298Sobrien continue 390789857Sobrien fi # $pass = conv 390877298Sobrien 3909218822Sdim 391060484Sobrien # Get the name of the library we link against. 391160484Sobrien linklib= 391260484Sobrien for l in $old_library $library_names; do 391360484Sobrien linklib="$l" 391460484Sobrien done 391560484Sobrien if test -z "$linklib"; then 3916218822Sdim func_fatal_error "cannot find name of link library for \`$lib'" 391760484Sobrien fi 391838889Sjdp 391977298Sobrien # This library was specified with -dlopen. 3920218822Sdim if test "$pass" = dlopen; then 392177298Sobrien if test -z "$libdir"; then 3922218822Sdim func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 392377298Sobrien fi 3924218822Sdim if test -z "$dlname" || 3925218822Sdim test "$dlopen_support" != yes || 3926218822Sdim test "$build_libtool_libs" = no; then 392789857Sobrien # If there is no dlname, no dlopen support or we're linking 3928218822Sdim # statically, we need to preload. We also need to preload any 3929218822Sdim # dependent libraries so libltdl's deplib preloader doesn't 3930218822Sdim # bomb out in the load deplibs phase. 3931218822Sdim dlprefiles="$dlprefiles $lib $dependency_libs" 393277298Sobrien else 393377298Sobrien newdlfiles="$newdlfiles $lib" 393477298Sobrien fi 393577298Sobrien continue 393689857Sobrien fi # $pass = dlopen 393777298Sobrien 393877298Sobrien # We need an absolute path. 393989857Sobrien case $ladir in 394077298Sobrien [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 394177298Sobrien *) 394277298Sobrien abs_ladir=`cd "$ladir" && pwd` 394377298Sobrien if test -z "$abs_ladir"; then 3944218822Sdim func_warning "cannot determine absolute directory name of \`$ladir'" 3945218822Sdim func_warning "passing it literally to the linker, although it might fail" 394677298Sobrien abs_ladir="$ladir" 394777298Sobrien fi 394877298Sobrien ;; 394977298Sobrien esac 3950218822Sdim func_basename "$lib" 3951218822Sdim laname="$func_basename_result" 395277298Sobrien 395360484Sobrien # Find the relevant object directory and library name. 395460484Sobrien if test "X$installed" = Xyes; then 395577298Sobrien if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 3956218822Sdim func_warning "library \`$lib' was moved." 395777298Sobrien dir="$ladir" 395877298Sobrien absdir="$abs_ladir" 395977298Sobrien libdir="$abs_ladir" 396077298Sobrien else 396177298Sobrien dir="$libdir" 396277298Sobrien absdir="$libdir" 396377298Sobrien fi 3964218822Sdim test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 396560484Sobrien else 3966218822Sdim if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 3967218822Sdim dir="$ladir" 3968218822Sdim absdir="$abs_ladir" 3969218822Sdim # Remove this search path later 3970218822Sdim notinst_path="$notinst_path $abs_ladir" 3971218822Sdim else 3972218822Sdim dir="$ladir/$objdir" 3973218822Sdim absdir="$abs_ladir/$objdir" 3974218822Sdim # Remove this search path later 3975218822Sdim notinst_path="$notinst_path $abs_ladir" 3976218822Sdim fi 397789857Sobrien fi # $installed = yes 3978218822Sdim func_stripname 'lib' '.la' "$laname" 3979218822Sdim name=$func_stripname_result 398077298Sobrien 398177298Sobrien # This library was specified with -dlpreopen. 3982218822Sdim if test "$pass" = dlpreopen; then 3983218822Sdim if test -z "$libdir" && test "$linkmode" = prog; then 3984218822Sdim func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 398577298Sobrien fi 398677298Sobrien # Prefer using a static library (so that no silly _DYNAMIC symbols 398777298Sobrien # are required to link). 398877298Sobrien if test -n "$old_library"; then 398977298Sobrien newdlprefiles="$newdlprefiles $dir/$old_library" 3990218822Sdim # Keep a list of preopened convenience libraries to check 3991218822Sdim # that they are being used correctly in the link pass. 3992218822Sdim test -z "$libdir" && \ 3993218822Sdim dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 399477298Sobrien # Otherwise, use the dlname, so that lt_dlopen finds it. 399577298Sobrien elif test -n "$dlname"; then 399677298Sobrien newdlprefiles="$newdlprefiles $dir/$dlname" 399760484Sobrien else 399877298Sobrien newdlprefiles="$newdlprefiles $dir/$linklib" 399960484Sobrien fi 400089857Sobrien fi # $pass = dlpreopen 400160484Sobrien 400277298Sobrien if test -z "$libdir"; then 400389857Sobrien # Link the convenience library 4004218822Sdim if test "$linkmode" = lib; then 400577298Sobrien deplibs="$dir/$old_library $deplibs" 400677298Sobrien elif test "$linkmode,$pass" = "prog,link"; then 400777298Sobrien compile_deplibs="$dir/$old_library $compile_deplibs" 400877298Sobrien finalize_deplibs="$dir/$old_library $finalize_deplibs" 400977298Sobrien else 4010218822Sdim deplibs="$lib $deplibs" # used for prog,scan pass 401177298Sobrien fi 401277298Sobrien continue 401377298Sobrien fi 401477298Sobrien 4015218822Sdim 4016218822Sdim if test "$linkmode" = prog && test "$pass" != link; then 401777298Sobrien newlib_search_path="$newlib_search_path $ladir" 401877298Sobrien deplibs="$lib $deplibs" 401977298Sobrien 402077298Sobrien linkalldeplibs=no 402177298Sobrien if test "$link_all_deplibs" != no || test -z "$library_names" || 402277298Sobrien test "$build_libtool_libs" = no; then 402377298Sobrien linkalldeplibs=yes 402477298Sobrien fi 402577298Sobrien 402677298Sobrien tmp_libs= 402760484Sobrien for deplib in $dependency_libs; do 402889857Sobrien case $deplib in 4029218822Sdim -L*) func_stripname '-L' '' "$deplib" 4030218822Sdim newlib_search_path="$newlib_search_path $func_stripname_result" 4031218822Sdim ;; 403260484Sobrien esac 403377298Sobrien # Need to link against all dependency_libs? 4034218822Sdim if test "$linkalldeplibs" = yes; then 403577298Sobrien deplibs="$deplib $deplibs" 403677298Sobrien else 403777298Sobrien # Need to hardcode shared library paths 403877298Sobrien # or/and link against static libraries 403977298Sobrien newdependency_libs="$deplib $newdependency_libs" 404077298Sobrien fi 4041218822Sdim if $opt_duplicate_deps ; then 4042218822Sdim case "$tmp_libs " in 4043218822Sdim *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 4044218822Sdim esac 4045218822Sdim fi 404677298Sobrien tmp_libs="$tmp_libs $deplib" 404789857Sobrien done # for deplib 404860484Sobrien continue 404989857Sobrien fi # $linkmode = prog... 405060484Sobrien 4051218822Sdim if test "$linkmode,$pass" = "prog,link"; then 4052218822Sdim if test -n "$library_names" && 4053218822Sdim { { test "$prefer_static_libs" = no || 4054218822Sdim test "$prefer_static_libs,$installed" = "built,yes"; } || 4055218822Sdim test -z "$old_library"; }; then 4056218822Sdim # We need to hardcode the library path 4057218822Sdim if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 4058218822Sdim # Make sure the rpath contains only unique directories. 4059218822Sdim case "$temp_rpath:" in 4060218822Sdim *"$absdir:"*) ;; 4061218822Sdim *) temp_rpath="$temp_rpath$absdir:" ;; 4062218822Sdim esac 4063218822Sdim fi 406477298Sobrien 406577298Sobrien # Hardcode the library path. 406677298Sobrien # Skip directories that are in the system default run-time 406777298Sobrien # search path. 406877298Sobrien case " $sys_lib_dlsearch_path " in 406977298Sobrien *" $absdir "*) ;; 407077298Sobrien *) 407177298Sobrien case "$compile_rpath " in 407277298Sobrien *" $absdir "*) ;; 407377298Sobrien *) compile_rpath="$compile_rpath $absdir" 407477298Sobrien esac 407577298Sobrien ;; 407677298Sobrien esac 407777298Sobrien case " $sys_lib_dlsearch_path " in 407877298Sobrien *" $libdir "*) ;; 407977298Sobrien *) 408077298Sobrien case "$finalize_rpath " in 408177298Sobrien *" $libdir "*) ;; 408277298Sobrien *) finalize_rpath="$finalize_rpath $libdir" 408377298Sobrien esac 408477298Sobrien ;; 408577298Sobrien esac 408689857Sobrien fi # $linkmode,$pass = prog,link... 408738889Sjdp 408877298Sobrien if test "$alldeplibs" = yes && 408977298Sobrien { test "$deplibs_check_method" = pass_all || 409077298Sobrien { test "$build_libtool_libs" = yes && 409177298Sobrien test -n "$library_names"; }; }; then 409277298Sobrien # We only need to search for static libraries 409377298Sobrien continue 409460484Sobrien fi 4095218822Sdim fi 409638889Sjdp 4097218822Sdim link_static=no # Whether the deplib will be linked statically 4098218822Sdim use_static_libs=$prefer_static_libs 4099218822Sdim if test "$use_static_libs" = built && test "$installed" = yes; then 4100218822Sdim use_static_libs=no 4101218822Sdim fi 4102218822Sdim if test -n "$library_names" && 4103218822Sdim { test "$use_static_libs" = no || test -z "$old_library"; }; then 4104218822Sdim case $host in 4105218822Sdim *cygwin* | *mingw*) 4106218822Sdim # No point in relinking DLLs because paths are not encoded 4107218822Sdim notinst_deplibs="$notinst_deplibs $lib" 4108218822Sdim need_relink=no 4109218822Sdim ;; 4110218822Sdim *) 4111218822Sdim if test "$installed" = no; then 4112218822Sdim notinst_deplibs="$notinst_deplibs $lib" 4113218822Sdim need_relink=yes 4114218822Sdim fi 4115218822Sdim ;; 4116218822Sdim esac 4117218822Sdim # This is a shared library 4118218822Sdim 4119218822Sdim # Warn about portability, can't link against -module's on some 4120218822Sdim # systems (darwin). Don't bleat about dlopened modules though! 4121218822Sdim dlopenmodule="" 4122218822Sdim for dlpremoduletest in $dlprefiles; do 4123218822Sdim if test "X$dlpremoduletest" = "X$lib"; then 4124218822Sdim dlopenmodule="$dlpremoduletest" 4125218822Sdim break 4126218822Sdim fi 4127218822Sdim done 4128218822Sdim if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 4129218822Sdim $ECHO 4130218822Sdim if test "$linkmode" = prog; then 4131218822Sdim $ECHO "*** Warning: Linking the executable $output against the loadable module" 4132218822Sdim else 4133218822Sdim $ECHO "*** Warning: Linking the shared library $output against the loadable module" 4134218822Sdim fi 4135218822Sdim $ECHO "*** $linklib is not portable!" 413677298Sobrien fi 4137218822Sdim if test "$linkmode" = lib && 4138218822Sdim test "$hardcode_into_libs" = yes; then 4139218822Sdim # Hardcode the library path. 4140218822Sdim # Skip directories that are in the system default run-time 4141218822Sdim # search path. 4142218822Sdim case " $sys_lib_dlsearch_path " in 4143218822Sdim *" $absdir "*) ;; 4144218822Sdim *) 4145218822Sdim case "$compile_rpath " in 4146218822Sdim *" $absdir "*) ;; 4147218822Sdim *) compile_rpath="$compile_rpath $absdir" 4148218822Sdim esac 4149218822Sdim ;; 4150218822Sdim esac 4151218822Sdim case " $sys_lib_dlsearch_path " in 4152218822Sdim *" $libdir "*) ;; 4153218822Sdim *) 4154218822Sdim case "$finalize_rpath " in 4155218822Sdim *" $libdir "*) ;; 4156218822Sdim *) finalize_rpath="$finalize_rpath $libdir" 4157218822Sdim esac 4158218822Sdim ;; 4159218822Sdim esac 4160218822Sdim fi 416138889Sjdp 416277298Sobrien if test -n "$old_archive_from_expsyms_cmds"; then 416377298Sobrien # figure out the soname 416477298Sobrien set dummy $library_names 4165218822Sdim shift 4166218822Sdim realname="$1" 4167218822Sdim shift 4168218822Sdim libname=`eval "\\$ECHO \"$libname_spec\""` 416989857Sobrien # use dlname if we got it. it's perfectly good, no? 417089857Sobrien if test -n "$dlname"; then 417189857Sobrien soname="$dlname" 417289857Sobrien elif test -n "$soname_spec"; then 417389857Sobrien # bleh windows 417489857Sobrien case $host in 4175218822Sdim *cygwin* | mingw*) 417689857Sobrien major=`expr $current - $age` 417789857Sobrien versuffix="-$major" 417889857Sobrien ;; 417989857Sobrien esac 418077298Sobrien eval soname=\"$soname_spec\" 418177298Sobrien else 418277298Sobrien soname="$realname" 418360484Sobrien fi 418438889Sjdp 418577298Sobrien # Make a new name for the extract_expsyms_cmds to use 418689857Sobrien soroot="$soname" 4187218822Sdim func_basename "$soroot" 4188218822Sdim soname="$func_basename_result" 4189218822Sdim func_stripname 'lib' '.dll' "$soname" 4190218822Sdim newlib=libimp-$func_stripname_result.a 419177298Sobrien 419277298Sobrien # If the library has no export list, then create one now 419377298Sobrien if test -f "$output_objdir/$soname-def"; then : 419477298Sobrien else 4195218822Sdim func_echo "extracting exported symbol list from \`$soname'" 4196218822Sdim func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 419777298Sobrien fi 419877298Sobrien 419977298Sobrien # Create $newlib 420077298Sobrien if test -f "$output_objdir/$newlib"; then :; else 4201218822Sdim func_echo "generating import library for \`$soname'" 4202218822Sdim func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 420377298Sobrien fi 420477298Sobrien # make sure the library variables are pointing to the new library 420577298Sobrien dir=$output_objdir 420677298Sobrien linklib=$newlib 4207218822Sdim fi # test -n "$old_archive_from_expsyms_cmds" 420877298Sobrien 4209218822Sdim if test "$linkmode" = prog || test "$mode" != relink; then 421077298Sobrien add_shlibpath= 421177298Sobrien add_dir= 421277298Sobrien add= 421377298Sobrien lib_linked=yes 421489857Sobrien case $hardcode_action in 421577298Sobrien immediate | unsupported) 421677298Sobrien if test "$hardcode_direct" = no; then 421777298Sobrien add="$dir/$linklib" 4218218822Sdim case $host in 4219218822Sdim *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 4220218822Sdim *-*-sysv4*uw2*) add_dir="-L$dir" ;; 4221218822Sdim *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 4222218822Sdim *-*-unixware7*) add_dir="-L$dir" ;; 4223218822Sdim *-*-darwin* ) 4224218822Sdim # if the lib is a (non-dlopened) module then we can not 4225218822Sdim # link against it, someone is ignoring the earlier warnings 4226218822Sdim if /usr/bin/file -L $add 2> /dev/null | 4227218822Sdim $GREP ": [^:]* bundle" >/dev/null ; then 4228218822Sdim if test "X$dlopenmodule" != "X$lib"; then 4229218822Sdim $ECHO "*** Warning: lib $linklib is a module, not a shared library" 4230218822Sdim if test -z "$old_library" ; then 4231218822Sdim $ECHO 4232218822Sdim $ECHO "*** And there doesn't seem to be a static archive available" 4233218822Sdim $ECHO "*** The link will probably fail, sorry" 4234218822Sdim else 4235218822Sdim add="$dir/$old_library" 4236218822Sdim fi 4237218822Sdim elif test -n "$old_library"; then 4238218822Sdim add="$dir/$old_library" 4239218822Sdim fi 4240218822Sdim fi 4241218822Sdim esac 424277298Sobrien elif test "$hardcode_minus_L" = no; then 424389857Sobrien case $host in 424477298Sobrien *-*-sunos*) add_shlibpath="$dir" ;; 424577298Sobrien esac 424677298Sobrien add_dir="-L$dir" 424777298Sobrien add="-l$name" 424877298Sobrien elif test "$hardcode_shlibpath_var" = no; then 424977298Sobrien add_shlibpath="$dir" 425077298Sobrien add="-l$name" 425177298Sobrien else 425277298Sobrien lib_linked=no 425377298Sobrien fi 425477298Sobrien ;; 425577298Sobrien relink) 4256218822Sdim if test "$hardcode_direct" = yes && 4257218822Sdim test "$hardcode_direct_absolute" = no; then 425877298Sobrien add="$dir/$linklib" 425977298Sobrien elif test "$hardcode_minus_L" = yes; then 426077298Sobrien add_dir="-L$dir" 4261218822Sdim # Try looking first in the location we're being installed to. 4262218822Sdim if test -n "$inst_prefix_dir"; then 4263218822Sdim case $libdir in 4264218822Sdim [\\/]*) 4265218822Sdim add_dir="$add_dir -L$inst_prefix_dir$libdir" 4266218822Sdim ;; 4267218822Sdim esac 4268218822Sdim fi 426977298Sobrien add="-l$name" 427077298Sobrien elif test "$hardcode_shlibpath_var" = yes; then 427177298Sobrien add_shlibpath="$dir" 427277298Sobrien add="-l$name" 427377298Sobrien else 427477298Sobrien lib_linked=no 427577298Sobrien fi 427677298Sobrien ;; 427777298Sobrien *) lib_linked=no ;; 427860484Sobrien esac 427938889Sjdp 428077298Sobrien if test "$lib_linked" != yes; then 4281218822Sdim func_fatal_configuration "unsupported hardcode properties" 428277298Sobrien fi 428377298Sobrien 428477298Sobrien if test -n "$add_shlibpath"; then 428589857Sobrien case :$compile_shlibpath: in 428677298Sobrien *":$add_shlibpath:"*) ;; 428777298Sobrien *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 428860484Sobrien esac 428977298Sobrien fi 4290218822Sdim if test "$linkmode" = prog; then 429177298Sobrien test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 429277298Sobrien test -n "$add" && compile_deplibs="$add $compile_deplibs" 429360484Sobrien else 429477298Sobrien test -n "$add_dir" && deplibs="$add_dir $deplibs" 429577298Sobrien test -n "$add" && deplibs="$add $deplibs" 4296218822Sdim if test "$hardcode_direct" != yes && 4297218822Sdim test "$hardcode_minus_L" != yes && 429877298Sobrien test "$hardcode_shlibpath_var" = yes; then 429989857Sobrien case :$finalize_shlibpath: in 430077298Sobrien *":$libdir:"*) ;; 430177298Sobrien *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 430277298Sobrien esac 430377298Sobrien fi 430460484Sobrien fi 430577298Sobrien fi 430638889Sjdp 4307218822Sdim if test "$linkmode" = prog || test "$mode" = relink; then 430877298Sobrien add_shlibpath= 430977298Sobrien add_dir= 431077298Sobrien add= 431177298Sobrien # Finalize command for both is simple: just hardcode it. 4312218822Sdim if test "$hardcode_direct" = yes && 4313218822Sdim test "$hardcode_direct_absolute" = no; then 431477298Sobrien add="$libdir/$linklib" 431560484Sobrien elif test "$hardcode_minus_L" = yes; then 431677298Sobrien add_dir="-L$libdir" 431777298Sobrien add="-l$name" 431860484Sobrien elif test "$hardcode_shlibpath_var" = yes; then 431989857Sobrien case :$finalize_shlibpath: in 432077298Sobrien *":$libdir:"*) ;; 432177298Sobrien *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 432260484Sobrien esac 432377298Sobrien add="-l$name" 4324218822Sdim elif test "$hardcode_automatic" = yes; then 4325218822Sdim if test -n "$inst_prefix_dir" && 4326218822Sdim test -f "$inst_prefix_dir$libdir/$linklib" ; then 4327218822Sdim add="$inst_prefix_dir$libdir/$linklib" 4328218822Sdim else 4329218822Sdim add="$libdir/$linklib" 4330218822Sdim fi 433160484Sobrien else 433277298Sobrien # We cannot seem to hardcode it, guess we'll fake it. 433377298Sobrien add_dir="-L$libdir" 4334218822Sdim # Try looking first in the location we're being installed to. 4335218822Sdim if test -n "$inst_prefix_dir"; then 4336218822Sdim case $libdir in 4337218822Sdim [\\/]*) 4338218822Sdim add_dir="$add_dir -L$inst_prefix_dir$libdir" 4339218822Sdim ;; 4340218822Sdim esac 4341218822Sdim fi 434277298Sobrien add="-l$name" 434360484Sobrien fi 434438889Sjdp 4345218822Sdim if test "$linkmode" = prog; then 434677298Sobrien test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 434777298Sobrien test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 434877298Sobrien else 434977298Sobrien test -n "$add_dir" && deplibs="$add_dir $deplibs" 435077298Sobrien test -n "$add" && deplibs="$add $deplibs" 435177298Sobrien fi 435260484Sobrien fi 4353218822Sdim elif test "$linkmode" = prog; then 435438889Sjdp # Here we assume that one of hardcode_direct or hardcode_minus_L 435538889Sjdp # is not unsupported. This is valid on all known static and 435638889Sjdp # shared platforms. 435738889Sjdp if test "$hardcode_direct" != unsupported; then 435838889Sjdp test -n "$old_library" && linklib="$old_library" 435977298Sobrien compile_deplibs="$dir/$linklib $compile_deplibs" 436077298Sobrien finalize_deplibs="$dir/$linklib $finalize_deplibs" 436138889Sjdp else 436277298Sobrien compile_deplibs="-l$name -L$dir $compile_deplibs" 436377298Sobrien finalize_deplibs="-l$name -L$dir $finalize_deplibs" 436438889Sjdp fi 436577298Sobrien elif test "$build_libtool_libs" = yes; then 436677298Sobrien # Not a shared library 436777298Sobrien if test "$deplibs_check_method" != pass_all; then 436877298Sobrien # We're trying link a shared library against a static one 436977298Sobrien # but the system doesn't support it. 437089857Sobrien 437177298Sobrien # Just print a warning and add the library to dependency_libs so 437277298Sobrien # that the program can be linked against the static library. 4373218822Sdim $ECHO 4374218822Sdim $ECHO "*** Warning: This system can not link to static lib archive $lib." 4375218822Sdim $ECHO "*** I have the capability to make that library automatically link in when" 4376218822Sdim $ECHO "*** you link to this library. But I can only do this if you have a" 4377218822Sdim $ECHO "*** shared version of the library, which you do not appear to have." 437889857Sobrien if test "$module" = yes; then 4379218822Sdim $ECHO "*** But as you try to build a module library, libtool will still create " 4380218822Sdim $ECHO "*** a static module, that should work as long as the dlopening application" 4381218822Sdim $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." 438289857Sobrien if test -z "$global_symbol_pipe"; then 4383218822Sdim $ECHO 4384218822Sdim $ECHO "*** However, this would only work if libtool was able to extract symbol" 4385218822Sdim $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 4386218822Sdim $ECHO "*** not find such a program. So, this module is probably useless." 4387218822Sdim $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 438889857Sobrien fi 438989857Sobrien if test "$build_old_libs" = no; then 4390218822Sdim build_libtool_libs=module 4391218822Sdim build_old_libs=yes 439289857Sobrien else 4393218822Sdim build_libtool_libs=no 439489857Sobrien fi 439589857Sobrien fi 439677298Sobrien else 439777298Sobrien deplibs="$dir/$old_library $deplibs" 439877298Sobrien link_static=yes 439977298Sobrien fi 440089857Sobrien fi # link shared/static library? 440138889Sjdp 4402218822Sdim if test "$linkmode" = lib; then 440377298Sobrien if test -n "$dependency_libs" && 4404218822Sdim { test "$hardcode_into_libs" != yes || 4405218822Sdim test "$build_old_libs" = yes || 4406218822Sdim test "$link_static" = yes; }; then 440777298Sobrien # Extract -R from dependency_libs 440877298Sobrien temp_deplibs= 440977298Sobrien for libdir in $dependency_libs; do 441089857Sobrien case $libdir in 4411218822Sdim -R*) func_stripname '-R' '' "$libdir" 4412218822Sdim temp_xrpath=$func_stripname_result 441377298Sobrien case " $xrpath " in 441477298Sobrien *" $temp_xrpath "*) ;; 441577298Sobrien *) xrpath="$xrpath $temp_xrpath";; 441677298Sobrien esac;; 441777298Sobrien *) temp_deplibs="$temp_deplibs $libdir";; 441877298Sobrien esac 441977298Sobrien done 442077298Sobrien dependency_libs="$temp_deplibs" 442177298Sobrien fi 442238889Sjdp 442377298Sobrien newlib_search_path="$newlib_search_path $absdir" 442477298Sobrien # Link against this library 442577298Sobrien test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 442677298Sobrien # ... and its dependency_libs 442777298Sobrien tmp_libs= 442877298Sobrien for deplib in $dependency_libs; do 442977298Sobrien newdependency_libs="$deplib $newdependency_libs" 4430218822Sdim if $opt_duplicate_deps ; then 4431218822Sdim case "$tmp_libs " in 4432218822Sdim *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 4433218822Sdim esac 4434218822Sdim fi 443577298Sobrien tmp_libs="$tmp_libs $deplib" 443677298Sobrien done 443738889Sjdp 4438218822Sdim if test "$link_all_deplibs" != no; then 443977298Sobrien # Add the search paths of all dependency libraries 444077298Sobrien for deplib in $dependency_libs; do 444189857Sobrien case $deplib in 444277298Sobrien -L*) path="$deplib" ;; 444377298Sobrien *.la) 4444218822Sdim func_dirname "$deplib" "" "." 4445218822Sdim dir="$func_dirname_result" 444677298Sobrien # We need an absolute path. 444789857Sobrien case $dir in 444877298Sobrien [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 444977298Sobrien *) 445077298Sobrien absdir=`cd "$dir" && pwd` 445177298Sobrien if test -z "$absdir"; then 4452218822Sdim func_warning "cannot determine absolute directory name of \`$dir'" 445377298Sobrien absdir="$dir" 445477298Sobrien fi 445577298Sobrien ;; 445677298Sobrien esac 4457218822Sdim if $GREP "^installed=no" $deplib > /dev/null; then 4458218822Sdim case $host in 4459218822Sdim *-*-darwin*) 4460218822Sdim depdepl= 4461218822Sdim eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 4462218822Sdim if test -n "$deplibrary_names" ; then 4463218822Sdim for tmp in $deplibrary_names ; do 4464218822Sdim depdepl=$tmp 4465218822Sdim done 4466218822Sdim if test -f "$absdir/$objdir/$depdepl" ; then 4467218822Sdim depdepl="$absdir/$objdir/$depdepl" 4468218822Sdim darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'` 4469218822Sdim darwin_install_name=`$ECHO $darwin_install_name` 4470218822Sdim if test -z "$darwin_install_name"; then 4471218822Sdim darwin_install_name=`otool64 -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'` 4472218822Sdim darwin_install_name=`$ECHO $darwin_install_name` 4473218822Sdim fi 4474218822Sdim compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 4475218822Sdim linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 4476218822Sdim path= 4477218822Sdim fi 4478218822Sdim fi 4479218822Sdim ;; 4480218822Sdim *) 448177298Sobrien path="-L$absdir/$objdir" 4482218822Sdim ;; 4483218822Sdim esac 448477298Sobrien else 4485218822Sdim eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 4486218822Sdim test -z "$libdir" && \ 4487218822Sdim func_fatal_error "\`$deplib' is not a valid libtool archive" 4488218822Sdim test "$absdir" != "$libdir" && \ 4489218822Sdim func_warning "\`$deplib' seems to be moved" 4490218822Sdim 449177298Sobrien path="-L$absdir" 449277298Sobrien fi 449377298Sobrien ;; 449477298Sobrien esac 449577298Sobrien case " $deplibs " in 449677298Sobrien *" $path "*) ;; 449777298Sobrien *) deplibs="$path $deplibs" ;; 449877298Sobrien esac 449977298Sobrien done 450089857Sobrien fi # link_all_deplibs != no 450189857Sobrien fi # linkmode = lib 450289857Sobrien done # for deplib in $libs 4503218822Sdim dependency_libs="$newdependency_libs" 4504218822Sdim if test "$pass" = dlpreopen; then 450577298Sobrien # Link the dlpreopened libraries before other libraries 450677298Sobrien for deplib in $save_deplibs; do 450777298Sobrien deplibs="$deplib $deplibs" 450877298Sobrien done 450938889Sjdp fi 4510218822Sdim if test "$pass" != dlopen; then 4511218822Sdim if test "$pass" != conv; then 451277298Sobrien # Make sure lib_search_path contains only unique directories. 451377298Sobrien lib_search_path= 451477298Sobrien for dir in $newlib_search_path; do 451577298Sobrien case "$lib_search_path " in 451677298Sobrien *" $dir "*) ;; 451777298Sobrien *) lib_search_path="$lib_search_path $dir" ;; 451877298Sobrien esac 451977298Sobrien done 452077298Sobrien newlib_search_path= 452177298Sobrien fi 452277298Sobrien 452377298Sobrien if test "$linkmode,$pass" != "prog,link"; then 452477298Sobrien vars="deplibs" 452577298Sobrien else 452677298Sobrien vars="compile_deplibs finalize_deplibs" 452777298Sobrien fi 452877298Sobrien for var in $vars dependency_libs; do 452989857Sobrien # Add libraries to $var in reverse order 453077298Sobrien eval tmp_libs=\"\$$var\" 453177298Sobrien new_libs= 453277298Sobrien for deplib in $tmp_libs; do 4533218822Sdim # FIXME: Pedantically, this is the right thing to do, so 4534218822Sdim # that some nasty dependency loop isn't accidentally 4535218822Sdim # broken: 4536218822Sdim #new_libs="$deplib $new_libs" 4537218822Sdim # Pragmatically, this seems to cause very few problems in 4538218822Sdim # practice: 453989857Sobrien case $deplib in 454077298Sobrien -L*) new_libs="$deplib $new_libs" ;; 4541218822Sdim -R*) ;; 454277298Sobrien *) 4543218822Sdim # And here is the reason: when a library appears more 4544218822Sdim # than once as an explicit dependence of a library, or 4545218822Sdim # is implicitly linked in more than once by the 4546218822Sdim # compiler, it is considered special, and multiple 4547218822Sdim # occurrences thereof are not removed. Compare this 4548218822Sdim # with having the same library being listed as a 4549218822Sdim # dependency of multiple other libraries: in this case, 4550218822Sdim # we know (pedantically, we assume) the library does not 4551218822Sdim # need to be listed more than once, so we keep only the 4552218822Sdim # last copy. This is not always right, but it is rare 4553218822Sdim # enough that we require users that really mean to play 4554218822Sdim # such unportable linking tricks to link the library 4555218822Sdim # using -Wl,-lname, so that libtool does not consider it 4556218822Sdim # for duplicate removal. 455777298Sobrien case " $specialdeplibs " in 455877298Sobrien *" $deplib "*) new_libs="$deplib $new_libs" ;; 455977298Sobrien *) 456077298Sobrien case " $new_libs " in 456177298Sobrien *" $deplib "*) ;; 456277298Sobrien *) new_libs="$deplib $new_libs" ;; 456377298Sobrien esac 456477298Sobrien ;; 456577298Sobrien esac 456677298Sobrien ;; 456777298Sobrien esac 456877298Sobrien done 456977298Sobrien tmp_libs= 457077298Sobrien for deplib in $new_libs; do 457189857Sobrien case $deplib in 457277298Sobrien -L*) 457377298Sobrien case " $tmp_libs " in 457477298Sobrien *" $deplib "*) ;; 457577298Sobrien *) tmp_libs="$tmp_libs $deplib" ;; 457677298Sobrien esac 457777298Sobrien ;; 457877298Sobrien *) tmp_libs="$tmp_libs $deplib" ;; 457977298Sobrien esac 458077298Sobrien done 458177298Sobrien eval $var=\"$tmp_libs\" 458289857Sobrien done # for var 458377298Sobrien fi 4584218822Sdim # Last step: remove runtime libs from dependency_libs 4585218822Sdim # (they stay in deplibs) 4586218822Sdim tmp_libs= 4587218822Sdim for i in $dependency_libs ; do 4588218822Sdim case " $predeps $postdeps $compiler_lib_search_path " in 4589218822Sdim *" $i "*) 4590218822Sdim i="" 4591218822Sdim ;; 4592218822Sdim esac 4593218822Sdim if test -n "$i" ; then 4594218822Sdim tmp_libs="$tmp_libs $i" 4595218822Sdim fi 4596218822Sdim done 4597218822Sdim dependency_libs=$tmp_libs 459889857Sobrien done # for pass 4599218822Sdim if test "$linkmode" = prog; then 460077298Sobrien dlfiles="$newdlfiles" 4601218822Sdim fi 4602218822Sdim if test "$linkmode" = prog || test "$linkmode" = lib; then 460377298Sobrien dlprefiles="$newdlprefiles" 460438889Sjdp fi 460538889Sjdp 460677298Sobrien case $linkmode in 460777298Sobrien oldlib) 460860484Sobrien if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4609218822Sdim func_warning "\`-dlopen' is ignored for archives" 461060484Sobrien fi 461160484Sobrien 4612218822Sdim test -n "$deplibs" && \ 4613218822Sdim func_warning "\`-l' and \`-L' are ignored for archives" 461460484Sobrien 461560484Sobrien 4616218822Sdim test -n "$rpath" && \ 4617218822Sdim func_warning "\`-rpath' is ignored for archives" 461860484Sobrien 4619218822Sdim test -n "$xrpath" && \ 4620218822Sdim func_warning "\`-R' is ignored for archives" 462160484Sobrien 4622218822Sdim test -n "$vinfo" && \ 4623218822Sdim func_warning "\`-version-info/-version-number' is ignored for archives" 462460484Sobrien 4625218822Sdim test -n "$release" && \ 4626218822Sdim func_warning "\`-release' is ignored for archives" 4627218822Sdim 4628218822Sdim test -n "$export_symbols$export_symbols_regex" && \ 4629218822Sdim func_warning "\`-export-symbols' is ignored for archives" 4630218822Sdim 463138889Sjdp # Now set the variables for building old libraries. 463238889Sjdp build_libtool_libs=no 463360484Sobrien oldlibs="$output" 463477298Sobrien objs="$objs$old_deplibs" 463538889Sjdp ;; 463638889Sjdp 463777298Sobrien lib) 463838889Sjdp # Make sure we only generate libraries of the form `libNAME.la'. 463989857Sobrien case $outputname in 464060484Sobrien lib*) 4641218822Sdim func_stripname 'lib' '.la' "$outputname" 4642218822Sdim name=$func_stripname_result 4643218822Sdim eval shared_ext=\"$shrext_cmds\" 464460484Sobrien eval libname=\"$libname_spec\" 464560484Sobrien ;; 464638889Sjdp *) 4647218822Sdim test "$module" = no && \ 4648218822Sdim func_fatal_help "libtool library \`$output' must begin with \`lib'" 4649218822Sdim 465060484Sobrien if test "$need_lib_prefix" != no; then 465160484Sobrien # Add the "lib" prefix for modules if required 4652218822Sdim func_stripname '' '.la' "$outputname" 4653218822Sdim name=$func_stripname_result 4654218822Sdim eval shared_ext=\"$shrext_cmds\" 465560484Sobrien eval libname=\"$libname_spec\" 465660484Sobrien else 4657218822Sdim func_stripname '' '.la' "$outputname" 4658218822Sdim libname=$func_stripname_result 465960484Sobrien fi 466038889Sjdp ;; 466138889Sjdp esac 466238889Sjdp 466338889Sjdp if test -n "$objs"; then 466477298Sobrien if test "$deplibs_check_method" != pass_all; then 4665218822Sdim func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 466677298Sobrien else 4667218822Sdim $ECHO 4668218822Sdim $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 4669218822Sdim $ECHO "*** objects $objs is not portable!" 467077298Sobrien libobjs="$libobjs $objs" 467177298Sobrien fi 467238889Sjdp fi 467338889Sjdp 4674218822Sdim test "$dlself" != no && \ 4675218822Sdim func_warning "\`-dlopen self' is ignored for libtool libraries" 467638889Sjdp 467738889Sjdp set dummy $rpath 4678218822Sdim shift 4679218822Sdim test "$#" -gt 1 && \ 4680218822Sdim func_warning "ignoring multiple \`-rpath's for a libtool library" 468138889Sjdp 4682218822Sdim install_libdir="$1" 4683218822Sdim 468460484Sobrien oldlibs= 468560484Sobrien if test -z "$rpath"; then 468660484Sobrien if test "$build_libtool_libs" = yes; then 468760484Sobrien # Building a libtool convenience library. 468877298Sobrien # Some compilers have problems with a `.al' extension so 4689218822Sdim # convenience libraries should have the same extension an 4690218822Sdim # archive normally would. 469160484Sobrien oldlibs="$output_objdir/$libname.$libext $oldlibs" 469260484Sobrien build_libtool_libs=convenience 469360484Sobrien build_old_libs=yes 469460484Sobrien fi 469538889Sjdp 4696218822Sdim test -n "$vinfo" && \ 4697218822Sdim func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 469838889Sjdp 4699218822Sdim test -n "$release" && \ 4700218822Sdim func_warning "\`-release' is ignored for convenience libraries" 470160484Sobrien else 470238889Sjdp 470360484Sobrien # Parse the version information argument. 4704218822Sdim save_ifs="$IFS"; IFS=':' 470560484Sobrien set dummy $vinfo 0 0 0 4706218822Sdim shift 470760484Sobrien IFS="$save_ifs" 470838889Sjdp 4709218822Sdim test -n "$7" && \ 4710218822Sdim func_fatal_help "too many parameters to \`-version-info'" 471138889Sjdp 4712218822Sdim # convert absolute version numbers to libtool ages 4713218822Sdim # this retains compatibility with .la files and attempts 4714218822Sdim # to make the code below a bit more comprehensible 471538889Sjdp 4716218822Sdim case $vinfo_number in 4717218822Sdim yes) 4718218822Sdim number_major="$1" 4719218822Sdim number_minor="$2" 4720218822Sdim number_revision="$3" 4721218822Sdim # 4722218822Sdim # There are really only two kinds -- those that 4723218822Sdim # use the current revision as the major version 4724218822Sdim # and those that subtract age and use age as 4725218822Sdim # a minor version. But, then there is irix 4726218822Sdim # which has an extra 1 added just for fun 4727218822Sdim # 4728218822Sdim case $version_type in 4729218822Sdim darwin|linux|osf|windows|none) 4730218822Sdim current=`expr $number_major + $number_minor` 4731218822Sdim age="$number_minor" 4732218822Sdim revision="$number_revision" 4733218822Sdim ;; 4734218822Sdim freebsd-aout|freebsd-elf|sunos) 4735218822Sdim current="$number_major" 4736218822Sdim revision="$number_minor" 4737218822Sdim age="0" 4738218822Sdim ;; 4739218822Sdim irix|nonstopux) 4740218822Sdim current=`expr $number_major + $number_minor - 1` 4741218822Sdim age="$number_minor" 4742218822Sdim revision="$number_minor" 4743218822Sdim ;; 4744218822Sdim esac 4745218822Sdim ;; 4746218822Sdim no) 4747218822Sdim current="$1" 4748218822Sdim revision="$2" 4749218822Sdim age="$3" 4750218822Sdim ;; 4751218822Sdim esac 4752218822Sdim 475360484Sobrien # Check that each of the things are valid numbers. 475489857Sobrien case $current in 4755218822Sdim 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]) ;; 475660484Sobrien *) 4757218822Sdim func_error "CURRENT \`$current' must be a nonnegative integer" 4758218822Sdim func_fatal_error "\`$vinfo' is not valid version information" 475960484Sobrien ;; 476060484Sobrien esac 476138889Sjdp 476289857Sobrien case $revision in 4763218822Sdim 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]) ;; 476460484Sobrien *) 4765218822Sdim func_error "REVISION \`$revision' must be a nonnegative integer" 4766218822Sdim func_fatal_error "\`$vinfo' is not valid version information" 476760484Sobrien ;; 476860484Sobrien esac 476938889Sjdp 477089857Sobrien case $age in 4771218822Sdim 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]) ;; 477260484Sobrien *) 4773218822Sdim func_error "AGE \`$age' must be a nonnegative integer" 4774218822Sdim func_fatal_error "\`$vinfo' is not valid version information" 477560484Sobrien ;; 477660484Sobrien esac 477738889Sjdp 4778218822Sdim if test "$age" -gt "$current"; then 4779218822Sdim func_error "AGE \`$age' is greater than the current interface number \`$current'" 4780218822Sdim func_fatal_error "\`$vinfo' is not valid version information" 478160484Sobrien fi 478238889Sjdp 478360484Sobrien # Calculate the version variables. 478460484Sobrien major= 478560484Sobrien versuffix= 478660484Sobrien verstring= 478789857Sobrien case $version_type in 478860484Sobrien none) ;; 478938889Sjdp 479089857Sobrien darwin) 479189857Sobrien # Like Linux, but with the current version available in 479289857Sobrien # verstring for coding it into the library header 479389857Sobrien major=.`expr $current - $age` 479489857Sobrien versuffix="$major.$age.$revision" 479589857Sobrien # Darwin ld doesn't like 0 for these options... 479689857Sobrien minor_current=`expr $current + 1` 479789857Sobrien verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 479889857Sobrien ;; 479989857Sobrien 480089857Sobrien freebsd-aout) 480189857Sobrien major=".$current" 480289857Sobrien versuffix=".$current.$revision"; 480389857Sobrien ;; 480489857Sobrien 480589857Sobrien freebsd-elf) 480689857Sobrien major=".$current" 4807218822Sdim versuffix=".$current" 480889857Sobrien ;; 480989857Sobrien 4810218822Sdim irix | nonstopux) 481160484Sobrien major=`expr $current - $age + 1` 481238889Sjdp 4813218822Sdim case $version_type in 4814218822Sdim nonstopux) verstring_prefix=nonstopux ;; 4815218822Sdim *) verstring_prefix=sgi ;; 4816218822Sdim esac 4817218822Sdim verstring="$verstring_prefix$major.$revision" 4818218822Sdim 481960484Sobrien # Add in all the interfaces that we are compatible with. 482060484Sobrien loop=$revision 4821218822Sdim while test "$loop" -ne 0; do 482260484Sobrien iface=`expr $revision - $loop` 482360484Sobrien loop=`expr $loop - 1` 4824218822Sdim verstring="$verstring_prefix$major.$iface:$verstring" 482560484Sobrien done 482677298Sobrien 482777298Sobrien # Before this point, $major must not contain `.'. 482877298Sobrien major=.$major 482977298Sobrien versuffix="$major.$revision" 483060484Sobrien ;; 483138889Sjdp 483260484Sobrien linux) 483360484Sobrien major=.`expr $current - $age` 483460484Sobrien versuffix="$major.$age.$revision" 483560484Sobrien ;; 483638889Sjdp 483760484Sobrien osf) 4838218822Sdim major=.`expr $current - $age` 483960484Sobrien versuffix=".$current.$age.$revision" 484060484Sobrien verstring="$current.$age.$revision" 484160484Sobrien 484260484Sobrien # Add in all the interfaces that we are compatible with. 484360484Sobrien loop=$age 4844218822Sdim while test "$loop" -ne 0; do 484560484Sobrien iface=`expr $current - $loop` 484660484Sobrien loop=`expr $loop - 1` 484760484Sobrien verstring="$verstring:${iface}.0" 484860484Sobrien done 484960484Sobrien 485060484Sobrien # Make executables depend on our current version. 485160484Sobrien verstring="$verstring:${current}.0" 485260484Sobrien ;; 485360484Sobrien 4854218822Sdim qnx) 4855218822Sdim major=".$current" 4856218822Sdim versuffix=".$current" 4857218822Sdim ;; 4858218822Sdim 485960484Sobrien sunos) 486060484Sobrien major=".$current" 486160484Sobrien versuffix=".$current.$revision" 486260484Sobrien ;; 486360484Sobrien 486460484Sobrien windows) 486577298Sobrien # Use '-' rather than '.', since we only want one 486677298Sobrien # extension on DOS 8.3 filesystems. 486760484Sobrien major=`expr $current - $age` 486877298Sobrien versuffix="-$major" 486960484Sobrien ;; 487060484Sobrien 487160484Sobrien *) 4872218822Sdim func_fatal_configuration "unknown library version type \`$version_type'" 487360484Sobrien ;; 487460484Sobrien esac 487560484Sobrien 487660484Sobrien # Clear the version info if we defaulted, and they specified a release. 487760484Sobrien if test -z "$vinfo" && test -n "$release"; then 487860484Sobrien major= 4879218822Sdim case $version_type in 4880218822Sdim darwin) 4881218822Sdim # we can't check for "0.0" in archive_cmds due to quoting 4882218822Sdim # problems, so we reset it completely 4883218822Sdim verstring= 4884218822Sdim ;; 4885218822Sdim *) 4886218822Sdim verstring="0.0" 4887218822Sdim ;; 4888218822Sdim esac 488960484Sobrien if test "$need_version" = no; then 489060484Sobrien versuffix= 489160484Sobrien else 489260484Sobrien versuffix=".0.0" 489360484Sobrien fi 489460484Sobrien fi 489560484Sobrien 489660484Sobrien # Remove version info from name if versioning should be avoided 489760484Sobrien if test "$avoid_version" = yes && test "$need_version" = no; then 489860484Sobrien major= 489960484Sobrien versuffix= 490060484Sobrien verstring="" 490160484Sobrien fi 490277298Sobrien 490360484Sobrien # Check to see if the archive will have undefined symbols. 490460484Sobrien if test "$allow_undefined" = yes; then 490560484Sobrien if test "$allow_undefined_flag" = unsupported; then 4906218822Sdim func_warning "undefined symbols not allowed in $host shared libraries" 490760484Sobrien build_libtool_libs=no 490860484Sobrien build_old_libs=yes 490960484Sobrien fi 491060484Sobrien else 491160484Sobrien # Don't allow undefined symbols. 491260484Sobrien allow_undefined_flag="$no_undefined_flag" 491360484Sobrien fi 4914218822Sdim 491560484Sobrien fi 491660484Sobrien 4917218822Sdim func_generate_dlsyms "$libname" "$libname" "yes" 4918218822Sdim libobjs="$libobjs $symfileobj" 4919218822Sdim test "X$libobjs" = "X " && libobjs= 4920218822Sdim 492177298Sobrien if test "$mode" != relink; then 492277298Sobrien # Remove our outputs, but don't remove object files since they 4923218822Sdim # may have been created when compiling PIC objects. 4924218822Sdim removelist= 4925218822Sdim tempremovelist=`$ECHO "$output_objdir/*"` 492677298Sobrien for p in $tempremovelist; do 4927218822Sdim case $p in 4928218822Sdim *.$objext) 4929218822Sdim ;; 4930218822Sdim $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 4931218822Sdim if test "X$precious_files_regex" != "X"; then 4932218822Sdim if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 4933218822Sdim then 4934218822Sdim continue 4935218822Sdim fi 4936218822Sdim fi 4937218822Sdim removelist="$removelist $p" 4938218822Sdim ;; 4939218822Sdim *) ;; 4940218822Sdim esac 4941218822Sdim done 4942218822Sdim test -n "$removelist" && \ 4943218822Sdim func_show_eval "${RM}r \$removelist" 494438889Sjdp fi 494538889Sjdp 494660484Sobrien # Now set the variables for building old libraries. 494760484Sobrien if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 494860484Sobrien oldlibs="$oldlibs $output_objdir/$libname.$libext" 494960484Sobrien 495060484Sobrien # Transform .lo files to .o files. 4951218822Sdim oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 495238889Sjdp fi 495338889Sjdp 495477298Sobrien # Eliminate all temporary directories. 4955218822Sdim #for path in $notinst_path; do 4956218822Sdim # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` 4957218822Sdim # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` 4958218822Sdim # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` 4959218822Sdim #done 496077298Sobrien 496177298Sobrien if test -n "$xrpath"; then 496277298Sobrien # If the user specified any rpath flags, then add them. 496377298Sobrien temp_xrpath= 496477298Sobrien for libdir in $xrpath; do 496577298Sobrien temp_xrpath="$temp_xrpath -R$libdir" 496677298Sobrien case "$finalize_rpath " in 496777298Sobrien *" $libdir "*) ;; 496877298Sobrien *) finalize_rpath="$finalize_rpath $libdir" ;; 496977298Sobrien esac 497077298Sobrien done 4971218822Sdim if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 497277298Sobrien dependency_libs="$temp_xrpath $dependency_libs" 497377298Sobrien fi 497477298Sobrien fi 497577298Sobrien 497677298Sobrien # Make sure dlfiles contains only unique files that won't be dlpreopened 497777298Sobrien old_dlfiles="$dlfiles" 497877298Sobrien dlfiles= 497977298Sobrien for lib in $old_dlfiles; do 498077298Sobrien case " $dlprefiles $dlfiles " in 498177298Sobrien *" $lib "*) ;; 498277298Sobrien *) dlfiles="$dlfiles $lib" ;; 498377298Sobrien esac 498477298Sobrien done 498577298Sobrien 498677298Sobrien # Make sure dlprefiles contains only unique files 498777298Sobrien old_dlprefiles="$dlprefiles" 498877298Sobrien dlprefiles= 498977298Sobrien for lib in $old_dlprefiles; do 499077298Sobrien case "$dlprefiles " in 499177298Sobrien *" $lib "*) ;; 499277298Sobrien *) dlprefiles="$dlprefiles $lib" ;; 499377298Sobrien esac 499477298Sobrien done 499577298Sobrien 499660484Sobrien if test "$build_libtool_libs" = yes; then 499777298Sobrien if test -n "$rpath"; then 499889857Sobrien case $host in 499977298Sobrien *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 500077298Sobrien # these systems don't actually have a c library (as such)! 500177298Sobrien ;; 500289857Sobrien *-*-rhapsody* | *-*-darwin1.[012]) 500389857Sobrien # Rhapsody C library is in the System framework 5004218822Sdim deplibs="$deplibs System.ltframework" 500589857Sobrien ;; 500689857Sobrien *-*-netbsd*) 500789857Sobrien # Don't link with libc until the a.out ld.so is fixed. 500889857Sobrien ;; 5009218822Sdim *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5010218822Sdim # Do not include libc due to us having libc/libc_r. 5011218822Sdim ;; 5012218822Sdim *-*-sco3.2v5* | *-*-sco5v6*) 5013218822Sdim # Causes problems with __ctype 5014218822Sdim ;; 5015218822Sdim *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 5016218822Sdim # Compiler inserts libc in the correct place for threads to work 5017218822Sdim ;; 5018218822Sdim *) 501989857Sobrien # Add libc to deplibs on all other systems if necessary. 5020218822Sdim if test "$build_libtool_need_lc" = "yes"; then 502189857Sobrien deplibs="$deplibs -lc" 502289857Sobrien fi 502377298Sobrien ;; 502477298Sobrien esac 502577298Sobrien fi 502677298Sobrien 502760484Sobrien # Transform deplibs into only deplibs that can be linked in shared. 502860484Sobrien name_save=$name 502960484Sobrien libname_save=$libname 503060484Sobrien release_save=$release 503160484Sobrien versuffix_save=$versuffix 503260484Sobrien major_save=$major 503360484Sobrien # I'm not sure if I'm treating the release correctly. I think 503460484Sobrien # release should show up in the -l (ie -lgmp5) so we don't want to 503560484Sobrien # add it in twice. Is that correct? 503660484Sobrien release="" 503760484Sobrien versuffix="" 503860484Sobrien major="" 503960484Sobrien newdeplibs= 504060484Sobrien droppeddeps=no 504189857Sobrien case $deplibs_check_method in 504260484Sobrien pass_all) 504360484Sobrien # Don't check for shared/static. Everything works. 504460484Sobrien # This might be a little naive. We might want to check 504560484Sobrien # whether the library exists or not. But this is on 504660484Sobrien # osf3 & osf4 and I'm not really sure... Just 5047218822Sdim # implementing what was already the behavior. 504860484Sobrien newdeplibs=$deplibs 504960484Sobrien ;; 505060484Sobrien test_compile) 505160484Sobrien # This code stresses the "libraries are programs" paradigm to its 505260484Sobrien # limits. Maybe even breaks it. We compile a program, linking it 505360484Sobrien # against the deplibs as a proxy for the library. Then we can check 505460484Sobrien # whether they linked in statically or dynamically with ldd. 5055218822Sdim $opt_dry_run || $RM conftest.c 505660484Sobrien cat > conftest.c <<EOF 505760484Sobrien int main() { return 0; } 505860484SobrienEOF 5059218822Sdim $opt_dry_run || $RM conftest 5060218822Sdim if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 506160484Sobrien ldd_output=`ldd conftest` 506260484Sobrien for i in $deplibs; do 5063218822Sdim name=`expr $i : '-l\(.*\)'` 506460484Sobrien # If $name is empty we are operating on a -L argument. 5065218822Sdim if test "$name" != "" && test "$name" != "0"; then 5066218822Sdim if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 5067218822Sdim case " $predeps $postdeps " in 5068218822Sdim *" $i "*) 5069218822Sdim newdeplibs="$newdeplibs $i" 5070218822Sdim i="" 5071218822Sdim ;; 5072218822Sdim esac 507360484Sobrien fi 5074218822Sdim if test -n "$i" ; then 5075218822Sdim libname=`eval "\\$ECHO \"$libname_spec\""` 5076218822Sdim deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 5077218822Sdim set dummy $deplib_matches; shift 5078218822Sdim deplib_match=$1 5079218822Sdim if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 5080218822Sdim newdeplibs="$newdeplibs $i" 5081218822Sdim else 5082218822Sdim droppeddeps=yes 5083218822Sdim $ECHO 5084218822Sdim $ECHO "*** Warning: dynamic linker does not accept needed library $i." 5085218822Sdim $ECHO "*** I have the capability to make that library automatically link in when" 5086218822Sdim $ECHO "*** you link to this library. But I can only do this if you have a" 5087218822Sdim $ECHO "*** shared version of the library, which I believe you do not have" 5088218822Sdim $ECHO "*** because a test_compile did reveal that the linker did not use it for" 5089218822Sdim $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." 5090218822Sdim fi 5091218822Sdim fi 509260484Sobrien else 509360484Sobrien newdeplibs="$newdeplibs $i" 509460484Sobrien fi 509560484Sobrien done 509660484Sobrien else 5097218822Sdim # Error occurred in the first compile. Let's try to salvage 5098218822Sdim # the situation: Compile a separate program for each library. 509960484Sobrien for i in $deplibs; do 5100218822Sdim name=`expr $i : '-l\(.*\)'` 5101218822Sdim # If $name is empty we are operating on a -L argument. 5102218822Sdim if test "$name" != "" && test "$name" != "0"; then 5103218822Sdim $opt_dry_run || $RM conftest 5104218822Sdim if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 510560484Sobrien ldd_output=`ldd conftest` 5106218822Sdim if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 5107218822Sdim case " $predeps $postdeps " in 5108218822Sdim *" $i "*) 5109218822Sdim newdeplibs="$newdeplibs $i" 5110218822Sdim i="" 5111218822Sdim ;; 5112218822Sdim esac 511360484Sobrien fi 5114218822Sdim if test -n "$i" ; then 5115218822Sdim libname=`eval "\\$ECHO \"$libname_spec\""` 5116218822Sdim deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 5117218822Sdim set dummy $deplib_matches; shift 5118218822Sdim deplib_match=$1 5119218822Sdim if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 5120218822Sdim newdeplibs="$newdeplibs $i" 5121218822Sdim else 5122218822Sdim droppeddeps=yes 5123218822Sdim $ECHO 5124218822Sdim $ECHO "*** Warning: dynamic linker does not accept needed library $i." 5125218822Sdim $ECHO "*** I have the capability to make that library automatically link in when" 5126218822Sdim $ECHO "*** you link to this library. But I can only do this if you have a" 5127218822Sdim $ECHO "*** shared version of the library, which you do not appear to have" 5128218822Sdim $ECHO "*** because a test_compile did reveal that the linker did not use this one" 5129218822Sdim $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." 5130218822Sdim fi 5131218822Sdim fi 513260484Sobrien else 513360484Sobrien droppeddeps=yes 5134218822Sdim $ECHO 5135218822Sdim $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 5136218822Sdim $ECHO "*** make it link in! You will probably need to install it or some" 5137218822Sdim $ECHO "*** library that it depends on before this library will be fully" 5138218822Sdim $ECHO "*** functional. Installing it before continuing would be even better." 513960484Sobrien fi 514060484Sobrien else 514160484Sobrien newdeplibs="$newdeplibs $i" 514260484Sobrien fi 514360484Sobrien done 514460484Sobrien fi 514560484Sobrien ;; 514660484Sobrien file_magic*) 5147218822Sdim set dummy $deplibs_check_method; shift 5148218822Sdim file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 514960484Sobrien for a_deplib in $deplibs; do 5150218822Sdim name=`expr $a_deplib : '-l\(.*\)'` 515160484Sobrien # If $name is empty we are operating on a -L argument. 5152218822Sdim if test "$name" != "" && test "$name" != "0"; then 5153218822Sdim if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 5154218822Sdim case " $predeps $postdeps " in 5155218822Sdim *" $a_deplib "*) 5156218822Sdim newdeplibs="$newdeplibs $a_deplib" 5157218822Sdim a_deplib="" 5158218822Sdim ;; 5159218822Sdim esac 5160218822Sdim fi 5161218822Sdim if test -n "$a_deplib" ; then 5162218822Sdim libname=`eval "\\$ECHO \"$libname_spec\""` 5163218822Sdim for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 5164218822Sdim potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 5165218822Sdim for potent_lib in $potential_libs; do 516660484Sobrien # Follow soft links. 5167218822Sdim if ls -lLd "$potent_lib" 2>/dev/null | 5168218822Sdim $GREP " -> " >/dev/null; then 516977298Sobrien continue 517060484Sobrien fi 517160484Sobrien # The statement above tries to avoid entering an 517260484Sobrien # endless loop below, in case of cyclic links. 517360484Sobrien # We might still enter an endless loop, since a link 517460484Sobrien # loop can be closed while we follow links, 517560484Sobrien # but so what? 517660484Sobrien potlib="$potent_lib" 517760484Sobrien while test -h "$potlib" 2>/dev/null; do 5178218822Sdim potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 517989857Sobrien case $potliblink in 518060484Sobrien [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 5181218822Sdim *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 518260484Sobrien esac 518360484Sobrien done 5184218822Sdim if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 5185218822Sdim $SED -e 10q | 5186218822Sdim $EGREP "$file_magic_regex" > /dev/null; then 518760484Sobrien newdeplibs="$newdeplibs $a_deplib" 518860484Sobrien a_deplib="" 518960484Sobrien break 2 519060484Sobrien fi 5191218822Sdim done 5192218822Sdim done 5193218822Sdim fi 519460484Sobrien if test -n "$a_deplib" ; then 519560484Sobrien droppeddeps=yes 5196218822Sdim $ECHO 5197218822Sdim $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 5198218822Sdim $ECHO "*** I have the capability to make that library automatically link in when" 5199218822Sdim $ECHO "*** you link to this library. But I can only do this if you have a" 5200218822Sdim $ECHO "*** shared version of the library, which you do not appear to have" 5201218822Sdim $ECHO "*** because I did check the linker path looking for a file starting" 5202218822Sdim if test -z "$potlib" ; then 5203218822Sdim $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 5204218822Sdim else 5205218822Sdim $ECHO "*** with $libname and none of the candidates passed a file format test" 5206218822Sdim $ECHO "*** using a file magic. Last file checked: $potlib" 5207218822Sdim fi 520860484Sobrien fi 520960484Sobrien else 521060484Sobrien # Add a -L argument. 521160484Sobrien newdeplibs="$newdeplibs $a_deplib" 521260484Sobrien fi 521360484Sobrien done # Gone through all deplibs. 521460484Sobrien ;; 521589857Sobrien match_pattern*) 5216218822Sdim set dummy $deplibs_check_method; shift 5217218822Sdim match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 521889857Sobrien for a_deplib in $deplibs; do 5219218822Sdim name=`expr $a_deplib : '-l\(.*\)'` 522089857Sobrien # If $name is empty we are operating on a -L argument. 522189857Sobrien if test -n "$name" && test "$name" != "0"; then 5222218822Sdim if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 5223218822Sdim case " $predeps $postdeps " in 5224218822Sdim *" $a_deplib "*) 5225218822Sdim newdeplibs="$newdeplibs $a_deplib" 5226218822Sdim a_deplib="" 5227218822Sdim ;; 5228218822Sdim esac 5229218822Sdim fi 5230218822Sdim if test -n "$a_deplib" ; then 5231218822Sdim libname=`eval "\\$ECHO \"$libname_spec\""` 5232218822Sdim for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 5233218822Sdim potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 5234218822Sdim for potent_lib in $potential_libs; do 5235218822Sdim potlib="$potent_lib" # see symlink-check above in file_magic test 5236218822Sdim if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ 5237218822Sdim $EGREP "$match_pattern_regex" > /dev/null; then 5238218822Sdim newdeplibs="$newdeplibs $a_deplib" 5239218822Sdim a_deplib="" 5240218822Sdim break 2 5241218822Sdim fi 5242218822Sdim done 524389857Sobrien done 5244218822Sdim fi 524589857Sobrien if test -n "$a_deplib" ; then 524689857Sobrien droppeddeps=yes 5247218822Sdim $ECHO 5248218822Sdim $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 5249218822Sdim $ECHO "*** I have the capability to make that library automatically link in when" 5250218822Sdim $ECHO "*** you link to this library. But I can only do this if you have a" 5251218822Sdim $ECHO "*** shared version of the library, which you do not appear to have" 5252218822Sdim $ECHO "*** because I did check the linker path looking for a file starting" 5253218822Sdim if test -z "$potlib" ; then 5254218822Sdim $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 5255218822Sdim else 5256218822Sdim $ECHO "*** with $libname and none of the candidates passed a file format test" 5257218822Sdim $ECHO "*** using a regex pattern. Last file checked: $potlib" 5258218822Sdim fi 525989857Sobrien fi 526089857Sobrien else 526189857Sobrien # Add a -L argument. 526289857Sobrien newdeplibs="$newdeplibs $a_deplib" 526389857Sobrien fi 526489857Sobrien done # Gone through all deplibs. 526589857Sobrien ;; 526660484Sobrien none | unknown | *) 526760484Sobrien newdeplibs="" 5268218822Sdim tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ 5269218822Sdim -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` 5270218822Sdim if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 5271218822Sdim for i in $predeps $postdeps ; do 5272218822Sdim # can't use Xsed below, because $i might contain '/' 5273218822Sdim tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` 5274218822Sdim done 5275218822Sdim fi 5276218822Sdim if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | 5277218822Sdim $GREP . >/dev/null; then 5278218822Sdim $ECHO 527960484Sobrien if test "X$deplibs_check_method" = "Xnone"; then 5280218822Sdim $ECHO "*** Warning: inter-library dependencies are not supported in this platform." 528160484Sobrien else 5282218822Sdim $ECHO "*** Warning: inter-library dependencies are not known to be supported." 528360484Sobrien fi 5284218822Sdim $ECHO "*** All declared inter-library dependencies are being dropped." 528560484Sobrien droppeddeps=yes 528660484Sobrien fi 528760484Sobrien ;; 528860484Sobrien esac 528960484Sobrien versuffix=$versuffix_save 529060484Sobrien major=$major_save 529160484Sobrien release=$release_save 529260484Sobrien libname=$libname_save 529360484Sobrien name=$name_save 529438889Sjdp 529589857Sobrien case $host in 529689857Sobrien *-*-rhapsody* | *-*-darwin1.[012]) 5297218822Sdim # On Rhapsody replace the C library with the System framework 5298218822Sdim newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 529989857Sobrien ;; 530089857Sobrien esac 530189857Sobrien 530260484Sobrien if test "$droppeddeps" = yes; then 530360484Sobrien if test "$module" = yes; then 5304218822Sdim $ECHO 5305218822Sdim $ECHO "*** Warning: libtool could not satisfy all declared inter-library" 5306218822Sdim $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 5307218822Sdim $ECHO "*** a static module, that should work as long as the dlopening" 5308218822Sdim $ECHO "*** application is linked with the -dlopen flag." 530960484Sobrien if test -z "$global_symbol_pipe"; then 5310218822Sdim $ECHO 5311218822Sdim $ECHO "*** However, this would only work if libtool was able to extract symbol" 5312218822Sdim $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 5313218822Sdim $ECHO "*** not find such a program. So, this module is probably useless." 5314218822Sdim $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 531560484Sobrien fi 531660484Sobrien if test "$build_old_libs" = no; then 531760484Sobrien oldlibs="$output_objdir/$libname.$libext" 531860484Sobrien build_libtool_libs=module 531960484Sobrien build_old_libs=yes 532060484Sobrien else 532160484Sobrien build_libtool_libs=no 532260484Sobrien fi 532360484Sobrien else 5324218822Sdim $ECHO "*** The inter-library dependencies that have been dropped here will be" 5325218822Sdim $ECHO "*** automatically added whenever a program is linked with this library" 5326218822Sdim $ECHO "*** or is declared to -dlopen it." 532789857Sobrien 5328218822Sdim if test "$allow_undefined" = no; then 5329218822Sdim $ECHO 5330218822Sdim $ECHO "*** Since this library must not contain undefined symbols," 5331218822Sdim $ECHO "*** because either the platform does not support them or" 5332218822Sdim $ECHO "*** it was explicitly requested with -no-undefined," 5333218822Sdim $ECHO "*** libtool will only create a static version of it." 533489857Sobrien if test "$build_old_libs" = no; then 533589857Sobrien oldlibs="$output_objdir/$libname.$libext" 533689857Sobrien build_libtool_libs=module 533789857Sobrien build_old_libs=yes 533889857Sobrien else 533989857Sobrien build_libtool_libs=no 534089857Sobrien fi 534189857Sobrien fi 534260484Sobrien fi 534360484Sobrien fi 534460484Sobrien # Done checking deplibs! 534560484Sobrien deplibs=$newdeplibs 534660484Sobrien fi 5347218822Sdim # Time to change all our "foo.ltframework" stuff back to "-framework foo" 5348218822Sdim case $host in 5349218822Sdim *-*-darwin*) 5350218822Sdim newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 5351218822Sdim new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 5352218822Sdim deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 5353218822Sdim ;; 5354218822Sdim esac 535560484Sobrien 5356218822Sdim # move library search paths that coincide with paths to not yet 5357218822Sdim # installed libraries to the beginning of the library search list 5358218822Sdim new_libs= 5359218822Sdim for path in $notinst_path; do 5360218822Sdim case " $new_libs " in 5361218822Sdim *" -L$path/$objdir "*) ;; 5362218822Sdim *) 5363218822Sdim case " $deplibs " in 5364218822Sdim *" -L$path/$objdir "*) 5365218822Sdim new_libs="$new_libs -L$path/$objdir" ;; 5366218822Sdim esac 5367218822Sdim ;; 5368218822Sdim esac 5369218822Sdim done 5370218822Sdim for deplib in $deplibs; do 5371218822Sdim case $deplib in 5372218822Sdim -L*) 5373218822Sdim case " $new_libs " in 5374218822Sdim *" $deplib "*) ;; 5375218822Sdim *) new_libs="$new_libs $deplib" ;; 5376218822Sdim esac 5377218822Sdim ;; 5378218822Sdim *) new_libs="$new_libs $deplib" ;; 5379218822Sdim esac 5380218822Sdim done 5381218822Sdim deplibs="$new_libs" 5382218822Sdim 538360484Sobrien # All the library-specific variables (install_libdir is set above). 538460484Sobrien library_names= 538560484Sobrien old_library= 538660484Sobrien dlname= 538777298Sobrien 538860484Sobrien # Test again, we may have decided not to build it any more 538938889Sjdp if test "$build_libtool_libs" = yes; then 5390218822Sdim if test "$hardcode_into_libs" = yes; then 539177298Sobrien # Hardcode the library paths 539277298Sobrien hardcode_libdirs= 539377298Sobrien dep_rpath= 539477298Sobrien rpath="$finalize_rpath" 539577298Sobrien test "$mode" != relink && rpath="$compile_rpath$rpath" 539677298Sobrien for libdir in $rpath; do 539777298Sobrien if test -n "$hardcode_libdir_flag_spec"; then 539877298Sobrien if test -n "$hardcode_libdir_separator"; then 539977298Sobrien if test -z "$hardcode_libdirs"; then 540077298Sobrien hardcode_libdirs="$libdir" 540177298Sobrien else 540277298Sobrien # Just accumulate the unique libdirs. 540389857Sobrien case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 540477298Sobrien *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 540577298Sobrien ;; 540677298Sobrien *) 540777298Sobrien hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 540877298Sobrien ;; 540977298Sobrien esac 541077298Sobrien fi 541177298Sobrien else 541277298Sobrien eval flag=\"$hardcode_libdir_flag_spec\" 541377298Sobrien dep_rpath="$dep_rpath $flag" 541477298Sobrien fi 541577298Sobrien elif test -n "$runpath_var"; then 541677298Sobrien case "$perm_rpath " in 541777298Sobrien *" $libdir "*) ;; 541877298Sobrien *) perm_rpath="$perm_rpath $libdir" ;; 541977298Sobrien esac 542077298Sobrien fi 542177298Sobrien done 542277298Sobrien # Substitute the hardcoded libdirs into the rpath. 542377298Sobrien if test -n "$hardcode_libdir_separator" && 542477298Sobrien test -n "$hardcode_libdirs"; then 542577298Sobrien libdir="$hardcode_libdirs" 5426218822Sdim if test -n "$hardcode_libdir_flag_spec_ld"; then 5427218822Sdim eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 5428218822Sdim else 5429218822Sdim eval dep_rpath=\"$hardcode_libdir_flag_spec\" 5430218822Sdim fi 543177298Sobrien fi 543277298Sobrien if test -n "$runpath_var" && test -n "$perm_rpath"; then 543377298Sobrien # We should set the runpath_var. 543477298Sobrien rpath= 543577298Sobrien for dir in $perm_rpath; do 543677298Sobrien rpath="$rpath$dir:" 543777298Sobrien done 543877298Sobrien eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 543977298Sobrien fi 544077298Sobrien test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 544177298Sobrien fi 544277298Sobrien 544377298Sobrien shlibpath="$finalize_shlibpath" 544477298Sobrien test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 544577298Sobrien if test -n "$shlibpath"; then 544677298Sobrien eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 544777298Sobrien fi 544877298Sobrien 544960484Sobrien # Get the real and link names of the library. 5450218822Sdim eval shared_ext=\"$shrext_cmds\" 545160484Sobrien eval library_names=\"$library_names_spec\" 545260484Sobrien set dummy $library_names 5453218822Sdim shift 5454218822Sdim realname="$1" 5455218822Sdim shift 545638889Sjdp 545760484Sobrien if test -n "$soname_spec"; then 545860484Sobrien eval soname=\"$soname_spec\" 545960484Sobrien else 546060484Sobrien soname="$realname" 546160484Sobrien fi 5462218822Sdim if test -z "$dlname"; then 5463218822Sdim dlname=$soname 5464218822Sdim fi 546538889Sjdp 546660484Sobrien lib="$output_objdir/$realname" 5467218822Sdim linknames= 546838889Sjdp for link 546938889Sjdp do 547038889Sjdp linknames="$linknames $link" 547138889Sjdp done 547238889Sjdp 547360484Sobrien # Use standard objects if they are pic 5474218822Sdim test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 5475218822Sdim test "X$libobjs" = "X " && libobjs= 547638889Sjdp 5477218822Sdim delfiles= 5478218822Sdim if test -n "$export_symbols" && test -n "$include_expsyms"; then 5479218822Sdim $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 5480218822Sdim export_symbols="$output_objdir/$libname.uexp" 5481218822Sdim delfiles="$delfiles $export_symbols" 5482218822Sdim fi 5483218822Sdim 5484218822Sdim orig_export_symbols= 5485218822Sdim case $host_os in 5486218822Sdim cygwin* | mingw*) 5487218822Sdim if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 5488218822Sdim # exporting using user supplied symfile 5489218822Sdim if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 5490218822Sdim # and it's NOT already a .def file. Must figure out 5491218822Sdim # which of the given symbols are data symbols and tag 5492218822Sdim # them as such. So, trigger use of export_symbols_cmds. 5493218822Sdim # export_symbols gets reassigned inside the "prepare 5494218822Sdim # the list of exported symbols" if statement, so the 5495218822Sdim # include_expsyms logic still works. 5496218822Sdim orig_export_symbols="$export_symbols" 5497218822Sdim export_symbols= 5498218822Sdim always_export_symbols=yes 5499218822Sdim fi 5500218822Sdim fi 5501218822Sdim ;; 5502218822Sdim esac 5503218822Sdim 550460484Sobrien # Prepare the list of exported symbols 550560484Sobrien if test -z "$export_symbols"; then 550660484Sobrien if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 5507218822Sdim func_echo "generating symbol list for \`$libname.la'" 550860484Sobrien export_symbols="$output_objdir/$libname.exp" 5509218822Sdim $opt_dry_run || $RM $export_symbols 5510218822Sdim cmds=$export_symbols_cmds 5511218822Sdim save_ifs="$IFS"; IFS='~' 551260484Sobrien for cmd in $cmds; do 551360484Sobrien IFS="$save_ifs" 5514218822Sdim eval cmd=\"$cmd\" 5515218822Sdim if len=`expr "X$cmd" : ".*"` && 5516218822Sdim test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5517218822Sdim func_show_eval "$cmd" 'exit $?' 5518218822Sdim skipped_export=false 5519218822Sdim else 5520218822Sdim # The command line is too long to execute in one step. 5521218822Sdim func_echo "using reloadable object file for export list..." 5522218822Sdim skipped_export=: 5523218822Sdim # Break out early, otherwise skipped_export may be 5524218822Sdim # set to false by a later but shorter cmd. 5525218822Sdim break 5526218822Sdim fi 552760484Sobrien done 552860484Sobrien IFS="$save_ifs" 5529218822Sdim if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 5530218822Sdim func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 5531218822Sdim func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 553260484Sobrien fi 553360484Sobrien fi 553460484Sobrien fi 553538889Sjdp 553660484Sobrien if test -n "$export_symbols" && test -n "$include_expsyms"; then 5537218822Sdim tmp_export_symbols="$export_symbols" 5538218822Sdim test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 5539218822Sdim $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 554060484Sobrien fi 554160484Sobrien 5542218822Sdim if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 5543218822Sdim # The given exports_symbols file has to be filtered, so filter it. 5544218822Sdim func_echo "filter symbol list for \`$libname.la' to tag DATA exports" 5545218822Sdim # FIXME: $output_objdir/$libname.filter potentially contains lots of 5546218822Sdim # 's' commands which not all seds can handle. GNU sed should be fine 5547218822Sdim # though. Also, the filter scales superlinearly with the number of 5548218822Sdim # global variables. join(1) would be nice here, but unfortunately 5549218822Sdim # isn't a blessed tool. 5550218822Sdim $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 5551218822Sdim delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 5552218822Sdim export_symbols=$output_objdir/$libname.def 5553218822Sdim $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 5554218822Sdim fi 5555218822Sdim 5556218822Sdim tmp_deplibs= 5557218822Sdim for test_deplib in $deplibs; do 5558218822Sdim case " $convenience " in 5559218822Sdim *" $test_deplib "*) ;; 5560218822Sdim *) 5561218822Sdim tmp_deplibs="$tmp_deplibs $test_deplib" 5562218822Sdim ;; 5563218822Sdim esac 5564218822Sdim done 5565218822Sdim deplibs="$tmp_deplibs" 5566218822Sdim 556760484Sobrien if test -n "$convenience"; then 5568218822Sdim if test -n "$whole_archive_flag_spec" && 5569218822Sdim test "$compiler_needs_object" = yes && 5570218822Sdim test -z "$libobjs"; then 5571218822Sdim # extract the archives, so we have objects to list. 5572218822Sdim # TODO: could optimize this to just extract one archive. 5573218822Sdim whole_archive_flag_spec= 5574218822Sdim fi 557560484Sobrien if test -n "$whole_archive_flag_spec"; then 557689857Sobrien save_libobjs=$libobjs 557760484Sobrien eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 5578218822Sdim test "X$libobjs" = "X " && libobjs= 557960484Sobrien else 558060484Sobrien gentop="$output_objdir/${outputname}x" 558160484Sobrien generated="$generated $gentop" 558260484Sobrien 5583218822Sdim func_extract_archives $gentop $convenience 5584218822Sdim libobjs="$libobjs $func_extract_archives_result" 5585218822Sdim test "X$libobjs" = "X " && libobjs= 558660484Sobrien fi 558760484Sobrien fi 558860484Sobrien 558960484Sobrien if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 559060484Sobrien eval flag=\"$thread_safe_flag_spec\" 559177298Sobrien linker_flags="$linker_flags $flag" 559260484Sobrien fi 559360484Sobrien 559477298Sobrien # Make a backup of the uninstalled library when relinking 559577298Sobrien if test "$mode" = relink; then 5596218822Sdim $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 559777298Sobrien fi 559877298Sobrien 559960484Sobrien # Do each of the archive commands. 5600218822Sdim if test "$module" = yes && test -n "$module_cmds" ; then 5601218822Sdim if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 5602218822Sdim eval test_cmds=\"$module_expsym_cmds\" 5603218822Sdim cmds=$module_expsym_cmds 5604218822Sdim else 5605218822Sdim eval test_cmds=\"$module_cmds\" 5606218822Sdim cmds=$module_cmds 5607218822Sdim fi 560860484Sobrien else 5609218822Sdim if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 5610218822Sdim eval test_cmds=\"$archive_expsym_cmds\" 5611218822Sdim cmds=$archive_expsym_cmds 5612218822Sdim else 5613218822Sdim eval test_cmds=\"$archive_cmds\" 5614218822Sdim cmds=$archive_cmds 5615218822Sdim fi 561660484Sobrien fi 561760484Sobrien 5618218822Sdim if test "X$skipped_export" != "X:" && 5619218822Sdim len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5620218822Sdim test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5621218822Sdim : 5622218822Sdim else 5623218822Sdim # The command line is too long to link in one step, link piecewise 5624218822Sdim # or, if using GNU ld and skipped_export is not :, use a linker 5625218822Sdim # script. 5626218822Sdim 562789857Sobrien # Save the value of $output and $libobjs because we want to 562889857Sobrien # use them later. If we have whole_archive_flag_spec, we 562989857Sobrien # want to use save_libobjs as it was before 563089857Sobrien # whole_archive_flag_spec was expanded, because we can't 563189857Sobrien # assume the linker understands whole_archive_flag_spec. 563289857Sobrien # This may have to be revisited, in case too many 563389857Sobrien # convenience libraries get linked in and end up exceeding 563489857Sobrien # the spec. 563589857Sobrien if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 563689857Sobrien save_libobjs=$libobjs 563789857Sobrien fi 5638218822Sdim save_output=$output 5639218822Sdim output_la=`$ECHO "X$output" | $Xsed -e "$basename"` 564089857Sobrien 564189857Sobrien # Clear the reloadable object creation command queue and 564289857Sobrien # initialize k to one. 5643218822Sdim test_cmds= 5644218822Sdim concat_cmds= 5645218822Sdim objlist= 5646218822Sdim last_robj= 5647218822Sdim k=1 564889857Sobrien 5649218822Sdim if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 5650218822Sdim output=${output_objdir}/${output_la}.lnkscript 5651218822Sdim func_echo "creating GNU ld script: $output" 5652218822Sdim $ECHO 'INPUT (' > $output 5653218822Sdim for obj in $save_libobjs 5654218822Sdim do 5655218822Sdim $ECHO "$obj" >> $output 5656218822Sdim done 5657218822Sdim $ECHO ')' >> $output 5658218822Sdim delfiles="$delfiles $output" 5659218822Sdim elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 5660218822Sdim output=${output_objdir}/${output_la}.lnk 5661218822Sdim func_echo "creating linker input file list: $output" 5662218822Sdim : > $output 5663218822Sdim set x $save_libobjs 5664218822Sdim shift 5665218822Sdim firstobj= 5666218822Sdim if test "$compiler_needs_object" = yes; then 5667218822Sdim firstobj="$1 " 5668218822Sdim shift 5669218822Sdim fi 5670218822Sdim for obj 5671218822Sdim do 5672218822Sdim $ECHO "$obj" >> $output 5673218822Sdim done 5674218822Sdim delfiles="$delfiles $output" 5675218822Sdim output=$firstobj\"$file_list_spec$output\" 5676218822Sdim else 5677218822Sdim if test -n "$save_libobjs"; then 5678218822Sdim func_echo "creating reloadable object files..." 5679218822Sdim output=$output_objdir/$output_la-${k}.$objext 5680218822Sdim # Loop over the list of objects to be linked. 5681218822Sdim for obj in $save_libobjs 5682218822Sdim do 5683218822Sdim eval test_cmds=\"$reload_cmds $objlist $last_robj\" 5684218822Sdim if test "X$objlist" = X || 5685218822Sdim { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5686218822Sdim test "$len" -le "$max_cmd_len"; }; then 5687218822Sdim objlist="$objlist $obj" 5688218822Sdim else 5689218822Sdim # The command $test_cmds is almost too long, add a 5690218822Sdim # command to the queue. 5691218822Sdim if test "$k" -eq 1 ; then 5692218822Sdim # The first file doesn't have a previous command to add. 5693218822Sdim eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 5694218822Sdim else 5695218822Sdim # All subsequent reloadable object files will link in 5696218822Sdim # the last one created. 5697218822Sdim eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 5698218822Sdim fi 5699218822Sdim last_robj=$output_objdir/$output_la-${k}.$objext 5700218822Sdim k=`expr $k + 1` 5701218822Sdim output=$output_objdir/$output_la-${k}.$objext 5702218822Sdim objlist=$obj 5703218822Sdim len=1 5704218822Sdim fi 5705218822Sdim done 5706218822Sdim # Handle the remaining objects by creating one last 5707218822Sdim # reloadable object file. All subsequent reloadable object 5708218822Sdim # files will link in the last one created. 5709218822Sdim test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5710218822Sdim eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 571189857Sobrien 5712218822Sdim # Set up a command to remove the reloadable object files 5713218822Sdim # after they are used. 5714218822Sdim i=0 5715218822Sdim while test "$i" -lt "$k" 5716218822Sdim do 5717218822Sdim i=`expr $i + 1` 5718218822Sdim delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 5719218822Sdim done 5720218822Sdim else 5721218822Sdim output= 5722218822Sdim fi 572389857Sobrien 5724218822Sdim if ${skipped_export-false}; then 5725218822Sdim func_echo "generating symbol list for \`$libname.la'" 5726218822Sdim export_symbols="$output_objdir/$libname.exp" 5727218822Sdim $opt_dry_run || $RM $export_symbols 5728218822Sdim libobjs=$output 5729218822Sdim # Append the command to create the export file. 5730218822Sdim test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5731218822Sdim eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 5732218822Sdim fi 573389857Sobrien 5734218822Sdim test -n "$save_libobjs" && 5735218822Sdim func_echo "creating a temporary reloadable object file: $output" 5736218822Sdim 5737218822Sdim # Loop through the commands generated above and execute them. 5738218822Sdim save_ifs="$IFS"; IFS='~' 5739218822Sdim for cmd in $concat_cmds; do 5740218822Sdim IFS="$save_ifs" 5741218822Sdim $opt_silent || { 5742218822Sdim func_quote_for_expand "$cmd" 5743218822Sdim eval "func_echo $func_quote_for_expand_result" 5744218822Sdim } 5745218822Sdim $opt_dry_run || eval "$cmd" || { 5746218822Sdim lt_exit=$? 5747218822Sdim 5748218822Sdim # Restore the uninstalled library and exit 5749218822Sdim if test "$mode" = relink; then 5750218822Sdim ( cd "$output_objdir" && \ 5751218822Sdim $RM "${realname}T" && \ 5752218822Sdim $MV "${realname}U" "$realname" ) 5753218822Sdim fi 5754218822Sdim 5755218822Sdim exit $lt_exit 5756218822Sdim } 5757218822Sdim done 5758218822Sdim IFS="$save_ifs" 5759218822Sdim 5760218822Sdim if test -n "$export_symbols_regex" && ${skipped_export-false}; then 5761218822Sdim func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 5762218822Sdim func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 5763218822Sdim fi 5764218822Sdim fi 5765218822Sdim 5766218822Sdim if ${skipped_export-false}; then 5767218822Sdim if test -n "$export_symbols" && test -n "$include_expsyms"; then 5768218822Sdim tmp_export_symbols="$export_symbols" 5769218822Sdim test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 5770218822Sdim $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 5771218822Sdim fi 5772218822Sdim 5773218822Sdim if test -n "$orig_export_symbols"; then 5774218822Sdim # The given exports_symbols file has to be filtered, so filter it. 5775218822Sdim func_echo "filter symbol list for \`$libname.la' to tag DATA exports" 5776218822Sdim # FIXME: $output_objdir/$libname.filter potentially contains lots of 5777218822Sdim # 's' commands which not all seds can handle. GNU sed should be fine 5778218822Sdim # though. Also, the filter scales superlinearly with the number of 5779218822Sdim # global variables. join(1) would be nice here, but unfortunately 5780218822Sdim # isn't a blessed tool. 5781218822Sdim $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 5782218822Sdim delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 5783218822Sdim export_symbols=$output_objdir/$libname.def 5784218822Sdim $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 5785218822Sdim fi 5786218822Sdim fi 5787218822Sdim 5788218822Sdim libobjs=$output 578989857Sobrien # Restore the value of output. 5790218822Sdim output=$save_output 579189857Sobrien 579289857Sobrien if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 579389857Sobrien eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 5794218822Sdim test "X$libobjs" = "X " && libobjs= 579589857Sobrien fi 579689857Sobrien # Expand the library linking commands again to reset the 579789857Sobrien # value of $libobjs for piecewise linking. 579889857Sobrien 579989857Sobrien # Do each of the archive commands. 5800218822Sdim if test "$module" = yes && test -n "$module_cmds" ; then 5801218822Sdim if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 5802218822Sdim cmds=$module_expsym_cmds 5803218822Sdim else 5804218822Sdim cmds=$module_cmds 5805218822Sdim fi 5806218822Sdim else 5807218822Sdim if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 5808218822Sdim cmds=$archive_expsym_cmds 5809218822Sdim else 5810218822Sdim cmds=$archive_cmds 5811218822Sdim fi 5812218822Sdim fi 5813218822Sdim fi 581489857Sobrien 5815218822Sdim if test -n "$delfiles"; then 5816218822Sdim # Append the command to remove temporary files to $cmds. 5817218822Sdim eval cmds=\"\$cmds~\$RM $delfiles\" 5818218822Sdim fi 581989857Sobrien 5820218822Sdim # Add any objects from preloaded convenience libraries 5821218822Sdim if test -n "$dlprefiles"; then 5822218822Sdim gentop="$output_objdir/${outputname}x" 5823218822Sdim generated="$generated $gentop" 5824218822Sdim 5825218822Sdim func_extract_archives $gentop $dlprefiles 5826218822Sdim libobjs="$libobjs $func_extract_archives_result" 5827218822Sdim test "X$libobjs" = "X " && libobjs= 5828218822Sdim fi 5829218822Sdim 5830218822Sdim save_ifs="$IFS"; IFS='~' 5831218822Sdim for cmd in $cmds; do 5832218822Sdim IFS="$save_ifs" 5833218822Sdim eval cmd=\"$cmd\" 5834218822Sdim $opt_silent || { 5835218822Sdim func_quote_for_expand "$cmd" 5836218822Sdim eval "func_echo $func_quote_for_expand_result" 5837218822Sdim } 5838218822Sdim $opt_dry_run || eval "$cmd" || { 5839218822Sdim lt_exit=$? 5840218822Sdim 5841218822Sdim # Restore the uninstalled library and exit 5842218822Sdim if test "$mode" = relink; then 5843218822Sdim ( cd "$output_objdir" && \ 5844218822Sdim $RM "${realname}T" && \ 5845218822Sdim $MV "${realname}U" "$realname" ) 5846218822Sdim fi 5847218822Sdim 5848218822Sdim exit $lt_exit 5849218822Sdim } 5850218822Sdim done 5851218822Sdim IFS="$save_ifs" 5852218822Sdim 585377298Sobrien # Restore the uninstalled library and exit 585477298Sobrien if test "$mode" = relink; then 5855218822Sdim $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 5856218822Sdim 5857218822Sdim if test -n "$convenience"; then 5858218822Sdim if test -z "$whole_archive_flag_spec"; then 5859218822Sdim func_show_eval '${RM}r "$gentop"' 5860218822Sdim fi 5861218822Sdim fi 5862218822Sdim 5863218822Sdim exit $EXIT_SUCCESS 586477298Sobrien fi 586577298Sobrien 586660484Sobrien # Create links to the real library. 586760484Sobrien for linkname in $linknames; do 586860484Sobrien if test "$realname" != "$linkname"; then 5869218822Sdim func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 587060484Sobrien fi 587160484Sobrien done 587260484Sobrien 587360484Sobrien # If -module or -export-dynamic was specified, set the dlname. 587460484Sobrien if test "$module" = yes || test "$export_dynamic" = yes; then 587560484Sobrien # On all known operating systems, these are identical. 587660484Sobrien dlname="$soname" 587760484Sobrien fi 587838889Sjdp fi 587938889Sjdp ;; 588038889Sjdp 588177298Sobrien obj) 588260484Sobrien if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 5883218822Sdim func_warning "\`-dlopen' is ignored for objects" 588438889Sjdp fi 588538889Sjdp 5886218822Sdim test -n "$deplibs" && \ 5887218822Sdim func_warning "\`-l' and \`-L' are ignored for objects" 588838889Sjdp 5889218822Sdim test -n "$rpath" && \ 5890218822Sdim func_warning "\`-rpath' is ignored for objects" 589160484Sobrien 5892218822Sdim test -n "$xrpath" && \ 5893218822Sdim func_warning "\`-R' is ignored for objects" 589438889Sjdp 5895218822Sdim test -n "$vinfo" && \ 5896218822Sdim func_warning "\`-version-info' is ignored for objects" 589738889Sjdp 5898218822Sdim test -n "$release" && \ 5899218822Sdim func_warning "\`-release' is ignored for objects" 5900218822Sdim 590189857Sobrien case $output in 590238889Sjdp *.lo) 5903218822Sdim test -n "$objs$old_deplibs" && \ 5904218822Sdim func_fatal_error "cannot build library object \`$output' from non-libtool objects" 5905218822Sdim 5906218822Sdim libobj=$output 5907218822Sdim func_lo2o "$libobj" 5908218822Sdim obj=$func_lo2o_result 590960484Sobrien ;; 591038889Sjdp *) 591160484Sobrien libobj= 591260484Sobrien obj="$output" 591360484Sobrien ;; 591438889Sjdp esac 591538889Sjdp 591638889Sjdp # Delete the old objects. 5917218822Sdim $opt_dry_run || $RM $obj $libobj 591838889Sjdp 591960484Sobrien # Objects from convenience libraries. This assumes 592060484Sobrien # single-version convenience libraries. Whenever we create 592160484Sobrien # different ones for PIC/non-PIC, this we'll have to duplicate 592260484Sobrien # the extraction. 592360484Sobrien reload_conv_objs= 592460484Sobrien gentop= 592560484Sobrien # reload_cmds runs $LD directly, so let us get rid of 5926218822Sdim # -Wl from whole_archive_flag_spec and hope we can get by with 5927218822Sdim # turning comma into space.. 592877298Sobrien wl= 592960484Sobrien 593060484Sobrien if test -n "$convenience"; then 593160484Sobrien if test -n "$whole_archive_flag_spec"; then 5932218822Sdim eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 5933218822Sdim reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 593460484Sobrien else 593560484Sobrien gentop="$output_objdir/${obj}x" 593660484Sobrien generated="$generated $gentop" 593760484Sobrien 5938218822Sdim func_extract_archives $gentop $convenience 5939218822Sdim reload_conv_objs="$reload_objs $func_extract_archives_result" 594060484Sobrien fi 594160484Sobrien fi 594260484Sobrien 594338889Sjdp # Create the old-style object. 5944218822Sdim 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 594538889Sjdp 594638889Sjdp output="$obj" 5947218822Sdim func_execute_cmds "$reload_cmds" 'exit $?' 594838889Sjdp 594938889Sjdp # Exit if we aren't doing a library object file. 595060484Sobrien if test -z "$libobj"; then 595160484Sobrien if test -n "$gentop"; then 5952218822Sdim func_show_eval '${RM}r "$gentop"' 595360484Sobrien fi 595438889Sjdp 5955218822Sdim exit $EXIT_SUCCESS 595660484Sobrien fi 595760484Sobrien 595838889Sjdp if test "$build_libtool_libs" != yes; then 595960484Sobrien if test -n "$gentop"; then 5960218822Sdim func_show_eval '${RM}r "$gentop"' 596160484Sobrien fi 596260484Sobrien 596360484Sobrien # Create an invalid libtool object if no PIC, so that we don't 596460484Sobrien # accidentally link it into a program. 596577298Sobrien # $show "echo timestamp > $libobj" 5966218822Sdim # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 5967218822Sdim exit $EXIT_SUCCESS 596838889Sjdp fi 596938889Sjdp 597077298Sobrien if test -n "$pic_flag" || test "$pic_mode" != default; then 597160484Sobrien # Only do commands if we really have different PIC objects. 597260484Sobrien reload_objs="$libobjs $reload_conv_objs" 597360484Sobrien output="$libobj" 5974218822Sdim func_execute_cmds "$reload_cmds" 'exit $?' 597538889Sjdp fi 597638889Sjdp 597760484Sobrien if test -n "$gentop"; then 5978218822Sdim func_show_eval '${RM}r "$gentop"' 597960484Sobrien fi 598060484Sobrien 5981218822Sdim exit $EXIT_SUCCESS 598238889Sjdp ;; 598338889Sjdp 598477298Sobrien prog) 598589857Sobrien case $host in 5986218822Sdim *cygwin*) func_stripname '' '.exe' "$output" 5987218822Sdim output=$func_stripname_result.exe;; 598889857Sobrien esac 5989218822Sdim test -n "$vinfo" && \ 5990218822Sdim func_warning "\`-version-info' is ignored for programs" 599138889Sjdp 5992218822Sdim test -n "$release" && \ 5993218822Sdim func_warning "\`-release' is ignored for programs" 599438889Sjdp 5995218822Sdim test "$preload" = yes \ 5996218822Sdim && test "$dlopen_support" = unknown \ 5997218822Sdim && test "$dlopen_self" = unknown \ 5998218822Sdim && test "$dlopen_self_static" = unknown && \ 5999218822Sdim func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 600077298Sobrien 600189857Sobrien case $host in 600289857Sobrien *-*-rhapsody* | *-*-darwin1.[012]) 600389857Sobrien # On Rhapsody replace the C library is the System framework 6004218822Sdim compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 6005218822Sdim finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 600689857Sobrien ;; 600789857Sobrien esac 600889857Sobrien 6009218822Sdim case $host in 6010218822Sdim *-*-darwin*) 6011218822Sdim # Don't allow lazy linking, it breaks C++ global constructors 6012218822Sdim # But is supposedly fixed on 10.4 or later (yay!). 6013218822Sdim if test "$tagname" = CXX ; then 6014218822Sdim case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 6015218822Sdim 10.[0123]) 6016218822Sdim compile_command="$compile_command ${wl}-bind_at_load" 6017218822Sdim finalize_command="$finalize_command ${wl}-bind_at_load" 6018218822Sdim ;; 6019218822Sdim esac 6020218822Sdim fi 6021218822Sdim # Time to change all our "foo.ltframework" stuff back to "-framework foo" 6022218822Sdim compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6023218822Sdim finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6024218822Sdim ;; 6025218822Sdim esac 6026218822Sdim 6027218822Sdim 6028218822Sdim # move library search paths that coincide with paths to not yet 6029218822Sdim # installed libraries to the beginning of the library search list 6030218822Sdim new_libs= 6031218822Sdim for path in $notinst_path; do 6032218822Sdim case " $new_libs " in 6033218822Sdim *" -L$path/$objdir "*) ;; 6034218822Sdim *) 6035218822Sdim case " $compile_deplibs " in 6036218822Sdim *" -L$path/$objdir "*) 6037218822Sdim new_libs="$new_libs -L$path/$objdir" ;; 6038218822Sdim esac 6039218822Sdim ;; 6040218822Sdim esac 6041218822Sdim done 6042218822Sdim for deplib in $compile_deplibs; do 6043218822Sdim case $deplib in 6044218822Sdim -L*) 6045218822Sdim case " $new_libs " in 6046218822Sdim *" $deplib "*) ;; 6047218822Sdim *) new_libs="$new_libs $deplib" ;; 6048218822Sdim esac 6049218822Sdim ;; 6050218822Sdim *) new_libs="$new_libs $deplib" ;; 6051218822Sdim esac 6052218822Sdim done 6053218822Sdim compile_deplibs="$new_libs" 6054218822Sdim 6055218822Sdim 605677298Sobrien compile_command="$compile_command $compile_deplibs" 605777298Sobrien finalize_command="$finalize_command $finalize_deplibs" 605877298Sobrien 605960484Sobrien if test -n "$rpath$xrpath"; then 606038889Sjdp # If the user specified any rpath flags, then add them. 606160484Sobrien for libdir in $rpath $xrpath; do 606260484Sobrien # This is the magic to use -rpath. 606360484Sobrien case "$finalize_rpath " in 606460484Sobrien *" $libdir "*) ;; 606560484Sobrien *) finalize_rpath="$finalize_rpath $libdir" ;; 606660484Sobrien esac 606738889Sjdp done 606838889Sjdp fi 606938889Sjdp 607060484Sobrien # Now hardcode the library paths 607160484Sobrien rpath= 607260484Sobrien hardcode_libdirs= 607360484Sobrien for libdir in $compile_rpath $finalize_rpath; do 607460484Sobrien if test -n "$hardcode_libdir_flag_spec"; then 607560484Sobrien if test -n "$hardcode_libdir_separator"; then 607660484Sobrien if test -z "$hardcode_libdirs"; then 607760484Sobrien hardcode_libdirs="$libdir" 607860484Sobrien else 607960484Sobrien # Just accumulate the unique libdirs. 608089857Sobrien case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 608160484Sobrien *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 608260484Sobrien ;; 608360484Sobrien *) 608460484Sobrien hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 608560484Sobrien ;; 608660484Sobrien esac 608760484Sobrien fi 608860484Sobrien else 608960484Sobrien eval flag=\"$hardcode_libdir_flag_spec\" 609060484Sobrien rpath="$rpath $flag" 609160484Sobrien fi 609260484Sobrien elif test -n "$runpath_var"; then 609360484Sobrien case "$perm_rpath " in 609460484Sobrien *" $libdir "*) ;; 609560484Sobrien *) perm_rpath="$perm_rpath $libdir" ;; 609660484Sobrien esac 609760484Sobrien fi 609889857Sobrien case $host in 609977298Sobrien *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 6100218822Sdim testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 610189857Sobrien case :$dllsearchpath: in 610277298Sobrien *":$libdir:"*) ;; 610377298Sobrien *) dllsearchpath="$dllsearchpath:$libdir";; 610477298Sobrien esac 6105218822Sdim case :$dllsearchpath: in 6106218822Sdim *":$testbindir:"*) ;; 6107218822Sdim *) dllsearchpath="$dllsearchpath:$testbindir";; 6108218822Sdim esac 610977298Sobrien ;; 611077298Sobrien esac 611160484Sobrien done 611260484Sobrien # Substitute the hardcoded libdirs into the rpath. 611360484Sobrien if test -n "$hardcode_libdir_separator" && 611460484Sobrien test -n "$hardcode_libdirs"; then 611560484Sobrien libdir="$hardcode_libdirs" 611660484Sobrien eval rpath=\" $hardcode_libdir_flag_spec\" 611738889Sjdp fi 611860484Sobrien compile_rpath="$rpath" 611938889Sjdp 612060484Sobrien rpath= 612160484Sobrien hardcode_libdirs= 612260484Sobrien for libdir in $finalize_rpath; do 612360484Sobrien if test -n "$hardcode_libdir_flag_spec"; then 612460484Sobrien if test -n "$hardcode_libdir_separator"; then 612560484Sobrien if test -z "$hardcode_libdirs"; then 612660484Sobrien hardcode_libdirs="$libdir" 612760484Sobrien else 612860484Sobrien # Just accumulate the unique libdirs. 612989857Sobrien case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 613060484Sobrien *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 613160484Sobrien ;; 613260484Sobrien *) 613360484Sobrien hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 613460484Sobrien ;; 613560484Sobrien esac 613660484Sobrien fi 613760484Sobrien else 613860484Sobrien eval flag=\"$hardcode_libdir_flag_spec\" 613960484Sobrien rpath="$rpath $flag" 614060484Sobrien fi 614160484Sobrien elif test -n "$runpath_var"; then 614260484Sobrien case "$finalize_perm_rpath " in 614360484Sobrien *" $libdir "*) ;; 614460484Sobrien *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 614560484Sobrien esac 614660484Sobrien fi 614760484Sobrien done 614860484Sobrien # Substitute the hardcoded libdirs into the rpath. 614960484Sobrien if test -n "$hardcode_libdir_separator" && 615060484Sobrien test -n "$hardcode_libdirs"; then 615160484Sobrien libdir="$hardcode_libdirs" 615260484Sobrien eval rpath=\" $hardcode_libdir_flag_spec\" 615338889Sjdp fi 615460484Sobrien finalize_rpath="$rpath" 615538889Sjdp 6156218822Sdim if test -n "$libobjs" && test "$build_old_libs" = yes; then 6157218822Sdim # Transform all the library objects into standard objects. 6158218822Sdim compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 6159218822Sdim finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 616060484Sobrien fi 616138889Sjdp 6162218822Sdim func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 616338889Sjdp 6164218822Sdim # template prelinking step 6165218822Sdim if test -n "$prelink_cmds"; then 6166218822Sdim func_execute_cmds "$prelink_cmds" 'exit $?' 616738889Sjdp fi 616838889Sjdp 6169218822Sdim wrappers_required=yes 6170218822Sdim case $host in 6171218822Sdim *cygwin* | *mingw* ) 6172218822Sdim if test "$build_libtool_libs" != yes; then 6173218822Sdim wrappers_required=no 6174218822Sdim fi 6175218822Sdim ;; 6176218822Sdim *) 6177218822Sdim if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 6178218822Sdim wrappers_required=no 6179218822Sdim fi 6180218822Sdim ;; 6181218822Sdim esac 6182218822Sdim if test "$wrappers_required" = no; then 618360484Sobrien # Replace the output file specification. 6184218822Sdim compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 618560484Sobrien link_command="$compile_command$compile_rpath" 618638889Sjdp 618760484Sobrien # We have no uninstalled library dependencies, so finalize right now. 6188218822Sdim exit_status=0 6189218822Sdim func_show_eval "$link_command" 'exit_status=$?' 619077298Sobrien 619160484Sobrien # Delete the generated files. 6192218822Sdim if test -f "$output_objdir/${outputname}S.${objext}"; then 6193218822Sdim func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 619438889Sjdp fi 619560484Sobrien 6196218822Sdim exit $exit_status 619738889Sjdp fi 619838889Sjdp 619960484Sobrien if test -n "$compile_shlibpath$finalize_shlibpath"; then 620060484Sobrien compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 620138889Sjdp fi 620238889Sjdp if test -n "$finalize_shlibpath"; then 620360484Sobrien finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 620438889Sjdp fi 620538889Sjdp 620660484Sobrien compile_var= 620760484Sobrien finalize_var= 620860484Sobrien if test -n "$runpath_var"; then 620960484Sobrien if test -n "$perm_rpath"; then 621060484Sobrien # We should set the runpath_var. 621160484Sobrien rpath= 621260484Sobrien for dir in $perm_rpath; do 621360484Sobrien rpath="$rpath$dir:" 621460484Sobrien done 621560484Sobrien compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 621660484Sobrien fi 621760484Sobrien if test -n "$finalize_perm_rpath"; then 621860484Sobrien # We should set the runpath_var. 621960484Sobrien rpath= 622060484Sobrien for dir in $finalize_perm_rpath; do 622160484Sobrien rpath="$rpath$dir:" 622260484Sobrien done 622360484Sobrien finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 622460484Sobrien fi 622538889Sjdp fi 622638889Sjdp 622777298Sobrien if test "$no_install" = yes; then 622877298Sobrien # We don't need to create a wrapper script. 622977298Sobrien link_command="$compile_var$compile_command$compile_rpath" 623077298Sobrien # Replace the output file specification. 6231218822Sdim link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 623277298Sobrien # Delete the old output file. 6233218822Sdim $opt_dry_run || $RM $output 623477298Sobrien # Link the executable and exit 6235218822Sdim func_show_eval "$link_command" 'exit $?' 6236218822Sdim exit $EXIT_SUCCESS 623777298Sobrien fi 623877298Sobrien 623960484Sobrien if test "$hardcode_action" = relink; then 624060484Sobrien # Fast installation is not supported 624160484Sobrien link_command="$compile_var$compile_command$compile_rpath" 624260484Sobrien relink_command="$finalize_var$finalize_command$finalize_rpath" 624377298Sobrien 6244218822Sdim func_warning "this platform does not like uninstalled shared libraries" 6245218822Sdim func_warning "\`$output' will be relinked during installation" 624660484Sobrien else 624760484Sobrien if test "$fast_install" != no; then 624860484Sobrien link_command="$finalize_var$compile_command$finalize_rpath" 624960484Sobrien if test "$fast_install" = yes; then 6250218822Sdim relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 625160484Sobrien else 625260484Sobrien # fast_install is set to needless 625360484Sobrien relink_command= 625460484Sobrien fi 625560484Sobrien else 625660484Sobrien link_command="$compile_var$compile_command$compile_rpath" 625760484Sobrien relink_command="$finalize_var$finalize_command$finalize_rpath" 625860484Sobrien fi 625960484Sobrien fi 626038889Sjdp 626160484Sobrien # Replace the output file specification. 6262218822Sdim link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 626377298Sobrien 626460484Sobrien # Delete the old output files. 6265218822Sdim $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 626638889Sjdp 6267218822Sdim func_show_eval "$link_command" 'exit $?' 626860484Sobrien 626938889Sjdp # Now create the wrapper script. 6270218822Sdim func_echo "creating $output" 627138889Sjdp 627260484Sobrien # Quote the relink command for shipping. 627360484Sobrien if test -n "$relink_command"; then 627477298Sobrien # Preserve any variables that may affect compiler behavior 627577298Sobrien for var in $variables_saved_for_relink; do 627677298Sobrien if eval test -z \"\${$var+set}\"; then 6277218822Sdim relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 627877298Sobrien elif eval var_value=\$$var; test -z "$var_value"; then 627977298Sobrien relink_command="$var=; export $var; $relink_command" 628077298Sobrien else 6281218822Sdim func_quote_for_eval "$var_value" 6282218822Sdim relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 628377298Sobrien fi 628477298Sobrien done 6285218822Sdim relink_command="(cd `pwd`; $relink_command)" 6286218822Sdim relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 628760484Sobrien fi 628838889Sjdp 6289218822Sdim # Quote $ECHO for shipping. 6290218822Sdim if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then 6291218822Sdim case $progpath in 6292218822Sdim [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 6293218822Sdim *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 629460484Sobrien esac 6295218822Sdim qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` 629660484Sobrien else 6297218822Sdim qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` 629860484Sobrien fi 629938889Sjdp 6300218822Sdim # Only actually do things if not in dry run mode. 6301218822Sdim $opt_dry_run || { 630260484Sobrien # win32 will think the script is a binary if it has 630360484Sobrien # a .exe suffix, so we strip it off here. 630460484Sobrien case $output in 6305218822Sdim *.exe) func_stripname '' '.exe' "$output" 6306218822Sdim output=$func_stripname_result ;; 630760484Sobrien esac 630889857Sobrien # test for cygwin because mv fails w/o .exe extensions 630989857Sobrien case $host in 6310218822Sdim *cygwin*) 6311218822Sdim exeext=.exe 6312218822Sdim func_stripname '' '.exe' "$outputname" 6313218822Sdim outputname=$func_stripname_result ;; 631489857Sobrien *) exeext= ;; 631589857Sobrien esac 6316218822Sdim case $host in 6317218822Sdim *cygwin* | *mingw* ) 6318218822Sdim output_name=`basename $output` 6319218822Sdim output_path=`dirname $output` 6320218822Sdim cwrappersource="$output_path/$objdir/lt-$output_name.c" 6321218822Sdim cwrapper="$output_path/$output_name.exe" 6322218822Sdim $RM $cwrappersource $cwrapper 6323218822Sdim trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 632438889Sjdp 6325218822Sdim cat > $cwrappersource <<EOF 6326218822Sdim 6327218822Sdim/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 6328218822Sdim Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 6329218822Sdim 6330218822Sdim The $output program cannot be directly executed until all the libtool 6331218822Sdim libraries that it depends on are installed. 6332218822Sdim 6333218822Sdim This wrapper executable should never be moved out of the build directory. 6334218822Sdim If it is, it will not operate correctly. 6335218822Sdim 6336218822Sdim Currently, it simply execs the wrapper *script* "/bin/sh $output", 6337218822Sdim but could eventually absorb all of the scripts functionality and 6338218822Sdim exec $objdir/$outputname directly. 6339218822Sdim*/ 6340218822SdimEOF 6341218822Sdim cat >> $cwrappersource<<"EOF" 6342218822Sdim#include <stdio.h> 6343218822Sdim#include <stdlib.h> 6344218822Sdim#include <unistd.h> 6345218822Sdim#include <malloc.h> 6346218822Sdim#include <stdarg.h> 6347218822Sdim#include <assert.h> 6348218822Sdim#include <string.h> 6349218822Sdim#include <ctype.h> 6350218822Sdim#include <sys/stat.h> 6351218822Sdim 6352218822Sdim#if defined(PATH_MAX) 6353218822Sdim# define LT_PATHMAX PATH_MAX 6354218822Sdim#elif defined(MAXPATHLEN) 6355218822Sdim# define LT_PATHMAX MAXPATHLEN 6356218822Sdim#else 6357218822Sdim# define LT_PATHMAX 1024 6358218822Sdim#endif 6359218822Sdim 6360218822Sdim#ifndef DIR_SEPARATOR 6361218822Sdim# define DIR_SEPARATOR '/' 6362218822Sdim# define PATH_SEPARATOR ':' 6363218822Sdim#endif 6364218822Sdim 6365218822Sdim#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 6366218822Sdim defined (__OS2__) 6367218822Sdim# define HAVE_DOS_BASED_FILE_SYSTEM 6368218822Sdim# ifndef DIR_SEPARATOR_2 6369218822Sdim# define DIR_SEPARATOR_2 '\\' 6370218822Sdim# endif 6371218822Sdim# ifndef PATH_SEPARATOR_2 6372218822Sdim# define PATH_SEPARATOR_2 ';' 6373218822Sdim# endif 6374218822Sdim#endif 6375218822Sdim 6376218822Sdim#ifndef DIR_SEPARATOR_2 6377218822Sdim# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 6378218822Sdim#else /* DIR_SEPARATOR_2 */ 6379218822Sdim# define IS_DIR_SEPARATOR(ch) \ 6380218822Sdim (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 6381218822Sdim#endif /* DIR_SEPARATOR_2 */ 6382218822Sdim 6383218822Sdim#ifndef PATH_SEPARATOR_2 6384218822Sdim# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 6385218822Sdim#else /* PATH_SEPARATOR_2 */ 6386218822Sdim# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 6387218822Sdim#endif /* PATH_SEPARATOR_2 */ 6388218822Sdim 6389218822Sdim#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 6390218822Sdim#define XFREE(stale) do { \ 6391218822Sdim if (stale) { free ((void *) stale); stale = 0; } \ 6392218822Sdim} while (0) 6393218822Sdim 6394218822Sdim/* -DDEBUG is fairly common in CFLAGS. */ 6395218822Sdim#undef DEBUG 6396218822Sdim#if defined DEBUGWRAPPER 6397218822Sdim# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 6398218822Sdim#else 6399218822Sdim# define DEBUG(format, ...) 6400218822Sdim#endif 6401218822Sdim 6402218822Sdimconst char *program_name = NULL; 6403218822Sdim 6404218822Sdimvoid * xmalloc (size_t num); 6405218822Sdimchar * xstrdup (const char *string); 6406218822Sdimconst char * base_name (const char *name); 6407218822Sdimchar * find_executable(const char *wrapper); 6408218822Sdimint check_executable(const char *path); 6409218822Sdimchar * strendzap(char *str, const char *pat); 6410218822Sdimvoid lt_fatal (const char *message, ...); 6411218822Sdim 6412218822Sdimint 6413218822Sdimmain (int argc, char *argv[]) 6414218822Sdim{ 6415218822Sdim char **newargz; 6416218822Sdim int i; 6417218822Sdim 6418218822Sdim program_name = (char *) xstrdup (base_name (argv[0])); 6419218822Sdim DEBUG("(main) argv[0] : %s\n",argv[0]); 6420218822Sdim DEBUG("(main) program_name : %s\n",program_name); 6421218822Sdim newargz = XMALLOC(char *, argc+2); 6422218822SdimEOF 6423218822Sdim 6424218822Sdim cat >> $cwrappersource <<EOF 6425218822Sdim newargz[0] = (char *) xstrdup("$SHELL"); 6426218822SdimEOF 6427218822Sdim 6428218822Sdim cat >> $cwrappersource <<"EOF" 6429218822Sdim newargz[1] = find_executable(argv[0]); 6430218822Sdim if (newargz[1] == NULL) 6431218822Sdim lt_fatal("Couldn't find %s", argv[0]); 6432218822Sdim DEBUG("(main) found exe at : %s\n",newargz[1]); 6433218822Sdim /* we know the script has the same name, without the .exe */ 6434218822Sdim /* so make sure newargz[1] doesn't end in .exe */ 6435218822Sdim strendzap(newargz[1],".exe"); 6436218822Sdim for (i = 1; i < argc; i++) 6437218822Sdim newargz[i+1] = xstrdup(argv[i]); 6438218822Sdim newargz[argc+1] = NULL; 6439218822Sdim 6440218822Sdim for (i=0; i<argc+1; i++) 6441218822Sdim { 6442218822Sdim DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 6443218822Sdim ; 6444218822Sdim } 6445218822Sdim 6446218822SdimEOF 6447218822Sdim 6448218822Sdim case $host_os in 6449218822Sdim mingw*) 6450218822Sdim cat >> $cwrappersource <<EOF 6451218822Sdim execv("$SHELL",(char const **)newargz); 6452218822SdimEOF 6453218822Sdim ;; 6454218822Sdim *) 6455218822Sdim cat >> $cwrappersource <<EOF 6456218822Sdim execv("$SHELL",newargz); 6457218822SdimEOF 6458218822Sdim ;; 6459218822Sdim esac 6460218822Sdim 6461218822Sdim cat >> $cwrappersource <<"EOF" 6462218822Sdim return 127; 6463218822Sdim} 6464218822Sdim 6465218822Sdimvoid * 6466218822Sdimxmalloc (size_t num) 6467218822Sdim{ 6468218822Sdim void * p = (void *) malloc (num); 6469218822Sdim if (!p) 6470218822Sdim lt_fatal ("Memory exhausted"); 6471218822Sdim 6472218822Sdim return p; 6473218822Sdim} 6474218822Sdim 6475218822Sdimchar * 6476218822Sdimxstrdup (const char *string) 6477218822Sdim{ 6478218822Sdim return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 6479218822Sdim; 6480218822Sdim} 6481218822Sdim 6482218822Sdimconst char * 6483218822Sdimbase_name (const char *name) 6484218822Sdim{ 6485218822Sdim const char *base; 6486218822Sdim 6487218822Sdim#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 6488218822Sdim /* Skip over the disk name in MSDOS pathnames. */ 6489218822Sdim if (isalpha ((unsigned char)name[0]) && name[1] == ':') 6490218822Sdim name += 2; 6491218822Sdim#endif 6492218822Sdim 6493218822Sdim for (base = name; *name; name++) 6494218822Sdim if (IS_DIR_SEPARATOR (*name)) 6495218822Sdim base = name + 1; 6496218822Sdim return base; 6497218822Sdim} 6498218822Sdim 6499218822Sdimint 6500218822Sdimcheck_executable(const char * path) 6501218822Sdim{ 6502218822Sdim struct stat st; 6503218822Sdim 6504218822Sdim DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 6505218822Sdim if ((!path) || (!*path)) 6506218822Sdim return 0; 6507218822Sdim 6508218822Sdim if ((stat (path, &st) >= 0) && 6509218822Sdim ( 6510218822Sdim /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 6511218822Sdim#if defined (S_IXOTH) 6512218822Sdim ((st.st_mode & S_IXOTH) == S_IXOTH) || 6513218822Sdim#endif 6514218822Sdim#if defined (S_IXGRP) 6515218822Sdim ((st.st_mode & S_IXGRP) == S_IXGRP) || 6516218822Sdim#endif 6517218822Sdim ((st.st_mode & S_IXUSR) == S_IXUSR)) 6518218822Sdim ) 6519218822Sdim return 1; 6520218822Sdim else 6521218822Sdim return 0; 6522218822Sdim} 6523218822Sdim 6524218822Sdim/* Searches for the full path of the wrapper. Returns 6525218822Sdim newly allocated full path name if found, NULL otherwise */ 6526218822Sdimchar * 6527218822Sdimfind_executable (const char* wrapper) 6528218822Sdim{ 6529218822Sdim int has_slash = 0; 6530218822Sdim const char* p; 6531218822Sdim const char* p_next; 6532218822Sdim /* static buffer for getcwd */ 6533218822Sdim char tmp[LT_PATHMAX + 1]; 6534218822Sdim int tmp_len; 6535218822Sdim char* concat_name; 6536218822Sdim 6537218822Sdim DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 6538218822Sdim 6539218822Sdim if ((wrapper == NULL) || (*wrapper == '\0')) 6540218822Sdim return NULL; 6541218822Sdim 6542218822Sdim /* Absolute path? */ 6543218822Sdim#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 6544218822Sdim if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 6545218822Sdim { 6546218822Sdim concat_name = xstrdup (wrapper); 6547218822Sdim if (check_executable(concat_name)) 6548218822Sdim return concat_name; 6549218822Sdim XFREE(concat_name); 6550218822Sdim } 6551218822Sdim else 6552218822Sdim { 6553218822Sdim#endif 6554218822Sdim if (IS_DIR_SEPARATOR (wrapper[0])) 6555218822Sdim { 6556218822Sdim concat_name = xstrdup (wrapper); 6557218822Sdim if (check_executable(concat_name)) 6558218822Sdim return concat_name; 6559218822Sdim XFREE(concat_name); 6560218822Sdim } 6561218822Sdim#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 6562218822Sdim } 6563218822Sdim#endif 6564218822Sdim 6565218822Sdim for (p = wrapper; *p; p++) 6566218822Sdim if (*p == '/') 6567218822Sdim { 6568218822Sdim has_slash = 1; 6569218822Sdim break; 6570218822Sdim } 6571218822Sdim if (!has_slash) 6572218822Sdim { 6573218822Sdim /* no slashes; search PATH */ 6574218822Sdim const char* path = getenv ("PATH"); 6575218822Sdim if (path != NULL) 6576218822Sdim { 6577218822Sdim for (p = path; *p; p = p_next) 6578218822Sdim { 6579218822Sdim const char* q; 6580218822Sdim size_t p_len; 6581218822Sdim for (q = p; *q; q++) 6582218822Sdim if (IS_PATH_SEPARATOR(*q)) 6583218822Sdim break; 6584218822Sdim p_len = q - p; 6585218822Sdim p_next = (*q == '\0' ? q : q + 1); 6586218822Sdim if (p_len == 0) 6587218822Sdim { 6588218822Sdim /* empty path: current directory */ 6589218822Sdim if (getcwd (tmp, LT_PATHMAX) == NULL) 6590218822Sdim lt_fatal ("getcwd failed"); 6591218822Sdim tmp_len = strlen(tmp); 6592218822Sdim concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 6593218822Sdim memcpy (concat_name, tmp, tmp_len); 6594218822Sdim concat_name[tmp_len] = '/'; 6595218822Sdim strcpy (concat_name + tmp_len + 1, wrapper); 6596218822Sdim } 6597218822Sdim else 6598218822Sdim { 6599218822Sdim concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 6600218822Sdim memcpy (concat_name, p, p_len); 6601218822Sdim concat_name[p_len] = '/'; 6602218822Sdim strcpy (concat_name + p_len + 1, wrapper); 6603218822Sdim } 6604218822Sdim if (check_executable(concat_name)) 6605218822Sdim return concat_name; 6606218822Sdim XFREE(concat_name); 6607218822Sdim } 6608218822Sdim } 6609218822Sdim /* not found in PATH; assume curdir */ 6610218822Sdim } 6611218822Sdim /* Relative path | not found in path: prepend cwd */ 6612218822Sdim if (getcwd (tmp, LT_PATHMAX) == NULL) 6613218822Sdim lt_fatal ("getcwd failed"); 6614218822Sdim tmp_len = strlen(tmp); 6615218822Sdim concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 6616218822Sdim memcpy (concat_name, tmp, tmp_len); 6617218822Sdim concat_name[tmp_len] = '/'; 6618218822Sdim strcpy (concat_name + tmp_len + 1, wrapper); 6619218822Sdim 6620218822Sdim if (check_executable(concat_name)) 6621218822Sdim return concat_name; 6622218822Sdim XFREE(concat_name); 6623218822Sdim return NULL; 6624218822Sdim} 6625218822Sdim 6626218822Sdimchar * 6627218822Sdimstrendzap(char *str, const char *pat) 6628218822Sdim{ 6629218822Sdim size_t len, patlen; 6630218822Sdim 6631218822Sdim assert(str != NULL); 6632218822Sdim assert(pat != NULL); 6633218822Sdim 6634218822Sdim len = strlen(str); 6635218822Sdim patlen = strlen(pat); 6636218822Sdim 6637218822Sdim if (patlen <= len) 6638218822Sdim { 6639218822Sdim str += len - patlen; 6640218822Sdim if (strcmp(str, pat) == 0) 6641218822Sdim *str = '\0'; 6642218822Sdim } 6643218822Sdim return str; 6644218822Sdim} 6645218822Sdim 6646218822Sdimstatic void 6647218822Sdimlt_error_core (int exit_status, const char * mode, 6648218822Sdim const char * message, va_list ap) 6649218822Sdim{ 6650218822Sdim fprintf (stderr, "%s: %s: ", program_name, mode); 6651218822Sdim vfprintf (stderr, message, ap); 6652218822Sdim fprintf (stderr, ".\n"); 6653218822Sdim 6654218822Sdim if (exit_status >= 0) 6655218822Sdim exit (exit_status); 6656218822Sdim} 6657218822Sdim 6658218822Sdimvoid 6659218822Sdimlt_fatal (const char *message, ...) 6660218822Sdim{ 6661218822Sdim va_list ap; 6662218822Sdim va_start (ap, message); 6663218822Sdim lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 6664218822Sdim va_end (ap); 6665218822Sdim} 6666218822SdimEOF 6667218822Sdim # we should really use a build-platform specific compiler 6668218822Sdim # here, but OTOH, the wrappers (shell script and this C one) 6669218822Sdim # are only useful if you want to execute the "real" binary. 6670218822Sdim # Since the "real" binary is built for $host, then this 6671218822Sdim # wrapper might as well be built for $host, too. 6672218822Sdim $opt_dry_run || $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 6673218822Sdim ;; 6674218822Sdim esac 6675218822Sdim $RM $output 6676218822Sdim trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 6677218822Sdim 6678218822Sdim $ECHO > $output "\ 667960484Sobrien#! $SHELL 668038889Sjdp 668160484Sobrien# $output - temporary wrapper script for $objdir/$outputname 6682218822Sdim# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 668338889Sjdp# 668438889Sjdp# The $output program cannot be directly executed until all the libtool 668538889Sjdp# libraries that it depends on are installed. 668638889Sjdp# 668760484Sobrien# This wrapper script should never be moved out of the build directory. 668838889Sjdp# If it is, it will not operate correctly. 668938889Sjdp 669038889Sjdp# Sed substitution that helps us do robust quoting. It backslashifies 669138889Sjdp# metacharacters that are still active within double-quoted strings. 6692218822SdimXsed='${SED} -e 1s/^X//' 669338889Sjdpsed_quote_subst='$sed_quote_subst' 669438889Sjdp 6695218822Sdim# Be Bourne compatible 6696218822Sdimif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 6697218822Sdim emulate sh 6698218822Sdim NULLCMD=: 6699218822Sdim # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 6700218822Sdim # is contrary to our usage. Disable this feature. 6701218822Sdim alias -g '\${1+\"\$@\"}'='\"\$@\"' 6702218822Sdim setopt NO_GLOB_SUBST 6703218822Sdimelse 6704218822Sdim case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 6705218822Sdimfi 6706218822SdimBIN_SH=xpg4; export BIN_SH # for Tru64 6707218822SdimDUALCASE=1; export DUALCASE # for MKS sh 6708218822Sdim 670938889Sjdp# The HP-UX ksh and POSIX shell print the target directory to stdout 671038889Sjdp# if CDPATH is set. 6711218822Sdim(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 671238889Sjdp 671360484Sobrienrelink_command=\"$relink_command\" 671460484Sobrien 671538889Sjdp# This environment variable determines our operation mode. 671638889Sjdpif test \"\$libtool_install_magic\" = \"$magic\"; then 6717218822Sdim # install mode needs the following variables: 6718218822Sdim generated_by_libtool_version='$macro_version' 671989857Sobrien notinst_deplibs='$notinst_deplibs' 672038889Sjdpelse 6721218822Sdim # When we are sourced in execute mode, \$file and \$ECHO are already set. 672260484Sobrien if test \"\$libtool_execute_magic\" != \"$magic\"; then 6723218822Sdim ECHO=\"$qecho\" 672438889Sjdp file=\"\$0\" 672560484Sobrien # Make sure echo works. 672660484Sobrien if test \"X\$1\" = X--no-reexec; then 672760484Sobrien # Discard the --no-reexec flag, and continue. 672860484Sobrien shift 6729218822Sdim elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then 6730218822Sdim # Yippee, \$ECHO works! 673160484Sobrien : 673260484Sobrien else 6733218822Sdim # Restart under the correct shell, and then maybe \$ECHO will work. 673460484Sobrien exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 673560484Sobrien fi 673638889Sjdp fi\ 673738889Sjdp" 6738218822Sdim $ECHO >> $output "\ 673938889Sjdp 674038889Sjdp # Find the directory that this script lives in. 6741218822Sdim thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 674238889Sjdp test \"x\$thisdir\" = \"x\$file\" && thisdir=. 674338889Sjdp 674438889Sjdp # Follow symbolic links until we get to the real thisdir. 6745218822Sdim file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 674638889Sjdp while test -n \"\$file\"; do 6747218822Sdim destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 674838889Sjdp 674938889Sjdp # If there was a directory component, then change thisdir. 675038889Sjdp if test \"x\$destdir\" != \"x\$file\"; then 675138889Sjdp case \"\$destdir\" in 675277298Sobrien [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 675338889Sjdp *) thisdir=\"\$thisdir/\$destdir\" ;; 675438889Sjdp esac 675538889Sjdp fi 675638889Sjdp 6757218822Sdim file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 6758218822Sdim file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 675938889Sjdp done 676038889Sjdp 676138889Sjdp # Try to get the absolute directory name. 676238889Sjdp absdir=\`cd \"\$thisdir\" && pwd\` 676338889Sjdp test -n \"\$absdir\" && thisdir=\"\$absdir\" 676460484Sobrien" 676538889Sjdp 676660484Sobrien if test "$fast_install" = yes; then 6767218822Sdim $ECHO >> $output "\ 676889857Sobrien program=lt-'$outputname'$exeext 676938889Sjdp progdir=\"\$thisdir/$objdir\" 677077298Sobrien 6771218822Sdim if test ! -f \"\$progdir/\$program\" || 6772218822Sdim { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 677360484Sobrien test \"X\$file\" != \"X\$progdir/\$program\"; }; then 677438889Sjdp 677560484Sobrien file=\"\$\$-\$program\" 677660484Sobrien 677760484Sobrien if test ! -d \"\$progdir\"; then 6778218822Sdim $MKDIR \"\$progdir\" 677960484Sobrien else 6780218822Sdim $RM \"\$progdir/\$file\" 678160484Sobrien fi" 678260484Sobrien 6783218822Sdim $ECHO >> $output "\ 678460484Sobrien 678560484Sobrien # relink executable if necessary 678660484Sobrien if test -n \"\$relink_command\"; then 678789857Sobrien if relink_command_output=\`eval \$relink_command 2>&1\`; then : 678860484Sobrien else 6789218822Sdim $ECHO \"\$relink_command_output\" >&2 6790218822Sdim $RM \"\$progdir/\$file\" 679160484Sobrien exit 1 679260484Sobrien fi 679360484Sobrien fi 679460484Sobrien 6795218822Sdim $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 6796218822Sdim { $RM \"\$progdir/\$program\"; 6797218822Sdim $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 6798218822Sdim $RM \"\$progdir/\$file\" 679960484Sobrien fi" 680060484Sobrien else 6801218822Sdim $ECHO >> $output "\ 680260484Sobrien program='$outputname' 680360484Sobrien progdir=\"\$thisdir/$objdir\" 680460484Sobrien" 680560484Sobrien fi 680660484Sobrien 6807218822Sdim $ECHO >> $output "\ 680860484Sobrien 680938889Sjdp if test -f \"\$progdir/\$program\"; then" 681038889Sjdp 681160484Sobrien # Export our shlibpath_var if we have one. 681260484Sobrien if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 6813218822Sdim $ECHO >> $output "\ 681438889Sjdp # Add our own library path to $shlibpath_var 681538889Sjdp $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 681638889Sjdp 681738889Sjdp # Some systems cannot cope with colon-terminated $shlibpath_var 681860484Sobrien # The second colon is a workaround for a bug in BeOS R4 sed 6819218822Sdim $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 682038889Sjdp 682138889Sjdp export $shlibpath_var 682238889Sjdp" 682360484Sobrien fi 682438889Sjdp 682560484Sobrien # fixup the dll searchpath if we need to. 682660484Sobrien if test -n "$dllsearchpath"; then 6827218822Sdim $ECHO >> $output "\ 682860484Sobrien # Add the dll search path components to the executable PATH 682960484Sobrien PATH=$dllsearchpath:\$PATH 683060484Sobrien" 683160484Sobrien fi 683260484Sobrien 6833218822Sdim $ECHO >> $output "\ 683438889Sjdp if test \"\$libtool_execute_magic\" != \"$magic\"; then 683538889Sjdp # Run the actual program with our arguments. 683660484Sobrien" 683760484Sobrien case $host in 683877298Sobrien # Backslashes separate directories on plain windows 683977298Sobrien *-*-mingw | *-*-os2*) 6840218822Sdim $ECHO >> $output "\ 6841218822Sdim exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 684260484Sobrien" 684360484Sobrien ;; 684477298Sobrien 684560484Sobrien *) 6846218822Sdim $ECHO >> $output "\ 6847218822Sdim exec \"\$progdir/\$program\" \${1+\"\$@\"} 684860484Sobrien" 684960484Sobrien ;; 685060484Sobrien esac 6851218822Sdim $ECHO >> $output "\ 6852218822Sdim \$ECHO \"\$0: cannot exec \$program \$*\" 685338889Sjdp exit 1 685438889Sjdp fi 685538889Sjdp else 685638889Sjdp # The program doesn't exist. 6857218822Sdim \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 6858218822Sdim \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 6859218822Sdim $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 686038889Sjdp exit 1 686138889Sjdp fi 686238889Sjdpfi\ 686338889Sjdp" 686460484Sobrien chmod +x $output 6865218822Sdim } 6866218822Sdim exit $EXIT_SUCCESS 686738889Sjdp ;; 686838889Sjdp esac 686938889Sjdp 687038889Sjdp # See if we need to build an old-fashioned archive. 687160484Sobrien for oldlib in $oldlibs; do 687238889Sjdp 687360484Sobrien if test "$build_libtool_libs" = convenience; then 6874218822Sdim oldobjs="$libobjs_save $symfileobj" 687560484Sobrien addlibs="$convenience" 687660484Sobrien build_libtool_libs=no 687760484Sobrien else 687860484Sobrien if test "$build_libtool_libs" = module; then 687960484Sobrien oldobjs="$libobjs_save" 688060484Sobrien build_libtool_libs=no 688160484Sobrien else 6882218822Sdim oldobjs="$old_deplibs $non_pic_objects" 6883218822Sdim if test "$preload" = yes && test -f "$symfileobj"; then 6884218822Sdim oldobjs="$oldobjs $symfileobj" 6885218822Sdim fi 688660484Sobrien fi 688760484Sobrien addlibs="$old_convenience" 688860484Sobrien fi 688960484Sobrien 689060484Sobrien if test -n "$addlibs"; then 689160484Sobrien gentop="$output_objdir/${outputname}x" 689260484Sobrien generated="$generated $gentop" 689377298Sobrien 6894218822Sdim func_extract_archives $gentop $addlibs 6895218822Sdim oldobjs="$oldobjs $func_extract_archives_result" 689660484Sobrien fi 689760484Sobrien 689838889Sjdp # Do each command in the archive commands. 689938889Sjdp if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 6900218822Sdim cmds=$old_archive_from_new_cmds 690138889Sjdp else 690260484Sobrien 6903218822Sdim # Add any objects from preloaded convenience libraries 6904218822Sdim if test -n "$dlprefiles"; then 6905218822Sdim gentop="$output_objdir/${outputname}x" 6906218822Sdim generated="$generated $gentop" 690789857Sobrien 6908218822Sdim func_extract_archives $gentop $dlprefiles 6909218822Sdim oldobjs="$oldobjs $func_extract_archives_result" 6910218822Sdim fi 6911218822Sdim 6912218822Sdim # POSIX demands no paths to be encoded in archives. We have 6913218822Sdim # to avoid creating archives with duplicate basenames if we 6914218822Sdim # might have to extract them afterwards, e.g., when creating a 6915218822Sdim # static archive out of a convenience library, or when linking 6916218822Sdim # the entirety of a libtool archive into another (currently 6917218822Sdim # not supported by libtool). 6918218822Sdim if (for obj in $oldobjs 6919218822Sdim do 6920218822Sdim func_basename "$obj" 6921218822Sdim $ECHO "$func_basename_result" 6922218822Sdim done | sort | sort -uc >/dev/null 2>&1); then 6923218822Sdim : 6924218822Sdim else 6925218822Sdim $ECHO "copying selected object files to avoid basename conflicts..." 6926218822Sdim gentop="$output_objdir/${outputname}x" 6927218822Sdim generated="$generated $gentop" 6928218822Sdim func_mkdir_p "$gentop" 6929218822Sdim save_oldobjs=$oldobjs 6930218822Sdim oldobjs= 6931218822Sdim counter=1 6932218822Sdim for obj in $save_oldobjs 6933218822Sdim do 6934218822Sdim func_basename "$obj" 6935218822Sdim objbase="$func_basename_result" 6936218822Sdim case " $oldobjs " in 6937218822Sdim " ") oldobjs=$obj ;; 6938218822Sdim *[\ /]"$objbase "*) 6939218822Sdim while :; do 6940218822Sdim # Make sure we don't pick an alternate name that also 6941218822Sdim # overlaps. 6942218822Sdim newobj=lt$counter-$objbase 6943218822Sdim counter=`expr $counter + 1` 6944218822Sdim case " $oldobjs " in 6945218822Sdim *[\ /]"$newobj "*) ;; 6946218822Sdim *) if test ! -f "$gentop/$newobj"; then break; fi ;; 6947218822Sdim esac 6948218822Sdim done 6949218822Sdim func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 6950218822Sdim oldobjs="$oldobjs $gentop/$newobj" 6951218822Sdim ;; 6952218822Sdim *) oldobjs="$oldobjs $obj" ;; 6953218822Sdim esac 6954218822Sdim done 6955218822Sdim fi 6956218822Sdim eval cmds=\"$old_archive_cmds\" 6957218822Sdim 6958218822Sdim if len=`expr "X$cmds" : ".*" 2>/dev/null` && 6959218822Sdim test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 6960218822Sdim cmds=$old_archive_cmds 6961218822Sdim else 6962218822Sdim # the command line is too long to link in one step, link in parts 6963218822Sdim func_echo "using piecewise archive linking..." 696489857Sobrien save_RANLIB=$RANLIB 696589857Sobrien RANLIB=: 6966218822Sdim objlist= 6967218822Sdim concat_cmds= 6968218822Sdim save_oldobjs=$oldobjs 6969218822Sdim # Is there a better way of finding the last object in the list? 6970218822Sdim for obj in $save_oldobjs 6971218822Sdim do 6972218822Sdim last_oldobj=$obj 6973218822Sdim done 6974218822Sdim for obj in $save_oldobjs 6975218822Sdim do 6976218822Sdim oldobjs="$objlist $obj" 6977218822Sdim objlist="$objlist $obj" 6978218822Sdim eval test_cmds=\"$old_archive_cmds\" 6979218822Sdim if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 6980218822Sdim test "$len" -le "$max_cmd_len"; then 6981218822Sdim : 6982218822Sdim else 6983218822Sdim # the above command should be used before it gets too long 6984218822Sdim oldobjs=$objlist 6985218822Sdim if test "$obj" = "$last_oldobj" ; then 6986218822Sdim RANLIB=$save_RANLIB 6987218822Sdim fi 698889857Sobrien test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 6989218822Sdim eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 6990218822Sdim objlist= 6991218822Sdim fi 6992218822Sdim done 699389857Sobrien RANLIB=$save_RANLIB 6994218822Sdim oldobjs=$objlist 6995218822Sdim if test "X$oldobjs" = "X" ; then 6996218822Sdim eval cmds=\"\$concat_cmds\" 6997218822Sdim else 6998218822Sdim eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 6999218822Sdim fi 7000218822Sdim fi 700138889Sjdp fi 7002218822Sdim func_execute_cmds "$cmds" 'exit $?' 700360484Sobrien done 700460484Sobrien 7005218822Sdim test -n "$generated" && \ 7006218822Sdim func_show_eval "${RM}r$generated" 700738889Sjdp 700838889Sjdp # Now create the libtool archive. 700989857Sobrien case $output in 701038889Sjdp *.la) 701138889Sjdp old_library= 701260484Sobrien test "$build_old_libs" = yes && old_library="$libname.$libext" 7013218822Sdim func_echo "creating $output" 701438889Sjdp 701577298Sobrien # Preserve any variables that may affect compiler behavior 701677298Sobrien for var in $variables_saved_for_relink; do 701777298Sobrien if eval test -z \"\${$var+set}\"; then 7018218822Sdim relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 701977298Sobrien elif eval var_value=\$$var; test -z "$var_value"; then 702077298Sobrien relink_command="$var=; export $var; $relink_command" 702177298Sobrien else 7022218822Sdim func_quote_for_eval "$var_value" 7023218822Sdim relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 702477298Sobrien fi 702577298Sobrien done 702677298Sobrien # Quote the link command for shipping. 7027218822Sdim relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 7028218822Sdim relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 7029218822Sdim if test "$hardcode_automatic" = yes ; then 7030218822Sdim relink_command= 7031218822Sdim fi 703260484Sobrien 703338889Sjdp # Only create the output if not a dry run. 7034218822Sdim $opt_dry_run || { 703560484Sobrien for installed in no yes; do 703660484Sobrien if test "$installed" = yes; then 703760484Sobrien if test -z "$install_libdir"; then 703860484Sobrien break 703960484Sobrien fi 704060484Sobrien output="$output_objdir/$outputname"i 704177298Sobrien # Replace all uninstalled libtool libraries with the installed ones 704277298Sobrien newdependency_libs= 704377298Sobrien for deplib in $dependency_libs; do 704489857Sobrien case $deplib in 704577298Sobrien *.la) 7046218822Sdim func_basename "$deplib" 7047218822Sdim name="$func_basename_result" 7048218822Sdim eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 7049218822Sdim test -z "$libdir" && \ 7050218822Sdim func_fatal_error "\`$deplib' is not a valid libtool archive" 705177298Sobrien newdependency_libs="$newdependency_libs $libdir/$name" 705277298Sobrien ;; 705377298Sobrien *) newdependency_libs="$newdependency_libs $deplib" ;; 705477298Sobrien esac 705577298Sobrien done 705677298Sobrien dependency_libs="$newdependency_libs" 705777298Sobrien newdlfiles= 7058218822Sdim 705977298Sobrien for lib in $dlfiles; do 7060218822Sdim case $lib in 7061218822Sdim *.la) 7062218822Sdim func_basename "$lib" 7063218822Sdim name="$func_basename_result" 7064218822Sdim eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 7065218822Sdim test -z "$libdir" && \ 7066218822Sdim func_fatal_error "\`$lib' is not a valid libtool archive" 7067218822Sdim newdlfiles="$newdlfiles $libdir/$name" 7068218822Sdim ;; 7069218822Sdim *) newdlfiles="$newdlfiles $lib" ;; 7070218822Sdim esac 707177298Sobrien done 707277298Sobrien dlfiles="$newdlfiles" 707377298Sobrien newdlprefiles= 707477298Sobrien for lib in $dlprefiles; do 7075218822Sdim case $lib in 7076218822Sdim *.la) 7077218822Sdim # Only pass preopened files to the pseudo-archive (for 7078218822Sdim # eventual linking with the app. that links it) if we 7079218822Sdim # didn't already link the preopened objects directly into 7080218822Sdim # the library: 7081218822Sdim func_basename "$lib" 7082218822Sdim name="$func_basename_result" 7083218822Sdim eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 7084218822Sdim test -z "$libdir" && \ 7085218822Sdim func_fatal_error "\`$lib' is not a valid libtool archive" 7086218822Sdim newdlprefiles="$newdlprefiles $libdir/$name" 7087218822Sdim ;; 7088218822Sdim esac 708977298Sobrien done 709077298Sobrien dlprefiles="$newdlprefiles" 7091218822Sdim else 7092218822Sdim newdlfiles= 7093218822Sdim for lib in $dlfiles; do 7094218822Sdim case $lib in 7095218822Sdim [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 7096218822Sdim *) abs=`pwd`"/$lib" ;; 7097218822Sdim esac 7098218822Sdim newdlfiles="$newdlfiles $abs" 7099218822Sdim done 7100218822Sdim dlfiles="$newdlfiles" 7101218822Sdim newdlprefiles= 7102218822Sdim for lib in $dlprefiles; do 7103218822Sdim case $lib in 7104218822Sdim [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 7105218822Sdim *) abs=`pwd`"/$lib" ;; 7106218822Sdim esac 7107218822Sdim newdlprefiles="$newdlprefiles $abs" 7108218822Sdim done 7109218822Sdim dlprefiles="$newdlprefiles" 711060484Sobrien fi 7111218822Sdim $RM $output 711289857Sobrien # place dlname in correct position for cygwin 711389857Sobrien tdlname=$dlname 711489857Sobrien case $host,$output,$installed,$module,$dlname in 7115218822Sdim *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 711689857Sobrien esac 7117218822Sdim $ECHO > $output "\ 711860484Sobrien# $outputname - a libtool library file 7119218822Sdim# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 712060484Sobrien# 712160484Sobrien# Please DO NOT delete this file! 712260484Sobrien# It is necessary for linking the library. 712338889Sjdp 712438889Sjdp# The name that we can dlopen(3). 712589857Sobriendlname='$tdlname' 712638889Sjdp 712738889Sjdp# Names of this library. 712838889Sjdplibrary_names='$library_names' 712938889Sjdp 713038889Sjdp# The name of the static archive. 713138889Sjdpold_library='$old_library' 713238889Sjdp 7133218822Sdim# Linker flags that can not go in dependency_libs. 7134218822Sdiminherited_linker_flags='$new_inherited_linker_flags' 7135218822Sdim 713638889Sjdp# Libraries that this one depends upon. 713738889Sjdpdependency_libs='$dependency_libs' 713838889Sjdp 7139218822Sdim# Names of additional weak libraries provided by this library 7140218822Sdimweak_library_names='$weak_libs' 7141218822Sdim 714238889Sjdp# Version information for $libname. 714338889Sjdpcurrent=$current 714438889Sjdpage=$age 714538889Sjdprevision=$revision 714638889Sjdp 714760484Sobrien# Is this an already installed library? 714860484Sobrieninstalled=$installed 714960484Sobrien 7150218822Sdim# Should we warn about portability when linking against -modules? 7151218822Sdimshouldnotlink=$module 7152218822Sdim 715377298Sobrien# Files to dlopen/dlpreopen 715477298Sobriendlopen='$dlfiles' 715577298Sobriendlpreopen='$dlprefiles' 715677298Sobrien 715738889Sjdp# Directory that this library needs to be installed in: 715877298Sobrienlibdir='$install_libdir'" 7159218822Sdim if test "$installed" = no && test "$need_relink" = yes; then 7160218822Sdim $ECHO >> $output "\ 716177298Sobrienrelink_command=\"$relink_command\"" 716277298Sobrien fi 716360484Sobrien done 7164218822Sdim } 716538889Sjdp 716638889Sjdp # Do a symbolic link so that the libtool archive can be found in 716738889Sjdp # LD_LIBRARY_PATH before the program is installed. 7168218822Sdim func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 716938889Sjdp ;; 717038889Sjdp esac 7171218822Sdim exit $EXIT_SUCCESS 7172218822Sdim} 717338889Sjdp 7174218822Sdim{ test "$mode" = link || test "$mode" = relink; } && 7175218822Sdim func_mode_link ${1+"$@"} 717638889Sjdp 717738889Sjdp 7178218822Sdim# func_mode_uninstall arg... 7179218822Sdimfunc_mode_uninstall () 7180218822Sdim{ 7181218822Sdim $opt_debug 7182218822Sdim RM="$nonopt" 718338889Sjdp files= 718489857Sobrien rmforce= 718589857Sobrien exit_status=0 718638889Sjdp 718777298Sobrien # This variable tells wrapper scripts just to set variables rather 718877298Sobrien # than running their programs. 718977298Sobrien libtool_install_magic="$magic" 719077298Sobrien 719138889Sjdp for arg 719238889Sjdp do 719389857Sobrien case $arg in 7194218822Sdim -f) RM="$RM $arg"; rmforce=yes ;; 7195218822Sdim -*) RM="$RM $arg" ;; 719638889Sjdp *) files="$files $arg" ;; 719738889Sjdp esac 719838889Sjdp done 719938889Sjdp 7200218822Sdim test -z "$RM" && \ 7201218822Sdim func_fatal_help "you must specify an RM program" 720238889Sjdp 720389857Sobrien rmdirs= 720489857Sobrien 7205218822Sdim origobjdir="$objdir" 720638889Sjdp for file in $files; do 7207218822Sdim func_dirname "$file" "" "." 7208218822Sdim dir="$func_dirname_result" 7209218822Sdim if test "X$dir" = X.; then 7210218822Sdim objdir="$origobjdir" 721177298Sobrien else 7212218822Sdim objdir="$dir/$origobjdir" 721377298Sobrien fi 7214218822Sdim func_basename "$file" 7215218822Sdim name="$func_basename_result" 7216218822Sdim test "$mode" = uninstall && objdir="$dir" 721738889Sjdp 721889857Sobrien # Remember objdir for removal later, being careful to avoid duplicates 7219218822Sdim if test "$mode" = clean; then 722089857Sobrien case " $rmdirs " in 722189857Sobrien *" $objdir "*) ;; 722289857Sobrien *) rmdirs="$rmdirs $objdir" ;; 722389857Sobrien esac 722489857Sobrien fi 722589857Sobrien 722689857Sobrien # Don't error if the file doesn't exist and rm -f was used. 7227218822Sdim if { test -L "$file"; } >/dev/null 2>&1 || 7228218822Sdim { test -h "$file"; } >/dev/null 2>&1 || 7229218822Sdim test -f "$file"; then 7230218822Sdim : 723189857Sobrien elif test -d "$file"; then 7232218822Sdim exit_status=1 723389857Sobrien continue 723489857Sobrien elif test "$rmforce" = yes; then 7235218822Sdim continue 723689857Sobrien fi 723789857Sobrien 723838889Sjdp rmfiles="$file" 723938889Sjdp 724089857Sobrien case $name in 724138889Sjdp *.la) 724260484Sobrien # Possibly a libtool archive, so verify it. 7243218822Sdim if func_lalib_p "$file"; then 7244218822Sdim func_source $dir/$name 724538889Sjdp 724660484Sobrien # Delete the libtool libraries and symlinks. 724760484Sobrien for n in $library_names; do 724877298Sobrien rmfiles="$rmfiles $objdir/$n" 724960484Sobrien done 725077298Sobrien test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 725138889Sjdp 7252218822Sdim case "$mode" in 7253218822Sdim clean) 7254218822Sdim case " $library_names " in 7255218822Sdim # " " in the beginning catches empty $dlname 7256218822Sdim *" $dlname "*) ;; 7257218822Sdim *) rmfiles="$rmfiles $objdir/$dlname" ;; 7258218822Sdim esac 7259218822Sdim test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 7260218822Sdim ;; 7261218822Sdim uninstall) 726277298Sobrien if test -n "$library_names"; then 726377298Sobrien # Do each command in the postuninstall commands. 7264218822Sdim func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 726577298Sobrien fi 726638889Sjdp 726777298Sobrien if test -n "$old_library"; then 726877298Sobrien # Do each command in the old_postuninstall commands. 7269218822Sdim func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 727077298Sobrien fi 727177298Sobrien # FIXME: should reinstall the best remaining shared library. 7272218822Sdim ;; 7273218822Sdim esac 727460484Sobrien fi 727560484Sobrien ;; 727638889Sjdp 727738889Sjdp *.lo) 727877298Sobrien # Possibly a libtool object, so verify it. 7279218822Sdim if func_lalib_p "$file"; then 728077298Sobrien 7281218822Sdim # Read the .lo file 7282218822Sdim func_source $dir/$name 728377298Sobrien 728477298Sobrien # Add PIC object to the list of files to remove. 7285218822Sdim if test -n "$pic_object" && 7286218822Sdim test "$pic_object" != none; then 728777298Sobrien rmfiles="$rmfiles $dir/$pic_object" 7288218822Sdim fi 728977298Sobrien 729077298Sobrien # Add non-PIC object to the list of files to remove. 7291218822Sdim if test -n "$non_pic_object" && 7292218822Sdim test "$non_pic_object" != none; then 729377298Sobrien rmfiles="$rmfiles $dir/$non_pic_object" 7294218822Sdim fi 729560484Sobrien fi 729660484Sobrien ;; 729738889Sjdp 729838889Sjdp *) 7299218822Sdim if test "$mode" = clean ; then 7300218822Sdim noexename=$name 7301218822Sdim case $file in 7302218822Sdim *.exe) 7303218822Sdim func_stripname '' '.exe' "$file" 7304218822Sdim file=$func_stripname_result 7305218822Sdim func_stripname '' '.exe' "$name" 7306218822Sdim noexename=$func_stripname_result 7307218822Sdim # $file with .exe has already been added to rmfiles, 7308218822Sdim # add $file without .exe 7309218822Sdim rmfiles="$rmfiles $file" 7310218822Sdim ;; 7311218822Sdim esac 7312218822Sdim # Do a test to see if this is a libtool program. 7313218822Sdim if func_ltwrapper_p "$file"; then 7314218822Sdim relink_command= 7315218822Sdim func_source $dir/$noexename 731677298Sobrien 7317218822Sdim # note $name still contains .exe if it was in $file originally 7318218822Sdim # as does the version of $file that was added into $rmfiles 7319218822Sdim rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 7320218822Sdim if test "$fast_install" = yes && test -n "$relink_command"; then 7321218822Sdim rmfiles="$rmfiles $objdir/lt-$name" 7322218822Sdim fi 7323218822Sdim if test "X$noexename" != "X$name" ; then 7324218822Sdim rmfiles="$rmfiles $objdir/lt-${noexename}.c" 7325218822Sdim fi 732677298Sobrien fi 732777298Sobrien fi 732838889Sjdp ;; 732938889Sjdp esac 7330218822Sdim func_show_eval "$RM $rmfiles" 'exit_status=1' 733138889Sjdp done 7332218822Sdim objdir="$origobjdir" 733389857Sobrien 733489857Sobrien # Try to remove the ${objdir}s in the directories where we deleted files 733589857Sobrien for dir in $rmdirs; do 733689857Sobrien if test -d "$dir"; then 7337218822Sdim func_show_eval "rmdir $dir >/dev/null 2>&1" 733889857Sobrien fi 733989857Sobrien done 734089857Sobrien 734189857Sobrien exit $exit_status 7342218822Sdim} 734338889Sjdp 7344218822Sdim{ test "$mode" = uninstall || test "$mode" = clean; } && 7345218822Sdim func_mode_uninstall ${1+"$@"} 734638889Sjdp 7347218822Sdimtest -z "$mode" && { 7348218822Sdim help="$generic_help" 7349218822Sdim func_fatal_help "you must specify a MODE" 7350218822Sdim} 735138889Sjdp 7352218822Sdimtest -z "$exec_cmd" && \ 7353218822Sdim func_fatal_help "invalid operation mode \`$mode'" 7354218822Sdim 735589857Sobrienif test -n "$exec_cmd"; then 7356218822Sdim eval exec "$exec_cmd" 7357218822Sdim exit $EXIT_FAILURE 735889857Sobrienfi 735989857Sobrien 7360218822Sdimexit $exit_status 736138889Sjdp 736238889Sjdp 736377298Sobrien# The TAGs below are defined such that we never get into a situation 736477298Sobrien# in which we disable both kinds of libraries. Given conflicting 736577298Sobrien# choices, we go for a static library, that is the most portable, 736677298Sobrien# since we can't tell whether shared libraries were disabled because 736777298Sobrien# the user asked for that or because the platform doesn't support 736877298Sobrien# them. This is particularly important on AIX, because we don't 736977298Sobrien# support having both static and shared libraries enabled at the same 737077298Sobrien# time on that platform, so we default to a shared-only configuration. 737177298Sobrien# If a disable-shared tag is given, we'll fallback to a static-only 737277298Sobrien# configuration. But we'll never go from static-only to shared-only. 737377298Sobrien 7374218822Sdim# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 737577298Sobrienbuild_libtool_libs=no 737677298Sobrienbuild_old_libs=yes 7377218822Sdim# ### END LIBTOOL TAG CONFIG: disable-shared 737877298Sobrien 7379218822Sdim# ### BEGIN LIBTOOL TAG CONFIG: disable-static 738077298Sobrienbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 7381218822Sdim# ### END LIBTOOL TAG CONFIG: disable-static 738277298Sobrien 738338889Sjdp# Local Variables: 738438889Sjdp# mode:shell-script 738538889Sjdp# sh-indentation:2 738638889Sjdp# End: 7387218822Sdim# vi:sw=2 7388