1fa225cbcSrjs# Generated from ltmain.m4sh. 2fa225cbcSrjs 3fa225cbcSrjs# ltmain.sh (GNU libtool) 2.2.6 4fa225cbcSrjs# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 5fa225cbcSrjs 6fa225cbcSrjs# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. 7fa225cbcSrjs# This is free software; see the source for copying conditions. There is NO 8fa225cbcSrjs# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9fa225cbcSrjs 10fa225cbcSrjs# GNU Libtool is free software; you can redistribute it and/or modify 11fa225cbcSrjs# it under the terms of the GNU General Public License as published by 12fa225cbcSrjs# the Free Software Foundation; either version 2 of the License, or 13fa225cbcSrjs# (at your option) any later version. 14fa225cbcSrjs# 15fa225cbcSrjs# As a special exception to the GNU General Public License, 16fa225cbcSrjs# if you distribute this file as part of a program or library that 17fa225cbcSrjs# is built using GNU Libtool, you may include this file under the 18fa225cbcSrjs# same distribution terms that you use for the rest of that program. 19fa225cbcSrjs# 20fa225cbcSrjs# GNU Libtool is distributed in the hope that it will be useful, but 21fa225cbcSrjs# WITHOUT ANY WARRANTY; without even the implied warranty of 22fa225cbcSrjs# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23fa225cbcSrjs# General Public License for more details. 24fa225cbcSrjs# 25fa225cbcSrjs# You should have received a copy of the GNU General Public License 26fa225cbcSrjs# along with GNU Libtool; see the file COPYING. If not, a copy 27fa225cbcSrjs# can be downloaded from http://www.gnu.org/licenses/gpl.html, 28fa225cbcSrjs# or obtained by writing to the Free Software Foundation, Inc., 29fa225cbcSrjs# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30fa225cbcSrjs 31fa225cbcSrjs# Usage: $progname [OPTION]... [MODE-ARG]... 32fa225cbcSrjs# 33fa225cbcSrjs# Provide generalized library-building support services. 34fa225cbcSrjs# 35fa225cbcSrjs# --config show all configuration variables 36fa225cbcSrjs# --debug enable verbose shell tracing 37fa225cbcSrjs# -n, --dry-run display commands without modifying any files 38fa225cbcSrjs# --features display basic configuration information and exit 39fa225cbcSrjs# --mode=MODE use operation mode MODE 40fa225cbcSrjs# --preserve-dup-deps don't remove duplicate dependency libraries 41fa225cbcSrjs# --quiet, --silent don't print informational messages 42fa225cbcSrjs# --tag=TAG use configuration variables from tag TAG 43fa225cbcSrjs# -v, --verbose print informational messages (default) 44fa225cbcSrjs# --version print version information 45fa225cbcSrjs# -h, --help print short or long help message 46fa225cbcSrjs# 47fa225cbcSrjs# MODE must be one of the following: 48fa225cbcSrjs# 49fa225cbcSrjs# clean remove files from the build directory 50fa225cbcSrjs# compile compile a source file into a libtool object 51fa225cbcSrjs# execute automatically set library path, then run a program 52fa225cbcSrjs# finish complete the installation of libtool libraries 53fa225cbcSrjs# install install libraries or executables 54fa225cbcSrjs# link create a library or an executable 55fa225cbcSrjs# uninstall remove libraries from an installed directory 56fa225cbcSrjs# 57fa225cbcSrjs# MODE-ARGS vary depending on the MODE. 58fa225cbcSrjs# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 59fa225cbcSrjs# 60fa225cbcSrjs# When reporting a bug, please describe a test case to reproduce it and 61fa225cbcSrjs# include the following information: 62fa225cbcSrjs# 63fa225cbcSrjs# host-triplet: $host 64fa225cbcSrjs# shell: $SHELL 65fa225cbcSrjs# compiler: $LTCC 66fa225cbcSrjs# compiler flags: $LTCFLAGS 67fa225cbcSrjs# linker: $LD (gnu? $with_gnu_ld) 68fa225cbcSrjs# $progname: (GNU libtool) 2.2.6 Debian-2.2.6a-4 69fa225cbcSrjs# automake: $automake_version 70fa225cbcSrjs# autoconf: $autoconf_version 71fa225cbcSrjs# 72fa225cbcSrjs# Report bugs to <bug-libtool@gnu.org>. 73fa225cbcSrjs 74fa225cbcSrjsPROGRAM=ltmain.sh 75fa225cbcSrjsPACKAGE=libtool 76fa225cbcSrjsVERSION="2.2.6 Debian-2.2.6a-4" 77fa225cbcSrjsTIMESTAMP="" 78fa225cbcSrjspackage_revision=1.3012 79fa225cbcSrjs 80fa225cbcSrjs# Be Bourne compatible 81fa225cbcSrjsif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 82fa225cbcSrjs emulate sh 83fa225cbcSrjs NULLCMD=: 84fa225cbcSrjs # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 85fa225cbcSrjs # is contrary to our usage. Disable this feature. 86fa225cbcSrjs alias -g '${1+"$@"}'='"$@"' 87fa225cbcSrjs setopt NO_GLOB_SUBST 88fa225cbcSrjselse 89fa225cbcSrjs case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 90fa225cbcSrjsfi 91fa225cbcSrjsBIN_SH=xpg4; export BIN_SH # for Tru64 92fa225cbcSrjsDUALCASE=1; export DUALCASE # for MKS sh 93fa225cbcSrjs 94fa225cbcSrjs# NLS nuisances: We save the old values to restore during execute mode. 95fa225cbcSrjs# Only set LANG and LC_ALL to C if already set. 96fa225cbcSrjs# These must not be set unconditionally because not all systems understand 97fa225cbcSrjs# e.g. LANG=C (notably SCO). 98fa225cbcSrjslt_user_locale= 99fa225cbcSrjslt_safe_locale= 100fa225cbcSrjsfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 101fa225cbcSrjsdo 102fa225cbcSrjs eval "if test \"\${$lt_var+set}\" = set; then 103fa225cbcSrjs save_$lt_var=\$$lt_var 104fa225cbcSrjs $lt_var=C 105fa225cbcSrjs export $lt_var 106fa225cbcSrjs lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 107fa225cbcSrjs lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 108fa225cbcSrjs fi" 109fa225cbcSrjsdone 110fa225cbcSrjs 111fa225cbcSrjs$lt_unset CDPATH 112fa225cbcSrjs 113fa225cbcSrjs 114fa225cbcSrjs 115fa225cbcSrjs 116fa225cbcSrjs 117fa225cbcSrjs: ${CP="cp -f"} 118fa225cbcSrjs: ${ECHO="echo"} 119fa225cbcSrjs: ${EGREP="/bin/grep -E"} 120fa225cbcSrjs: ${FGREP="/bin/grep -F"} 121fa225cbcSrjs: ${GREP="/bin/grep"} 122fa225cbcSrjs: ${LN_S="ln -s"} 123fa225cbcSrjs: ${MAKE="make"} 124fa225cbcSrjs: ${MKDIR="mkdir"} 125fa225cbcSrjs: ${MV="mv -f"} 126fa225cbcSrjs: ${RM="rm -f"} 127fa225cbcSrjs: ${SED="/bin/sed"} 128fa225cbcSrjs: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 129fa225cbcSrjs: ${Xsed="$SED -e 1s/^X//"} 130fa225cbcSrjs 131fa225cbcSrjs# Global variables: 132fa225cbcSrjsEXIT_SUCCESS=0 133fa225cbcSrjsEXIT_FAILURE=1 134fa225cbcSrjsEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 135fa225cbcSrjsEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 136fa225cbcSrjs 137fa225cbcSrjsexit_status=$EXIT_SUCCESS 138fa225cbcSrjs 139fa225cbcSrjs# Make sure IFS has a sensible default 140fa225cbcSrjslt_nl=' 141fa225cbcSrjs' 142fa225cbcSrjsIFS=" $lt_nl" 143fa225cbcSrjs 144fa225cbcSrjsdirname="s,/[^/]*$,," 145fa225cbcSrjsbasename="s,^.*/,," 146fa225cbcSrjs 147fa225cbcSrjs# func_dirname_and_basename file append nondir_replacement 148fa225cbcSrjs# perform func_basename and func_dirname in a single function 149fa225cbcSrjs# call: 150fa225cbcSrjs# dirname: Compute the dirname of FILE. If nonempty, 151fa225cbcSrjs# add APPEND to the result, otherwise set result 152fa225cbcSrjs# to NONDIR_REPLACEMENT. 153fa225cbcSrjs# value returned in "$func_dirname_result" 154fa225cbcSrjs# basename: Compute filename of FILE. 155fa225cbcSrjs# value retuned in "$func_basename_result" 156fa225cbcSrjs# Implementation must be kept synchronized with func_dirname 157fa225cbcSrjs# and func_basename. For efficiency, we do not delegate to 158fa225cbcSrjs# those functions but instead duplicate the functionality here. 159fa225cbcSrjsfunc_dirname_and_basename () 160fa225cbcSrjs{ 161fa225cbcSrjs # Extract subdirectory from the argument. 162fa225cbcSrjs func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` 163fa225cbcSrjs if test "X$func_dirname_result" = "X${1}"; then 164fa225cbcSrjs func_dirname_result="${3}" 165fa225cbcSrjs else 166fa225cbcSrjs func_dirname_result="$func_dirname_result${2}" 167fa225cbcSrjs fi 168fa225cbcSrjs func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` 169fa225cbcSrjs} 170fa225cbcSrjs 171fa225cbcSrjs# Generated shell functions inserted here. 172fa225cbcSrjs 173fa225cbcSrjs# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 174fa225cbcSrjs# is ksh but when the shell is invoked as "sh" and the current value of 175fa225cbcSrjs# the _XPG environment variable is not equal to 1 (one), the special 176fa225cbcSrjs# positional parameter $0, within a function call, is the name of the 177fa225cbcSrjs# function. 178fa225cbcSrjsprogpath="$0" 179fa225cbcSrjs 180fa225cbcSrjs# The name of this program: 181fa225cbcSrjs# In the unlikely event $progname began with a '-', it would play havoc with 182fa225cbcSrjs# func_echo (imagine progname=-n), so we prepend ./ in that case: 183fa225cbcSrjsfunc_dirname_and_basename "$progpath" 184fa225cbcSrjsprogname=$func_basename_result 185fa225cbcSrjscase $progname in 186fa225cbcSrjs -*) progname=./$progname ;; 187fa225cbcSrjsesac 188fa225cbcSrjs 189fa225cbcSrjs# Make sure we have an absolute path for reexecution: 190fa225cbcSrjscase $progpath in 191fa225cbcSrjs [\\/]*|[A-Za-z]:\\*) ;; 192fa225cbcSrjs *[\\/]*) 193fa225cbcSrjs progdir=$func_dirname_result 194fa225cbcSrjs progdir=`cd "$progdir" && pwd` 195fa225cbcSrjs progpath="$progdir/$progname" 196fa225cbcSrjs ;; 197fa225cbcSrjs *) 198fa225cbcSrjs save_IFS="$IFS" 199fa225cbcSrjs IFS=: 200fa225cbcSrjs for progdir in $PATH; do 201fa225cbcSrjs IFS="$save_IFS" 202fa225cbcSrjs test -x "$progdir/$progname" && break 203fa225cbcSrjs done 204fa225cbcSrjs IFS="$save_IFS" 205fa225cbcSrjs test -n "$progdir" || progdir=`pwd` 206fa225cbcSrjs progpath="$progdir/$progname" 207fa225cbcSrjs ;; 208fa225cbcSrjsesac 209fa225cbcSrjs 210fa225cbcSrjs# Sed substitution that helps us do robust quoting. It backslashifies 211fa225cbcSrjs# metacharacters that are still active within double-quoted strings. 212fa225cbcSrjsXsed="${SED}"' -e 1s/^X//' 213fa225cbcSrjssed_quote_subst='s/\([`"$\\]\)/\\\1/g' 214fa225cbcSrjs 215fa225cbcSrjs# Same as above, but do not quote variable references. 216fa225cbcSrjsdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 217fa225cbcSrjs 218fa225cbcSrjs# Re-`\' parameter expansions in output of double_quote_subst that were 219fa225cbcSrjs# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 220fa225cbcSrjs# in input to double_quote_subst, that '$' was protected from expansion. 221fa225cbcSrjs# Since each input `\' is now two `\'s, look for any number of runs of 222fa225cbcSrjs# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 223fa225cbcSrjsbs='\\' 224fa225cbcSrjsbs2='\\\\' 225fa225cbcSrjsbs4='\\\\\\\\' 226fa225cbcSrjsdollar='\$' 227fa225cbcSrjssed_double_backslash="\ 228fa225cbcSrjs s/$bs4/&\\ 229fa225cbcSrjs/g 230fa225cbcSrjs s/^$bs2$dollar/$bs&/ 231fa225cbcSrjs s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 232fa225cbcSrjs s/\n//g" 233fa225cbcSrjs 234fa225cbcSrjs# Standard options: 235fa225cbcSrjsopt_dry_run=false 236fa225cbcSrjsopt_help=false 237fa225cbcSrjsopt_quiet=false 238fa225cbcSrjsopt_verbose=false 239fa225cbcSrjsopt_warning=: 240fa225cbcSrjs 241fa225cbcSrjs# func_echo arg... 242fa225cbcSrjs# Echo program name prefixed message, along with the current mode 243fa225cbcSrjs# name if it has been set yet. 244fa225cbcSrjsfunc_echo () 245fa225cbcSrjs{ 246fa225cbcSrjs $ECHO "$progname${mode+: }$mode: $*" 247fa225cbcSrjs} 248fa225cbcSrjs 249fa225cbcSrjs# func_verbose arg... 250fa225cbcSrjs# Echo program name prefixed message in verbose mode only. 251fa225cbcSrjsfunc_verbose () 252fa225cbcSrjs{ 253fa225cbcSrjs $opt_verbose && func_echo ${1+"$@"} 254fa225cbcSrjs 255fa225cbcSrjs # A bug in bash halts the script if the last line of a function 256fa225cbcSrjs # fails when set -e is in force, so we need another command to 257fa225cbcSrjs # work around that: 258fa225cbcSrjs : 259fa225cbcSrjs} 260fa225cbcSrjs 261fa225cbcSrjs# func_error arg... 262fa225cbcSrjs# Echo program name prefixed message to standard error. 263fa225cbcSrjsfunc_error () 264fa225cbcSrjs{ 265fa225cbcSrjs $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 266fa225cbcSrjs} 267fa225cbcSrjs 268fa225cbcSrjs# func_warning arg... 269fa225cbcSrjs# Echo program name prefixed warning message to standard error. 270fa225cbcSrjsfunc_warning () 271fa225cbcSrjs{ 272fa225cbcSrjs $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 273fa225cbcSrjs 274fa225cbcSrjs # bash bug again: 275fa225cbcSrjs : 276fa225cbcSrjs} 277fa225cbcSrjs 278fa225cbcSrjs# func_fatal_error arg... 279fa225cbcSrjs# Echo program name prefixed message to standard error, and exit. 280fa225cbcSrjsfunc_fatal_error () 281fa225cbcSrjs{ 282fa225cbcSrjs func_error ${1+"$@"} 283fa225cbcSrjs exit $EXIT_FAILURE 284fa225cbcSrjs} 285fa225cbcSrjs 286fa225cbcSrjs# func_fatal_help arg... 287fa225cbcSrjs# Echo program name prefixed message to standard error, followed by 288fa225cbcSrjs# a help hint, and exit. 289fa225cbcSrjsfunc_fatal_help () 290fa225cbcSrjs{ 291fa225cbcSrjs func_error ${1+"$@"} 292fa225cbcSrjs func_fatal_error "$help" 293fa225cbcSrjs} 294fa225cbcSrjshelp="Try \`$progname --help' for more information." ## default 295fa225cbcSrjs 296fa225cbcSrjs 297fa225cbcSrjs# func_grep expression filename 298fa225cbcSrjs# Check whether EXPRESSION matches any line of FILENAME, without output. 299fa225cbcSrjsfunc_grep () 300fa225cbcSrjs{ 301fa225cbcSrjs $GREP "$1" "$2" >/dev/null 2>&1 302fa225cbcSrjs} 303fa225cbcSrjs 304fa225cbcSrjs 305fa225cbcSrjs# func_mkdir_p directory-path 306fa225cbcSrjs# Make sure the entire path to DIRECTORY-PATH is available. 307fa225cbcSrjsfunc_mkdir_p () 308fa225cbcSrjs{ 309fa225cbcSrjs my_directory_path="$1" 310fa225cbcSrjs my_dir_list= 311fa225cbcSrjs 312fa225cbcSrjs if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 313fa225cbcSrjs 314fa225cbcSrjs # Protect directory names starting with `-' 315fa225cbcSrjs case $my_directory_path in 316fa225cbcSrjs -*) my_directory_path="./$my_directory_path" ;; 317fa225cbcSrjs esac 318fa225cbcSrjs 319fa225cbcSrjs # While some portion of DIR does not yet exist... 320fa225cbcSrjs while test ! -d "$my_directory_path"; do 321fa225cbcSrjs # ...make a list in topmost first order. Use a colon delimited 322fa225cbcSrjs # list incase some portion of path contains whitespace. 323fa225cbcSrjs my_dir_list="$my_directory_path:$my_dir_list" 324fa225cbcSrjs 325fa225cbcSrjs # If the last portion added has no slash in it, the list is done 326fa225cbcSrjs case $my_directory_path in */*) ;; *) break ;; esac 327fa225cbcSrjs 328fa225cbcSrjs # ...otherwise throw away the child directory and loop 329fa225cbcSrjs my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` 330fa225cbcSrjs done 331fa225cbcSrjs my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` 332fa225cbcSrjs 333fa225cbcSrjs save_mkdir_p_IFS="$IFS"; IFS=':' 334fa225cbcSrjs for my_dir in $my_dir_list; do 335fa225cbcSrjs IFS="$save_mkdir_p_IFS" 336fa225cbcSrjs # mkdir can fail with a `File exist' error if two processes 337fa225cbcSrjs # try to create one of the directories concurrently. Don't 338fa225cbcSrjs # stop in that case! 339fa225cbcSrjs $MKDIR "$my_dir" 2>/dev/null || : 340fa225cbcSrjs done 341fa225cbcSrjs IFS="$save_mkdir_p_IFS" 342fa225cbcSrjs 343fa225cbcSrjs # Bail out if we (or some other process) failed to create a directory. 344fa225cbcSrjs test -d "$my_directory_path" || \ 345fa225cbcSrjs func_fatal_error "Failed to create \`$1'" 346fa225cbcSrjs fi 347fa225cbcSrjs} 348fa225cbcSrjs 349fa225cbcSrjs 350fa225cbcSrjs# func_mktempdir [string] 351fa225cbcSrjs# Make a temporary directory that won't clash with other running 352fa225cbcSrjs# libtool processes, and avoids race conditions if possible. If 353fa225cbcSrjs# given, STRING is the basename for that directory. 354fa225cbcSrjsfunc_mktempdir () 355fa225cbcSrjs{ 356fa225cbcSrjs my_template="${TMPDIR-/tmp}/${1-$progname}" 357fa225cbcSrjs 358fa225cbcSrjs if test "$opt_dry_run" = ":"; then 359fa225cbcSrjs # Return a directory name, but don't create it in dry-run mode 360fa225cbcSrjs my_tmpdir="${my_template}-$$" 361fa225cbcSrjs else 362fa225cbcSrjs 363fa225cbcSrjs # If mktemp works, use that first and foremost 364fa225cbcSrjs my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 365fa225cbcSrjs 366fa225cbcSrjs if test ! -d "$my_tmpdir"; then 367fa225cbcSrjs # Failing that, at least try and use $RANDOM to avoid a race 368fa225cbcSrjs my_tmpdir="${my_template}-${RANDOM-0}$$" 369fa225cbcSrjs 370fa225cbcSrjs save_mktempdir_umask=`umask` 371fa225cbcSrjs umask 0077 372fa225cbcSrjs $MKDIR "$my_tmpdir" 373fa225cbcSrjs umask $save_mktempdir_umask 374fa225cbcSrjs fi 375fa225cbcSrjs 376fa225cbcSrjs # If we're not in dry-run mode, bomb out on failure 377fa225cbcSrjs test -d "$my_tmpdir" || \ 378fa225cbcSrjs func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 379fa225cbcSrjs fi 380fa225cbcSrjs 381fa225cbcSrjs $ECHO "X$my_tmpdir" | $Xsed 382fa225cbcSrjs} 383fa225cbcSrjs 384fa225cbcSrjs 385fa225cbcSrjs# func_quote_for_eval arg 386fa225cbcSrjs# Aesthetically quote ARG to be evaled later. 387fa225cbcSrjs# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 388fa225cbcSrjs# is double-quoted, suitable for a subsequent eval, whereas 389fa225cbcSrjs# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 390fa225cbcSrjs# which are still active within double quotes backslashified. 391fa225cbcSrjsfunc_quote_for_eval () 392fa225cbcSrjs{ 393fa225cbcSrjs case $1 in 394fa225cbcSrjs *[\\\`\"\$]*) 395fa225cbcSrjs func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; 396fa225cbcSrjs *) 397fa225cbcSrjs func_quote_for_eval_unquoted_result="$1" ;; 398fa225cbcSrjs esac 399fa225cbcSrjs 400fa225cbcSrjs case $func_quote_for_eval_unquoted_result in 401fa225cbcSrjs # Double-quote args containing shell metacharacters to delay 402fa225cbcSrjs # word splitting, command substitution and and variable 403fa225cbcSrjs # expansion for a subsequent eval. 404fa225cbcSrjs # Many Bourne shells cannot handle close brackets correctly 405fa225cbcSrjs # in scan sets, so we specify it separately. 406fa225cbcSrjs *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 407fa225cbcSrjs func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 408fa225cbcSrjs ;; 409fa225cbcSrjs *) 410fa225cbcSrjs func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 411fa225cbcSrjs esac 412fa225cbcSrjs} 413fa225cbcSrjs 414fa225cbcSrjs 415fa225cbcSrjs# func_quote_for_expand arg 416fa225cbcSrjs# Aesthetically quote ARG to be evaled later; same as above, 417fa225cbcSrjs# but do not quote variable references. 418fa225cbcSrjsfunc_quote_for_expand () 419fa225cbcSrjs{ 420fa225cbcSrjs case $1 in 421fa225cbcSrjs *[\\\`\"]*) 422fa225cbcSrjs my_arg=`$ECHO "X$1" | $Xsed \ 423fa225cbcSrjs -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 424fa225cbcSrjs *) 425fa225cbcSrjs my_arg="$1" ;; 426fa225cbcSrjs esac 427fa225cbcSrjs 428fa225cbcSrjs case $my_arg in 429fa225cbcSrjs # Double-quote args containing shell metacharacters to delay 430fa225cbcSrjs # word splitting and command substitution for a subsequent eval. 431fa225cbcSrjs # Many Bourne shells cannot handle close brackets correctly 432fa225cbcSrjs # in scan sets, so we specify it separately. 433fa225cbcSrjs *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 434fa225cbcSrjs my_arg="\"$my_arg\"" 435fa225cbcSrjs ;; 436fa225cbcSrjs esac 437fa225cbcSrjs 438fa225cbcSrjs func_quote_for_expand_result="$my_arg" 439fa225cbcSrjs} 440fa225cbcSrjs 441fa225cbcSrjs 442fa225cbcSrjs# func_show_eval cmd [fail_exp] 443fa225cbcSrjs# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 444fa225cbcSrjs# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 445fa225cbcSrjs# is given, then evaluate it. 446fa225cbcSrjsfunc_show_eval () 447fa225cbcSrjs{ 448fa225cbcSrjs my_cmd="$1" 449fa225cbcSrjs my_fail_exp="${2-:}" 450fa225cbcSrjs 451fa225cbcSrjs ${opt_silent-false} || { 452fa225cbcSrjs func_quote_for_expand "$my_cmd" 453fa225cbcSrjs eval "func_echo $func_quote_for_expand_result" 454fa225cbcSrjs } 455fa225cbcSrjs 456fa225cbcSrjs if ${opt_dry_run-false}; then :; else 457fa225cbcSrjs eval "$my_cmd" 458fa225cbcSrjs my_status=$? 459fa225cbcSrjs if test "$my_status" -eq 0; then :; else 460fa225cbcSrjs eval "(exit $my_status); $my_fail_exp" 461fa225cbcSrjs fi 462fa225cbcSrjs fi 463fa225cbcSrjs} 464fa225cbcSrjs 465fa225cbcSrjs 466fa225cbcSrjs# func_show_eval_locale cmd [fail_exp] 467fa225cbcSrjs# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 468fa225cbcSrjs# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 469fa225cbcSrjs# is given, then evaluate it. Use the saved locale for evaluation. 470fa225cbcSrjsfunc_show_eval_locale () 471fa225cbcSrjs{ 472fa225cbcSrjs my_cmd="$1" 473fa225cbcSrjs my_fail_exp="${2-:}" 474fa225cbcSrjs 475fa225cbcSrjs ${opt_silent-false} || { 476fa225cbcSrjs func_quote_for_expand "$my_cmd" 477fa225cbcSrjs eval "func_echo $func_quote_for_expand_result" 478fa225cbcSrjs } 479fa225cbcSrjs 480fa225cbcSrjs if ${opt_dry_run-false}; then :; else 481fa225cbcSrjs eval "$lt_user_locale 482fa225cbcSrjs $my_cmd" 483fa225cbcSrjs my_status=$? 484fa225cbcSrjs eval "$lt_safe_locale" 485fa225cbcSrjs if test "$my_status" -eq 0; then :; else 486fa225cbcSrjs eval "(exit $my_status); $my_fail_exp" 487fa225cbcSrjs fi 488fa225cbcSrjs fi 489fa225cbcSrjs} 490fa225cbcSrjs 491fa225cbcSrjs 492fa225cbcSrjs 493fa225cbcSrjs 494fa225cbcSrjs 495fa225cbcSrjs# func_version 496fa225cbcSrjs# Echo version message to standard output and exit. 497fa225cbcSrjsfunc_version () 498fa225cbcSrjs{ 499fa225cbcSrjs $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { 500fa225cbcSrjs s/^# // 501fa225cbcSrjs s/^# *$// 502fa225cbcSrjs s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 503fa225cbcSrjs p 504fa225cbcSrjs }' < "$progpath" 505fa225cbcSrjs exit $? 506fa225cbcSrjs} 507fa225cbcSrjs 508fa225cbcSrjs# func_usage 509fa225cbcSrjs# Echo short help message to standard output and exit. 510fa225cbcSrjsfunc_usage () 511fa225cbcSrjs{ 512fa225cbcSrjs $SED -n '/^# Usage:/,/# -h/ { 513fa225cbcSrjs s/^# // 514fa225cbcSrjs s/^# *$// 515fa225cbcSrjs s/\$progname/'$progname'/ 516fa225cbcSrjs p 517fa225cbcSrjs }' < "$progpath" 518fa225cbcSrjs $ECHO 519fa225cbcSrjs $ECHO "run \`$progname --help | more' for full usage" 520fa225cbcSrjs exit $? 521fa225cbcSrjs} 522fa225cbcSrjs 523fa225cbcSrjs# func_help 524fa225cbcSrjs# Echo long help message to standard output and exit. 525fa225cbcSrjsfunc_help () 526fa225cbcSrjs{ 527fa225cbcSrjs $SED -n '/^# Usage:/,/# Report bugs to/ { 528fa225cbcSrjs s/^# // 529fa225cbcSrjs s/^# *$// 530fa225cbcSrjs s*\$progname*'$progname'* 531fa225cbcSrjs s*\$host*'"$host"'* 532fa225cbcSrjs s*\$SHELL*'"$SHELL"'* 533fa225cbcSrjs s*\$LTCC*'"$LTCC"'* 534fa225cbcSrjs s*\$LTCFLAGS*'"$LTCFLAGS"'* 535fa225cbcSrjs s*\$LD*'"$LD"'* 536fa225cbcSrjs s/\$with_gnu_ld/'"$with_gnu_ld"'/ 537fa225cbcSrjs s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 538fa225cbcSrjs s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 539fa225cbcSrjs p 540fa225cbcSrjs }' < "$progpath" 541fa225cbcSrjs exit $? 542fa225cbcSrjs} 543fa225cbcSrjs 544fa225cbcSrjs# func_missing_arg argname 545fa225cbcSrjs# Echo program name prefixed message to standard error and set global 546fa225cbcSrjs# exit_cmd. 547fa225cbcSrjsfunc_missing_arg () 548fa225cbcSrjs{ 549fa225cbcSrjs func_error "missing argument for $1" 550fa225cbcSrjs exit_cmd=exit 551fa225cbcSrjs} 552fa225cbcSrjs 553fa225cbcSrjsexit_cmd=: 554fa225cbcSrjs 555fa225cbcSrjs 556fa225cbcSrjs 557fa225cbcSrjs 558fa225cbcSrjs 559fa225cbcSrjs# Check that we have a working $ECHO. 560fa225cbcSrjsif test "X$1" = X--no-reexec; then 561fa225cbcSrjs # Discard the --no-reexec flag, and continue. 562fa225cbcSrjs shift 563fa225cbcSrjselif test "X$1" = X--fallback-echo; then 564fa225cbcSrjs # Avoid inline document here, it may be left over 565fa225cbcSrjs : 566fa225cbcSrjselif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then 567fa225cbcSrjs # Yippee, $ECHO works! 568fa225cbcSrjs : 569fa225cbcSrjselse 570fa225cbcSrjs # Restart under the correct shell, and then maybe $ECHO will work. 571fa225cbcSrjs exec $SHELL "$progpath" --no-reexec ${1+"$@"} 572fa225cbcSrjsfi 573fa225cbcSrjs 574fa225cbcSrjsif test "X$1" = X--fallback-echo; then 575fa225cbcSrjs # used as fallback echo 576fa225cbcSrjs shift 577fa225cbcSrjs cat <<EOF 578fa225cbcSrjs$* 579fa225cbcSrjsEOF 580fa225cbcSrjs exit $EXIT_SUCCESS 581fa225cbcSrjsfi 582fa225cbcSrjs 583fa225cbcSrjsmagic="%%%MAGIC variable%%%" 584fa225cbcSrjsmagic_exe="%%%MAGIC EXE variable%%%" 585fa225cbcSrjs 586fa225cbcSrjs# Global variables. 587fa225cbcSrjs# $mode is unset 588fa225cbcSrjsnonopt= 589fa225cbcSrjsexecute_dlfiles= 590fa225cbcSrjspreserve_args= 591fa225cbcSrjslo2o="s/\\.lo\$/.${objext}/" 592fa225cbcSrjso2lo="s/\\.${objext}\$/.lo/" 593fa225cbcSrjsextracted_archives= 594fa225cbcSrjsextracted_serial=0 595fa225cbcSrjs 596fa225cbcSrjsopt_dry_run=false 597fa225cbcSrjsopt_duplicate_deps=false 598fa225cbcSrjsopt_silent=false 599fa225cbcSrjsopt_debug=: 600fa225cbcSrjs 601fa225cbcSrjs# If this variable is set in any of the actions, the command in it 602fa225cbcSrjs# will be execed at the end. This prevents here-documents from being 603fa225cbcSrjs# left over by shells. 604fa225cbcSrjsexec_cmd= 605fa225cbcSrjs 606fa225cbcSrjs# func_fatal_configuration arg... 607fa225cbcSrjs# Echo program name prefixed message to standard error, followed by 608fa225cbcSrjs# a configuration failure hint, and exit. 609fa225cbcSrjsfunc_fatal_configuration () 610fa225cbcSrjs{ 611fa225cbcSrjs func_error ${1+"$@"} 612fa225cbcSrjs func_error "See the $PACKAGE documentation for more information." 613fa225cbcSrjs func_fatal_error "Fatal configuration error." 614fa225cbcSrjs} 615fa225cbcSrjs 616fa225cbcSrjs 617fa225cbcSrjs# func_config 618fa225cbcSrjs# Display the configuration for all the tags in this script. 619fa225cbcSrjsfunc_config () 620fa225cbcSrjs{ 621fa225cbcSrjs re_begincf='^# ### BEGIN LIBTOOL' 622fa225cbcSrjs re_endcf='^# ### END LIBTOOL' 623fa225cbcSrjs 624fa225cbcSrjs # Default configuration. 625fa225cbcSrjs $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 626fa225cbcSrjs 627fa225cbcSrjs # Now print the configurations for the tags. 628fa225cbcSrjs for tagname in $taglist; do 629fa225cbcSrjs $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 630fa225cbcSrjs done 631fa225cbcSrjs 632fa225cbcSrjs exit $? 633fa225cbcSrjs} 634fa225cbcSrjs 635fa225cbcSrjs# func_features 636fa225cbcSrjs# Display the features supported by this script. 637fa225cbcSrjsfunc_features () 638fa225cbcSrjs{ 639fa225cbcSrjs $ECHO "host: $host" 640fa225cbcSrjs if test "$build_libtool_libs" = yes; then 641fa225cbcSrjs $ECHO "enable shared libraries" 642fa225cbcSrjs else 643fa225cbcSrjs $ECHO "disable shared libraries" 644fa225cbcSrjs fi 645fa225cbcSrjs if test "$build_old_libs" = yes; then 646fa225cbcSrjs $ECHO "enable static libraries" 647fa225cbcSrjs else 648fa225cbcSrjs $ECHO "disable static libraries" 649fa225cbcSrjs fi 650fa225cbcSrjs 651fa225cbcSrjs exit $? 652fa225cbcSrjs} 653fa225cbcSrjs 654fa225cbcSrjs# func_enable_tag tagname 655fa225cbcSrjs# Verify that TAGNAME is valid, and either flag an error and exit, or 656fa225cbcSrjs# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 657fa225cbcSrjs# variable here. 658fa225cbcSrjsfunc_enable_tag () 659fa225cbcSrjs{ 660fa225cbcSrjs # Global variable: 661fa225cbcSrjs tagname="$1" 662fa225cbcSrjs 663fa225cbcSrjs re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 664fa225cbcSrjs re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 665fa225cbcSrjs sed_extractcf="/$re_begincf/,/$re_endcf/p" 666fa225cbcSrjs 667fa225cbcSrjs # Validate tagname. 668fa225cbcSrjs case $tagname in 669fa225cbcSrjs *[!-_A-Za-z0-9,/]*) 670fa225cbcSrjs func_fatal_error "invalid tag name: $tagname" 671fa225cbcSrjs ;; 672fa225cbcSrjs esac 673fa225cbcSrjs 674fa225cbcSrjs # Don't test for the "default" C tag, as we know it's 675fa225cbcSrjs # there but not specially marked. 676fa225cbcSrjs case $tagname in 677fa225cbcSrjs CC) ;; 678fa225cbcSrjs *) 679fa225cbcSrjs if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 680fa225cbcSrjs taglist="$taglist $tagname" 681fa225cbcSrjs 682fa225cbcSrjs # Evaluate the configuration. Be careful to quote the path 683fa225cbcSrjs # and the sed script, to avoid splitting on whitespace, but 684fa225cbcSrjs # also don't use non-portable quotes within backquotes within 685fa225cbcSrjs # quotes we have to do it in 2 steps: 686fa225cbcSrjs extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 687fa225cbcSrjs eval "$extractedcf" 688fa225cbcSrjs else 689fa225cbcSrjs func_error "ignoring unknown tag $tagname" 690fa225cbcSrjs fi 691fa225cbcSrjs ;; 692fa225cbcSrjs esac 693fa225cbcSrjs} 694fa225cbcSrjs 695fa225cbcSrjs# Parse options once, thoroughly. This comes as soon as possible in 696fa225cbcSrjs# the script to make things like `libtool --version' happen quickly. 697fa225cbcSrjs{ 698fa225cbcSrjs 699fa225cbcSrjs # Shorthand for --mode=foo, only valid as the first argument 700fa225cbcSrjs case $1 in 701fa225cbcSrjs clean|clea|cle|cl) 702fa225cbcSrjs shift; set dummy --mode clean ${1+"$@"}; shift 703fa225cbcSrjs ;; 704fa225cbcSrjs compile|compil|compi|comp|com|co|c) 705fa225cbcSrjs shift; set dummy --mode compile ${1+"$@"}; shift 706fa225cbcSrjs ;; 707fa225cbcSrjs execute|execut|execu|exec|exe|ex|e) 708fa225cbcSrjs shift; set dummy --mode execute ${1+"$@"}; shift 709fa225cbcSrjs ;; 710fa225cbcSrjs finish|finis|fini|fin|fi|f) 711fa225cbcSrjs shift; set dummy --mode finish ${1+"$@"}; shift 712fa225cbcSrjs ;; 713fa225cbcSrjs install|instal|insta|inst|ins|in|i) 714fa225cbcSrjs shift; set dummy --mode install ${1+"$@"}; shift 715fa225cbcSrjs ;; 716fa225cbcSrjs link|lin|li|l) 717fa225cbcSrjs shift; set dummy --mode link ${1+"$@"}; shift 718fa225cbcSrjs ;; 719fa225cbcSrjs uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 720fa225cbcSrjs shift; set dummy --mode uninstall ${1+"$@"}; shift 721fa225cbcSrjs ;; 722fa225cbcSrjs esac 723fa225cbcSrjs 724fa225cbcSrjs # Parse non-mode specific arguments: 725fa225cbcSrjs while test "$#" -gt 0; do 726fa225cbcSrjs opt="$1" 727fa225cbcSrjs shift 728fa225cbcSrjs 729fa225cbcSrjs case $opt in 730fa225cbcSrjs --config) func_config ;; 731fa225cbcSrjs 732fa225cbcSrjs --debug) preserve_args="$preserve_args $opt" 733fa225cbcSrjs func_echo "enabling shell trace mode" 734fa225cbcSrjs opt_debug='set -x' 735fa225cbcSrjs $opt_debug 736fa225cbcSrjs ;; 737fa225cbcSrjs 738fa225cbcSrjs -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 739fa225cbcSrjs execute_dlfiles="$execute_dlfiles $1" 740fa225cbcSrjs shift 741fa225cbcSrjs ;; 742fa225cbcSrjs 743fa225cbcSrjs --dry-run | -n) opt_dry_run=: ;; 744fa225cbcSrjs --features) func_features ;; 745fa225cbcSrjs --finish) mode="finish" ;; 746fa225cbcSrjs 747fa225cbcSrjs --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 748fa225cbcSrjs case $1 in 749fa225cbcSrjs # Valid mode arguments: 750fa225cbcSrjs clean) ;; 751fa225cbcSrjs compile) ;; 752fa225cbcSrjs execute) ;; 753fa225cbcSrjs finish) ;; 754fa225cbcSrjs install) ;; 755fa225cbcSrjs link) ;; 756fa225cbcSrjs relink) ;; 757fa225cbcSrjs uninstall) ;; 758fa225cbcSrjs 759fa225cbcSrjs # Catch anything else as an error 760fa225cbcSrjs *) func_error "invalid argument for $opt" 761fa225cbcSrjs exit_cmd=exit 762fa225cbcSrjs break 763fa225cbcSrjs ;; 764fa225cbcSrjs esac 765fa225cbcSrjs 766fa225cbcSrjs mode="$1" 767fa225cbcSrjs shift 768fa225cbcSrjs ;; 769fa225cbcSrjs 770fa225cbcSrjs --preserve-dup-deps) 771fa225cbcSrjs opt_duplicate_deps=: ;; 772fa225cbcSrjs 773fa225cbcSrjs --quiet|--silent) preserve_args="$preserve_args $opt" 774fa225cbcSrjs opt_silent=: 775fa225cbcSrjs ;; 776fa225cbcSrjs 777fa225cbcSrjs --verbose| -v) preserve_args="$preserve_args $opt" 778fa225cbcSrjs opt_silent=false 779fa225cbcSrjs ;; 780fa225cbcSrjs 781fa225cbcSrjs --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 782fa225cbcSrjs preserve_args="$preserve_args $opt $1" 783fa225cbcSrjs func_enable_tag "$1" # tagname is set here 784fa225cbcSrjs shift 785fa225cbcSrjs ;; 786fa225cbcSrjs 787fa225cbcSrjs # Separate optargs to long options: 788fa225cbcSrjs -dlopen=*|--mode=*|--tag=*) 789fa225cbcSrjs func_opt_split "$opt" 790fa225cbcSrjs set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 791fa225cbcSrjs shift 792fa225cbcSrjs ;; 793fa225cbcSrjs 794fa225cbcSrjs -\?|-h) func_usage ;; 795fa225cbcSrjs --help) opt_help=: ;; 796fa225cbcSrjs --version) func_version ;; 797fa225cbcSrjs 798fa225cbcSrjs -*) func_fatal_help "unrecognized option \`$opt'" ;; 799fa225cbcSrjs 800fa225cbcSrjs *) nonopt="$opt" 801fa225cbcSrjs break 802fa225cbcSrjs ;; 803fa225cbcSrjs esac 804fa225cbcSrjs done 805fa225cbcSrjs 806fa225cbcSrjs 807fa225cbcSrjs case $host in 808fa225cbcSrjs *cygwin* | *mingw* | *pw32* | *cegcc*) 809fa225cbcSrjs # don't eliminate duplications in $postdeps and $predeps 810fa225cbcSrjs opt_duplicate_compiler_generated_deps=: 811fa225cbcSrjs ;; 812fa225cbcSrjs *) 813fa225cbcSrjs opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 814fa225cbcSrjs ;; 815fa225cbcSrjs esac 816fa225cbcSrjs 817fa225cbcSrjs # Having warned about all mis-specified options, bail out if 818fa225cbcSrjs # anything was wrong. 819fa225cbcSrjs $exit_cmd $EXIT_FAILURE 820fa225cbcSrjs} 821fa225cbcSrjs 822fa225cbcSrjs# func_check_version_match 823fa225cbcSrjs# Ensure that we are using m4 macros, and libtool script from the same 824fa225cbcSrjs# release of libtool. 825fa225cbcSrjsfunc_check_version_match () 826fa225cbcSrjs{ 827fa225cbcSrjs if test "$package_revision" != "$macro_revision"; then 828fa225cbcSrjs if test "$VERSION" != "$macro_version"; then 829fa225cbcSrjs if test -z "$macro_version"; then 830fa225cbcSrjs cat >&2 <<_LT_EOF 831fa225cbcSrjs$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 832fa225cbcSrjs$progname: definition of this LT_INIT comes from an older release. 833fa225cbcSrjs$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 834fa225cbcSrjs$progname: and run autoconf again. 835fa225cbcSrjs_LT_EOF 836fa225cbcSrjs else 837fa225cbcSrjs cat >&2 <<_LT_EOF 838fa225cbcSrjs$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 839fa225cbcSrjs$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 840fa225cbcSrjs$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 841fa225cbcSrjs$progname: and run autoconf again. 842fa225cbcSrjs_LT_EOF 843fa225cbcSrjs fi 844fa225cbcSrjs else 845fa225cbcSrjs cat >&2 <<_LT_EOF 846fa225cbcSrjs$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 847fa225cbcSrjs$progname: but the definition of this LT_INIT comes from revision $macro_revision. 848fa225cbcSrjs$progname: You should recreate aclocal.m4 with macros from revision $package_revision 849fa225cbcSrjs$progname: of $PACKAGE $VERSION and run autoconf again. 850fa225cbcSrjs_LT_EOF 851fa225cbcSrjs fi 852fa225cbcSrjs 853fa225cbcSrjs exit $EXIT_MISMATCH 854fa225cbcSrjs fi 855fa225cbcSrjs} 856fa225cbcSrjs 857fa225cbcSrjs 858fa225cbcSrjs## ----------- ## 859fa225cbcSrjs## Main. ## 860fa225cbcSrjs## ----------- ## 861fa225cbcSrjs 862fa225cbcSrjs$opt_help || { 863fa225cbcSrjs # Sanity checks first: 864fa225cbcSrjs func_check_version_match 865fa225cbcSrjs 866fa225cbcSrjs if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 867fa225cbcSrjs func_fatal_configuration "not configured to build any kind of library" 868fa225cbcSrjs fi 869fa225cbcSrjs 870fa225cbcSrjs test -z "$mode" && func_fatal_error "error: you must specify a MODE." 871fa225cbcSrjs 872fa225cbcSrjs 873fa225cbcSrjs # Darwin sucks 874fa225cbcSrjs eval std_shrext=\"$shrext_cmds\" 875fa225cbcSrjs 876fa225cbcSrjs 877fa225cbcSrjs # Only execute mode is allowed to have -dlopen flags. 878fa225cbcSrjs if test -n "$execute_dlfiles" && test "$mode" != execute; then 879fa225cbcSrjs func_error "unrecognized option \`-dlopen'" 880fa225cbcSrjs $ECHO "$help" 1>&2 881fa225cbcSrjs exit $EXIT_FAILURE 882fa225cbcSrjs fi 883fa225cbcSrjs 884fa225cbcSrjs # Change the help message to a mode-specific one. 885fa225cbcSrjs generic_help="$help" 886fa225cbcSrjs help="Try \`$progname --help --mode=$mode' for more information." 887fa225cbcSrjs} 888fa225cbcSrjs 889fa225cbcSrjs 890fa225cbcSrjs# func_lalib_p file 891fa225cbcSrjs# True iff FILE is a libtool `.la' library or `.lo' object file. 892fa225cbcSrjs# This function is only a basic sanity check; it will hardly flush out 893fa225cbcSrjs# determined imposters. 894fa225cbcSrjsfunc_lalib_p () 895fa225cbcSrjs{ 896fa225cbcSrjs test -f "$1" && 897fa225cbcSrjs $SED -e 4q "$1" 2>/dev/null \ 898fa225cbcSrjs | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 899fa225cbcSrjs} 900fa225cbcSrjs 901fa225cbcSrjs# func_lalib_unsafe_p file 902fa225cbcSrjs# True iff FILE is a libtool `.la' library or `.lo' object file. 903fa225cbcSrjs# This function implements the same check as func_lalib_p without 904fa225cbcSrjs# resorting to external programs. To this end, it redirects stdin and 905fa225cbcSrjs# closes it afterwards, without saving the original file descriptor. 906fa225cbcSrjs# As a safety measure, use it only where a negative result would be 907fa225cbcSrjs# fatal anyway. Works if `file' does not exist. 908fa225cbcSrjsfunc_lalib_unsafe_p () 909fa225cbcSrjs{ 910fa225cbcSrjs lalib_p=no 911fa225cbcSrjs if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 912fa225cbcSrjs for lalib_p_l in 1 2 3 4 913fa225cbcSrjs do 914fa225cbcSrjs read lalib_p_line 915fa225cbcSrjs case "$lalib_p_line" in 916fa225cbcSrjs \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 917fa225cbcSrjs esac 918fa225cbcSrjs done 919fa225cbcSrjs exec 0<&5 5<&- 920fa225cbcSrjs fi 921fa225cbcSrjs test "$lalib_p" = yes 922fa225cbcSrjs} 923fa225cbcSrjs 924fa225cbcSrjs# func_ltwrapper_script_p file 925fa225cbcSrjs# True iff FILE is a libtool wrapper script 926fa225cbcSrjs# This function is only a basic sanity check; it will hardly flush out 927fa225cbcSrjs# determined imposters. 928fa225cbcSrjsfunc_ltwrapper_script_p () 929fa225cbcSrjs{ 930fa225cbcSrjs func_lalib_p "$1" 931fa225cbcSrjs} 932fa225cbcSrjs 933fa225cbcSrjs# func_ltwrapper_executable_p file 934fa225cbcSrjs# True iff FILE is a libtool wrapper executable 935fa225cbcSrjs# This function is only a basic sanity check; it will hardly flush out 936fa225cbcSrjs# determined imposters. 937fa225cbcSrjsfunc_ltwrapper_executable_p () 938fa225cbcSrjs{ 939fa225cbcSrjs func_ltwrapper_exec_suffix= 940fa225cbcSrjs case $1 in 941fa225cbcSrjs *.exe) ;; 942fa225cbcSrjs *) func_ltwrapper_exec_suffix=.exe ;; 943fa225cbcSrjs esac 944fa225cbcSrjs $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 945fa225cbcSrjs} 946fa225cbcSrjs 947fa225cbcSrjs# func_ltwrapper_scriptname file 948fa225cbcSrjs# Assumes file is an ltwrapper_executable 949fa225cbcSrjs# uses $file to determine the appropriate filename for a 950fa225cbcSrjs# temporary ltwrapper_script. 951fa225cbcSrjsfunc_ltwrapper_scriptname () 952fa225cbcSrjs{ 953fa225cbcSrjs func_ltwrapper_scriptname_result="" 954fa225cbcSrjs if func_ltwrapper_executable_p "$1"; then 955fa225cbcSrjs func_dirname_and_basename "$1" "" "." 956fa225cbcSrjs func_stripname '' '.exe' "$func_basename_result" 957fa225cbcSrjs func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 958fa225cbcSrjs fi 959fa225cbcSrjs} 960fa225cbcSrjs 961fa225cbcSrjs# func_ltwrapper_p file 962fa225cbcSrjs# True iff FILE is a libtool wrapper script or wrapper executable 963fa225cbcSrjs# This function is only a basic sanity check; it will hardly flush out 964fa225cbcSrjs# determined imposters. 965fa225cbcSrjsfunc_ltwrapper_p () 966fa225cbcSrjs{ 967fa225cbcSrjs func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 968fa225cbcSrjs} 969fa225cbcSrjs 970fa225cbcSrjs 971fa225cbcSrjs# func_execute_cmds commands fail_cmd 972fa225cbcSrjs# Execute tilde-delimited COMMANDS. 973fa225cbcSrjs# If FAIL_CMD is given, eval that upon failure. 974fa225cbcSrjs# FAIL_CMD may read-access the current command in variable CMD! 975fa225cbcSrjsfunc_execute_cmds () 976fa225cbcSrjs{ 977fa225cbcSrjs $opt_debug 978fa225cbcSrjs save_ifs=$IFS; IFS='~' 979fa225cbcSrjs for cmd in $1; do 980fa225cbcSrjs IFS=$save_ifs 981fa225cbcSrjs eval cmd=\"$cmd\" 982fa225cbcSrjs func_show_eval "$cmd" "${2-:}" 983fa225cbcSrjs done 984fa225cbcSrjs IFS=$save_ifs 985fa225cbcSrjs} 986fa225cbcSrjs 987fa225cbcSrjs 988fa225cbcSrjs# func_source file 989fa225cbcSrjs# Source FILE, adding directory component if necessary. 990fa225cbcSrjs# Note that it is not necessary on cygwin/mingw to append a dot to 991fa225cbcSrjs# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 992fa225cbcSrjs# behavior happens only for exec(3), not for open(2)! Also, sourcing 993fa225cbcSrjs# `FILE.' does not work on cygwin managed mounts. 994fa225cbcSrjsfunc_source () 995fa225cbcSrjs{ 996fa225cbcSrjs $opt_debug 997fa225cbcSrjs case $1 in 998fa225cbcSrjs */* | *\\*) . "$1" ;; 999fa225cbcSrjs *) . "./$1" ;; 1000fa225cbcSrjs esac 1001fa225cbcSrjs} 1002fa225cbcSrjs 1003fa225cbcSrjs 1004fa225cbcSrjs# func_infer_tag arg 1005fa225cbcSrjs# Infer tagged configuration to use if any are available and 1006fa225cbcSrjs# if one wasn't chosen via the "--tag" command line option. 1007fa225cbcSrjs# Only attempt this if the compiler in the base compile 1008fa225cbcSrjs# command doesn't match the default compiler. 1009fa225cbcSrjs# arg is usually of the form 'gcc ...' 1010fa225cbcSrjsfunc_infer_tag () 1011fa225cbcSrjs{ 1012fa225cbcSrjs $opt_debug 1013fa225cbcSrjs if test -n "$available_tags" && test -z "$tagname"; then 1014fa225cbcSrjs CC_quoted= 1015fa225cbcSrjs for arg in $CC; do 1016fa225cbcSrjs func_quote_for_eval "$arg" 1017fa225cbcSrjs CC_quoted="$CC_quoted $func_quote_for_eval_result" 1018fa225cbcSrjs done 1019fa225cbcSrjs case $@ in 1020fa225cbcSrjs # Blanks in the command may have been stripped by the calling shell, 1021fa225cbcSrjs # but not from the CC environment variable when configure was run. 1022fa225cbcSrjs " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; 1023fa225cbcSrjs # Blanks at the start of $base_compile will cause this to fail 1024fa225cbcSrjs # if we don't check for them as well. 1025fa225cbcSrjs *) 1026fa225cbcSrjs for z in $available_tags; do 1027fa225cbcSrjs if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 1028fa225cbcSrjs # Evaluate the configuration. 1029fa225cbcSrjs eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 1030fa225cbcSrjs CC_quoted= 1031fa225cbcSrjs for arg in $CC; do 1032fa225cbcSrjs # Double-quote args containing other shell metacharacters. 1033fa225cbcSrjs func_quote_for_eval "$arg" 1034fa225cbcSrjs CC_quoted="$CC_quoted $func_quote_for_eval_result" 1035fa225cbcSrjs done 1036fa225cbcSrjs case "$@ " in 1037fa225cbcSrjs " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) 1038fa225cbcSrjs # The compiler in the base compile command matches 1039fa225cbcSrjs # the one in the tagged configuration. 1040fa225cbcSrjs # Assume this is the tagged configuration we want. 1041fa225cbcSrjs tagname=$z 1042fa225cbcSrjs break 1043fa225cbcSrjs ;; 1044fa225cbcSrjs esac 1045fa225cbcSrjs fi 1046fa225cbcSrjs done 1047fa225cbcSrjs # If $tagname still isn't set, then no tagged configuration 1048fa225cbcSrjs # was found and let the user know that the "--tag" command 1049fa225cbcSrjs # line option must be used. 1050fa225cbcSrjs if test -z "$tagname"; then 1051fa225cbcSrjs func_echo "unable to infer tagged configuration" 1052fa225cbcSrjs func_fatal_error "specify a tag with \`--tag'" 1053fa225cbcSrjs# else 1054fa225cbcSrjs# func_verbose "using $tagname tagged configuration" 1055fa225cbcSrjs fi 1056fa225cbcSrjs ;; 1057fa225cbcSrjs esac 1058fa225cbcSrjs fi 1059fa225cbcSrjs} 1060fa225cbcSrjs 1061fa225cbcSrjs 1062fa225cbcSrjs 1063fa225cbcSrjs# func_write_libtool_object output_name pic_name nonpic_name 1064fa225cbcSrjs# Create a libtool object file (analogous to a ".la" file), 1065fa225cbcSrjs# but don't create it if we're doing a dry run. 1066fa225cbcSrjsfunc_write_libtool_object () 1067fa225cbcSrjs{ 1068fa225cbcSrjs write_libobj=${1} 1069fa225cbcSrjs if test "$build_libtool_libs" = yes; then 1070fa225cbcSrjs write_lobj=\'${2}\' 1071fa225cbcSrjs else 1072fa225cbcSrjs write_lobj=none 1073fa225cbcSrjs fi 1074fa225cbcSrjs 1075fa225cbcSrjs if test "$build_old_libs" = yes; then 1076fa225cbcSrjs write_oldobj=\'${3}\' 1077fa225cbcSrjs else 1078fa225cbcSrjs write_oldobj=none 1079fa225cbcSrjs fi 1080fa225cbcSrjs 1081fa225cbcSrjs $opt_dry_run || { 1082fa225cbcSrjs cat >${write_libobj}T <<EOF 1083fa225cbcSrjs# $write_libobj - a libtool object file 1084fa225cbcSrjs# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1085fa225cbcSrjs# 1086fa225cbcSrjs# Please DO NOT delete this file! 1087fa225cbcSrjs# It is necessary for linking the library. 1088fa225cbcSrjs 1089fa225cbcSrjs# Name of the PIC object. 1090fa225cbcSrjspic_object=$write_lobj 1091fa225cbcSrjs 1092fa225cbcSrjs# Name of the non-PIC object 1093fa225cbcSrjsnon_pic_object=$write_oldobj 1094fa225cbcSrjs 1095fa225cbcSrjsEOF 1096fa225cbcSrjs $MV "${write_libobj}T" "${write_libobj}" 1097fa225cbcSrjs } 1098fa225cbcSrjs} 1099fa225cbcSrjs 1100fa225cbcSrjs# func_mode_compile arg... 1101fa225cbcSrjsfunc_mode_compile () 1102fa225cbcSrjs{ 1103fa225cbcSrjs $opt_debug 1104fa225cbcSrjs # Get the compilation command and the source file. 1105fa225cbcSrjs base_compile= 1106fa225cbcSrjs srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1107fa225cbcSrjs suppress_opt=yes 1108fa225cbcSrjs suppress_output= 1109fa225cbcSrjs arg_mode=normal 1110fa225cbcSrjs libobj= 1111fa225cbcSrjs later= 1112fa225cbcSrjs pie_flag= 1113fa225cbcSrjs 1114fa225cbcSrjs for arg 1115fa225cbcSrjs do 1116fa225cbcSrjs case $arg_mode in 1117fa225cbcSrjs arg ) 1118fa225cbcSrjs # do not "continue". Instead, add this to base_compile 1119fa225cbcSrjs lastarg="$arg" 1120fa225cbcSrjs arg_mode=normal 1121fa225cbcSrjs ;; 1122fa225cbcSrjs 1123fa225cbcSrjs target ) 1124fa225cbcSrjs libobj="$arg" 1125fa225cbcSrjs arg_mode=normal 1126fa225cbcSrjs continue 1127fa225cbcSrjs ;; 1128fa225cbcSrjs 1129fa225cbcSrjs normal ) 1130fa225cbcSrjs # Accept any command-line options. 1131fa225cbcSrjs case $arg in 1132fa225cbcSrjs -o) 1133fa225cbcSrjs test -n "$libobj" && \ 1134fa225cbcSrjs func_fatal_error "you cannot specify \`-o' more than once" 1135fa225cbcSrjs arg_mode=target 1136fa225cbcSrjs continue 1137fa225cbcSrjs ;; 1138fa225cbcSrjs 1139fa225cbcSrjs -pie | -fpie | -fPIE) 1140fa225cbcSrjs pie_flag="$pie_flag $arg" 1141fa225cbcSrjs continue 1142fa225cbcSrjs ;; 1143fa225cbcSrjs 1144fa225cbcSrjs -shared | -static | -prefer-pic | -prefer-non-pic) 1145fa225cbcSrjs later="$later $arg" 1146fa225cbcSrjs continue 1147fa225cbcSrjs ;; 1148fa225cbcSrjs 1149fa225cbcSrjs -no-suppress) 1150fa225cbcSrjs suppress_opt=no 1151fa225cbcSrjs continue 1152fa225cbcSrjs ;; 1153fa225cbcSrjs 1154fa225cbcSrjs -Xcompiler) 1155fa225cbcSrjs arg_mode=arg # the next one goes into the "base_compile" arg list 1156fa225cbcSrjs continue # The current "srcfile" will either be retained or 1157fa225cbcSrjs ;; # replaced later. I would guess that would be a bug. 1158fa225cbcSrjs 1159fa225cbcSrjs -Wc,*) 1160fa225cbcSrjs func_stripname '-Wc,' '' "$arg" 1161fa225cbcSrjs args=$func_stripname_result 1162fa225cbcSrjs lastarg= 1163fa225cbcSrjs save_ifs="$IFS"; IFS=',' 1164fa225cbcSrjs for arg in $args; do 1165fa225cbcSrjs IFS="$save_ifs" 1166fa225cbcSrjs func_quote_for_eval "$arg" 1167fa225cbcSrjs lastarg="$lastarg $func_quote_for_eval_result" 1168fa225cbcSrjs done 1169fa225cbcSrjs IFS="$save_ifs" 1170fa225cbcSrjs func_stripname ' ' '' "$lastarg" 1171fa225cbcSrjs lastarg=$func_stripname_result 1172fa225cbcSrjs 1173fa225cbcSrjs # Add the arguments to base_compile. 1174fa225cbcSrjs base_compile="$base_compile $lastarg" 1175fa225cbcSrjs continue 1176fa225cbcSrjs ;; 1177fa225cbcSrjs 1178fa225cbcSrjs *) 1179fa225cbcSrjs # Accept the current argument as the source file. 1180fa225cbcSrjs # The previous "srcfile" becomes the current argument. 1181fa225cbcSrjs # 1182fa225cbcSrjs lastarg="$srcfile" 1183fa225cbcSrjs srcfile="$arg" 1184fa225cbcSrjs ;; 1185fa225cbcSrjs esac # case $arg 1186fa225cbcSrjs ;; 1187fa225cbcSrjs esac # case $arg_mode 1188fa225cbcSrjs 1189fa225cbcSrjs # Aesthetically quote the previous argument. 1190fa225cbcSrjs func_quote_for_eval "$lastarg" 1191fa225cbcSrjs base_compile="$base_compile $func_quote_for_eval_result" 1192fa225cbcSrjs done # for arg 1193fa225cbcSrjs 1194fa225cbcSrjs case $arg_mode in 1195fa225cbcSrjs arg) 1196fa225cbcSrjs func_fatal_error "you must specify an argument for -Xcompile" 1197fa225cbcSrjs ;; 1198fa225cbcSrjs target) 1199fa225cbcSrjs func_fatal_error "you must specify a target with \`-o'" 1200fa225cbcSrjs ;; 1201fa225cbcSrjs *) 1202fa225cbcSrjs # Get the name of the library object. 1203fa225cbcSrjs test -z "$libobj" && { 1204fa225cbcSrjs func_basename "$srcfile" 1205fa225cbcSrjs libobj="$func_basename_result" 1206fa225cbcSrjs } 1207fa225cbcSrjs ;; 1208fa225cbcSrjs esac 1209fa225cbcSrjs 1210fa225cbcSrjs # Recognize several different file suffixes. 1211fa225cbcSrjs # If the user specifies -o file.o, it is replaced with file.lo 1212fa225cbcSrjs case $libobj in 1213fa225cbcSrjs *.[cCFSifmso] | \ 1214fa225cbcSrjs *.ada | *.adb | *.ads | *.asm | \ 1215fa225cbcSrjs *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 1216fa225cbcSrjs *.[fF][09]? | *.for | *.java | *.obj | *.sx) 1217fa225cbcSrjs func_xform "$libobj" 1218fa225cbcSrjs libobj=$func_xform_result 1219fa225cbcSrjs ;; 1220fa225cbcSrjs esac 1221fa225cbcSrjs 1222fa225cbcSrjs case $libobj in 1223fa225cbcSrjs *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 1224fa225cbcSrjs *) 1225fa225cbcSrjs func_fatal_error "cannot determine name of library object from \`$libobj'" 1226fa225cbcSrjs ;; 1227fa225cbcSrjs esac 1228fa225cbcSrjs 1229fa225cbcSrjs func_infer_tag $base_compile 1230fa225cbcSrjs 1231fa225cbcSrjs for arg in $later; do 1232fa225cbcSrjs case $arg in 1233fa225cbcSrjs -shared) 1234fa225cbcSrjs test "$build_libtool_libs" != yes && \ 1235fa225cbcSrjs func_fatal_configuration "can not build a shared library" 1236fa225cbcSrjs build_old_libs=no 1237fa225cbcSrjs continue 1238fa225cbcSrjs ;; 1239fa225cbcSrjs 1240fa225cbcSrjs -static) 1241fa225cbcSrjs build_libtool_libs=no 1242fa225cbcSrjs build_old_libs=yes 1243fa225cbcSrjs continue 1244fa225cbcSrjs ;; 1245fa225cbcSrjs 1246fa225cbcSrjs -prefer-pic) 1247fa225cbcSrjs pic_mode=yes 1248fa225cbcSrjs continue 1249fa225cbcSrjs ;; 1250fa225cbcSrjs 1251fa225cbcSrjs -prefer-non-pic) 1252fa225cbcSrjs pic_mode=no 1253fa225cbcSrjs continue 1254fa225cbcSrjs ;; 1255fa225cbcSrjs esac 1256fa225cbcSrjs done 1257fa225cbcSrjs 1258fa225cbcSrjs func_quote_for_eval "$libobj" 1259fa225cbcSrjs test "X$libobj" != "X$func_quote_for_eval_result" \ 1260fa225cbcSrjs && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 1261fa225cbcSrjs && func_warning "libobj name \`$libobj' may not contain shell special characters." 1262fa225cbcSrjs func_dirname_and_basename "$obj" "/" "" 1263fa225cbcSrjs objname="$func_basename_result" 1264fa225cbcSrjs xdir="$func_dirname_result" 1265fa225cbcSrjs lobj=${xdir}$objdir/$objname 1266fa225cbcSrjs 1267fa225cbcSrjs test -z "$base_compile" && \ 1268fa225cbcSrjs func_fatal_help "you must specify a compilation command" 1269fa225cbcSrjs 1270fa225cbcSrjs # Delete any leftover library objects. 1271fa225cbcSrjs if test "$build_old_libs" = yes; then 1272fa225cbcSrjs removelist="$obj $lobj $libobj ${libobj}T" 1273fa225cbcSrjs else 1274fa225cbcSrjs removelist="$lobj $libobj ${libobj}T" 1275fa225cbcSrjs fi 1276fa225cbcSrjs 1277fa225cbcSrjs # On Cygwin there's no "real" PIC flag so we must build both object types 1278fa225cbcSrjs case $host_os in 1279fa225cbcSrjs cygwin* | mingw* | pw32* | os2* | cegcc*) 1280fa225cbcSrjs pic_mode=default 1281fa225cbcSrjs ;; 1282fa225cbcSrjs esac 1283fa225cbcSrjs if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 1284fa225cbcSrjs # non-PIC code in shared libraries is not supported 1285fa225cbcSrjs pic_mode=default 1286fa225cbcSrjs fi 1287fa225cbcSrjs 1288fa225cbcSrjs # Calculate the filename of the output object if compiler does 1289fa225cbcSrjs # not support -o with -c 1290fa225cbcSrjs if test "$compiler_c_o" = no; then 1291fa225cbcSrjs output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 1292fa225cbcSrjs lockfile="$output_obj.lock" 1293fa225cbcSrjs else 1294fa225cbcSrjs output_obj= 1295fa225cbcSrjs need_locks=no 1296fa225cbcSrjs lockfile= 1297fa225cbcSrjs fi 1298fa225cbcSrjs 1299fa225cbcSrjs # Lock this critical section if it is needed 1300fa225cbcSrjs # We use this script file to make the link, it avoids creating a new file 1301fa225cbcSrjs if test "$need_locks" = yes; then 1302fa225cbcSrjs until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 1303fa225cbcSrjs func_echo "Waiting for $lockfile to be removed" 1304fa225cbcSrjs sleep 2 1305fa225cbcSrjs done 1306fa225cbcSrjs elif test "$need_locks" = warn; then 1307fa225cbcSrjs if test -f "$lockfile"; then 1308fa225cbcSrjs $ECHO "\ 1309fa225cbcSrjs*** ERROR, $lockfile exists and contains: 1310fa225cbcSrjs`cat $lockfile 2>/dev/null` 1311fa225cbcSrjs 1312fa225cbcSrjsThis indicates that another process is trying to use the same 1313fa225cbcSrjstemporary object file, and libtool could not work around it because 1314fa225cbcSrjsyour compiler does not support \`-c' and \`-o' together. If you 1315fa225cbcSrjsrepeat this compilation, it may succeed, by chance, but you had better 1316fa225cbcSrjsavoid parallel builds (make -j) in this platform, or get a better 1317fa225cbcSrjscompiler." 1318fa225cbcSrjs 1319fa225cbcSrjs $opt_dry_run || $RM $removelist 1320fa225cbcSrjs exit $EXIT_FAILURE 1321fa225cbcSrjs fi 1322fa225cbcSrjs removelist="$removelist $output_obj" 1323fa225cbcSrjs $ECHO "$srcfile" > "$lockfile" 1324fa225cbcSrjs fi 1325fa225cbcSrjs 1326fa225cbcSrjs $opt_dry_run || $RM $removelist 1327fa225cbcSrjs removelist="$removelist $lockfile" 1328fa225cbcSrjs trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 1329fa225cbcSrjs 1330fa225cbcSrjs if test -n "$fix_srcfile_path"; then 1331fa225cbcSrjs eval srcfile=\"$fix_srcfile_path\" 1332fa225cbcSrjs fi 1333fa225cbcSrjs func_quote_for_eval "$srcfile" 1334fa225cbcSrjs qsrcfile=$func_quote_for_eval_result 1335fa225cbcSrjs 1336fa225cbcSrjs # Only build a PIC object if we are building libtool libraries. 1337fa225cbcSrjs if test "$build_libtool_libs" = yes; then 1338fa225cbcSrjs # Without this assignment, base_compile gets emptied. 1339fa225cbcSrjs fbsd_hideous_sh_bug=$base_compile 1340fa225cbcSrjs 1341fa225cbcSrjs if test "$pic_mode" != no; then 1342fa225cbcSrjs command="$base_compile $qsrcfile $pic_flag" 1343fa225cbcSrjs else 1344fa225cbcSrjs # Don't build PIC code 1345fa225cbcSrjs command="$base_compile $qsrcfile" 1346fa225cbcSrjs fi 1347fa225cbcSrjs 1348fa225cbcSrjs func_mkdir_p "$xdir$objdir" 1349fa225cbcSrjs 1350fa225cbcSrjs if test -z "$output_obj"; then 1351fa225cbcSrjs # Place PIC objects in $objdir 1352fa225cbcSrjs command="$command -o $lobj" 1353fa225cbcSrjs fi 1354fa225cbcSrjs 1355fa225cbcSrjs func_show_eval_locale "$command" \ 1356fa225cbcSrjs 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 1357fa225cbcSrjs 1358fa225cbcSrjs if test "$need_locks" = warn && 1359fa225cbcSrjs test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1360fa225cbcSrjs $ECHO "\ 1361fa225cbcSrjs*** ERROR, $lockfile contains: 1362fa225cbcSrjs`cat $lockfile 2>/dev/null` 1363fa225cbcSrjs 1364fa225cbcSrjsbut it should contain: 1365fa225cbcSrjs$srcfile 1366fa225cbcSrjs 1367fa225cbcSrjsThis indicates that another process is trying to use the same 1368fa225cbcSrjstemporary object file, and libtool could not work around it because 1369fa225cbcSrjsyour compiler does not support \`-c' and \`-o' together. If you 1370fa225cbcSrjsrepeat this compilation, it may succeed, by chance, but you had better 1371fa225cbcSrjsavoid parallel builds (make -j) in this platform, or get a better 1372fa225cbcSrjscompiler." 1373fa225cbcSrjs 1374fa225cbcSrjs $opt_dry_run || $RM $removelist 1375fa225cbcSrjs exit $EXIT_FAILURE 1376fa225cbcSrjs fi 1377fa225cbcSrjs 1378fa225cbcSrjs # Just move the object if needed, then go on to compile the next one 1379fa225cbcSrjs if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 1380fa225cbcSrjs func_show_eval '$MV "$output_obj" "$lobj"' \ 1381fa225cbcSrjs 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1382fa225cbcSrjs fi 1383fa225cbcSrjs 1384fa225cbcSrjs # Allow error messages only from the first compilation. 1385fa225cbcSrjs if test "$suppress_opt" = yes; then 1386fa225cbcSrjs suppress_output=' >/dev/null 2>&1' 1387fa225cbcSrjs fi 1388fa225cbcSrjs fi 1389fa225cbcSrjs 1390fa225cbcSrjs # Only build a position-dependent object if we build old libraries. 1391fa225cbcSrjs if test "$build_old_libs" = yes; then 1392fa225cbcSrjs if test "$pic_mode" != yes; then 1393fa225cbcSrjs # Don't build PIC code 1394fa225cbcSrjs command="$base_compile $qsrcfile$pie_flag" 1395fa225cbcSrjs else 1396fa225cbcSrjs command="$base_compile $qsrcfile $pic_flag" 1397fa225cbcSrjs fi 1398fa225cbcSrjs if test "$compiler_c_o" = yes; then 1399fa225cbcSrjs command="$command -o $obj" 1400fa225cbcSrjs fi 1401fa225cbcSrjs 1402fa225cbcSrjs # Suppress compiler output if we already did a PIC compilation. 1403fa225cbcSrjs command="$command$suppress_output" 1404fa225cbcSrjs func_show_eval_locale "$command" \ 1405fa225cbcSrjs '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1406fa225cbcSrjs 1407fa225cbcSrjs if test "$need_locks" = warn && 1408fa225cbcSrjs test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1409fa225cbcSrjs $ECHO "\ 1410fa225cbcSrjs*** ERROR, $lockfile contains: 1411fa225cbcSrjs`cat $lockfile 2>/dev/null` 1412fa225cbcSrjs 1413fa225cbcSrjsbut it should contain: 1414fa225cbcSrjs$srcfile 1415fa225cbcSrjs 1416fa225cbcSrjsThis indicates that another process is trying to use the same 1417fa225cbcSrjstemporary object file, and libtool could not work around it because 1418fa225cbcSrjsyour compiler does not support \`-c' and \`-o' together. If you 1419fa225cbcSrjsrepeat this compilation, it may succeed, by chance, but you had better 1420fa225cbcSrjsavoid parallel builds (make -j) in this platform, or get a better 1421fa225cbcSrjscompiler." 1422fa225cbcSrjs 1423fa225cbcSrjs $opt_dry_run || $RM $removelist 1424fa225cbcSrjs exit $EXIT_FAILURE 1425fa225cbcSrjs fi 1426fa225cbcSrjs 1427fa225cbcSrjs # Just move the object if needed 1428fa225cbcSrjs if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1429fa225cbcSrjs func_show_eval '$MV "$output_obj" "$obj"' \ 1430fa225cbcSrjs 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 1431fa225cbcSrjs fi 1432fa225cbcSrjs fi 1433fa225cbcSrjs 1434fa225cbcSrjs $opt_dry_run || { 1435fa225cbcSrjs func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 1436fa225cbcSrjs 1437fa225cbcSrjs # Unlock the critical section if it was locked 1438fa225cbcSrjs if test "$need_locks" != no; then 1439fa225cbcSrjs removelist=$lockfile 1440fa225cbcSrjs $RM "$lockfile" 1441fa225cbcSrjs fi 1442fa225cbcSrjs } 1443fa225cbcSrjs 1444fa225cbcSrjs exit $EXIT_SUCCESS 1445fa225cbcSrjs} 1446fa225cbcSrjs 1447fa225cbcSrjs$opt_help || { 1448fa225cbcSrjstest "$mode" = compile && func_mode_compile ${1+"$@"} 1449fa225cbcSrjs} 1450fa225cbcSrjs 1451fa225cbcSrjsfunc_mode_help () 1452fa225cbcSrjs{ 1453fa225cbcSrjs # We need to display help for each of the modes. 1454fa225cbcSrjs case $mode in 1455fa225cbcSrjs "") 1456fa225cbcSrjs # Generic help is extracted from the usage comments 1457fa225cbcSrjs # at the start of this file. 1458fa225cbcSrjs func_help 1459fa225cbcSrjs ;; 1460fa225cbcSrjs 1461fa225cbcSrjs clean) 1462fa225cbcSrjs $ECHO \ 1463fa225cbcSrjs"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 1464fa225cbcSrjs 1465fa225cbcSrjsRemove files from the build directory. 1466fa225cbcSrjs 1467fa225cbcSrjsRM is the name of the program to use to delete files associated with each FILE 1468fa225cbcSrjs(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 1469fa225cbcSrjsto RM. 1470fa225cbcSrjs 1471fa225cbcSrjsIf FILE is a libtool library, object or program, all the files associated 1472fa225cbcSrjswith it are deleted. Otherwise, only FILE itself is deleted using RM." 1473fa225cbcSrjs ;; 1474fa225cbcSrjs 1475fa225cbcSrjs compile) 1476fa225cbcSrjs $ECHO \ 1477fa225cbcSrjs"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 1478fa225cbcSrjs 1479fa225cbcSrjsCompile a source file into a libtool library object. 1480fa225cbcSrjs 1481fa225cbcSrjsThis mode accepts the following additional options: 1482fa225cbcSrjs 1483fa225cbcSrjs -o OUTPUT-FILE set the output file name to OUTPUT-FILE 1484fa225cbcSrjs -no-suppress do not suppress compiler output for multiple passes 1485fa225cbcSrjs -prefer-pic try to building PIC objects only 1486fa225cbcSrjs -prefer-non-pic try to building non-PIC objects only 1487fa225cbcSrjs -shared do not build a \`.o' file suitable for static linking 1488fa225cbcSrjs -static only build a \`.o' file suitable for static linking 1489fa225cbcSrjs 1490fa225cbcSrjsCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 1491fa225cbcSrjsfrom the given SOURCEFILE. 1492fa225cbcSrjs 1493fa225cbcSrjsThe output file name is determined by removing the directory component from 1494fa225cbcSrjsSOURCEFILE, then substituting the C source code suffix \`.c' with the 1495fa225cbcSrjslibrary object suffix, \`.lo'." 1496fa225cbcSrjs ;; 1497fa225cbcSrjs 1498fa225cbcSrjs execute) 1499fa225cbcSrjs $ECHO \ 1500fa225cbcSrjs"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 1501fa225cbcSrjs 1502fa225cbcSrjsAutomatically set library path, then run a program. 1503fa225cbcSrjs 1504fa225cbcSrjsThis mode accepts the following additional options: 1505fa225cbcSrjs 1506fa225cbcSrjs -dlopen FILE add the directory containing FILE to the library path 1507fa225cbcSrjs 1508fa225cbcSrjsThis mode sets the library path environment variable according to \`-dlopen' 1509fa225cbcSrjsflags. 1510fa225cbcSrjs 1511fa225cbcSrjsIf any of the ARGS are libtool executable wrappers, then they are translated 1512fa225cbcSrjsinto their corresponding uninstalled binary, and any of their required library 1513fa225cbcSrjsdirectories are added to the library path. 1514fa225cbcSrjs 1515fa225cbcSrjsThen, COMMAND is executed, with ARGS as arguments." 1516fa225cbcSrjs ;; 1517fa225cbcSrjs 1518fa225cbcSrjs finish) 1519fa225cbcSrjs $ECHO \ 1520fa225cbcSrjs"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 1521fa225cbcSrjs 1522fa225cbcSrjsComplete the installation of libtool libraries. 1523fa225cbcSrjs 1524fa225cbcSrjsEach LIBDIR is a directory that contains libtool libraries. 1525fa225cbcSrjs 1526fa225cbcSrjsThe commands that this mode executes may require superuser privileges. Use 1527fa225cbcSrjsthe \`--dry-run' option if you just want to see what would be executed." 1528fa225cbcSrjs ;; 1529fa225cbcSrjs 1530fa225cbcSrjs install) 1531fa225cbcSrjs $ECHO \ 1532fa225cbcSrjs"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 1533fa225cbcSrjs 1534fa225cbcSrjsInstall executables or libraries. 1535fa225cbcSrjs 1536fa225cbcSrjsINSTALL-COMMAND is the installation command. The first component should be 1537fa225cbcSrjseither the \`install' or \`cp' program. 1538fa225cbcSrjs 1539fa225cbcSrjsThe following components of INSTALL-COMMAND are treated specially: 1540fa225cbcSrjs 1541fa225cbcSrjs -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation 1542fa225cbcSrjs 1543fa225cbcSrjsThe rest of the components are interpreted as arguments to that command (only 1544fa225cbcSrjsBSD-compatible install options are recognized)." 1545fa225cbcSrjs ;; 1546fa225cbcSrjs 1547fa225cbcSrjs link) 1548fa225cbcSrjs $ECHO \ 1549fa225cbcSrjs"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 1550fa225cbcSrjs 1551fa225cbcSrjsLink object files or libraries together to form another library, or to 1552fa225cbcSrjscreate an executable program. 1553fa225cbcSrjs 1554fa225cbcSrjsLINK-COMMAND is a command using the C compiler that you would use to create 1555fa225cbcSrjsa program from several object files. 1556fa225cbcSrjs 1557fa225cbcSrjsThe following components of LINK-COMMAND are treated specially: 1558fa225cbcSrjs 1559fa225cbcSrjs -all-static do not do any dynamic linking at all 1560fa225cbcSrjs -avoid-version do not add a version suffix if possible 1561fa225cbcSrjs -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 1562fa225cbcSrjs -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 1563fa225cbcSrjs -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 1564fa225cbcSrjs -export-symbols SYMFILE 1565fa225cbcSrjs try to export only the symbols listed in SYMFILE 1566fa225cbcSrjs -export-symbols-regex REGEX 1567fa225cbcSrjs try to export only the symbols matching REGEX 1568fa225cbcSrjs -LLIBDIR search LIBDIR for required installed libraries 1569fa225cbcSrjs -lNAME OUTPUT-FILE requires the installed library libNAME 1570fa225cbcSrjs -module build a library that can dlopened 1571fa225cbcSrjs -no-fast-install disable the fast-install mode 1572fa225cbcSrjs -no-install link a not-installable executable 1573fa225cbcSrjs -no-undefined declare that a library does not refer to external symbols 1574fa225cbcSrjs -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 1575fa225cbcSrjs -objectlist FILE Use a list of object files found in FILE to specify objects 1576fa225cbcSrjs -precious-files-regex REGEX 1577fa225cbcSrjs don't remove output files matching REGEX 1578fa225cbcSrjs -release RELEASE specify package release information 1579fa225cbcSrjs -rpath LIBDIR the created library will eventually be installed in LIBDIR 1580fa225cbcSrjs -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 1581fa225cbcSrjs -shared only do dynamic linking of libtool libraries 1582fa225cbcSrjs -shrext SUFFIX override the standard shared library file extension 1583fa225cbcSrjs -static do not do any dynamic linking of uninstalled libtool libraries 1584fa225cbcSrjs -static-libtool-libs 1585fa225cbcSrjs do not do any dynamic linking of libtool libraries 1586fa225cbcSrjs -version-info CURRENT[:REVISION[:AGE]] 1587fa225cbcSrjs specify library version info [each variable defaults to 0] 1588fa225cbcSrjs -weak LIBNAME declare that the target provides the LIBNAME interface 1589fa225cbcSrjs 1590fa225cbcSrjsAll other options (arguments beginning with \`-') are ignored. 1591fa225cbcSrjs 1592fa225cbcSrjsEvery other argument is treated as a filename. Files ending in \`.la' are 1593fa225cbcSrjstreated as uninstalled libtool libraries, other files are standard or library 1594fa225cbcSrjsobject files. 1595fa225cbcSrjs 1596fa225cbcSrjsIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 1597fa225cbcSrjsonly library objects (\`.lo' files) may be specified, and \`-rpath' is 1598fa225cbcSrjsrequired, except when creating a convenience library. 1599fa225cbcSrjs 1600fa225cbcSrjsIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 1601fa225cbcSrjsusing \`ar' and \`ranlib', or on Windows using \`lib'. 1602fa225cbcSrjs 1603fa225cbcSrjsIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 1604fa225cbcSrjsis created, otherwise an executable program is created." 1605fa225cbcSrjs ;; 1606fa225cbcSrjs 1607fa225cbcSrjs uninstall) 1608fa225cbcSrjs $ECHO \ 1609fa225cbcSrjs"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 1610fa225cbcSrjs 1611fa225cbcSrjsRemove libraries from an installation directory. 1612fa225cbcSrjs 1613fa225cbcSrjsRM is the name of the program to use to delete files associated with each FILE 1614fa225cbcSrjs(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 1615fa225cbcSrjsto RM. 1616fa225cbcSrjs 1617fa225cbcSrjsIf FILE is a libtool library, all the files associated with it are deleted. 1618fa225cbcSrjsOtherwise, only FILE itself is deleted using RM." 1619fa225cbcSrjs ;; 1620fa225cbcSrjs 1621fa225cbcSrjs *) 1622fa225cbcSrjs func_fatal_help "invalid operation mode \`$mode'" 1623fa225cbcSrjs ;; 1624fa225cbcSrjs esac 1625fa225cbcSrjs 1626fa225cbcSrjs $ECHO 1627fa225cbcSrjs $ECHO "Try \`$progname --help' for more information about other modes." 1628fa225cbcSrjs 1629fa225cbcSrjs exit $? 1630fa225cbcSrjs} 1631fa225cbcSrjs 1632fa225cbcSrjs # Now that we've collected a possible --mode arg, show help if necessary 1633fa225cbcSrjs $opt_help && func_mode_help 1634fa225cbcSrjs 1635fa225cbcSrjs 1636fa225cbcSrjs# func_mode_execute arg... 1637fa225cbcSrjsfunc_mode_execute () 1638fa225cbcSrjs{ 1639fa225cbcSrjs $opt_debug 1640fa225cbcSrjs # The first argument is the command name. 1641fa225cbcSrjs cmd="$nonopt" 1642fa225cbcSrjs test -z "$cmd" && \ 1643fa225cbcSrjs func_fatal_help "you must specify a COMMAND" 1644fa225cbcSrjs 1645fa225cbcSrjs # Handle -dlopen flags immediately. 1646fa225cbcSrjs for file in $execute_dlfiles; do 1647fa225cbcSrjs test -f "$file" \ 1648fa225cbcSrjs || func_fatal_help "\`$file' is not a file" 1649fa225cbcSrjs 1650fa225cbcSrjs dir= 1651fa225cbcSrjs case $file in 1652fa225cbcSrjs *.la) 1653fa225cbcSrjs # Check to see that this really is a libtool archive. 1654fa225cbcSrjs func_lalib_unsafe_p "$file" \ 1655fa225cbcSrjs || func_fatal_help "\`$lib' is not a valid libtool archive" 1656fa225cbcSrjs 1657fa225cbcSrjs # Read the libtool library. 1658fa225cbcSrjs dlname= 1659fa225cbcSrjs library_names= 1660fa225cbcSrjs func_source "$file" 1661fa225cbcSrjs 1662fa225cbcSrjs # Skip this library if it cannot be dlopened. 1663fa225cbcSrjs if test -z "$dlname"; then 1664fa225cbcSrjs # Warn if it was a shared library. 1665fa225cbcSrjs test -n "$library_names" && \ 1666fa225cbcSrjs func_warning "\`$file' was not linked with \`-export-dynamic'" 1667fa225cbcSrjs continue 1668fa225cbcSrjs fi 1669fa225cbcSrjs 1670fa225cbcSrjs func_dirname "$file" "" "." 1671fa225cbcSrjs dir="$func_dirname_result" 1672fa225cbcSrjs 1673fa225cbcSrjs if test -f "$dir/$objdir/$dlname"; then 1674fa225cbcSrjs dir="$dir/$objdir" 1675fa225cbcSrjs else 1676fa225cbcSrjs if test ! -f "$dir/$dlname"; then 1677fa225cbcSrjs func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1678fa225cbcSrjs fi 1679fa225cbcSrjs fi 1680fa225cbcSrjs ;; 1681fa225cbcSrjs 1682fa225cbcSrjs *.lo) 1683fa225cbcSrjs # Just add the directory containing the .lo file. 1684fa225cbcSrjs func_dirname "$file" "" "." 1685fa225cbcSrjs dir="$func_dirname_result" 1686fa225cbcSrjs ;; 1687fa225cbcSrjs 1688fa225cbcSrjs *) 1689fa225cbcSrjs func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 1690fa225cbcSrjs continue 1691fa225cbcSrjs ;; 1692fa225cbcSrjs esac 1693fa225cbcSrjs 1694fa225cbcSrjs # Get the absolute pathname. 1695fa225cbcSrjs absdir=`cd "$dir" && pwd` 1696fa225cbcSrjs test -n "$absdir" && dir="$absdir" 1697fa225cbcSrjs 1698fa225cbcSrjs # Now add the directory to shlibpath_var. 1699fa225cbcSrjs if eval "test -z \"\$$shlibpath_var\""; then 1700fa225cbcSrjs eval "$shlibpath_var=\"\$dir\"" 1701fa225cbcSrjs else 1702fa225cbcSrjs eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 1703fa225cbcSrjs fi 1704fa225cbcSrjs done 1705fa225cbcSrjs 1706fa225cbcSrjs # This variable tells wrapper scripts just to set shlibpath_var 1707fa225cbcSrjs # rather than running their programs. 1708fa225cbcSrjs libtool_execute_magic="$magic" 1709fa225cbcSrjs 1710fa225cbcSrjs # Check if any of the arguments is a wrapper script. 1711fa225cbcSrjs args= 1712fa225cbcSrjs for file 1713fa225cbcSrjs do 1714fa225cbcSrjs case $file in 1715fa225cbcSrjs -*) ;; 1716fa225cbcSrjs *) 1717fa225cbcSrjs # Do a test to see if this is really a libtool program. 1718fa225cbcSrjs if func_ltwrapper_script_p "$file"; then 1719fa225cbcSrjs func_source "$file" 1720fa225cbcSrjs # Transform arg to wrapped name. 1721fa225cbcSrjs file="$progdir/$program" 1722fa225cbcSrjs elif func_ltwrapper_executable_p "$file"; then 1723fa225cbcSrjs func_ltwrapper_scriptname "$file" 1724fa225cbcSrjs func_source "$func_ltwrapper_scriptname_result" 1725fa225cbcSrjs # Transform arg to wrapped name. 1726fa225cbcSrjs file="$progdir/$program" 1727fa225cbcSrjs fi 1728fa225cbcSrjs ;; 1729fa225cbcSrjs esac 1730fa225cbcSrjs # Quote arguments (to preserve shell metacharacters). 1731fa225cbcSrjs func_quote_for_eval "$file" 1732fa225cbcSrjs args="$args $func_quote_for_eval_result" 1733fa225cbcSrjs done 1734fa225cbcSrjs 1735fa225cbcSrjs if test "X$opt_dry_run" = Xfalse; then 1736fa225cbcSrjs if test -n "$shlibpath_var"; then 1737fa225cbcSrjs # Export the shlibpath_var. 1738fa225cbcSrjs eval "export $shlibpath_var" 1739fa225cbcSrjs fi 1740fa225cbcSrjs 1741fa225cbcSrjs # Restore saved environment variables 1742fa225cbcSrjs for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1743fa225cbcSrjs do 1744fa225cbcSrjs eval "if test \"\${save_$lt_var+set}\" = set; then 1745fa225cbcSrjs $lt_var=\$save_$lt_var; export $lt_var 1746fa225cbcSrjs else 1747fa225cbcSrjs $lt_unset $lt_var 1748fa225cbcSrjs fi" 1749fa225cbcSrjs done 1750fa225cbcSrjs 1751fa225cbcSrjs # Now prepare to actually exec the command. 1752fa225cbcSrjs exec_cmd="\$cmd$args" 1753fa225cbcSrjs else 1754fa225cbcSrjs # Display what would be done. 1755fa225cbcSrjs if test -n "$shlibpath_var"; then 1756fa225cbcSrjs eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 1757fa225cbcSrjs $ECHO "export $shlibpath_var" 1758fa225cbcSrjs fi 1759fa225cbcSrjs $ECHO "$cmd$args" 1760fa225cbcSrjs exit $EXIT_SUCCESS 1761fa225cbcSrjs fi 1762fa225cbcSrjs} 1763fa225cbcSrjs 1764fa225cbcSrjstest "$mode" = execute && func_mode_execute ${1+"$@"} 1765fa225cbcSrjs 1766fa225cbcSrjs 1767fa225cbcSrjs# func_mode_finish arg... 1768fa225cbcSrjsfunc_mode_finish () 1769fa225cbcSrjs{ 1770fa225cbcSrjs $opt_debug 1771fa225cbcSrjs libdirs="$nonopt" 1772fa225cbcSrjs admincmds= 1773fa225cbcSrjs 1774fa225cbcSrjs if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 1775fa225cbcSrjs for dir 1776fa225cbcSrjs do 1777fa225cbcSrjs libdirs="$libdirs $dir" 1778fa225cbcSrjs done 1779fa225cbcSrjs 1780fa225cbcSrjs for libdir in $libdirs; do 1781fa225cbcSrjs if test -n "$finish_cmds"; then 1782fa225cbcSrjs # Do each command in the finish commands. 1783fa225cbcSrjs func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 1784fa225cbcSrjs'"$cmd"'"' 1785fa225cbcSrjs fi 1786fa225cbcSrjs if test -n "$finish_eval"; then 1787fa225cbcSrjs # Do the single finish_eval. 1788fa225cbcSrjs eval cmds=\"$finish_eval\" 1789fa225cbcSrjs $opt_dry_run || eval "$cmds" || admincmds="$admincmds 1790fa225cbcSrjs $cmds" 1791fa225cbcSrjs fi 1792fa225cbcSrjs done 1793fa225cbcSrjs fi 1794fa225cbcSrjs 1795fa225cbcSrjs # Exit here if they wanted silent mode. 1796fa225cbcSrjs $opt_silent && exit $EXIT_SUCCESS 1797fa225cbcSrjs 1798fa225cbcSrjs $ECHO "X----------------------------------------------------------------------" | $Xsed 1799fa225cbcSrjs $ECHO "Libraries have been installed in:" 1800fa225cbcSrjs for libdir in $libdirs; do 1801fa225cbcSrjs $ECHO " $libdir" 1802fa225cbcSrjs done 1803fa225cbcSrjs $ECHO 1804fa225cbcSrjs $ECHO "If you ever happen to want to link against installed libraries" 1805fa225cbcSrjs $ECHO "in a given directory, LIBDIR, you must either use libtool, and" 1806fa225cbcSrjs $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" 1807fa225cbcSrjs $ECHO "flag during linking and do at least one of the following:" 1808fa225cbcSrjs if test -n "$shlibpath_var"; then 1809fa225cbcSrjs $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" 1810fa225cbcSrjs $ECHO " during execution" 1811fa225cbcSrjs fi 1812fa225cbcSrjs if test -n "$runpath_var"; then 1813fa225cbcSrjs $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" 1814fa225cbcSrjs $ECHO " during linking" 1815fa225cbcSrjs fi 1816fa225cbcSrjs if test -n "$hardcode_libdir_flag_spec"; then 1817fa225cbcSrjs libdir=LIBDIR 1818fa225cbcSrjs eval flag=\"$hardcode_libdir_flag_spec\" 1819fa225cbcSrjs 1820fa225cbcSrjs $ECHO " - use the \`$flag' linker flag" 1821fa225cbcSrjs fi 1822fa225cbcSrjs if test -n "$admincmds"; then 1823fa225cbcSrjs $ECHO " - have your system administrator run these commands:$admincmds" 1824fa225cbcSrjs fi 1825fa225cbcSrjs if test -f /etc/ld.so.conf; then 1826fa225cbcSrjs $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 1827fa225cbcSrjs fi 1828fa225cbcSrjs $ECHO 1829fa225cbcSrjs 1830fa225cbcSrjs $ECHO "See any operating system documentation about shared libraries for" 1831fa225cbcSrjs case $host in 1832fa225cbcSrjs solaris2.[6789]|solaris2.1[0-9]) 1833fa225cbcSrjs $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" 1834fa225cbcSrjs $ECHO "pages." 1835fa225cbcSrjs ;; 1836fa225cbcSrjs *) 1837fa225cbcSrjs $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." 1838fa225cbcSrjs ;; 1839fa225cbcSrjs esac 1840fa225cbcSrjs $ECHO "X----------------------------------------------------------------------" | $Xsed 1841fa225cbcSrjs exit $EXIT_SUCCESS 1842fa225cbcSrjs} 1843fa225cbcSrjs 1844fa225cbcSrjstest "$mode" = finish && func_mode_finish ${1+"$@"} 1845fa225cbcSrjs 1846fa225cbcSrjs 1847fa225cbcSrjs# func_mode_install arg... 1848fa225cbcSrjsfunc_mode_install () 1849fa225cbcSrjs{ 1850fa225cbcSrjs $opt_debug 1851fa225cbcSrjs # There may be an optional sh(1) argument at the beginning of 1852fa225cbcSrjs # install_prog (especially on Windows NT). 1853fa225cbcSrjs if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 1854fa225cbcSrjs # Allow the use of GNU shtool's install command. 1855fa225cbcSrjs $ECHO "X$nonopt" | $GREP shtool >/dev/null; then 1856fa225cbcSrjs # Aesthetically quote it. 1857fa225cbcSrjs func_quote_for_eval "$nonopt" 1858fa225cbcSrjs install_prog="$func_quote_for_eval_result " 1859fa225cbcSrjs arg=$1 1860fa225cbcSrjs shift 1861fa225cbcSrjs else 1862fa225cbcSrjs install_prog= 1863fa225cbcSrjs arg=$nonopt 1864fa225cbcSrjs fi 1865fa225cbcSrjs 1866fa225cbcSrjs # The real first argument should be the name of the installation program. 1867fa225cbcSrjs # Aesthetically quote it. 1868fa225cbcSrjs func_quote_for_eval "$arg" 1869fa225cbcSrjs install_prog="$install_prog$func_quote_for_eval_result" 1870fa225cbcSrjs 1871fa225cbcSrjs # We need to accept at least all the BSD install flags. 1872fa225cbcSrjs dest= 1873fa225cbcSrjs files= 1874fa225cbcSrjs opts= 1875fa225cbcSrjs prev= 1876fa225cbcSrjs install_type= 1877fa225cbcSrjs isdir=no 1878fa225cbcSrjs stripme= 1879fa225cbcSrjs for arg 1880fa225cbcSrjs do 1881fa225cbcSrjs if test -n "$dest"; then 1882fa225cbcSrjs files="$files $dest" 1883fa225cbcSrjs dest=$arg 1884fa225cbcSrjs continue 1885fa225cbcSrjs fi 1886fa225cbcSrjs 1887fa225cbcSrjs case $arg in 1888fa225cbcSrjs -d) isdir=yes ;; 1889fa225cbcSrjs -f) 1890fa225cbcSrjs case " $install_prog " in 1891fa225cbcSrjs *[\\\ /]cp\ *) ;; 1892fa225cbcSrjs *) prev=$arg ;; 1893fa225cbcSrjs esac 1894fa225cbcSrjs ;; 1895fa225cbcSrjs -g | -m | -o) 1896fa225cbcSrjs prev=$arg 1897fa225cbcSrjs ;; 1898fa225cbcSrjs -s) 1899fa225cbcSrjs stripme=" -s" 1900fa225cbcSrjs continue 1901fa225cbcSrjs ;; 1902fa225cbcSrjs -*) 1903fa225cbcSrjs ;; 1904fa225cbcSrjs *) 1905fa225cbcSrjs # If the previous option needed an argument, then skip it. 1906fa225cbcSrjs if test -n "$prev"; then 1907fa225cbcSrjs prev= 1908fa225cbcSrjs else 1909fa225cbcSrjs dest=$arg 1910fa225cbcSrjs continue 1911fa225cbcSrjs fi 1912fa225cbcSrjs ;; 1913fa225cbcSrjs esac 1914fa225cbcSrjs 1915fa225cbcSrjs # Aesthetically quote the argument. 1916fa225cbcSrjs func_quote_for_eval "$arg" 1917fa225cbcSrjs install_prog="$install_prog $func_quote_for_eval_result" 1918fa225cbcSrjs done 1919fa225cbcSrjs 1920fa225cbcSrjs test -z "$install_prog" && \ 1921fa225cbcSrjs func_fatal_help "you must specify an install program" 1922fa225cbcSrjs 1923fa225cbcSrjs test -n "$prev" && \ 1924fa225cbcSrjs func_fatal_help "the \`$prev' option requires an argument" 1925fa225cbcSrjs 1926fa225cbcSrjs if test -z "$files"; then 1927fa225cbcSrjs if test -z "$dest"; then 1928fa225cbcSrjs func_fatal_help "no file or destination specified" 1929fa225cbcSrjs else 1930fa225cbcSrjs func_fatal_help "you must specify a destination" 1931fa225cbcSrjs fi 1932fa225cbcSrjs fi 1933fa225cbcSrjs 1934fa225cbcSrjs # Strip any trailing slash from the destination. 1935fa225cbcSrjs func_stripname '' '/' "$dest" 1936fa225cbcSrjs dest=$func_stripname_result 1937fa225cbcSrjs 1938fa225cbcSrjs # Check to see that the destination is a directory. 1939fa225cbcSrjs test -d "$dest" && isdir=yes 1940fa225cbcSrjs if test "$isdir" = yes; then 1941fa225cbcSrjs destdir="$dest" 1942fa225cbcSrjs destname= 1943fa225cbcSrjs else 1944fa225cbcSrjs func_dirname_and_basename "$dest" "" "." 1945fa225cbcSrjs destdir="$func_dirname_result" 1946fa225cbcSrjs destname="$func_basename_result" 1947fa225cbcSrjs 1948fa225cbcSrjs # Not a directory, so check to see that there is only one file specified. 1949fa225cbcSrjs set dummy $files; shift 1950fa225cbcSrjs test "$#" -gt 1 && \ 1951fa225cbcSrjs func_fatal_help "\`$dest' is not a directory" 1952fa225cbcSrjs fi 1953fa225cbcSrjs case $destdir in 1954fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) ;; 1955fa225cbcSrjs *) 1956fa225cbcSrjs for file in $files; do 1957fa225cbcSrjs case $file in 1958fa225cbcSrjs *.lo) ;; 1959fa225cbcSrjs *) 1960fa225cbcSrjs func_fatal_help "\`$destdir' must be an absolute directory name" 1961fa225cbcSrjs ;; 1962fa225cbcSrjs esac 1963fa225cbcSrjs done 1964fa225cbcSrjs ;; 1965fa225cbcSrjs esac 1966fa225cbcSrjs 1967fa225cbcSrjs # This variable tells wrapper scripts just to set variables rather 1968fa225cbcSrjs # than running their programs. 1969fa225cbcSrjs libtool_install_magic="$magic" 1970fa225cbcSrjs 1971fa225cbcSrjs staticlibs= 1972fa225cbcSrjs future_libdirs= 1973fa225cbcSrjs current_libdirs= 1974fa225cbcSrjs for file in $files; do 1975fa225cbcSrjs 1976fa225cbcSrjs # Do each installation. 1977fa225cbcSrjs case $file in 1978fa225cbcSrjs *.$libext) 1979fa225cbcSrjs # Do the static libraries later. 1980fa225cbcSrjs staticlibs="$staticlibs $file" 1981fa225cbcSrjs ;; 1982fa225cbcSrjs 1983fa225cbcSrjs *.la) 1984fa225cbcSrjs # Check to see that this really is a libtool archive. 1985fa225cbcSrjs func_lalib_unsafe_p "$file" \ 1986fa225cbcSrjs || func_fatal_help "\`$file' is not a valid libtool archive" 1987fa225cbcSrjs 1988fa225cbcSrjs library_names= 1989fa225cbcSrjs old_library= 1990fa225cbcSrjs relink_command= 1991fa225cbcSrjs func_source "$file" 1992fa225cbcSrjs 1993fa225cbcSrjs # Add the libdir to current_libdirs if it is the destination. 1994fa225cbcSrjs if test "X$destdir" = "X$libdir"; then 1995fa225cbcSrjs case "$current_libdirs " in 1996fa225cbcSrjs *" $libdir "*) ;; 1997fa225cbcSrjs *) current_libdirs="$current_libdirs $libdir" ;; 1998fa225cbcSrjs esac 1999fa225cbcSrjs else 2000fa225cbcSrjs # Note the libdir as a future libdir. 2001fa225cbcSrjs case "$future_libdirs " in 2002fa225cbcSrjs *" $libdir "*) ;; 2003fa225cbcSrjs *) future_libdirs="$future_libdirs $libdir" ;; 2004fa225cbcSrjs esac 2005fa225cbcSrjs fi 2006fa225cbcSrjs 2007fa225cbcSrjs func_dirname "$file" "/" "" 2008fa225cbcSrjs dir="$func_dirname_result" 2009fa225cbcSrjs dir="$dir$objdir" 2010fa225cbcSrjs 2011fa225cbcSrjs if test -n "$relink_command"; then 2012fa225cbcSrjs # Determine the prefix the user has applied to our future dir. 2013fa225cbcSrjs inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` 2014fa225cbcSrjs 2015fa225cbcSrjs # Don't allow the user to place us outside of our expected 2016fa225cbcSrjs # location b/c this prevents finding dependent libraries that 2017fa225cbcSrjs # are installed to the same prefix. 2018fa225cbcSrjs # At present, this check doesn't affect windows .dll's that 2019fa225cbcSrjs # are installed into $libdir/../bin (currently, that works fine) 2020fa225cbcSrjs # but it's something to keep an eye on. 2021fa225cbcSrjs test "$inst_prefix_dir" = "$destdir" && \ 2022fa225cbcSrjs func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2023fa225cbcSrjs 2024fa225cbcSrjs if test -n "$inst_prefix_dir"; then 2025fa225cbcSrjs # Stick the inst_prefix_dir data into the link command. 2026fa225cbcSrjs relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2027fa225cbcSrjs else 2028fa225cbcSrjs relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` 2029fa225cbcSrjs fi 2030fa225cbcSrjs 2031fa225cbcSrjs func_warning "relinking \`$file'" 2032fa225cbcSrjs func_show_eval "$relink_command" \ 2033fa225cbcSrjs 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2034fa225cbcSrjs fi 2035fa225cbcSrjs 2036fa225cbcSrjs # See the names of the shared library. 2037fa225cbcSrjs set dummy $library_names; shift 2038fa225cbcSrjs if test -n "$1"; then 2039fa225cbcSrjs realname="$1" 2040fa225cbcSrjs shift 2041fa225cbcSrjs 2042fa225cbcSrjs srcname="$realname" 2043fa225cbcSrjs test -n "$relink_command" && srcname="$realname"T 2044fa225cbcSrjs 2045fa225cbcSrjs # Install the shared library and build the symlinks. 2046fa225cbcSrjs func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 2047fa225cbcSrjs 'exit $?' 2048fa225cbcSrjs tstripme="$stripme" 2049fa225cbcSrjs case $host_os in 2050fa225cbcSrjs cygwin* | mingw* | pw32* | cegcc*) 2051fa225cbcSrjs case $realname in 2052fa225cbcSrjs *.dll.a) 2053fa225cbcSrjs tstripme="" 2054fa225cbcSrjs ;; 2055fa225cbcSrjs esac 2056fa225cbcSrjs ;; 2057fa225cbcSrjs esac 2058fa225cbcSrjs if test -n "$tstripme" && test -n "$striplib"; then 2059fa225cbcSrjs func_show_eval "$striplib $destdir/$realname" 'exit $?' 2060fa225cbcSrjs fi 2061fa225cbcSrjs 2062fa225cbcSrjs if test "$#" -gt 0; then 2063fa225cbcSrjs # Delete the old symlinks, and create new ones. 2064fa225cbcSrjs # Try `ln -sf' first, because the `ln' binary might depend on 2065fa225cbcSrjs # the symlink we replace! Solaris /bin/ln does not understand -f, 2066fa225cbcSrjs # so we also need to try rm && ln -s. 2067fa225cbcSrjs for linkname 2068fa225cbcSrjs do 2069fa225cbcSrjs test "$linkname" != "$realname" \ 2070fa225cbcSrjs && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 2071fa225cbcSrjs done 2072fa225cbcSrjs fi 2073fa225cbcSrjs 2074fa225cbcSrjs # Do each command in the postinstall commands. 2075fa225cbcSrjs lib="$destdir/$realname" 2076fa225cbcSrjs func_execute_cmds "$postinstall_cmds" 'exit $?' 2077fa225cbcSrjs fi 2078fa225cbcSrjs 2079fa225cbcSrjs # Install the pseudo-library for information purposes. 2080fa225cbcSrjs func_basename "$file" 2081fa225cbcSrjs name="$func_basename_result" 2082fa225cbcSrjs instname="$dir/$name"i 2083fa225cbcSrjs func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 2084fa225cbcSrjs 2085fa225cbcSrjs # Maybe install the static library, too. 2086fa225cbcSrjs test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 2087fa225cbcSrjs ;; 2088fa225cbcSrjs 2089fa225cbcSrjs *.lo) 2090fa225cbcSrjs # Install (i.e. copy) a libtool object. 2091fa225cbcSrjs 2092fa225cbcSrjs # Figure out destination file name, if it wasn't already specified. 2093fa225cbcSrjs if test -n "$destname"; then 2094fa225cbcSrjs destfile="$destdir/$destname" 2095fa225cbcSrjs else 2096fa225cbcSrjs func_basename "$file" 2097fa225cbcSrjs destfile="$func_basename_result" 2098fa225cbcSrjs destfile="$destdir/$destfile" 2099fa225cbcSrjs fi 2100fa225cbcSrjs 2101fa225cbcSrjs # Deduce the name of the destination old-style object file. 2102fa225cbcSrjs case $destfile in 2103fa225cbcSrjs *.lo) 2104fa225cbcSrjs func_lo2o "$destfile" 2105fa225cbcSrjs staticdest=$func_lo2o_result 2106fa225cbcSrjs ;; 2107fa225cbcSrjs *.$objext) 2108fa225cbcSrjs staticdest="$destfile" 2109fa225cbcSrjs destfile= 2110fa225cbcSrjs ;; 2111fa225cbcSrjs *) 2112fa225cbcSrjs func_fatal_help "cannot copy a libtool object to \`$destfile'" 2113fa225cbcSrjs ;; 2114fa225cbcSrjs esac 2115fa225cbcSrjs 2116fa225cbcSrjs # Install the libtool object if requested. 2117fa225cbcSrjs test -n "$destfile" && \ 2118fa225cbcSrjs func_show_eval "$install_prog $file $destfile" 'exit $?' 2119fa225cbcSrjs 2120fa225cbcSrjs # Install the old object if enabled. 2121fa225cbcSrjs if test "$build_old_libs" = yes; then 2122fa225cbcSrjs # Deduce the name of the old-style object file. 2123fa225cbcSrjs func_lo2o "$file" 2124fa225cbcSrjs staticobj=$func_lo2o_result 2125fa225cbcSrjs func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 2126fa225cbcSrjs fi 2127fa225cbcSrjs exit $EXIT_SUCCESS 2128fa225cbcSrjs ;; 2129fa225cbcSrjs 2130fa225cbcSrjs *) 2131fa225cbcSrjs # Figure out destination file name, if it wasn't already specified. 2132fa225cbcSrjs if test -n "$destname"; then 2133fa225cbcSrjs destfile="$destdir/$destname" 2134fa225cbcSrjs else 2135fa225cbcSrjs func_basename "$file" 2136fa225cbcSrjs destfile="$func_basename_result" 2137fa225cbcSrjs destfile="$destdir/$destfile" 2138fa225cbcSrjs fi 2139fa225cbcSrjs 2140fa225cbcSrjs # If the file is missing, and there is a .exe on the end, strip it 2141fa225cbcSrjs # because it is most likely a libtool script we actually want to 2142fa225cbcSrjs # install 2143fa225cbcSrjs stripped_ext="" 2144fa225cbcSrjs case $file in 2145fa225cbcSrjs *.exe) 2146fa225cbcSrjs if test ! -f "$file"; then 2147fa225cbcSrjs func_stripname '' '.exe' "$file" 2148fa225cbcSrjs file=$func_stripname_result 2149fa225cbcSrjs stripped_ext=".exe" 2150fa225cbcSrjs fi 2151fa225cbcSrjs ;; 2152fa225cbcSrjs esac 2153fa225cbcSrjs 2154fa225cbcSrjs # Do a test to see if this is really a libtool program. 2155fa225cbcSrjs case $host in 2156fa225cbcSrjs *cygwin* | *mingw*) 2157fa225cbcSrjs if func_ltwrapper_executable_p "$file"; then 2158fa225cbcSrjs func_ltwrapper_scriptname "$file" 2159fa225cbcSrjs wrapper=$func_ltwrapper_scriptname_result 2160fa225cbcSrjs else 2161fa225cbcSrjs func_stripname '' '.exe' "$file" 2162fa225cbcSrjs wrapper=$func_stripname_result 2163fa225cbcSrjs fi 2164fa225cbcSrjs ;; 2165fa225cbcSrjs *) 2166fa225cbcSrjs wrapper=$file 2167fa225cbcSrjs ;; 2168fa225cbcSrjs esac 2169fa225cbcSrjs if func_ltwrapper_script_p "$wrapper"; then 2170fa225cbcSrjs notinst_deplibs= 2171fa225cbcSrjs relink_command= 2172fa225cbcSrjs 2173fa225cbcSrjs func_source "$wrapper" 2174fa225cbcSrjs 2175fa225cbcSrjs # Check the variables that should have been set. 2176fa225cbcSrjs test -z "$generated_by_libtool_version" && \ 2177fa225cbcSrjs func_fatal_error "invalid libtool wrapper script \`$wrapper'" 2178fa225cbcSrjs 2179fa225cbcSrjs finalize=yes 2180fa225cbcSrjs for lib in $notinst_deplibs; do 2181fa225cbcSrjs # Check to see that each library is installed. 2182fa225cbcSrjs libdir= 2183fa225cbcSrjs if test -f "$lib"; then 2184fa225cbcSrjs func_source "$lib" 2185fa225cbcSrjs fi 2186fa225cbcSrjs libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 2187fa225cbcSrjs if test -n "$libdir" && test ! -f "$libfile"; then 2188fa225cbcSrjs func_warning "\`$lib' has not been installed in \`$libdir'" 2189fa225cbcSrjs finalize=no 2190fa225cbcSrjs fi 2191fa225cbcSrjs done 2192fa225cbcSrjs 2193fa225cbcSrjs relink_command= 2194fa225cbcSrjs func_source "$wrapper" 2195fa225cbcSrjs 2196fa225cbcSrjs outputname= 2197fa225cbcSrjs if test "$fast_install" = no && test -n "$relink_command"; then 2198fa225cbcSrjs $opt_dry_run || { 2199fa225cbcSrjs if test "$finalize" = yes; then 2200fa225cbcSrjs tmpdir=`func_mktempdir` 2201fa225cbcSrjs func_basename "$file$stripped_ext" 2202fa225cbcSrjs file="$func_basename_result" 2203fa225cbcSrjs outputname="$tmpdir/$file" 2204fa225cbcSrjs # Replace the output file specification. 2205fa225cbcSrjs relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 2206fa225cbcSrjs 2207fa225cbcSrjs $opt_silent || { 2208fa225cbcSrjs func_quote_for_expand "$relink_command" 2209fa225cbcSrjs eval "func_echo $func_quote_for_expand_result" 2210fa225cbcSrjs } 2211fa225cbcSrjs if eval "$relink_command"; then : 2212fa225cbcSrjs else 2213fa225cbcSrjs func_error "error: relink \`$file' with the above command before installing it" 2214fa225cbcSrjs $opt_dry_run || ${RM}r "$tmpdir" 2215fa225cbcSrjs continue 2216fa225cbcSrjs fi 2217fa225cbcSrjs file="$outputname" 2218fa225cbcSrjs else 2219fa225cbcSrjs func_warning "cannot relink \`$file'" 2220fa225cbcSrjs fi 2221fa225cbcSrjs } 2222fa225cbcSrjs else 2223fa225cbcSrjs # Install the binary that we compiled earlier. 2224fa225cbcSrjs file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 2225fa225cbcSrjs fi 2226fa225cbcSrjs fi 2227fa225cbcSrjs 2228fa225cbcSrjs # remove .exe since cygwin /usr/bin/install will append another 2229fa225cbcSrjs # one anyway 2230fa225cbcSrjs case $install_prog,$host in 2231fa225cbcSrjs */usr/bin/install*,*cygwin*) 2232fa225cbcSrjs case $file:$destfile in 2233fa225cbcSrjs *.exe:*.exe) 2234fa225cbcSrjs # this is ok 2235fa225cbcSrjs ;; 2236fa225cbcSrjs *.exe:*) 2237fa225cbcSrjs destfile=$destfile.exe 2238fa225cbcSrjs ;; 2239fa225cbcSrjs *:*.exe) 2240fa225cbcSrjs func_stripname '' '.exe' "$destfile" 2241fa225cbcSrjs destfile=$func_stripname_result 2242fa225cbcSrjs ;; 2243fa225cbcSrjs esac 2244fa225cbcSrjs ;; 2245fa225cbcSrjs esac 2246fa225cbcSrjs func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 2247fa225cbcSrjs $opt_dry_run || if test -n "$outputname"; then 2248fa225cbcSrjs ${RM}r "$tmpdir" 2249fa225cbcSrjs fi 2250fa225cbcSrjs ;; 2251fa225cbcSrjs esac 2252fa225cbcSrjs done 2253fa225cbcSrjs 2254fa225cbcSrjs for file in $staticlibs; do 2255fa225cbcSrjs func_basename "$file" 2256fa225cbcSrjs name="$func_basename_result" 2257fa225cbcSrjs 2258fa225cbcSrjs # Set up the ranlib parameters. 2259fa225cbcSrjs oldlib="$destdir/$name" 2260fa225cbcSrjs 2261fa225cbcSrjs func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 2262fa225cbcSrjs 2263fa225cbcSrjs if test -n "$stripme" && test -n "$old_striplib"; then 2264fa225cbcSrjs func_show_eval "$old_striplib $oldlib" 'exit $?' 2265fa225cbcSrjs fi 2266fa225cbcSrjs 2267fa225cbcSrjs # Do each command in the postinstall commands. 2268fa225cbcSrjs func_execute_cmds "$old_postinstall_cmds" 'exit $?' 2269fa225cbcSrjs done 2270fa225cbcSrjs 2271fa225cbcSrjs test -n "$future_libdirs" && \ 2272fa225cbcSrjs func_warning "remember to run \`$progname --finish$future_libdirs'" 2273fa225cbcSrjs 2274fa225cbcSrjs if test -n "$current_libdirs"; then 2275fa225cbcSrjs # Maybe just do a dry run. 2276fa225cbcSrjs $opt_dry_run && current_libdirs=" -n$current_libdirs" 2277fa225cbcSrjs exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 2278fa225cbcSrjs else 2279fa225cbcSrjs exit $EXIT_SUCCESS 2280fa225cbcSrjs fi 2281fa225cbcSrjs} 2282fa225cbcSrjs 2283fa225cbcSrjstest "$mode" = install && func_mode_install ${1+"$@"} 2284fa225cbcSrjs 2285fa225cbcSrjs 2286fa225cbcSrjs# func_generate_dlsyms outputname originator pic_p 2287fa225cbcSrjs# Extract symbols from dlprefiles and create ${outputname}S.o with 2288fa225cbcSrjs# a dlpreopen symbol table. 2289fa225cbcSrjsfunc_generate_dlsyms () 2290fa225cbcSrjs{ 2291fa225cbcSrjs $opt_debug 2292fa225cbcSrjs my_outputname="$1" 2293fa225cbcSrjs my_originator="$2" 2294fa225cbcSrjs my_pic_p="${3-no}" 2295fa225cbcSrjs my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 2296fa225cbcSrjs my_dlsyms= 2297fa225cbcSrjs 2298fa225cbcSrjs if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 2299fa225cbcSrjs if test -n "$NM" && test -n "$global_symbol_pipe"; then 2300fa225cbcSrjs my_dlsyms="${my_outputname}S.c" 2301fa225cbcSrjs else 2302fa225cbcSrjs func_error "not configured to extract global symbols from dlpreopened files" 2303fa225cbcSrjs fi 2304fa225cbcSrjs fi 2305fa225cbcSrjs 2306fa225cbcSrjs if test -n "$my_dlsyms"; then 2307fa225cbcSrjs case $my_dlsyms in 2308fa225cbcSrjs "") ;; 2309fa225cbcSrjs *.c) 2310fa225cbcSrjs # Discover the nlist of each of the dlfiles. 2311fa225cbcSrjs nlist="$output_objdir/${my_outputname}.nm" 2312fa225cbcSrjs 2313fa225cbcSrjs func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 2314fa225cbcSrjs 2315fa225cbcSrjs # Parse the name list into a source file. 2316fa225cbcSrjs func_verbose "creating $output_objdir/$my_dlsyms" 2317fa225cbcSrjs 2318fa225cbcSrjs $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 2319fa225cbcSrjs/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 2320fa225cbcSrjs/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 2321fa225cbcSrjs 2322fa225cbcSrjs#ifdef __cplusplus 2323fa225cbcSrjsextern \"C\" { 2324fa225cbcSrjs#endif 2325fa225cbcSrjs 2326fa225cbcSrjs/* External symbol declarations for the compiler. */\ 2327fa225cbcSrjs" 2328fa225cbcSrjs 2329fa225cbcSrjs if test "$dlself" = yes; then 2330fa225cbcSrjs func_verbose "generating symbol list for \`$output'" 2331fa225cbcSrjs 2332fa225cbcSrjs $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 2333fa225cbcSrjs 2334fa225cbcSrjs # Add our own program objects to the symbol list. 2335fa225cbcSrjs progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 2336fa225cbcSrjs for progfile in $progfiles; do 2337fa225cbcSrjs func_verbose "extracting global C symbols from \`$progfile'" 2338fa225cbcSrjs $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 2339fa225cbcSrjs done 2340fa225cbcSrjs 2341fa225cbcSrjs if test -n "$exclude_expsyms"; then 2342fa225cbcSrjs $opt_dry_run || { 2343fa225cbcSrjs eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 2344fa225cbcSrjs eval '$MV "$nlist"T "$nlist"' 2345fa225cbcSrjs } 2346fa225cbcSrjs fi 2347fa225cbcSrjs 2348fa225cbcSrjs if test -n "$export_symbols_regex"; then 2349fa225cbcSrjs $opt_dry_run || { 2350fa225cbcSrjs eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 2351fa225cbcSrjs eval '$MV "$nlist"T "$nlist"' 2352fa225cbcSrjs } 2353fa225cbcSrjs fi 2354fa225cbcSrjs 2355fa225cbcSrjs # Prepare the list of exported symbols 2356fa225cbcSrjs if test -z "$export_symbols"; then 2357fa225cbcSrjs export_symbols="$output_objdir/$outputname.exp" 2358fa225cbcSrjs $opt_dry_run || { 2359fa225cbcSrjs $RM $export_symbols 2360fa225cbcSrjs eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 2361fa225cbcSrjs case $host in 2362fa225cbcSrjs *cygwin* | *mingw* | *cegcc* ) 2363fa225cbcSrjs eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 2364fa225cbcSrjs eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 2365fa225cbcSrjs ;; 2366fa225cbcSrjs esac 2367fa225cbcSrjs } 2368fa225cbcSrjs else 2369fa225cbcSrjs $opt_dry_run || { 2370fa225cbcSrjs eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 2371fa225cbcSrjs eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 2372fa225cbcSrjs eval '$MV "$nlist"T "$nlist"' 2373fa225cbcSrjs case $host in 2374fa225cbcSrjs *cygwin | *mingw* | *cegcc* ) 2375fa225cbcSrjs eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 2376fa225cbcSrjs eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 2377fa225cbcSrjs ;; 2378fa225cbcSrjs esac 2379fa225cbcSrjs } 2380fa225cbcSrjs fi 2381fa225cbcSrjs fi 2382fa225cbcSrjs 2383fa225cbcSrjs for dlprefile in $dlprefiles; do 2384fa225cbcSrjs func_verbose "extracting global C symbols from \`$dlprefile'" 2385fa225cbcSrjs func_basename "$dlprefile" 2386fa225cbcSrjs name="$func_basename_result" 2387fa225cbcSrjs $opt_dry_run || { 2388fa225cbcSrjs eval '$ECHO ": $name " >> "$nlist"' 2389fa225cbcSrjs eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 2390fa225cbcSrjs } 2391fa225cbcSrjs done 2392fa225cbcSrjs 2393fa225cbcSrjs $opt_dry_run || { 2394fa225cbcSrjs # Make sure we have at least an empty file. 2395fa225cbcSrjs test -f "$nlist" || : > "$nlist" 2396fa225cbcSrjs 2397fa225cbcSrjs if test -n "$exclude_expsyms"; then 2398fa225cbcSrjs $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 2399fa225cbcSrjs $MV "$nlist"T "$nlist" 2400fa225cbcSrjs fi 2401fa225cbcSrjs 2402fa225cbcSrjs # Try sorting and uniquifying the output. 2403fa225cbcSrjs if $GREP -v "^: " < "$nlist" | 2404fa225cbcSrjs if sort -k 3 </dev/null >/dev/null 2>&1; then 2405fa225cbcSrjs sort -k 3 2406fa225cbcSrjs else 2407fa225cbcSrjs sort +2 2408fa225cbcSrjs fi | 2409fa225cbcSrjs uniq > "$nlist"S; then 2410fa225cbcSrjs : 2411fa225cbcSrjs else 2412fa225cbcSrjs $GREP -v "^: " < "$nlist" > "$nlist"S 2413fa225cbcSrjs fi 2414fa225cbcSrjs 2415fa225cbcSrjs if test -f "$nlist"S; then 2416fa225cbcSrjs eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 2417fa225cbcSrjs else 2418fa225cbcSrjs $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" 2419fa225cbcSrjs fi 2420fa225cbcSrjs 2421fa225cbcSrjs $ECHO >> "$output_objdir/$my_dlsyms" "\ 2422fa225cbcSrjs 2423fa225cbcSrjs/* The mapping between symbol names and symbols. */ 2424fa225cbcSrjstypedef struct { 2425fa225cbcSrjs const char *name; 2426fa225cbcSrjs void *address; 2427fa225cbcSrjs} lt_dlsymlist; 2428fa225cbcSrjs" 2429fa225cbcSrjs case $host in 2430fa225cbcSrjs *cygwin* | *mingw* | *cegcc* ) 2431fa225cbcSrjs $ECHO >> "$output_objdir/$my_dlsyms" "\ 2432fa225cbcSrjs/* DATA imports from DLLs on WIN32 con't be const, because 2433fa225cbcSrjs runtime relocations are performed -- see ld's documentation 2434fa225cbcSrjs on pseudo-relocs. */" 2435fa225cbcSrjs lt_dlsym_const= ;; 2436fa225cbcSrjs *osf5*) 2437fa225cbcSrjs echo >> "$output_objdir/$my_dlsyms" "\ 2438fa225cbcSrjs/* This system does not cope well with relocations in const data */" 2439fa225cbcSrjs lt_dlsym_const= ;; 2440fa225cbcSrjs *) 2441fa225cbcSrjs lt_dlsym_const=const ;; 2442fa225cbcSrjs esac 2443fa225cbcSrjs 2444fa225cbcSrjs $ECHO >> "$output_objdir/$my_dlsyms" "\ 2445fa225cbcSrjsextern $lt_dlsym_const lt_dlsymlist 2446fa225cbcSrjslt_${my_prefix}_LTX_preloaded_symbols[]; 2447fa225cbcSrjs$lt_dlsym_const lt_dlsymlist 2448fa225cbcSrjslt_${my_prefix}_LTX_preloaded_symbols[] = 2449fa225cbcSrjs{\ 2450fa225cbcSrjs { \"$my_originator\", (void *) 0 }," 2451fa225cbcSrjs 2452fa225cbcSrjs case $need_lib_prefix in 2453fa225cbcSrjs no) 2454fa225cbcSrjs eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 2455fa225cbcSrjs ;; 2456fa225cbcSrjs *) 2457fa225cbcSrjs eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 2458fa225cbcSrjs ;; 2459fa225cbcSrjs esac 2460fa225cbcSrjs $ECHO >> "$output_objdir/$my_dlsyms" "\ 2461fa225cbcSrjs {0, (void *) 0} 2462fa225cbcSrjs}; 2463fa225cbcSrjs 2464fa225cbcSrjs/* This works around a problem in FreeBSD linker */ 2465fa225cbcSrjs#ifdef FREEBSD_WORKAROUND 2466fa225cbcSrjsstatic const void *lt_preloaded_setup() { 2467fa225cbcSrjs return lt_${my_prefix}_LTX_preloaded_symbols; 2468fa225cbcSrjs} 2469fa225cbcSrjs#endif 2470fa225cbcSrjs 2471fa225cbcSrjs#ifdef __cplusplus 2472fa225cbcSrjs} 2473fa225cbcSrjs#endif\ 2474fa225cbcSrjs" 2475fa225cbcSrjs } # !$opt_dry_run 2476fa225cbcSrjs 2477fa225cbcSrjs pic_flag_for_symtable= 2478fa225cbcSrjs case "$compile_command " in 2479fa225cbcSrjs *" -static "*) ;; 2480fa225cbcSrjs *) 2481fa225cbcSrjs case $host in 2482fa225cbcSrjs # compiling the symbol table file with pic_flag works around 2483fa225cbcSrjs # a FreeBSD bug that causes programs to crash when -lm is 2484fa225cbcSrjs # linked before any other PIC object. But we must not use 2485fa225cbcSrjs # pic_flag when linking with -static. The problem exists in 2486fa225cbcSrjs # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 2487fa225cbcSrjs *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 2488fa225cbcSrjs pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 2489fa225cbcSrjs *-*-hpux*) 2490fa225cbcSrjs pic_flag_for_symtable=" $pic_flag" ;; 2491fa225cbcSrjs *) 2492fa225cbcSrjs if test "X$my_pic_p" != Xno; then 2493fa225cbcSrjs pic_flag_for_symtable=" $pic_flag" 2494fa225cbcSrjs fi 2495fa225cbcSrjs ;; 2496fa225cbcSrjs esac 2497fa225cbcSrjs ;; 2498fa225cbcSrjs esac 2499fa225cbcSrjs symtab_cflags= 2500fa225cbcSrjs for arg in $LTCFLAGS; do 2501fa225cbcSrjs case $arg in 2502fa225cbcSrjs -pie | -fpie | -fPIE) ;; 2503fa225cbcSrjs *) symtab_cflags="$symtab_cflags $arg" ;; 2504fa225cbcSrjs esac 2505fa225cbcSrjs done 2506fa225cbcSrjs 2507fa225cbcSrjs # Now compile the dynamic symbol file. 2508fa225cbcSrjs func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 2509fa225cbcSrjs 2510fa225cbcSrjs # Clean up the generated files. 2511fa225cbcSrjs func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 2512fa225cbcSrjs 2513fa225cbcSrjs # Transform the symbol file into the correct name. 2514fa225cbcSrjs symfileobj="$output_objdir/${my_outputname}S.$objext" 2515fa225cbcSrjs case $host in 2516fa225cbcSrjs *cygwin* | *mingw* | *cegcc* ) 2517fa225cbcSrjs if test -f "$output_objdir/$my_outputname.def"; then 2518fa225cbcSrjs compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 2519fa225cbcSrjs finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 2520fa225cbcSrjs else 2521fa225cbcSrjs compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2522fa225cbcSrjs finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2523fa225cbcSrjs fi 2524fa225cbcSrjs ;; 2525fa225cbcSrjs *) 2526fa225cbcSrjs compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2527fa225cbcSrjs finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2528fa225cbcSrjs ;; 2529fa225cbcSrjs esac 2530fa225cbcSrjs ;; 2531fa225cbcSrjs *) 2532fa225cbcSrjs func_fatal_error "unknown suffix for \`$my_dlsyms'" 2533fa225cbcSrjs ;; 2534fa225cbcSrjs esac 2535fa225cbcSrjs else 2536fa225cbcSrjs # We keep going just in case the user didn't refer to 2537fa225cbcSrjs # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 2538fa225cbcSrjs # really was required. 2539fa225cbcSrjs 2540fa225cbcSrjs # Nullify the symbol file. 2541fa225cbcSrjs compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 2542fa225cbcSrjs finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 2543fa225cbcSrjs fi 2544fa225cbcSrjs} 2545fa225cbcSrjs 2546fa225cbcSrjs# func_win32_libid arg 2547fa225cbcSrjs# return the library type of file 'arg' 2548fa225cbcSrjs# 2549fa225cbcSrjs# Need a lot of goo to handle *both* DLLs and import libs 2550fa225cbcSrjs# Has to be a shell function in order to 'eat' the argument 2551fa225cbcSrjs# that is supplied when $file_magic_command is called. 2552fa225cbcSrjsfunc_win32_libid () 2553fa225cbcSrjs{ 2554fa225cbcSrjs $opt_debug 2555fa225cbcSrjs win32_libid_type="unknown" 2556fa225cbcSrjs win32_fileres=`file -L $1 2>/dev/null` 2557fa225cbcSrjs case $win32_fileres in 2558fa225cbcSrjs *ar\ archive\ import\ library*) # definitely import 2559fa225cbcSrjs win32_libid_type="x86 archive import" 2560fa225cbcSrjs ;; 2561fa225cbcSrjs *ar\ archive*) # could be an import, or static 2562fa225cbcSrjs if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 2563fa225cbcSrjs $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 2564fa225cbcSrjs win32_nmres=`eval $NM -f posix -A $1 | 2565fa225cbcSrjs $SED -n -e ' 2566fa225cbcSrjs 1,100{ 2567fa225cbcSrjs / I /{ 2568fa225cbcSrjs s,.*,import, 2569fa225cbcSrjs p 2570fa225cbcSrjs q 2571fa225cbcSrjs } 2572fa225cbcSrjs }'` 2573fa225cbcSrjs case $win32_nmres in 2574fa225cbcSrjs import*) win32_libid_type="x86 archive import";; 2575fa225cbcSrjs *) win32_libid_type="x86 archive static";; 2576fa225cbcSrjs esac 2577fa225cbcSrjs fi 2578fa225cbcSrjs ;; 2579fa225cbcSrjs *DLL*) 2580fa225cbcSrjs win32_libid_type="x86 DLL" 2581fa225cbcSrjs ;; 2582fa225cbcSrjs *executable*) # but shell scripts are "executable" too... 2583fa225cbcSrjs case $win32_fileres in 2584fa225cbcSrjs *MS\ Windows\ PE\ Intel*) 2585fa225cbcSrjs win32_libid_type="x86 DLL" 2586fa225cbcSrjs ;; 2587fa225cbcSrjs esac 2588fa225cbcSrjs ;; 2589fa225cbcSrjs esac 2590fa225cbcSrjs $ECHO "$win32_libid_type" 2591fa225cbcSrjs} 2592fa225cbcSrjs 2593fa225cbcSrjs 2594fa225cbcSrjs 2595fa225cbcSrjs# func_extract_an_archive dir oldlib 2596fa225cbcSrjsfunc_extract_an_archive () 2597fa225cbcSrjs{ 2598fa225cbcSrjs $opt_debug 2599fa225cbcSrjs f_ex_an_ar_dir="$1"; shift 2600fa225cbcSrjs f_ex_an_ar_oldlib="$1" 2601fa225cbcSrjs func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' 2602fa225cbcSrjs if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 2603fa225cbcSrjs : 2604fa225cbcSrjs else 2605fa225cbcSrjs func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 2606fa225cbcSrjs fi 2607fa225cbcSrjs} 2608fa225cbcSrjs 2609fa225cbcSrjs 2610fa225cbcSrjs# func_extract_archives gentop oldlib ... 2611fa225cbcSrjsfunc_extract_archives () 2612fa225cbcSrjs{ 2613fa225cbcSrjs $opt_debug 2614fa225cbcSrjs my_gentop="$1"; shift 2615fa225cbcSrjs my_oldlibs=${1+"$@"} 2616fa225cbcSrjs my_oldobjs="" 2617fa225cbcSrjs my_xlib="" 2618fa225cbcSrjs my_xabs="" 2619fa225cbcSrjs my_xdir="" 2620fa225cbcSrjs 2621fa225cbcSrjs for my_xlib in $my_oldlibs; do 2622fa225cbcSrjs # Extract the objects. 2623fa225cbcSrjs case $my_xlib in 2624fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 2625fa225cbcSrjs *) my_xabs=`pwd`"/$my_xlib" ;; 2626fa225cbcSrjs esac 2627fa225cbcSrjs func_basename "$my_xlib" 2628fa225cbcSrjs my_xlib="$func_basename_result" 2629fa225cbcSrjs my_xlib_u=$my_xlib 2630fa225cbcSrjs while :; do 2631fa225cbcSrjs case " $extracted_archives " in 2632fa225cbcSrjs *" $my_xlib_u "*) 2633fa225cbcSrjs func_arith $extracted_serial + 1 2634fa225cbcSrjs extracted_serial=$func_arith_result 2635fa225cbcSrjs my_xlib_u=lt$extracted_serial-$my_xlib ;; 2636fa225cbcSrjs *) break ;; 2637fa225cbcSrjs esac 2638fa225cbcSrjs done 2639fa225cbcSrjs extracted_archives="$extracted_archives $my_xlib_u" 2640fa225cbcSrjs my_xdir="$my_gentop/$my_xlib_u" 2641fa225cbcSrjs 2642fa225cbcSrjs func_mkdir_p "$my_xdir" 2643fa225cbcSrjs 2644fa225cbcSrjs case $host in 2645fa225cbcSrjs *-darwin*) 2646fa225cbcSrjs func_verbose "Extracting $my_xabs" 2647fa225cbcSrjs # Do not bother doing anything if just a dry run 2648fa225cbcSrjs $opt_dry_run || { 2649fa225cbcSrjs darwin_orig_dir=`pwd` 2650fa225cbcSrjs cd $my_xdir || exit $? 2651fa225cbcSrjs darwin_archive=$my_xabs 2652fa225cbcSrjs darwin_curdir=`pwd` 2653fa225cbcSrjs darwin_base_archive=`basename "$darwin_archive"` 2654fa225cbcSrjs darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 2655fa225cbcSrjs if test -n "$darwin_arches"; then 2656fa225cbcSrjs darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 2657fa225cbcSrjs darwin_arch= 2658fa225cbcSrjs func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 2659fa225cbcSrjs for darwin_arch in $darwin_arches ; do 2660fa225cbcSrjs func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 2661fa225cbcSrjs $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 2662fa225cbcSrjs cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 2663fa225cbcSrjs func_extract_an_archive "`pwd`" "${darwin_base_archive}" 2664fa225cbcSrjs cd "$darwin_curdir" 2665fa225cbcSrjs $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 2666fa225cbcSrjs done # $darwin_arches 2667fa225cbcSrjs ## Okay now we've a bunch of thin objects, gotta fatten them up :) 2668fa225cbcSrjs darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 2669fa225cbcSrjs darwin_file= 2670fa225cbcSrjs darwin_files= 2671fa225cbcSrjs for darwin_file in $darwin_filelist; do 2672fa225cbcSrjs darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 2673fa225cbcSrjs $LIPO -create -output "$darwin_file" $darwin_files 2674fa225cbcSrjs done # $darwin_filelist 2675fa225cbcSrjs $RM -rf unfat-$$ 2676fa225cbcSrjs cd "$darwin_orig_dir" 2677fa225cbcSrjs else 2678fa225cbcSrjs cd $darwin_orig_dir 2679fa225cbcSrjs func_extract_an_archive "$my_xdir" "$my_xabs" 2680fa225cbcSrjs fi # $darwin_arches 2681fa225cbcSrjs } # !$opt_dry_run 2682fa225cbcSrjs ;; 2683fa225cbcSrjs *) 2684fa225cbcSrjs func_extract_an_archive "$my_xdir" "$my_xabs" 2685fa225cbcSrjs ;; 2686fa225cbcSrjs esac 2687fa225cbcSrjs my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 2688fa225cbcSrjs done 2689fa225cbcSrjs 2690fa225cbcSrjs func_extract_archives_result="$my_oldobjs" 2691fa225cbcSrjs} 2692fa225cbcSrjs 2693fa225cbcSrjs 2694fa225cbcSrjs 2695fa225cbcSrjs# func_emit_wrapper_part1 [arg=no] 2696fa225cbcSrjs# 2697fa225cbcSrjs# Emit the first part of a libtool wrapper script on stdout. 2698fa225cbcSrjs# For more information, see the description associated with 2699fa225cbcSrjs# func_emit_wrapper(), below. 2700fa225cbcSrjsfunc_emit_wrapper_part1 () 2701fa225cbcSrjs{ 2702fa225cbcSrjs func_emit_wrapper_part1_arg1=no 2703fa225cbcSrjs if test -n "$1" ; then 2704fa225cbcSrjs func_emit_wrapper_part1_arg1=$1 2705fa225cbcSrjs fi 2706fa225cbcSrjs 2707fa225cbcSrjs $ECHO "\ 2708fa225cbcSrjs#! $SHELL 2709fa225cbcSrjs 2710fa225cbcSrjs# $output - temporary wrapper script for $objdir/$outputname 2711fa225cbcSrjs# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 2712fa225cbcSrjs# 2713fa225cbcSrjs# The $output program cannot be directly executed until all the libtool 2714fa225cbcSrjs# libraries that it depends on are installed. 2715fa225cbcSrjs# 2716fa225cbcSrjs# This wrapper script should never be moved out of the build directory. 2717fa225cbcSrjs# If it is, it will not operate correctly. 2718fa225cbcSrjs 2719fa225cbcSrjs# Sed substitution that helps us do robust quoting. It backslashifies 2720fa225cbcSrjs# metacharacters that are still active within double-quoted strings. 2721fa225cbcSrjsXsed='${SED} -e 1s/^X//' 2722fa225cbcSrjssed_quote_subst='$sed_quote_subst' 2723fa225cbcSrjs 2724fa225cbcSrjs# Be Bourne compatible 2725fa225cbcSrjsif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 2726fa225cbcSrjs emulate sh 2727fa225cbcSrjs NULLCMD=: 2728fa225cbcSrjs # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 2729fa225cbcSrjs # is contrary to our usage. Disable this feature. 2730fa225cbcSrjs alias -g '\${1+\"\$@\"}'='\"\$@\"' 2731fa225cbcSrjs setopt NO_GLOB_SUBST 2732fa225cbcSrjselse 2733fa225cbcSrjs case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 2734fa225cbcSrjsfi 2735fa225cbcSrjsBIN_SH=xpg4; export BIN_SH # for Tru64 2736fa225cbcSrjsDUALCASE=1; export DUALCASE # for MKS sh 2737fa225cbcSrjs 2738fa225cbcSrjs# The HP-UX ksh and POSIX shell print the target directory to stdout 2739fa225cbcSrjs# if CDPATH is set. 2740fa225cbcSrjs(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 2741fa225cbcSrjs 2742fa225cbcSrjsrelink_command=\"$relink_command\" 2743fa225cbcSrjs 2744fa225cbcSrjs# This environment variable determines our operation mode. 2745fa225cbcSrjsif test \"\$libtool_install_magic\" = \"$magic\"; then 2746fa225cbcSrjs # install mode needs the following variables: 2747fa225cbcSrjs generated_by_libtool_version='$macro_version' 2748fa225cbcSrjs notinst_deplibs='$notinst_deplibs' 2749fa225cbcSrjselse 2750fa225cbcSrjs # When we are sourced in execute mode, \$file and \$ECHO are already set. 2751fa225cbcSrjs if test \"\$libtool_execute_magic\" != \"$magic\"; then 2752fa225cbcSrjs ECHO=\"$qecho\" 2753fa225cbcSrjs file=\"\$0\" 2754fa225cbcSrjs # Make sure echo works. 2755fa225cbcSrjs if test \"X\$1\" = X--no-reexec; then 2756fa225cbcSrjs # Discard the --no-reexec flag, and continue. 2757fa225cbcSrjs shift 2758fa225cbcSrjs elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then 2759fa225cbcSrjs # Yippee, \$ECHO works! 2760fa225cbcSrjs : 2761fa225cbcSrjs else 2762fa225cbcSrjs # Restart under the correct shell, and then maybe \$ECHO will work. 2763fa225cbcSrjs exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 2764fa225cbcSrjs fi 2765fa225cbcSrjs fi\ 2766fa225cbcSrjs" 2767fa225cbcSrjs $ECHO "\ 2768fa225cbcSrjs 2769fa225cbcSrjs # Find the directory that this script lives in. 2770fa225cbcSrjs thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 2771fa225cbcSrjs test \"x\$thisdir\" = \"x\$file\" && thisdir=. 2772fa225cbcSrjs 2773fa225cbcSrjs # Follow symbolic links until we get to the real thisdir. 2774fa225cbcSrjs file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 2775fa225cbcSrjs while test -n \"\$file\"; do 2776fa225cbcSrjs destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 2777fa225cbcSrjs 2778fa225cbcSrjs # If there was a directory component, then change thisdir. 2779fa225cbcSrjs if test \"x\$destdir\" != \"x\$file\"; then 2780fa225cbcSrjs case \"\$destdir\" in 2781fa225cbcSrjs [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 2782fa225cbcSrjs *) thisdir=\"\$thisdir/\$destdir\" ;; 2783fa225cbcSrjs esac 2784fa225cbcSrjs fi 2785fa225cbcSrjs 2786fa225cbcSrjs file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 2787fa225cbcSrjs file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 2788fa225cbcSrjs done 2789fa225cbcSrjs" 2790fa225cbcSrjs} 2791fa225cbcSrjs# end: func_emit_wrapper_part1 2792fa225cbcSrjs 2793fa225cbcSrjs# func_emit_wrapper_part2 [arg=no] 2794fa225cbcSrjs# 2795fa225cbcSrjs# Emit the second part of a libtool wrapper script on stdout. 2796fa225cbcSrjs# For more information, see the description associated with 2797fa225cbcSrjs# func_emit_wrapper(), below. 2798fa225cbcSrjsfunc_emit_wrapper_part2 () 2799fa225cbcSrjs{ 2800fa225cbcSrjs func_emit_wrapper_part2_arg1=no 2801fa225cbcSrjs if test -n "$1" ; then 2802fa225cbcSrjs func_emit_wrapper_part2_arg1=$1 2803fa225cbcSrjs fi 2804fa225cbcSrjs 2805fa225cbcSrjs $ECHO "\ 2806fa225cbcSrjs 2807fa225cbcSrjs # Usually 'no', except on cygwin/mingw when embedded into 2808fa225cbcSrjs # the cwrapper. 2809fa225cbcSrjs WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 2810fa225cbcSrjs if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 2811fa225cbcSrjs # special case for '.' 2812fa225cbcSrjs if test \"\$thisdir\" = \".\"; then 2813fa225cbcSrjs thisdir=\`pwd\` 2814fa225cbcSrjs fi 2815fa225cbcSrjs # remove .libs from thisdir 2816fa225cbcSrjs case \"\$thisdir\" in 2817fa225cbcSrjs *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; 2818fa225cbcSrjs $objdir ) thisdir=. ;; 2819fa225cbcSrjs esac 2820fa225cbcSrjs fi 2821fa225cbcSrjs 2822fa225cbcSrjs # Try to get the absolute directory name. 2823fa225cbcSrjs absdir=\`cd \"\$thisdir\" && pwd\` 2824fa225cbcSrjs test -n \"\$absdir\" && thisdir=\"\$absdir\" 2825fa225cbcSrjs" 2826fa225cbcSrjs 2827fa225cbcSrjs if test "$fast_install" = yes; then 2828fa225cbcSrjs $ECHO "\ 2829fa225cbcSrjs program=lt-'$outputname'$exeext 2830fa225cbcSrjs progdir=\"\$thisdir/$objdir\" 2831fa225cbcSrjs 2832fa225cbcSrjs if test ! -f \"\$progdir/\$program\" || 2833fa225cbcSrjs { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 2834fa225cbcSrjs test \"X\$file\" != \"X\$progdir/\$program\"; }; then 2835fa225cbcSrjs 2836fa225cbcSrjs file=\"\$\$-\$program\" 2837fa225cbcSrjs 2838fa225cbcSrjs if test ! -d \"\$progdir\"; then 2839fa225cbcSrjs $MKDIR \"\$progdir\" 2840fa225cbcSrjs else 2841fa225cbcSrjs $RM \"\$progdir/\$file\" 2842fa225cbcSrjs fi" 2843fa225cbcSrjs 2844fa225cbcSrjs $ECHO "\ 2845fa225cbcSrjs 2846fa225cbcSrjs # relink executable if necessary 2847fa225cbcSrjs if test -n \"\$relink_command\"; then 2848fa225cbcSrjs if relink_command_output=\`eval \$relink_command 2>&1\`; then : 2849fa225cbcSrjs else 2850fa225cbcSrjs $ECHO \"\$relink_command_output\" >&2 2851fa225cbcSrjs $RM \"\$progdir/\$file\" 2852fa225cbcSrjs exit 1 2853fa225cbcSrjs fi 2854fa225cbcSrjs fi 2855fa225cbcSrjs 2856fa225cbcSrjs $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 2857fa225cbcSrjs { $RM \"\$progdir/\$program\"; 2858fa225cbcSrjs $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 2859fa225cbcSrjs $RM \"\$progdir/\$file\" 2860fa225cbcSrjs fi" 2861fa225cbcSrjs else 2862fa225cbcSrjs $ECHO "\ 2863fa225cbcSrjs program='$outputname' 2864fa225cbcSrjs progdir=\"\$thisdir/$objdir\" 2865fa225cbcSrjs" 2866fa225cbcSrjs fi 2867fa225cbcSrjs 2868fa225cbcSrjs $ECHO "\ 2869fa225cbcSrjs 2870fa225cbcSrjs if test -f \"\$progdir/\$program\"; then" 2871fa225cbcSrjs 2872fa225cbcSrjs # Export our shlibpath_var if we have one. 2873fa225cbcSrjs if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 2874fa225cbcSrjs $ECHO "\ 2875fa225cbcSrjs # Add our own library path to $shlibpath_var 2876fa225cbcSrjs $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 2877fa225cbcSrjs 2878fa225cbcSrjs # Some systems cannot cope with colon-terminated $shlibpath_var 2879fa225cbcSrjs # The second colon is a workaround for a bug in BeOS R4 sed 2880fa225cbcSrjs $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 2881fa225cbcSrjs 2882fa225cbcSrjs export $shlibpath_var 2883fa225cbcSrjs" 2884fa225cbcSrjs fi 2885fa225cbcSrjs 2886fa225cbcSrjs # fixup the dll searchpath if we need to. 2887fa225cbcSrjs if test -n "$dllsearchpath"; then 2888fa225cbcSrjs $ECHO "\ 2889fa225cbcSrjs # Add the dll search path components to the executable PATH 2890fa225cbcSrjs PATH=$dllsearchpath:\$PATH 2891fa225cbcSrjs" 2892fa225cbcSrjs fi 2893fa225cbcSrjs 2894fa225cbcSrjs $ECHO "\ 2895fa225cbcSrjs if test \"\$libtool_execute_magic\" != \"$magic\"; then 2896fa225cbcSrjs # Run the actual program with our arguments. 2897fa225cbcSrjs" 2898fa225cbcSrjs case $host in 2899fa225cbcSrjs # Backslashes separate directories on plain windows 2900fa225cbcSrjs *-*-mingw | *-*-os2* | *-cegcc*) 2901fa225cbcSrjs $ECHO "\ 2902fa225cbcSrjs exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 2903fa225cbcSrjs" 2904fa225cbcSrjs ;; 2905fa225cbcSrjs 2906fa225cbcSrjs *) 2907fa225cbcSrjs $ECHO "\ 2908fa225cbcSrjs exec \"\$progdir/\$program\" \${1+\"\$@\"} 2909fa225cbcSrjs" 2910fa225cbcSrjs ;; 2911fa225cbcSrjs esac 2912fa225cbcSrjs $ECHO "\ 2913fa225cbcSrjs \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 2914fa225cbcSrjs exit 1 2915fa225cbcSrjs fi 2916fa225cbcSrjs else 2917fa225cbcSrjs # The program doesn't exist. 2918fa225cbcSrjs \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 2919fa225cbcSrjs \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 2920fa225cbcSrjs $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 2921fa225cbcSrjs exit 1 2922fa225cbcSrjs fi 2923fa225cbcSrjsfi\ 2924fa225cbcSrjs" 2925fa225cbcSrjs} 2926fa225cbcSrjs# end: func_emit_wrapper_part2 2927fa225cbcSrjs 2928fa225cbcSrjs 2929fa225cbcSrjs# func_emit_wrapper [arg=no] 2930fa225cbcSrjs# 2931fa225cbcSrjs# Emit a libtool wrapper script on stdout. 2932fa225cbcSrjs# Don't directly open a file because we may want to 2933fa225cbcSrjs# incorporate the script contents within a cygwin/mingw 2934fa225cbcSrjs# wrapper executable. Must ONLY be called from within 2935fa225cbcSrjs# func_mode_link because it depends on a number of variables 2936fa225cbcSrjs# set therein. 2937fa225cbcSrjs# 2938fa225cbcSrjs# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 2939fa225cbcSrjs# variable will take. If 'yes', then the emitted script 2940fa225cbcSrjs# will assume that the directory in which it is stored is 2941fa225cbcSrjs# the $objdir directory. This is a cygwin/mingw-specific 2942fa225cbcSrjs# behavior. 2943fa225cbcSrjsfunc_emit_wrapper () 2944fa225cbcSrjs{ 2945fa225cbcSrjs func_emit_wrapper_arg1=no 2946fa225cbcSrjs if test -n "$1" ; then 2947fa225cbcSrjs func_emit_wrapper_arg1=$1 2948fa225cbcSrjs fi 2949fa225cbcSrjs 2950fa225cbcSrjs # split this up so that func_emit_cwrapperexe_src 2951fa225cbcSrjs # can call each part independently. 2952fa225cbcSrjs func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" 2953fa225cbcSrjs func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" 2954fa225cbcSrjs} 2955fa225cbcSrjs 2956fa225cbcSrjs 2957fa225cbcSrjs# func_to_host_path arg 2958fa225cbcSrjs# 2959fa225cbcSrjs# Convert paths to host format when used with build tools. 2960fa225cbcSrjs# Intended for use with "native" mingw (where libtool itself 2961fa225cbcSrjs# is running under the msys shell), or in the following cross- 2962fa225cbcSrjs# build environments: 2963fa225cbcSrjs# $build $host 2964fa225cbcSrjs# mingw (msys) mingw [e.g. native] 2965fa225cbcSrjs# cygwin mingw 2966fa225cbcSrjs# *nix + wine mingw 2967fa225cbcSrjs# where wine is equipped with the `winepath' executable. 2968fa225cbcSrjs# In the native mingw case, the (msys) shell automatically 2969fa225cbcSrjs# converts paths for any non-msys applications it launches, 2970fa225cbcSrjs# but that facility isn't available from inside the cwrapper. 2971fa225cbcSrjs# Similar accommodations are necessary for $host mingw and 2972fa225cbcSrjs# $build cygwin. Calling this function does no harm for other 2973fa225cbcSrjs# $host/$build combinations not listed above. 2974fa225cbcSrjs# 2975fa225cbcSrjs# ARG is the path (on $build) that should be converted to 2976fa225cbcSrjs# the proper representation for $host. The result is stored 2977fa225cbcSrjs# in $func_to_host_path_result. 2978fa225cbcSrjsfunc_to_host_path () 2979fa225cbcSrjs{ 2980fa225cbcSrjs func_to_host_path_result="$1" 2981fa225cbcSrjs if test -n "$1" ; then 2982fa225cbcSrjs case $host in 2983fa225cbcSrjs *mingw* ) 2984fa225cbcSrjs lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 2985fa225cbcSrjs case $build in 2986fa225cbcSrjs *mingw* ) # actually, msys 2987fa225cbcSrjs # awkward: cmd appends spaces to result 2988fa225cbcSrjs lt_sed_strip_trailing_spaces="s/[ ]*\$//" 2989fa225cbcSrjs func_to_host_path_tmp1=`( cmd //c echo "$1" |\ 2990fa225cbcSrjs $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 2991fa225cbcSrjs func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 2992fa225cbcSrjs $SED -e "$lt_sed_naive_backslashify"` 2993fa225cbcSrjs ;; 2994fa225cbcSrjs *cygwin* ) 2995fa225cbcSrjs func_to_host_path_tmp1=`cygpath -w "$1"` 2996fa225cbcSrjs func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 2997fa225cbcSrjs $SED -e "$lt_sed_naive_backslashify"` 2998fa225cbcSrjs ;; 2999fa225cbcSrjs * ) 3000fa225cbcSrjs # Unfortunately, winepath does not exit with a non-zero 3001fa225cbcSrjs # error code, so we are forced to check the contents of 3002fa225cbcSrjs # stdout. On the other hand, if the command is not 3003fa225cbcSrjs # found, the shell will set an exit code of 127 and print 3004fa225cbcSrjs # *an error message* to stdout. So we must check for both 3005fa225cbcSrjs # error code of zero AND non-empty stdout, which explains 3006fa225cbcSrjs # the odd construction: 3007fa225cbcSrjs func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` 3008fa225cbcSrjs if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then 3009fa225cbcSrjs func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 3010fa225cbcSrjs $SED -e "$lt_sed_naive_backslashify"` 3011fa225cbcSrjs else 3012fa225cbcSrjs # Allow warning below. 3013fa225cbcSrjs func_to_host_path_result="" 3014fa225cbcSrjs fi 3015fa225cbcSrjs ;; 3016fa225cbcSrjs esac 3017fa225cbcSrjs if test -z "$func_to_host_path_result" ; then 3018fa225cbcSrjs func_error "Could not determine host path corresponding to" 3019fa225cbcSrjs func_error " '$1'" 3020fa225cbcSrjs func_error "Continuing, but uninstalled executables may not work." 3021fa225cbcSrjs # Fallback: 3022fa225cbcSrjs func_to_host_path_result="$1" 3023fa225cbcSrjs fi 3024fa225cbcSrjs ;; 3025fa225cbcSrjs esac 3026fa225cbcSrjs fi 3027fa225cbcSrjs} 3028fa225cbcSrjs# end: func_to_host_path 3029fa225cbcSrjs 3030fa225cbcSrjs# func_to_host_pathlist arg 3031fa225cbcSrjs# 3032fa225cbcSrjs# Convert pathlists to host format when used with build tools. 3033fa225cbcSrjs# See func_to_host_path(), above. This function supports the 3034fa225cbcSrjs# following $build/$host combinations (but does no harm for 3035fa225cbcSrjs# combinations not listed here): 3036fa225cbcSrjs# $build $host 3037fa225cbcSrjs# mingw (msys) mingw [e.g. native] 3038fa225cbcSrjs# cygwin mingw 3039fa225cbcSrjs# *nix + wine mingw 3040fa225cbcSrjs# 3041fa225cbcSrjs# Path separators are also converted from $build format to 3042fa225cbcSrjs# $host format. If ARG begins or ends with a path separator 3043fa225cbcSrjs# character, it is preserved (but converted to $host format) 3044fa225cbcSrjs# on output. 3045fa225cbcSrjs# 3046fa225cbcSrjs# ARG is a pathlist (on $build) that should be converted to 3047fa225cbcSrjs# the proper representation on $host. The result is stored 3048fa225cbcSrjs# in $func_to_host_pathlist_result. 3049fa225cbcSrjsfunc_to_host_pathlist () 3050fa225cbcSrjs{ 3051fa225cbcSrjs func_to_host_pathlist_result="$1" 3052fa225cbcSrjs if test -n "$1" ; then 3053fa225cbcSrjs case $host in 3054fa225cbcSrjs *mingw* ) 3055fa225cbcSrjs lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 3056fa225cbcSrjs # Remove leading and trailing path separator characters from 3057fa225cbcSrjs # ARG. msys behavior is inconsistent here, cygpath turns them 3058fa225cbcSrjs # into '.;' and ';.', and winepath ignores them completely. 3059fa225cbcSrjs func_to_host_pathlist_tmp2="$1" 3060fa225cbcSrjs # Once set for this call, this variable should not be 3061fa225cbcSrjs # reassigned. It is used in tha fallback case. 3062fa225cbcSrjs func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ 3063fa225cbcSrjs $SED -e 's|^:*||' -e 's|:*$||'` 3064fa225cbcSrjs case $build in 3065fa225cbcSrjs *mingw* ) # Actually, msys. 3066fa225cbcSrjs # Awkward: cmd appends spaces to result. 3067fa225cbcSrjs lt_sed_strip_trailing_spaces="s/[ ]*\$//" 3068fa225cbcSrjs func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ 3069fa225cbcSrjs $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 3070fa225cbcSrjs func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 3071fa225cbcSrjs $SED -e "$lt_sed_naive_backslashify"` 3072fa225cbcSrjs ;; 3073fa225cbcSrjs *cygwin* ) 3074fa225cbcSrjs func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` 3075fa225cbcSrjs func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 3076fa225cbcSrjs $SED -e "$lt_sed_naive_backslashify"` 3077fa225cbcSrjs ;; 3078fa225cbcSrjs * ) 3079fa225cbcSrjs # unfortunately, winepath doesn't convert pathlists 3080fa225cbcSrjs func_to_host_pathlist_result="" 3081fa225cbcSrjs func_to_host_pathlist_oldIFS=$IFS 3082fa225cbcSrjs IFS=: 3083fa225cbcSrjs for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do 3084fa225cbcSrjs IFS=$func_to_host_pathlist_oldIFS 3085fa225cbcSrjs if test -n "$func_to_host_pathlist_f" ; then 3086fa225cbcSrjs func_to_host_path "$func_to_host_pathlist_f" 3087fa225cbcSrjs if test -n "$func_to_host_path_result" ; then 3088fa225cbcSrjs if test -z "$func_to_host_pathlist_result" ; then 3089fa225cbcSrjs func_to_host_pathlist_result="$func_to_host_path_result" 3090fa225cbcSrjs else 3091fa225cbcSrjs func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" 3092fa225cbcSrjs fi 3093fa225cbcSrjs fi 3094fa225cbcSrjs fi 3095fa225cbcSrjs IFS=: 3096fa225cbcSrjs done 3097fa225cbcSrjs IFS=$func_to_host_pathlist_oldIFS 3098fa225cbcSrjs ;; 3099fa225cbcSrjs esac 3100fa225cbcSrjs if test -z "$func_to_host_pathlist_result" ; then 3101fa225cbcSrjs func_error "Could not determine the host path(s) corresponding to" 3102fa225cbcSrjs func_error " '$1'" 3103fa225cbcSrjs func_error "Continuing, but uninstalled executables may not work." 3104fa225cbcSrjs # Fallback. This may break if $1 contains DOS-style drive 3105fa225cbcSrjs # specifications. The fix is not to complicate the expression 3106fa225cbcSrjs # below, but for the user to provide a working wine installation 3107fa225cbcSrjs # with winepath so that path translation in the cross-to-mingw 3108fa225cbcSrjs # case works properly. 3109fa225cbcSrjs lt_replace_pathsep_nix_to_dos="s|:|;|g" 3110fa225cbcSrjs func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ 3111fa225cbcSrjs $SED -e "$lt_replace_pathsep_nix_to_dos"` 3112fa225cbcSrjs fi 3113fa225cbcSrjs # Now, add the leading and trailing path separators back 3114fa225cbcSrjs case "$1" in 3115fa225cbcSrjs :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" 3116fa225cbcSrjs ;; 3117fa225cbcSrjs esac 3118fa225cbcSrjs case "$1" in 3119fa225cbcSrjs *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" 3120fa225cbcSrjs ;; 3121fa225cbcSrjs esac 3122fa225cbcSrjs ;; 3123fa225cbcSrjs esac 3124fa225cbcSrjs fi 3125fa225cbcSrjs} 3126fa225cbcSrjs# end: func_to_host_pathlist 3127fa225cbcSrjs 3128fa225cbcSrjs# func_emit_cwrapperexe_src 3129fa225cbcSrjs# emit the source code for a wrapper executable on stdout 3130fa225cbcSrjs# Must ONLY be called from within func_mode_link because 3131fa225cbcSrjs# it depends on a number of variable set therein. 3132fa225cbcSrjsfunc_emit_cwrapperexe_src () 3133fa225cbcSrjs{ 3134fa225cbcSrjs cat <<EOF 3135fa225cbcSrjs 3136fa225cbcSrjs/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 3137fa225cbcSrjs Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3138fa225cbcSrjs 3139fa225cbcSrjs The $output program cannot be directly executed until all the libtool 3140fa225cbcSrjs libraries that it depends on are installed. 3141fa225cbcSrjs 3142fa225cbcSrjs This wrapper executable should never be moved out of the build directory. 3143fa225cbcSrjs If it is, it will not operate correctly. 3144fa225cbcSrjs 3145fa225cbcSrjs Currently, it simply execs the wrapper *script* "$SHELL $output", 3146fa225cbcSrjs but could eventually absorb all of the scripts functionality and 3147fa225cbcSrjs exec $objdir/$outputname directly. 3148fa225cbcSrjs*/ 3149fa225cbcSrjsEOF 3150fa225cbcSrjs cat <<"EOF" 3151fa225cbcSrjs#include <stdio.h> 3152fa225cbcSrjs#include <stdlib.h> 3153fa225cbcSrjs#ifdef _MSC_VER 3154fa225cbcSrjs# include <direct.h> 3155fa225cbcSrjs# include <process.h> 3156fa225cbcSrjs# include <io.h> 3157fa225cbcSrjs# define setmode _setmode 3158fa225cbcSrjs#else 3159fa225cbcSrjs# include <unistd.h> 3160fa225cbcSrjs# include <stdint.h> 3161fa225cbcSrjs# ifdef __CYGWIN__ 3162fa225cbcSrjs# include <io.h> 3163fa225cbcSrjs# define HAVE_SETENV 3164fa225cbcSrjs# ifdef __STRICT_ANSI__ 3165fa225cbcSrjschar *realpath (const char *, char *); 3166fa225cbcSrjsint putenv (char *); 3167fa225cbcSrjsint setenv (const char *, const char *, int); 3168fa225cbcSrjs# endif 3169fa225cbcSrjs# endif 3170fa225cbcSrjs#endif 3171fa225cbcSrjs#include <malloc.h> 3172fa225cbcSrjs#include <stdarg.h> 3173fa225cbcSrjs#include <assert.h> 3174fa225cbcSrjs#include <string.h> 3175fa225cbcSrjs#include <ctype.h> 3176fa225cbcSrjs#include <errno.h> 3177fa225cbcSrjs#include <fcntl.h> 3178fa225cbcSrjs#include <sys/stat.h> 3179fa225cbcSrjs 3180fa225cbcSrjs#if defined(PATH_MAX) 3181fa225cbcSrjs# define LT_PATHMAX PATH_MAX 3182fa225cbcSrjs#elif defined(MAXPATHLEN) 3183fa225cbcSrjs# define LT_PATHMAX MAXPATHLEN 3184fa225cbcSrjs#else 3185fa225cbcSrjs# define LT_PATHMAX 1024 3186fa225cbcSrjs#endif 3187fa225cbcSrjs 3188fa225cbcSrjs#ifndef S_IXOTH 3189fa225cbcSrjs# define S_IXOTH 0 3190fa225cbcSrjs#endif 3191fa225cbcSrjs#ifndef S_IXGRP 3192fa225cbcSrjs# define S_IXGRP 0 3193fa225cbcSrjs#endif 3194fa225cbcSrjs 3195fa225cbcSrjs#ifdef _MSC_VER 3196fa225cbcSrjs# define S_IXUSR _S_IEXEC 3197fa225cbcSrjs# define stat _stat 3198fa225cbcSrjs# ifndef _INTPTR_T_DEFINED 3199fa225cbcSrjs# define intptr_t int 3200fa225cbcSrjs# endif 3201fa225cbcSrjs#endif 3202fa225cbcSrjs 3203fa225cbcSrjs#ifndef DIR_SEPARATOR 3204fa225cbcSrjs# define DIR_SEPARATOR '/' 3205fa225cbcSrjs# define PATH_SEPARATOR ':' 3206fa225cbcSrjs#endif 3207fa225cbcSrjs 3208fa225cbcSrjs#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 3209fa225cbcSrjs defined (__OS2__) 3210fa225cbcSrjs# define HAVE_DOS_BASED_FILE_SYSTEM 3211fa225cbcSrjs# define FOPEN_WB "wb" 3212fa225cbcSrjs# ifndef DIR_SEPARATOR_2 3213fa225cbcSrjs# define DIR_SEPARATOR_2 '\\' 3214fa225cbcSrjs# endif 3215fa225cbcSrjs# ifndef PATH_SEPARATOR_2 3216fa225cbcSrjs# define PATH_SEPARATOR_2 ';' 3217fa225cbcSrjs# endif 3218fa225cbcSrjs#endif 3219fa225cbcSrjs 3220fa225cbcSrjs#ifndef DIR_SEPARATOR_2 3221fa225cbcSrjs# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 3222fa225cbcSrjs#else /* DIR_SEPARATOR_2 */ 3223fa225cbcSrjs# define IS_DIR_SEPARATOR(ch) \ 3224fa225cbcSrjs (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 3225fa225cbcSrjs#endif /* DIR_SEPARATOR_2 */ 3226fa225cbcSrjs 3227fa225cbcSrjs#ifndef PATH_SEPARATOR_2 3228fa225cbcSrjs# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 3229fa225cbcSrjs#else /* PATH_SEPARATOR_2 */ 3230fa225cbcSrjs# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 3231fa225cbcSrjs#endif /* PATH_SEPARATOR_2 */ 3232fa225cbcSrjs 3233fa225cbcSrjs#ifdef __CYGWIN__ 3234fa225cbcSrjs# define FOPEN_WB "wb" 3235fa225cbcSrjs#endif 3236fa225cbcSrjs 3237fa225cbcSrjs#ifndef FOPEN_WB 3238fa225cbcSrjs# define FOPEN_WB "w" 3239fa225cbcSrjs#endif 3240fa225cbcSrjs#ifndef _O_BINARY 3241fa225cbcSrjs# define _O_BINARY 0 3242fa225cbcSrjs#endif 3243fa225cbcSrjs 3244fa225cbcSrjs#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 3245fa225cbcSrjs#define XFREE(stale) do { \ 3246fa225cbcSrjs if (stale) { free ((void *) stale); stale = 0; } \ 3247fa225cbcSrjs} while (0) 3248fa225cbcSrjs 3249fa225cbcSrjs#undef LTWRAPPER_DEBUGPRINTF 3250fa225cbcSrjs#if defined DEBUGWRAPPER 3251fa225cbcSrjs# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args 3252fa225cbcSrjsstatic void 3253fa225cbcSrjsltwrapper_debugprintf (const char *fmt, ...) 3254fa225cbcSrjs{ 3255fa225cbcSrjs va_list args; 3256fa225cbcSrjs va_start (args, fmt); 3257fa225cbcSrjs (void) vfprintf (stderr, fmt, args); 3258fa225cbcSrjs va_end (args); 3259fa225cbcSrjs} 3260fa225cbcSrjs#else 3261fa225cbcSrjs# define LTWRAPPER_DEBUGPRINTF(args) 3262fa225cbcSrjs#endif 3263fa225cbcSrjs 3264fa225cbcSrjsconst char *program_name = NULL; 3265fa225cbcSrjs 3266fa225cbcSrjsvoid *xmalloc (size_t num); 3267fa225cbcSrjschar *xstrdup (const char *string); 3268fa225cbcSrjsconst char *base_name (const char *name); 3269fa225cbcSrjschar *find_executable (const char *wrapper); 3270fa225cbcSrjschar *chase_symlinks (const char *pathspec); 3271fa225cbcSrjsint make_executable (const char *path); 3272fa225cbcSrjsint check_executable (const char *path); 3273fa225cbcSrjschar *strendzap (char *str, const char *pat); 3274fa225cbcSrjsvoid lt_fatal (const char *message, ...); 3275fa225cbcSrjsvoid lt_setenv (const char *name, const char *value); 3276fa225cbcSrjschar *lt_extend_str (const char *orig_value, const char *add, int to_end); 3277fa225cbcSrjsvoid lt_opt_process_env_set (const char *arg); 3278fa225cbcSrjsvoid lt_opt_process_env_prepend (const char *arg); 3279fa225cbcSrjsvoid lt_opt_process_env_append (const char *arg); 3280fa225cbcSrjsint lt_split_name_value (const char *arg, char** name, char** value); 3281fa225cbcSrjsvoid lt_update_exe_path (const char *name, const char *value); 3282fa225cbcSrjsvoid lt_update_lib_path (const char *name, const char *value); 3283fa225cbcSrjs 3284fa225cbcSrjsstatic const char *script_text_part1 = 3285fa225cbcSrjsEOF 3286fa225cbcSrjs 3287fa225cbcSrjs func_emit_wrapper_part1 yes | 3288fa225cbcSrjs $SED -e 's/\([\\"]\)/\\\1/g' \ 3289fa225cbcSrjs -e 's/^/ "/' -e 's/$/\\n"/' 3290fa225cbcSrjs echo ";" 3291fa225cbcSrjs cat <<EOF 3292fa225cbcSrjs 3293fa225cbcSrjsstatic const char *script_text_part2 = 3294fa225cbcSrjsEOF 3295fa225cbcSrjs func_emit_wrapper_part2 yes | 3296fa225cbcSrjs $SED -e 's/\([\\"]\)/\\\1/g' \ 3297fa225cbcSrjs -e 's/^/ "/' -e 's/$/\\n"/' 3298fa225cbcSrjs echo ";" 3299fa225cbcSrjs 3300fa225cbcSrjs cat <<EOF 3301fa225cbcSrjsconst char * MAGIC_EXE = "$magic_exe"; 3302fa225cbcSrjsconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 3303fa225cbcSrjsEOF 3304fa225cbcSrjs 3305fa225cbcSrjs if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 3306fa225cbcSrjs func_to_host_pathlist "$temp_rpath" 3307fa225cbcSrjs cat <<EOF 3308fa225cbcSrjsconst char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; 3309fa225cbcSrjsEOF 3310fa225cbcSrjs else 3311fa225cbcSrjs cat <<"EOF" 3312fa225cbcSrjsconst char * LIB_PATH_VALUE = ""; 3313fa225cbcSrjsEOF 3314fa225cbcSrjs fi 3315fa225cbcSrjs 3316fa225cbcSrjs if test -n "$dllsearchpath"; then 3317fa225cbcSrjs func_to_host_pathlist "$dllsearchpath:" 3318fa225cbcSrjs cat <<EOF 3319fa225cbcSrjsconst char * EXE_PATH_VARNAME = "PATH"; 3320fa225cbcSrjsconst char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; 3321fa225cbcSrjsEOF 3322fa225cbcSrjs else 3323fa225cbcSrjs cat <<"EOF" 3324fa225cbcSrjsconst char * EXE_PATH_VARNAME = ""; 3325fa225cbcSrjsconst char * EXE_PATH_VALUE = ""; 3326fa225cbcSrjsEOF 3327fa225cbcSrjs fi 3328fa225cbcSrjs 3329fa225cbcSrjs if test "$fast_install" = yes; then 3330fa225cbcSrjs cat <<EOF 3331fa225cbcSrjsconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 3332fa225cbcSrjsEOF 3333fa225cbcSrjs else 3334fa225cbcSrjs cat <<EOF 3335fa225cbcSrjsconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 3336fa225cbcSrjsEOF 3337fa225cbcSrjs fi 3338fa225cbcSrjs 3339fa225cbcSrjs 3340fa225cbcSrjs cat <<"EOF" 3341fa225cbcSrjs 3342fa225cbcSrjs#define LTWRAPPER_OPTION_PREFIX "--lt-" 3343fa225cbcSrjs#define LTWRAPPER_OPTION_PREFIX_LENGTH 5 3344fa225cbcSrjs 3345fa225cbcSrjsstatic const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; 3346fa225cbcSrjsstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 3347fa225cbcSrjs 3348fa225cbcSrjsstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 3349fa225cbcSrjs 3350fa225cbcSrjsstatic const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7; 3351fa225cbcSrjsstatic const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set"; 3352fa225cbcSrjs /* argument is putenv-style "foo=bar", value of foo is set to bar */ 3353fa225cbcSrjs 3354fa225cbcSrjsstatic const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11; 3355fa225cbcSrjsstatic const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend"; 3356fa225cbcSrjs /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */ 3357fa225cbcSrjs 3358fa225cbcSrjsstatic const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10; 3359fa225cbcSrjsstatic const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append"; 3360fa225cbcSrjs /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */ 3361fa225cbcSrjs 3362fa225cbcSrjsint 3363fa225cbcSrjsmain (int argc, char *argv[]) 3364fa225cbcSrjs{ 3365fa225cbcSrjs char **newargz; 3366fa225cbcSrjs int newargc; 3367fa225cbcSrjs char *tmp_pathspec; 3368fa225cbcSrjs char *actual_cwrapper_path; 3369fa225cbcSrjs char *actual_cwrapper_name; 3370fa225cbcSrjs char *target_name; 3371fa225cbcSrjs char *lt_argv_zero; 3372fa225cbcSrjs intptr_t rval = 127; 3373fa225cbcSrjs 3374fa225cbcSrjs int i; 3375fa225cbcSrjs 3376fa225cbcSrjs program_name = (char *) xstrdup (base_name (argv[0])); 3377fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); 3378fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); 3379fa225cbcSrjs 3380fa225cbcSrjs /* very simple arg parsing; don't want to rely on getopt */ 3381fa225cbcSrjs for (i = 1; i < argc; i++) 3382fa225cbcSrjs { 3383fa225cbcSrjs if (strcmp (argv[i], dumpscript_opt) == 0) 3384fa225cbcSrjs { 3385fa225cbcSrjsEOF 3386fa225cbcSrjs case "$host" in 3387fa225cbcSrjs *mingw* | *cygwin* ) 3388fa225cbcSrjs # make stdout use "unix" line endings 3389fa225cbcSrjs echo " setmode(1,_O_BINARY);" 3390fa225cbcSrjs ;; 3391fa225cbcSrjs esac 3392fa225cbcSrjs 3393fa225cbcSrjs cat <<"EOF" 3394fa225cbcSrjs printf ("%s", script_text_part1); 3395fa225cbcSrjs printf ("%s", script_text_part2); 3396fa225cbcSrjs return 0; 3397fa225cbcSrjs } 3398fa225cbcSrjs } 3399fa225cbcSrjs 3400fa225cbcSrjs newargz = XMALLOC (char *, argc + 1); 3401fa225cbcSrjs tmp_pathspec = find_executable (argv[0]); 3402fa225cbcSrjs if (tmp_pathspec == NULL) 3403fa225cbcSrjs lt_fatal ("Couldn't find %s", argv[0]); 3404fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", 3405fa225cbcSrjs tmp_pathspec)); 3406fa225cbcSrjs 3407fa225cbcSrjs actual_cwrapper_path = chase_symlinks (tmp_pathspec); 3408fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", 3409fa225cbcSrjs actual_cwrapper_path)); 3410fa225cbcSrjs XFREE (tmp_pathspec); 3411fa225cbcSrjs 3412fa225cbcSrjs actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path)); 3413fa225cbcSrjs strendzap (actual_cwrapper_path, actual_cwrapper_name); 3414fa225cbcSrjs 3415fa225cbcSrjs /* wrapper name transforms */ 3416fa225cbcSrjs strendzap (actual_cwrapper_name, ".exe"); 3417fa225cbcSrjs tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 3418fa225cbcSrjs XFREE (actual_cwrapper_name); 3419fa225cbcSrjs actual_cwrapper_name = tmp_pathspec; 3420fa225cbcSrjs tmp_pathspec = 0; 3421fa225cbcSrjs 3422fa225cbcSrjs /* target_name transforms -- use actual target program name; might have lt- prefix */ 3423fa225cbcSrjs target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 3424fa225cbcSrjs strendzap (target_name, ".exe"); 3425fa225cbcSrjs tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 3426fa225cbcSrjs XFREE (target_name); 3427fa225cbcSrjs target_name = tmp_pathspec; 3428fa225cbcSrjs tmp_pathspec = 0; 3429fa225cbcSrjs 3430fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n", 3431fa225cbcSrjs target_name)); 3432fa225cbcSrjsEOF 3433fa225cbcSrjs 3434fa225cbcSrjs cat <<EOF 3435fa225cbcSrjs newargz[0] = 3436fa225cbcSrjs XMALLOC (char, (strlen (actual_cwrapper_path) + 3437fa225cbcSrjs strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 3438fa225cbcSrjs strcpy (newargz[0], actual_cwrapper_path); 3439fa225cbcSrjs strcat (newargz[0], "$objdir"); 3440fa225cbcSrjs strcat (newargz[0], "/"); 3441fa225cbcSrjsEOF 3442fa225cbcSrjs 3443fa225cbcSrjs cat <<"EOF" 3444fa225cbcSrjs /* stop here, and copy so we don't have to do this twice */ 3445fa225cbcSrjs tmp_pathspec = xstrdup (newargz[0]); 3446fa225cbcSrjs 3447fa225cbcSrjs /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 3448fa225cbcSrjs strcat (newargz[0], actual_cwrapper_name); 3449fa225cbcSrjs 3450fa225cbcSrjs /* DO want the lt- prefix here if it exists, so use target_name */ 3451fa225cbcSrjs lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 3452fa225cbcSrjs XFREE (tmp_pathspec); 3453fa225cbcSrjs tmp_pathspec = NULL; 3454fa225cbcSrjsEOF 3455fa225cbcSrjs 3456fa225cbcSrjs case $host_os in 3457fa225cbcSrjs mingw*) 3458fa225cbcSrjs cat <<"EOF" 3459fa225cbcSrjs { 3460fa225cbcSrjs char* p; 3461fa225cbcSrjs while ((p = strchr (newargz[0], '\\')) != NULL) 3462fa225cbcSrjs { 3463fa225cbcSrjs *p = '/'; 3464fa225cbcSrjs } 3465fa225cbcSrjs while ((p = strchr (lt_argv_zero, '\\')) != NULL) 3466fa225cbcSrjs { 3467fa225cbcSrjs *p = '/'; 3468fa225cbcSrjs } 3469fa225cbcSrjs } 3470fa225cbcSrjsEOF 3471fa225cbcSrjs ;; 3472fa225cbcSrjs esac 3473fa225cbcSrjs 3474fa225cbcSrjs cat <<"EOF" 3475fa225cbcSrjs XFREE (target_name); 3476fa225cbcSrjs XFREE (actual_cwrapper_path); 3477fa225cbcSrjs XFREE (actual_cwrapper_name); 3478fa225cbcSrjs 3479fa225cbcSrjs lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 3480fa225cbcSrjs lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 3481fa225cbcSrjs lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 3482fa225cbcSrjs lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 3483fa225cbcSrjs 3484fa225cbcSrjs newargc=0; 3485fa225cbcSrjs for (i = 1; i < argc; i++) 3486fa225cbcSrjs { 3487fa225cbcSrjs if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0) 3488fa225cbcSrjs { 3489fa225cbcSrjs if (argv[i][env_set_opt_len] == '=') 3490fa225cbcSrjs { 3491fa225cbcSrjs const char *p = argv[i] + env_set_opt_len + 1; 3492fa225cbcSrjs lt_opt_process_env_set (p); 3493fa225cbcSrjs } 3494fa225cbcSrjs else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc) 3495fa225cbcSrjs { 3496fa225cbcSrjs lt_opt_process_env_set (argv[++i]); /* don't copy */ 3497fa225cbcSrjs } 3498fa225cbcSrjs else 3499fa225cbcSrjs lt_fatal ("%s missing required argument", env_set_opt); 3500fa225cbcSrjs continue; 3501fa225cbcSrjs } 3502fa225cbcSrjs if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0) 3503fa225cbcSrjs { 3504fa225cbcSrjs if (argv[i][env_prepend_opt_len] == '=') 3505fa225cbcSrjs { 3506fa225cbcSrjs const char *p = argv[i] + env_prepend_opt_len + 1; 3507fa225cbcSrjs lt_opt_process_env_prepend (p); 3508fa225cbcSrjs } 3509fa225cbcSrjs else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc) 3510fa225cbcSrjs { 3511fa225cbcSrjs lt_opt_process_env_prepend (argv[++i]); /* don't copy */ 3512fa225cbcSrjs } 3513fa225cbcSrjs else 3514fa225cbcSrjs lt_fatal ("%s missing required argument", env_prepend_opt); 3515fa225cbcSrjs continue; 3516fa225cbcSrjs } 3517fa225cbcSrjs if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0) 3518fa225cbcSrjs { 3519fa225cbcSrjs if (argv[i][env_append_opt_len] == '=') 3520fa225cbcSrjs { 3521fa225cbcSrjs const char *p = argv[i] + env_append_opt_len + 1; 3522fa225cbcSrjs lt_opt_process_env_append (p); 3523fa225cbcSrjs } 3524fa225cbcSrjs else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc) 3525fa225cbcSrjs { 3526fa225cbcSrjs lt_opt_process_env_append (argv[++i]); /* don't copy */ 3527fa225cbcSrjs } 3528fa225cbcSrjs else 3529fa225cbcSrjs lt_fatal ("%s missing required argument", env_append_opt); 3530fa225cbcSrjs continue; 3531fa225cbcSrjs } 3532fa225cbcSrjs if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) 3533fa225cbcSrjs { 3534fa225cbcSrjs /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 3535fa225cbcSrjs namespace, but it is not one of the ones we know about and 3536fa225cbcSrjs have already dealt with, above (inluding dump-script), then 3537fa225cbcSrjs report an error. Otherwise, targets might begin to believe 3538fa225cbcSrjs they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 3539fa225cbcSrjs namespace. The first time any user complains about this, we'll 3540fa225cbcSrjs need to make LTWRAPPER_OPTION_PREFIX a configure-time option 3541fa225cbcSrjs or a configure.ac-settable value. 3542fa225cbcSrjs */ 3543fa225cbcSrjs lt_fatal ("Unrecognized option in %s namespace: '%s'", 3544fa225cbcSrjs ltwrapper_option_prefix, argv[i]); 3545fa225cbcSrjs } 3546fa225cbcSrjs /* otherwise ... */ 3547fa225cbcSrjs newargz[++newargc] = xstrdup (argv[i]); 3548fa225cbcSrjs } 3549fa225cbcSrjs newargz[++newargc] = NULL; 3550fa225cbcSrjs 3551fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>"))); 3552fa225cbcSrjs for (i = 0; i < newargc; i++) 3553fa225cbcSrjs { 3554fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>"))); 3555fa225cbcSrjs } 3556fa225cbcSrjs 3557fa225cbcSrjsEOF 3558fa225cbcSrjs 3559fa225cbcSrjs case $host_os in 3560fa225cbcSrjs mingw*) 3561fa225cbcSrjs cat <<"EOF" 3562fa225cbcSrjs /* execv doesn't actually work on mingw as expected on unix */ 3563fa225cbcSrjs rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 3564fa225cbcSrjs if (rval == -1) 3565fa225cbcSrjs { 3566fa225cbcSrjs /* failed to start process */ 3567fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); 3568fa225cbcSrjs return 127; 3569fa225cbcSrjs } 3570fa225cbcSrjs return rval; 3571fa225cbcSrjsEOF 3572fa225cbcSrjs ;; 3573fa225cbcSrjs *) 3574fa225cbcSrjs cat <<"EOF" 3575fa225cbcSrjs execv (lt_argv_zero, newargz); 3576fa225cbcSrjs return rval; /* =127, but avoids unused variable warning */ 3577fa225cbcSrjsEOF 3578fa225cbcSrjs ;; 3579fa225cbcSrjs esac 3580fa225cbcSrjs 3581fa225cbcSrjs cat <<"EOF" 3582fa225cbcSrjs} 3583fa225cbcSrjs 3584fa225cbcSrjsvoid * 3585fa225cbcSrjsxmalloc (size_t num) 3586fa225cbcSrjs{ 3587fa225cbcSrjs void *p = (void *) malloc (num); 3588fa225cbcSrjs if (!p) 3589fa225cbcSrjs lt_fatal ("Memory exhausted"); 3590fa225cbcSrjs 3591fa225cbcSrjs return p; 3592fa225cbcSrjs} 3593fa225cbcSrjs 3594fa225cbcSrjschar * 3595fa225cbcSrjsxstrdup (const char *string) 3596fa225cbcSrjs{ 3597fa225cbcSrjs return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 3598fa225cbcSrjs string) : NULL; 3599fa225cbcSrjs} 3600fa225cbcSrjs 3601fa225cbcSrjsconst char * 3602fa225cbcSrjsbase_name (const char *name) 3603fa225cbcSrjs{ 3604fa225cbcSrjs const char *base; 3605fa225cbcSrjs 3606fa225cbcSrjs#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 3607fa225cbcSrjs /* Skip over the disk name in MSDOS pathnames. */ 3608fa225cbcSrjs if (isalpha ((unsigned char) name[0]) && name[1] == ':') 3609fa225cbcSrjs name += 2; 3610fa225cbcSrjs#endif 3611fa225cbcSrjs 3612fa225cbcSrjs for (base = name; *name; name++) 3613fa225cbcSrjs if (IS_DIR_SEPARATOR (*name)) 3614fa225cbcSrjs base = name + 1; 3615fa225cbcSrjs return base; 3616fa225cbcSrjs} 3617fa225cbcSrjs 3618fa225cbcSrjsint 3619fa225cbcSrjscheck_executable (const char *path) 3620fa225cbcSrjs{ 3621fa225cbcSrjs struct stat st; 3622fa225cbcSrjs 3623fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", 3624fa225cbcSrjs path ? (*path ? path : "EMPTY!") : "NULL!")); 3625fa225cbcSrjs if ((!path) || (!*path)) 3626fa225cbcSrjs return 0; 3627fa225cbcSrjs 3628fa225cbcSrjs if ((stat (path, &st) >= 0) 3629fa225cbcSrjs && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 3630fa225cbcSrjs return 1; 3631fa225cbcSrjs else 3632fa225cbcSrjs return 0; 3633fa225cbcSrjs} 3634fa225cbcSrjs 3635fa225cbcSrjsint 3636fa225cbcSrjsmake_executable (const char *path) 3637fa225cbcSrjs{ 3638fa225cbcSrjs int rval = 0; 3639fa225cbcSrjs struct stat st; 3640fa225cbcSrjs 3641fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", 3642fa225cbcSrjs path ? (*path ? path : "EMPTY!") : "NULL!")); 3643fa225cbcSrjs if ((!path) || (!*path)) 3644fa225cbcSrjs return 0; 3645fa225cbcSrjs 3646fa225cbcSrjs if (stat (path, &st) >= 0) 3647fa225cbcSrjs { 3648fa225cbcSrjs rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 3649fa225cbcSrjs } 3650fa225cbcSrjs return rval; 3651fa225cbcSrjs} 3652fa225cbcSrjs 3653fa225cbcSrjs/* Searches for the full path of the wrapper. Returns 3654fa225cbcSrjs newly allocated full path name if found, NULL otherwise 3655fa225cbcSrjs Does not chase symlinks, even on platforms that support them. 3656fa225cbcSrjs*/ 3657fa225cbcSrjschar * 3658fa225cbcSrjsfind_executable (const char *wrapper) 3659fa225cbcSrjs{ 3660fa225cbcSrjs int has_slash = 0; 3661fa225cbcSrjs const char *p; 3662fa225cbcSrjs const char *p_next; 3663fa225cbcSrjs /* static buffer for getcwd */ 3664fa225cbcSrjs char tmp[LT_PATHMAX + 1]; 3665fa225cbcSrjs int tmp_len; 3666fa225cbcSrjs char *concat_name; 3667fa225cbcSrjs 3668fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", 3669fa225cbcSrjs wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); 3670fa225cbcSrjs 3671fa225cbcSrjs if ((wrapper == NULL) || (*wrapper == '\0')) 3672fa225cbcSrjs return NULL; 3673fa225cbcSrjs 3674fa225cbcSrjs /* Absolute path? */ 3675fa225cbcSrjs#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 3676fa225cbcSrjs if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 3677fa225cbcSrjs { 3678fa225cbcSrjs concat_name = xstrdup (wrapper); 3679fa225cbcSrjs if (check_executable (concat_name)) 3680fa225cbcSrjs return concat_name; 3681fa225cbcSrjs XFREE (concat_name); 3682fa225cbcSrjs } 3683fa225cbcSrjs else 3684fa225cbcSrjs { 3685fa225cbcSrjs#endif 3686fa225cbcSrjs if (IS_DIR_SEPARATOR (wrapper[0])) 3687fa225cbcSrjs { 3688fa225cbcSrjs concat_name = xstrdup (wrapper); 3689fa225cbcSrjs if (check_executable (concat_name)) 3690fa225cbcSrjs return concat_name; 3691fa225cbcSrjs XFREE (concat_name); 3692fa225cbcSrjs } 3693fa225cbcSrjs#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 3694fa225cbcSrjs } 3695fa225cbcSrjs#endif 3696fa225cbcSrjs 3697fa225cbcSrjs for (p = wrapper; *p; p++) 3698fa225cbcSrjs if (*p == '/') 3699fa225cbcSrjs { 3700fa225cbcSrjs has_slash = 1; 3701fa225cbcSrjs break; 3702fa225cbcSrjs } 3703fa225cbcSrjs if (!has_slash) 3704fa225cbcSrjs { 3705fa225cbcSrjs /* no slashes; search PATH */ 3706fa225cbcSrjs const char *path = getenv ("PATH"); 3707fa225cbcSrjs if (path != NULL) 3708fa225cbcSrjs { 3709fa225cbcSrjs for (p = path; *p; p = p_next) 3710fa225cbcSrjs { 3711fa225cbcSrjs const char *q; 3712fa225cbcSrjs size_t p_len; 3713fa225cbcSrjs for (q = p; *q; q++) 3714fa225cbcSrjs if (IS_PATH_SEPARATOR (*q)) 3715fa225cbcSrjs break; 3716fa225cbcSrjs p_len = q - p; 3717fa225cbcSrjs p_next = (*q == '\0' ? q : q + 1); 3718fa225cbcSrjs if (p_len == 0) 3719fa225cbcSrjs { 3720fa225cbcSrjs /* empty path: current directory */ 3721fa225cbcSrjs if (getcwd (tmp, LT_PATHMAX) == NULL) 3722fa225cbcSrjs lt_fatal ("getcwd failed"); 3723fa225cbcSrjs tmp_len = strlen (tmp); 3724fa225cbcSrjs concat_name = 3725fa225cbcSrjs XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 3726fa225cbcSrjs memcpy (concat_name, tmp, tmp_len); 3727fa225cbcSrjs concat_name[tmp_len] = '/'; 3728fa225cbcSrjs strcpy (concat_name + tmp_len + 1, wrapper); 3729fa225cbcSrjs } 3730fa225cbcSrjs else 3731fa225cbcSrjs { 3732fa225cbcSrjs concat_name = 3733fa225cbcSrjs XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 3734fa225cbcSrjs memcpy (concat_name, p, p_len); 3735fa225cbcSrjs concat_name[p_len] = '/'; 3736fa225cbcSrjs strcpy (concat_name + p_len + 1, wrapper); 3737fa225cbcSrjs } 3738fa225cbcSrjs if (check_executable (concat_name)) 3739fa225cbcSrjs return concat_name; 3740fa225cbcSrjs XFREE (concat_name); 3741fa225cbcSrjs } 3742fa225cbcSrjs } 3743fa225cbcSrjs /* not found in PATH; assume curdir */ 3744fa225cbcSrjs } 3745fa225cbcSrjs /* Relative path | not found in path: prepend cwd */ 3746fa225cbcSrjs if (getcwd (tmp, LT_PATHMAX) == NULL) 3747fa225cbcSrjs lt_fatal ("getcwd failed"); 3748fa225cbcSrjs tmp_len = strlen (tmp); 3749fa225cbcSrjs concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 3750fa225cbcSrjs memcpy (concat_name, tmp, tmp_len); 3751fa225cbcSrjs concat_name[tmp_len] = '/'; 3752fa225cbcSrjs strcpy (concat_name + tmp_len + 1, wrapper); 3753fa225cbcSrjs 3754fa225cbcSrjs if (check_executable (concat_name)) 3755fa225cbcSrjs return concat_name; 3756fa225cbcSrjs XFREE (concat_name); 3757fa225cbcSrjs return NULL; 3758fa225cbcSrjs} 3759fa225cbcSrjs 3760fa225cbcSrjschar * 3761fa225cbcSrjschase_symlinks (const char *pathspec) 3762fa225cbcSrjs{ 3763fa225cbcSrjs#ifndef S_ISLNK 3764fa225cbcSrjs return xstrdup (pathspec); 3765fa225cbcSrjs#else 3766fa225cbcSrjs char buf[LT_PATHMAX]; 3767fa225cbcSrjs struct stat s; 3768fa225cbcSrjs char *tmp_pathspec = xstrdup (pathspec); 3769fa225cbcSrjs char *p; 3770fa225cbcSrjs int has_symlinks = 0; 3771fa225cbcSrjs while (strlen (tmp_pathspec) && !has_symlinks) 3772fa225cbcSrjs { 3773fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", 3774fa225cbcSrjs tmp_pathspec)); 3775fa225cbcSrjs if (lstat (tmp_pathspec, &s) == 0) 3776fa225cbcSrjs { 3777fa225cbcSrjs if (S_ISLNK (s.st_mode) != 0) 3778fa225cbcSrjs { 3779fa225cbcSrjs has_symlinks = 1; 3780fa225cbcSrjs break; 3781fa225cbcSrjs } 3782fa225cbcSrjs 3783fa225cbcSrjs /* search backwards for last DIR_SEPARATOR */ 3784fa225cbcSrjs p = tmp_pathspec + strlen (tmp_pathspec) - 1; 3785fa225cbcSrjs while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 3786fa225cbcSrjs p--; 3787fa225cbcSrjs if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 3788fa225cbcSrjs { 3789fa225cbcSrjs /* no more DIR_SEPARATORS left */ 3790fa225cbcSrjs break; 3791fa225cbcSrjs } 3792fa225cbcSrjs *p = '\0'; 3793fa225cbcSrjs } 3794fa225cbcSrjs else 3795fa225cbcSrjs { 3796fa225cbcSrjs char *errstr = strerror (errno); 3797fa225cbcSrjs lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); 3798fa225cbcSrjs } 3799fa225cbcSrjs } 3800fa225cbcSrjs XFREE (tmp_pathspec); 3801fa225cbcSrjs 3802fa225cbcSrjs if (!has_symlinks) 3803fa225cbcSrjs { 3804fa225cbcSrjs return xstrdup (pathspec); 3805fa225cbcSrjs } 3806fa225cbcSrjs 3807fa225cbcSrjs tmp_pathspec = realpath (pathspec, buf); 3808fa225cbcSrjs if (tmp_pathspec == 0) 3809fa225cbcSrjs { 3810fa225cbcSrjs lt_fatal ("Could not follow symlinks for %s", pathspec); 3811fa225cbcSrjs } 3812fa225cbcSrjs return xstrdup (tmp_pathspec); 3813fa225cbcSrjs#endif 3814fa225cbcSrjs} 3815fa225cbcSrjs 3816fa225cbcSrjschar * 3817fa225cbcSrjsstrendzap (char *str, const char *pat) 3818fa225cbcSrjs{ 3819fa225cbcSrjs size_t len, patlen; 3820fa225cbcSrjs 3821fa225cbcSrjs assert (str != NULL); 3822fa225cbcSrjs assert (pat != NULL); 3823fa225cbcSrjs 3824fa225cbcSrjs len = strlen (str); 3825fa225cbcSrjs patlen = strlen (pat); 3826fa225cbcSrjs 3827fa225cbcSrjs if (patlen <= len) 3828fa225cbcSrjs { 3829fa225cbcSrjs str += len - patlen; 3830fa225cbcSrjs if (strcmp (str, pat) == 0) 3831fa225cbcSrjs *str = '\0'; 3832fa225cbcSrjs } 3833fa225cbcSrjs return str; 3834fa225cbcSrjs} 3835fa225cbcSrjs 3836fa225cbcSrjsstatic void 3837fa225cbcSrjslt_error_core (int exit_status, const char *mode, 3838fa225cbcSrjs const char *message, va_list ap) 3839fa225cbcSrjs{ 3840fa225cbcSrjs fprintf (stderr, "%s: %s: ", program_name, mode); 3841fa225cbcSrjs vfprintf (stderr, message, ap); 3842fa225cbcSrjs fprintf (stderr, ".\n"); 3843fa225cbcSrjs 3844fa225cbcSrjs if (exit_status >= 0) 3845fa225cbcSrjs exit (exit_status); 3846fa225cbcSrjs} 3847fa225cbcSrjs 3848fa225cbcSrjsvoid 3849fa225cbcSrjslt_fatal (const char *message, ...) 3850fa225cbcSrjs{ 3851fa225cbcSrjs va_list ap; 3852fa225cbcSrjs va_start (ap, message); 3853fa225cbcSrjs lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 3854fa225cbcSrjs va_end (ap); 3855fa225cbcSrjs} 3856fa225cbcSrjs 3857fa225cbcSrjsvoid 3858fa225cbcSrjslt_setenv (const char *name, const char *value) 3859fa225cbcSrjs{ 3860fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", 3861fa225cbcSrjs (name ? name : "<NULL>"), 3862fa225cbcSrjs (value ? value : "<NULL>"))); 3863fa225cbcSrjs { 3864fa225cbcSrjs#ifdef HAVE_SETENV 3865fa225cbcSrjs /* always make a copy, for consistency with !HAVE_SETENV */ 3866fa225cbcSrjs char *str = xstrdup (value); 3867fa225cbcSrjs setenv (name, str, 1); 3868fa225cbcSrjs#else 3869fa225cbcSrjs int len = strlen (name) + 1 + strlen (value) + 1; 3870fa225cbcSrjs char *str = XMALLOC (char, len); 3871fa225cbcSrjs sprintf (str, "%s=%s", name, value); 3872fa225cbcSrjs if (putenv (str) != EXIT_SUCCESS) 3873fa225cbcSrjs { 3874fa225cbcSrjs XFREE (str); 3875fa225cbcSrjs } 3876fa225cbcSrjs#endif 3877fa225cbcSrjs } 3878fa225cbcSrjs} 3879fa225cbcSrjs 3880fa225cbcSrjschar * 3881fa225cbcSrjslt_extend_str (const char *orig_value, const char *add, int to_end) 3882fa225cbcSrjs{ 3883fa225cbcSrjs char *new_value; 3884fa225cbcSrjs if (orig_value && *orig_value) 3885fa225cbcSrjs { 3886fa225cbcSrjs int orig_value_len = strlen (orig_value); 3887fa225cbcSrjs int add_len = strlen (add); 3888fa225cbcSrjs new_value = XMALLOC (char, add_len + orig_value_len + 1); 3889fa225cbcSrjs if (to_end) 3890fa225cbcSrjs { 3891fa225cbcSrjs strcpy (new_value, orig_value); 3892fa225cbcSrjs strcpy (new_value + orig_value_len, add); 3893fa225cbcSrjs } 3894fa225cbcSrjs else 3895fa225cbcSrjs { 3896fa225cbcSrjs strcpy (new_value, add); 3897fa225cbcSrjs strcpy (new_value + add_len, orig_value); 3898fa225cbcSrjs } 3899fa225cbcSrjs } 3900fa225cbcSrjs else 3901fa225cbcSrjs { 3902fa225cbcSrjs new_value = xstrdup (add); 3903fa225cbcSrjs } 3904fa225cbcSrjs return new_value; 3905fa225cbcSrjs} 3906fa225cbcSrjs 3907fa225cbcSrjsint 3908fa225cbcSrjslt_split_name_value (const char *arg, char** name, char** value) 3909fa225cbcSrjs{ 3910fa225cbcSrjs const char *p; 3911fa225cbcSrjs int len; 3912fa225cbcSrjs if (!arg || !*arg) 3913fa225cbcSrjs return 1; 3914fa225cbcSrjs 3915fa225cbcSrjs p = strchr (arg, (int)'='); 3916fa225cbcSrjs 3917fa225cbcSrjs if (!p) 3918fa225cbcSrjs return 1; 3919fa225cbcSrjs 3920fa225cbcSrjs *value = xstrdup (++p); 3921fa225cbcSrjs 3922fa225cbcSrjs len = strlen (arg) - strlen (*value); 3923fa225cbcSrjs *name = XMALLOC (char, len); 3924fa225cbcSrjs strncpy (*name, arg, len-1); 3925fa225cbcSrjs (*name)[len - 1] = '\0'; 3926fa225cbcSrjs 3927fa225cbcSrjs return 0; 3928fa225cbcSrjs} 3929fa225cbcSrjs 3930fa225cbcSrjsvoid 3931fa225cbcSrjslt_opt_process_env_set (const char *arg) 3932fa225cbcSrjs{ 3933fa225cbcSrjs char *name = NULL; 3934fa225cbcSrjs char *value = NULL; 3935fa225cbcSrjs 3936fa225cbcSrjs if (lt_split_name_value (arg, &name, &value) != 0) 3937fa225cbcSrjs { 3938fa225cbcSrjs XFREE (name); 3939fa225cbcSrjs XFREE (value); 3940fa225cbcSrjs lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); 3941fa225cbcSrjs } 3942fa225cbcSrjs 3943fa225cbcSrjs lt_setenv (name, value); 3944fa225cbcSrjs XFREE (name); 3945fa225cbcSrjs XFREE (value); 3946fa225cbcSrjs} 3947fa225cbcSrjs 3948fa225cbcSrjsvoid 3949fa225cbcSrjslt_opt_process_env_prepend (const char *arg) 3950fa225cbcSrjs{ 3951fa225cbcSrjs char *name = NULL; 3952fa225cbcSrjs char *value = NULL; 3953fa225cbcSrjs char *new_value = NULL; 3954fa225cbcSrjs 3955fa225cbcSrjs if (lt_split_name_value (arg, &name, &value) != 0) 3956fa225cbcSrjs { 3957fa225cbcSrjs XFREE (name); 3958fa225cbcSrjs XFREE (value); 3959fa225cbcSrjs lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); 3960fa225cbcSrjs } 3961fa225cbcSrjs 3962fa225cbcSrjs new_value = lt_extend_str (getenv (name), value, 0); 3963fa225cbcSrjs lt_setenv (name, new_value); 3964fa225cbcSrjs XFREE (new_value); 3965fa225cbcSrjs XFREE (name); 3966fa225cbcSrjs XFREE (value); 3967fa225cbcSrjs} 3968fa225cbcSrjs 3969fa225cbcSrjsvoid 3970fa225cbcSrjslt_opt_process_env_append (const char *arg) 3971fa225cbcSrjs{ 3972fa225cbcSrjs char *name = NULL; 3973fa225cbcSrjs char *value = NULL; 3974fa225cbcSrjs char *new_value = NULL; 3975fa225cbcSrjs 3976fa225cbcSrjs if (lt_split_name_value (arg, &name, &value) != 0) 3977fa225cbcSrjs { 3978fa225cbcSrjs XFREE (name); 3979fa225cbcSrjs XFREE (value); 3980fa225cbcSrjs lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); 3981fa225cbcSrjs } 3982fa225cbcSrjs 3983fa225cbcSrjs new_value = lt_extend_str (getenv (name), value, 1); 3984fa225cbcSrjs lt_setenv (name, new_value); 3985fa225cbcSrjs XFREE (new_value); 3986fa225cbcSrjs XFREE (name); 3987fa225cbcSrjs XFREE (value); 3988fa225cbcSrjs} 3989fa225cbcSrjs 3990fa225cbcSrjsvoid 3991fa225cbcSrjslt_update_exe_path (const char *name, const char *value) 3992fa225cbcSrjs{ 3993fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 3994fa225cbcSrjs (name ? name : "<NULL>"), 3995fa225cbcSrjs (value ? value : "<NULL>"))); 3996fa225cbcSrjs 3997fa225cbcSrjs if (name && *name && value && *value) 3998fa225cbcSrjs { 3999fa225cbcSrjs char *new_value = lt_extend_str (getenv (name), value, 0); 4000fa225cbcSrjs /* some systems can't cope with a ':'-terminated path #' */ 4001fa225cbcSrjs int len = strlen (new_value); 4002fa225cbcSrjs while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 4003fa225cbcSrjs { 4004fa225cbcSrjs new_value[len-1] = '\0'; 4005fa225cbcSrjs } 4006fa225cbcSrjs lt_setenv (name, new_value); 4007fa225cbcSrjs XFREE (new_value); 4008fa225cbcSrjs } 4009fa225cbcSrjs} 4010fa225cbcSrjs 4011fa225cbcSrjsvoid 4012fa225cbcSrjslt_update_lib_path (const char *name, const char *value) 4013fa225cbcSrjs{ 4014fa225cbcSrjs LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 4015fa225cbcSrjs (name ? name : "<NULL>"), 4016fa225cbcSrjs (value ? value : "<NULL>"))); 4017fa225cbcSrjs 4018fa225cbcSrjs if (name && *name && value && *value) 4019fa225cbcSrjs { 4020fa225cbcSrjs char *new_value = lt_extend_str (getenv (name), value, 0); 4021fa225cbcSrjs lt_setenv (name, new_value); 4022fa225cbcSrjs XFREE (new_value); 4023fa225cbcSrjs } 4024fa225cbcSrjs} 4025fa225cbcSrjs 4026fa225cbcSrjs 4027fa225cbcSrjsEOF 4028fa225cbcSrjs} 4029fa225cbcSrjs# end: func_emit_cwrapperexe_src 4030fa225cbcSrjs 4031fa225cbcSrjs# func_mode_link arg... 4032fa225cbcSrjsfunc_mode_link () 4033fa225cbcSrjs{ 4034fa225cbcSrjs $opt_debug 4035fa225cbcSrjs case $host in 4036fa225cbcSrjs *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 4037fa225cbcSrjs # It is impossible to link a dll without this setting, and 4038fa225cbcSrjs # we shouldn't force the makefile maintainer to figure out 4039fa225cbcSrjs # which system we are compiling for in order to pass an extra 4040fa225cbcSrjs # flag for every libtool invocation. 4041fa225cbcSrjs # allow_undefined=no 4042fa225cbcSrjs 4043fa225cbcSrjs # FIXME: Unfortunately, there are problems with the above when trying 4044fa225cbcSrjs # to make a dll which has undefined symbols, in which case not 4045fa225cbcSrjs # even a static library is built. For now, we need to specify 4046fa225cbcSrjs # -no-undefined on the libtool link line when we can be certain 4047fa225cbcSrjs # that all symbols are satisfied, otherwise we get a static library. 4048fa225cbcSrjs allow_undefined=yes 4049fa225cbcSrjs ;; 4050fa225cbcSrjs *) 4051fa225cbcSrjs allow_undefined=yes 4052fa225cbcSrjs ;; 4053fa225cbcSrjs esac 4054fa225cbcSrjs libtool_args=$nonopt 4055fa225cbcSrjs base_compile="$nonopt $@" 4056fa225cbcSrjs compile_command=$nonopt 4057fa225cbcSrjs finalize_command=$nonopt 4058fa225cbcSrjs 4059fa225cbcSrjs compile_rpath= 4060fa225cbcSrjs finalize_rpath= 4061fa225cbcSrjs compile_shlibpath= 4062fa225cbcSrjs finalize_shlibpath= 4063fa225cbcSrjs convenience= 4064fa225cbcSrjs old_convenience= 4065fa225cbcSrjs deplibs= 4066fa225cbcSrjs old_deplibs= 4067fa225cbcSrjs compiler_flags= 4068fa225cbcSrjs linker_flags= 4069fa225cbcSrjs dllsearchpath= 4070fa225cbcSrjs lib_search_path=`pwd` 4071fa225cbcSrjs inst_prefix_dir= 4072fa225cbcSrjs new_inherited_linker_flags= 4073fa225cbcSrjs 4074fa225cbcSrjs avoid_version=no 4075fa225cbcSrjs dlfiles= 4076fa225cbcSrjs dlprefiles= 4077fa225cbcSrjs dlself=no 4078fa225cbcSrjs export_dynamic=no 4079fa225cbcSrjs export_symbols= 4080fa225cbcSrjs export_symbols_regex= 4081fa225cbcSrjs generated= 4082fa225cbcSrjs libobjs= 4083fa225cbcSrjs ltlibs= 4084fa225cbcSrjs module=no 4085fa225cbcSrjs no_install=no 4086fa225cbcSrjs objs= 4087fa225cbcSrjs non_pic_objects= 4088fa225cbcSrjs precious_files_regex= 4089fa225cbcSrjs prefer_static_libs=no 4090fa225cbcSrjs preload=no 4091fa225cbcSrjs prev= 4092fa225cbcSrjs prevarg= 4093fa225cbcSrjs release= 4094fa225cbcSrjs rpath= 4095fa225cbcSrjs xrpath= 4096fa225cbcSrjs perm_rpath= 4097fa225cbcSrjs temp_rpath= 4098fa225cbcSrjs thread_safe=no 4099fa225cbcSrjs vinfo= 4100fa225cbcSrjs vinfo_number=no 4101fa225cbcSrjs weak_libs= 4102fa225cbcSrjs single_module="${wl}-single_module" 4103fa225cbcSrjs func_infer_tag $base_compile 4104fa225cbcSrjs 4105fa225cbcSrjs # We need to know -static, to get the right output filenames. 4106fa225cbcSrjs for arg 4107fa225cbcSrjs do 4108fa225cbcSrjs case $arg in 4109fa225cbcSrjs -shared) 4110fa225cbcSrjs test "$build_libtool_libs" != yes && \ 4111fa225cbcSrjs func_fatal_configuration "can not build a shared library" 4112fa225cbcSrjs build_old_libs=no 4113fa225cbcSrjs break 4114fa225cbcSrjs ;; 4115fa225cbcSrjs -all-static | -static | -static-libtool-libs) 4116fa225cbcSrjs case $arg in 4117fa225cbcSrjs -all-static) 4118fa225cbcSrjs if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 4119fa225cbcSrjs func_warning "complete static linking is impossible in this configuration" 4120fa225cbcSrjs fi 4121fa225cbcSrjs if test -n "$link_static_flag"; then 4122fa225cbcSrjs dlopen_self=$dlopen_self_static 4123fa225cbcSrjs fi 4124fa225cbcSrjs prefer_static_libs=yes 4125fa225cbcSrjs ;; 4126fa225cbcSrjs -static) 4127fa225cbcSrjs if test -z "$pic_flag" && test -n "$link_static_flag"; then 4128fa225cbcSrjs dlopen_self=$dlopen_self_static 4129fa225cbcSrjs fi 4130fa225cbcSrjs prefer_static_libs=built 4131fa225cbcSrjs ;; 4132fa225cbcSrjs -static-libtool-libs) 4133fa225cbcSrjs if test -z "$pic_flag" && test -n "$link_static_flag"; then 4134fa225cbcSrjs dlopen_self=$dlopen_self_static 4135fa225cbcSrjs fi 4136fa225cbcSrjs prefer_static_libs=yes 4137fa225cbcSrjs ;; 4138fa225cbcSrjs esac 4139fa225cbcSrjs build_libtool_libs=no 4140fa225cbcSrjs build_old_libs=yes 4141fa225cbcSrjs break 4142fa225cbcSrjs ;; 4143fa225cbcSrjs esac 4144fa225cbcSrjs done 4145fa225cbcSrjs 4146fa225cbcSrjs # See if our shared archives depend on static archives. 4147fa225cbcSrjs test -n "$old_archive_from_new_cmds" && build_old_libs=yes 4148fa225cbcSrjs 4149fa225cbcSrjs # Go through the arguments, transforming them on the way. 4150fa225cbcSrjs while test "$#" -gt 0; do 4151fa225cbcSrjs arg="$1" 4152fa225cbcSrjs shift 4153fa225cbcSrjs func_quote_for_eval "$arg" 4154fa225cbcSrjs qarg=$func_quote_for_eval_unquoted_result 4155fa225cbcSrjs func_append libtool_args " $func_quote_for_eval_result" 4156fa225cbcSrjs 4157fa225cbcSrjs # If the previous option needs an argument, assign it. 4158fa225cbcSrjs if test -n "$prev"; then 4159fa225cbcSrjs case $prev in 4160fa225cbcSrjs output) 4161fa225cbcSrjs func_append compile_command " @OUTPUT@" 4162fa225cbcSrjs func_append finalize_command " @OUTPUT@" 4163fa225cbcSrjs ;; 4164fa225cbcSrjs esac 4165fa225cbcSrjs 4166fa225cbcSrjs case $prev in 4167fa225cbcSrjs dlfiles|dlprefiles) 4168fa225cbcSrjs if test "$preload" = no; then 4169fa225cbcSrjs # Add the symbol object into the linking commands. 4170fa225cbcSrjs func_append compile_command " @SYMFILE@" 4171fa225cbcSrjs func_append finalize_command " @SYMFILE@" 4172fa225cbcSrjs preload=yes 4173fa225cbcSrjs fi 4174fa225cbcSrjs case $arg in 4175fa225cbcSrjs *.la | *.lo) ;; # We handle these cases below. 4176fa225cbcSrjs force) 4177fa225cbcSrjs if test "$dlself" = no; then 4178fa225cbcSrjs dlself=needless 4179fa225cbcSrjs export_dynamic=yes 4180fa225cbcSrjs fi 4181fa225cbcSrjs prev= 4182fa225cbcSrjs continue 4183fa225cbcSrjs ;; 4184fa225cbcSrjs self) 4185fa225cbcSrjs if test "$prev" = dlprefiles; then 4186fa225cbcSrjs dlself=yes 4187fa225cbcSrjs elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 4188fa225cbcSrjs dlself=yes 4189fa225cbcSrjs else 4190fa225cbcSrjs dlself=needless 4191fa225cbcSrjs export_dynamic=yes 4192fa225cbcSrjs fi 4193fa225cbcSrjs prev= 4194fa225cbcSrjs continue 4195fa225cbcSrjs ;; 4196fa225cbcSrjs *) 4197fa225cbcSrjs if test "$prev" = dlfiles; then 4198fa225cbcSrjs dlfiles="$dlfiles $arg" 4199fa225cbcSrjs else 4200fa225cbcSrjs dlprefiles="$dlprefiles $arg" 4201fa225cbcSrjs fi 4202fa225cbcSrjs prev= 4203fa225cbcSrjs continue 4204fa225cbcSrjs ;; 4205fa225cbcSrjs esac 4206fa225cbcSrjs ;; 4207fa225cbcSrjs expsyms) 4208fa225cbcSrjs export_symbols="$arg" 4209fa225cbcSrjs test -f "$arg" \ 4210fa225cbcSrjs || func_fatal_error "symbol file \`$arg' does not exist" 4211fa225cbcSrjs prev= 4212fa225cbcSrjs continue 4213fa225cbcSrjs ;; 4214fa225cbcSrjs expsyms_regex) 4215fa225cbcSrjs export_symbols_regex="$arg" 4216fa225cbcSrjs prev= 4217fa225cbcSrjs continue 4218fa225cbcSrjs ;; 4219fa225cbcSrjs framework) 4220fa225cbcSrjs case $host in 4221fa225cbcSrjs *-*-darwin*) 4222fa225cbcSrjs case "$deplibs " in 4223fa225cbcSrjs *" $qarg.ltframework "*) ;; 4224fa225cbcSrjs *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 4225fa225cbcSrjs ;; 4226fa225cbcSrjs esac 4227fa225cbcSrjs ;; 4228fa225cbcSrjs esac 4229fa225cbcSrjs prev= 4230fa225cbcSrjs continue 4231fa225cbcSrjs ;; 4232fa225cbcSrjs inst_prefix) 4233fa225cbcSrjs inst_prefix_dir="$arg" 4234fa225cbcSrjs prev= 4235fa225cbcSrjs continue 4236fa225cbcSrjs ;; 4237fa225cbcSrjs objectlist) 4238fa225cbcSrjs if test -f "$arg"; then 4239fa225cbcSrjs save_arg=$arg 4240fa225cbcSrjs moreargs= 4241fa225cbcSrjs for fil in `cat "$save_arg"` 4242fa225cbcSrjs do 4243fa225cbcSrjs# moreargs="$moreargs $fil" 4244fa225cbcSrjs arg=$fil 4245fa225cbcSrjs # A libtool-controlled object. 4246fa225cbcSrjs 4247fa225cbcSrjs # Check to see that this really is a libtool object. 4248fa225cbcSrjs if func_lalib_unsafe_p "$arg"; then 4249fa225cbcSrjs pic_object= 4250fa225cbcSrjs non_pic_object= 4251fa225cbcSrjs 4252fa225cbcSrjs # Read the .lo file 4253fa225cbcSrjs func_source "$arg" 4254fa225cbcSrjs 4255fa225cbcSrjs if test -z "$pic_object" || 4256fa225cbcSrjs test -z "$non_pic_object" || 4257fa225cbcSrjs test "$pic_object" = none && 4258fa225cbcSrjs test "$non_pic_object" = none; then 4259fa225cbcSrjs func_fatal_error "cannot find name of object for \`$arg'" 4260fa225cbcSrjs fi 4261fa225cbcSrjs 4262fa225cbcSrjs # Extract subdirectory from the argument. 4263fa225cbcSrjs func_dirname "$arg" "/" "" 4264fa225cbcSrjs xdir="$func_dirname_result" 4265fa225cbcSrjs 4266fa225cbcSrjs if test "$pic_object" != none; then 4267fa225cbcSrjs # Prepend the subdirectory the object is found in. 4268fa225cbcSrjs pic_object="$xdir$pic_object" 4269fa225cbcSrjs 4270fa225cbcSrjs if test "$prev" = dlfiles; then 4271fa225cbcSrjs if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 4272fa225cbcSrjs dlfiles="$dlfiles $pic_object" 4273fa225cbcSrjs prev= 4274fa225cbcSrjs continue 4275fa225cbcSrjs else 4276fa225cbcSrjs # If libtool objects are unsupported, then we need to preload. 4277fa225cbcSrjs prev=dlprefiles 4278fa225cbcSrjs fi 4279fa225cbcSrjs fi 4280fa225cbcSrjs 4281fa225cbcSrjs # CHECK ME: I think I busted this. -Ossama 4282fa225cbcSrjs if test "$prev" = dlprefiles; then 4283fa225cbcSrjs # Preload the old-style object. 4284fa225cbcSrjs dlprefiles="$dlprefiles $pic_object" 4285fa225cbcSrjs prev= 4286fa225cbcSrjs fi 4287fa225cbcSrjs 4288fa225cbcSrjs # A PIC object. 4289fa225cbcSrjs func_append libobjs " $pic_object" 4290fa225cbcSrjs arg="$pic_object" 4291fa225cbcSrjs fi 4292fa225cbcSrjs 4293fa225cbcSrjs # Non-PIC object. 4294fa225cbcSrjs if test "$non_pic_object" != none; then 4295fa225cbcSrjs # Prepend the subdirectory the object is found in. 4296fa225cbcSrjs non_pic_object="$xdir$non_pic_object" 4297fa225cbcSrjs 4298fa225cbcSrjs # A standard non-PIC object 4299fa225cbcSrjs func_append non_pic_objects " $non_pic_object" 4300fa225cbcSrjs if test -z "$pic_object" || test "$pic_object" = none ; then 4301fa225cbcSrjs arg="$non_pic_object" 4302fa225cbcSrjs fi 4303fa225cbcSrjs else 4304fa225cbcSrjs # If the PIC object exists, use it instead. 4305fa225cbcSrjs # $xdir was prepended to $pic_object above. 4306fa225cbcSrjs non_pic_object="$pic_object" 4307fa225cbcSrjs func_append non_pic_objects " $non_pic_object" 4308fa225cbcSrjs fi 4309fa225cbcSrjs else 4310fa225cbcSrjs # Only an error if not doing a dry-run. 4311fa225cbcSrjs if $opt_dry_run; then 4312fa225cbcSrjs # Extract subdirectory from the argument. 4313fa225cbcSrjs func_dirname "$arg" "/" "" 4314fa225cbcSrjs xdir="$func_dirname_result" 4315fa225cbcSrjs 4316fa225cbcSrjs func_lo2o "$arg" 4317fa225cbcSrjs pic_object=$xdir$objdir/$func_lo2o_result 4318fa225cbcSrjs non_pic_object=$xdir$func_lo2o_result 4319fa225cbcSrjs func_append libobjs " $pic_object" 4320fa225cbcSrjs func_append non_pic_objects " $non_pic_object" 4321fa225cbcSrjs else 4322fa225cbcSrjs func_fatal_error "\`$arg' is not a valid libtool object" 4323fa225cbcSrjs fi 4324fa225cbcSrjs fi 4325fa225cbcSrjs done 4326fa225cbcSrjs else 4327fa225cbcSrjs func_fatal_error "link input file \`$arg' does not exist" 4328fa225cbcSrjs fi 4329fa225cbcSrjs arg=$save_arg 4330fa225cbcSrjs prev= 4331fa225cbcSrjs continue 4332fa225cbcSrjs ;; 4333fa225cbcSrjs precious_regex) 4334fa225cbcSrjs precious_files_regex="$arg" 4335fa225cbcSrjs prev= 4336fa225cbcSrjs continue 4337fa225cbcSrjs ;; 4338fa225cbcSrjs release) 4339fa225cbcSrjs release="-$arg" 4340fa225cbcSrjs prev= 4341fa225cbcSrjs continue 4342fa225cbcSrjs ;; 4343fa225cbcSrjs rpath | xrpath) 4344fa225cbcSrjs # We need an absolute path. 4345fa225cbcSrjs case $arg in 4346fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) ;; 4347fa225cbcSrjs *) 4348fa225cbcSrjs func_fatal_error "only absolute run-paths are allowed" 4349fa225cbcSrjs ;; 4350fa225cbcSrjs esac 4351fa225cbcSrjs if test "$prev" = rpath; then 4352fa225cbcSrjs case "$rpath " in 4353fa225cbcSrjs *" $arg "*) ;; 4354fa225cbcSrjs *) rpath="$rpath $arg" ;; 4355fa225cbcSrjs esac 4356fa225cbcSrjs else 4357fa225cbcSrjs case "$xrpath " in 4358fa225cbcSrjs *" $arg "*) ;; 4359fa225cbcSrjs *) xrpath="$xrpath $arg" ;; 4360fa225cbcSrjs esac 4361fa225cbcSrjs fi 4362fa225cbcSrjs prev= 4363fa225cbcSrjs continue 4364fa225cbcSrjs ;; 4365fa225cbcSrjs shrext) 4366fa225cbcSrjs shrext_cmds="$arg" 4367fa225cbcSrjs prev= 4368fa225cbcSrjs continue 4369fa225cbcSrjs ;; 4370fa225cbcSrjs weak) 4371fa225cbcSrjs weak_libs="$weak_libs $arg" 4372fa225cbcSrjs prev= 4373fa225cbcSrjs continue 4374fa225cbcSrjs ;; 4375fa225cbcSrjs xcclinker) 4376fa225cbcSrjs linker_flags="$linker_flags $qarg" 4377fa225cbcSrjs compiler_flags="$compiler_flags $qarg" 4378fa225cbcSrjs prev= 4379fa225cbcSrjs func_append compile_command " $qarg" 4380fa225cbcSrjs func_append finalize_command " $qarg" 4381fa225cbcSrjs continue 4382fa225cbcSrjs ;; 4383fa225cbcSrjs xcompiler) 4384fa225cbcSrjs compiler_flags="$compiler_flags $qarg" 4385fa225cbcSrjs prev= 4386fa225cbcSrjs func_append compile_command " $qarg" 4387fa225cbcSrjs func_append finalize_command " $qarg" 4388fa225cbcSrjs continue 4389fa225cbcSrjs ;; 4390fa225cbcSrjs xlinker) 4391fa225cbcSrjs linker_flags="$linker_flags $qarg" 4392fa225cbcSrjs compiler_flags="$compiler_flags $wl$qarg" 4393fa225cbcSrjs prev= 4394fa225cbcSrjs func_append compile_command " $wl$qarg" 4395fa225cbcSrjs func_append finalize_command " $wl$qarg" 4396fa225cbcSrjs continue 4397fa225cbcSrjs ;; 4398fa225cbcSrjs *) 4399fa225cbcSrjs eval "$prev=\"\$arg\"" 4400fa225cbcSrjs prev= 4401fa225cbcSrjs continue 4402fa225cbcSrjs ;; 4403fa225cbcSrjs esac 4404fa225cbcSrjs fi # test -n "$prev" 4405fa225cbcSrjs 4406fa225cbcSrjs prevarg="$arg" 4407fa225cbcSrjs 4408fa225cbcSrjs case $arg in 4409fa225cbcSrjs -all-static) 4410fa225cbcSrjs if test -n "$link_static_flag"; then 4411fa225cbcSrjs # See comment for -static flag below, for more details. 4412fa225cbcSrjs func_append compile_command " $link_static_flag" 4413fa225cbcSrjs func_append finalize_command " $link_static_flag" 4414fa225cbcSrjs fi 4415fa225cbcSrjs continue 4416fa225cbcSrjs ;; 4417fa225cbcSrjs 4418fa225cbcSrjs -allow-undefined) 4419fa225cbcSrjs # FIXME: remove this flag sometime in the future. 4420fa225cbcSrjs func_fatal_error "\`-allow-undefined' must not be used because it is the default" 4421fa225cbcSrjs ;; 4422fa225cbcSrjs 4423fa225cbcSrjs -avoid-version) 4424fa225cbcSrjs avoid_version=yes 4425fa225cbcSrjs continue 4426fa225cbcSrjs ;; 4427fa225cbcSrjs 4428fa225cbcSrjs -dlopen) 4429fa225cbcSrjs prev=dlfiles 4430fa225cbcSrjs continue 4431fa225cbcSrjs ;; 4432fa225cbcSrjs 4433fa225cbcSrjs -dlpreopen) 4434fa225cbcSrjs prev=dlprefiles 4435fa225cbcSrjs continue 4436fa225cbcSrjs ;; 4437fa225cbcSrjs 4438fa225cbcSrjs -export-dynamic) 4439fa225cbcSrjs export_dynamic=yes 4440fa225cbcSrjs continue 4441fa225cbcSrjs ;; 4442fa225cbcSrjs 4443fa225cbcSrjs -export-symbols | -export-symbols-regex) 4444fa225cbcSrjs if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 4445fa225cbcSrjs func_fatal_error "more than one -exported-symbols argument is not allowed" 4446fa225cbcSrjs fi 4447fa225cbcSrjs if test "X$arg" = "X-export-symbols"; then 4448fa225cbcSrjs prev=expsyms 4449fa225cbcSrjs else 4450fa225cbcSrjs prev=expsyms_regex 4451fa225cbcSrjs fi 4452fa225cbcSrjs continue 4453fa225cbcSrjs ;; 4454fa225cbcSrjs 4455fa225cbcSrjs -framework) 4456fa225cbcSrjs prev=framework 4457fa225cbcSrjs continue 4458fa225cbcSrjs ;; 4459fa225cbcSrjs 4460fa225cbcSrjs -inst-prefix-dir) 4461fa225cbcSrjs prev=inst_prefix 4462fa225cbcSrjs continue 4463fa225cbcSrjs ;; 4464fa225cbcSrjs 4465fa225cbcSrjs # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 4466fa225cbcSrjs # so, if we see these flags be careful not to treat them like -L 4467fa225cbcSrjs -L[A-Z][A-Z]*:*) 4468fa225cbcSrjs case $with_gcc/$host in 4469fa225cbcSrjs no/*-*-irix* | /*-*-irix*) 4470fa225cbcSrjs func_append compile_command " $arg" 4471fa225cbcSrjs func_append finalize_command " $arg" 4472fa225cbcSrjs ;; 4473fa225cbcSrjs esac 4474fa225cbcSrjs continue 4475fa225cbcSrjs ;; 4476fa225cbcSrjs 4477fa225cbcSrjs -L*) 4478fa225cbcSrjs func_stripname '-L' '' "$arg" 4479fa225cbcSrjs dir=$func_stripname_result 4480fa225cbcSrjs if test -z "$dir"; then 4481fa225cbcSrjs if test "$#" -gt 0; then 4482fa225cbcSrjs func_fatal_error "require no space between \`-L' and \`$1'" 4483fa225cbcSrjs else 4484fa225cbcSrjs func_fatal_error "need path for \`-L' option" 4485fa225cbcSrjs fi 4486fa225cbcSrjs fi 4487fa225cbcSrjs # We need an absolute path. 4488fa225cbcSrjs case $dir in 4489fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) ;; 4490fa225cbcSrjs *) 4491fa225cbcSrjs absdir=`cd "$dir" && pwd` 4492fa225cbcSrjs test -z "$absdir" && \ 4493fa225cbcSrjs func_fatal_error "cannot determine absolute directory name of \`$dir'" 4494fa225cbcSrjs dir="$absdir" 4495fa225cbcSrjs ;; 4496fa225cbcSrjs esac 4497fa225cbcSrjs case "$deplibs " in 4498fa225cbcSrjs *" -L$dir "*) ;; 4499fa225cbcSrjs *) 4500fa225cbcSrjs deplibs="$deplibs -L$dir" 4501fa225cbcSrjs lib_search_path="$lib_search_path $dir" 4502fa225cbcSrjs ;; 4503fa225cbcSrjs esac 4504fa225cbcSrjs case $host in 4505fa225cbcSrjs *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 4506fa225cbcSrjs testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` 4507fa225cbcSrjs case :$dllsearchpath: in 4508fa225cbcSrjs *":$dir:"*) ;; 4509fa225cbcSrjs ::) dllsearchpath=$dir;; 4510fa225cbcSrjs *) dllsearchpath="$dllsearchpath:$dir";; 4511fa225cbcSrjs esac 4512fa225cbcSrjs case :$dllsearchpath: in 4513fa225cbcSrjs *":$testbindir:"*) ;; 4514fa225cbcSrjs ::) dllsearchpath=$testbindir;; 4515fa225cbcSrjs *) dllsearchpath="$dllsearchpath:$testbindir";; 4516fa225cbcSrjs esac 4517fa225cbcSrjs ;; 4518fa225cbcSrjs esac 4519fa225cbcSrjs continue 4520fa225cbcSrjs ;; 4521fa225cbcSrjs 4522fa225cbcSrjs -l*) 4523fa225cbcSrjs if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 4524fa225cbcSrjs case $host in 4525fa225cbcSrjs *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) 4526fa225cbcSrjs # These systems don't actually have a C or math library (as such) 4527fa225cbcSrjs continue 4528fa225cbcSrjs ;; 4529fa225cbcSrjs *-*-os2*) 4530fa225cbcSrjs # These systems don't actually have a C library (as such) 4531fa225cbcSrjs test "X$arg" = "X-lc" && continue 4532fa225cbcSrjs ;; 4533fa225cbcSrjs *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 4534fa225cbcSrjs # Do not include libc due to us having libc/libc_r. 4535fa225cbcSrjs test "X$arg" = "X-lc" && continue 4536fa225cbcSrjs ;; 4537fa225cbcSrjs *-*-rhapsody* | *-*-darwin1.[012]) 4538fa225cbcSrjs # Rhapsody C and math libraries are in the System framework 4539fa225cbcSrjs deplibs="$deplibs System.ltframework" 4540fa225cbcSrjs continue 4541fa225cbcSrjs ;; 4542fa225cbcSrjs *-*-sco3.2v5* | *-*-sco5v6*) 4543fa225cbcSrjs # Causes problems with __ctype 4544fa225cbcSrjs test "X$arg" = "X-lc" && continue 4545fa225cbcSrjs ;; 4546fa225cbcSrjs *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 4547fa225cbcSrjs # Compiler inserts libc in the correct place for threads to work 4548fa225cbcSrjs test "X$arg" = "X-lc" && continue 4549fa225cbcSrjs ;; 4550fa225cbcSrjs esac 4551fa225cbcSrjs elif test "X$arg" = "X-lc_r"; then 4552fa225cbcSrjs case $host in 4553fa225cbcSrjs *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 4554fa225cbcSrjs # Do not include libc_r directly, use -pthread flag. 4555fa225cbcSrjs continue 4556fa225cbcSrjs ;; 4557fa225cbcSrjs esac 4558fa225cbcSrjs fi 4559fa225cbcSrjs deplibs="$deplibs $arg" 4560fa225cbcSrjs continue 4561fa225cbcSrjs ;; 4562fa225cbcSrjs 4563fa225cbcSrjs -module) 4564fa225cbcSrjs module=yes 4565fa225cbcSrjs continue 4566fa225cbcSrjs ;; 4567fa225cbcSrjs 4568fa225cbcSrjs # Tru64 UNIX uses -model [arg] to determine the layout of C++ 4569fa225cbcSrjs # classes, name mangling, and exception handling. 4570fa225cbcSrjs # Darwin uses the -arch flag to determine output architecture. 4571fa225cbcSrjs -model|-arch|-isysroot) 4572fa225cbcSrjs compiler_flags="$compiler_flags $arg" 4573fa225cbcSrjs func_append compile_command " $arg" 4574fa225cbcSrjs func_append finalize_command " $arg" 4575fa225cbcSrjs prev=xcompiler 4576fa225cbcSrjs continue 4577fa225cbcSrjs ;; 4578fa225cbcSrjs 4579fa225cbcSrjs -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 4580fa225cbcSrjs compiler_flags="$compiler_flags $arg" 4581fa225cbcSrjs func_append compile_command " $arg" 4582fa225cbcSrjs func_append finalize_command " $arg" 4583fa225cbcSrjs case "$new_inherited_linker_flags " in 4584fa225cbcSrjs *" $arg "*) ;; 4585fa225cbcSrjs * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 4586fa225cbcSrjs esac 4587fa225cbcSrjs continue 4588fa225cbcSrjs ;; 4589fa225cbcSrjs 4590fa225cbcSrjs -multi_module) 4591fa225cbcSrjs single_module="${wl}-multi_module" 4592fa225cbcSrjs continue 4593fa225cbcSrjs ;; 4594fa225cbcSrjs 4595fa225cbcSrjs -no-fast-install) 4596fa225cbcSrjs fast_install=no 4597fa225cbcSrjs continue 4598fa225cbcSrjs ;; 4599fa225cbcSrjs 4600fa225cbcSrjs -no-install) 4601fa225cbcSrjs case $host in 4602fa225cbcSrjs *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 4603fa225cbcSrjs # The PATH hackery in wrapper scripts is required on Windows 4604fa225cbcSrjs # and Darwin in order for the loader to find any dlls it needs. 4605fa225cbcSrjs func_warning "\`-no-install' is ignored for $host" 4606fa225cbcSrjs func_warning "assuming \`-no-fast-install' instead" 4607fa225cbcSrjs fast_install=no 4608fa225cbcSrjs ;; 4609fa225cbcSrjs *) no_install=yes ;; 4610fa225cbcSrjs esac 4611fa225cbcSrjs continue 4612fa225cbcSrjs ;; 4613fa225cbcSrjs 4614fa225cbcSrjs -no-undefined) 4615fa225cbcSrjs allow_undefined=no 4616fa225cbcSrjs continue 4617fa225cbcSrjs ;; 4618fa225cbcSrjs 4619fa225cbcSrjs -objectlist) 4620fa225cbcSrjs prev=objectlist 4621fa225cbcSrjs continue 4622fa225cbcSrjs ;; 4623fa225cbcSrjs 4624fa225cbcSrjs -o) prev=output ;; 4625fa225cbcSrjs 4626fa225cbcSrjs -precious-files-regex) 4627fa225cbcSrjs prev=precious_regex 4628fa225cbcSrjs continue 4629fa225cbcSrjs ;; 4630fa225cbcSrjs 4631fa225cbcSrjs -release) 4632fa225cbcSrjs prev=release 4633fa225cbcSrjs continue 4634fa225cbcSrjs ;; 4635fa225cbcSrjs 4636fa225cbcSrjs -rpath) 4637fa225cbcSrjs prev=rpath 4638fa225cbcSrjs continue 4639fa225cbcSrjs ;; 4640fa225cbcSrjs 4641fa225cbcSrjs -R) 4642fa225cbcSrjs prev=xrpath 4643fa225cbcSrjs continue 4644fa225cbcSrjs ;; 4645fa225cbcSrjs 4646fa225cbcSrjs -R*) 4647fa225cbcSrjs func_stripname '-R' '' "$arg" 4648fa225cbcSrjs dir=$func_stripname_result 4649fa225cbcSrjs # We need an absolute path. 4650fa225cbcSrjs case $dir in 4651fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) ;; 4652fa225cbcSrjs *) 4653fa225cbcSrjs func_fatal_error "only absolute run-paths are allowed" 4654fa225cbcSrjs ;; 4655fa225cbcSrjs esac 4656fa225cbcSrjs case "$xrpath " in 4657fa225cbcSrjs *" $dir "*) ;; 4658fa225cbcSrjs *) xrpath="$xrpath $dir" ;; 4659fa225cbcSrjs esac 4660fa225cbcSrjs continue 4661fa225cbcSrjs ;; 4662fa225cbcSrjs 4663fa225cbcSrjs -shared) 4664fa225cbcSrjs # The effects of -shared are defined in a previous loop. 4665fa225cbcSrjs continue 4666fa225cbcSrjs ;; 4667fa225cbcSrjs 4668fa225cbcSrjs -shrext) 4669fa225cbcSrjs prev=shrext 4670fa225cbcSrjs continue 4671fa225cbcSrjs ;; 4672fa225cbcSrjs 4673fa225cbcSrjs -static | -static-libtool-libs) 4674fa225cbcSrjs # The effects of -static are defined in a previous loop. 4675fa225cbcSrjs # We used to do the same as -all-static on platforms that 4676fa225cbcSrjs # didn't have a PIC flag, but the assumption that the effects 4677fa225cbcSrjs # would be equivalent was wrong. It would break on at least 4678fa225cbcSrjs # Digital Unix and AIX. 4679fa225cbcSrjs continue 4680fa225cbcSrjs ;; 4681fa225cbcSrjs 4682fa225cbcSrjs -thread-safe) 4683fa225cbcSrjs thread_safe=yes 4684fa225cbcSrjs continue 4685fa225cbcSrjs ;; 4686fa225cbcSrjs 4687fa225cbcSrjs -version-info) 4688fa225cbcSrjs prev=vinfo 4689fa225cbcSrjs continue 4690fa225cbcSrjs ;; 4691fa225cbcSrjs 4692fa225cbcSrjs -version-number) 4693fa225cbcSrjs prev=vinfo 4694fa225cbcSrjs vinfo_number=yes 4695fa225cbcSrjs continue 4696fa225cbcSrjs ;; 4697fa225cbcSrjs 4698fa225cbcSrjs -weak) 4699fa225cbcSrjs prev=weak 4700fa225cbcSrjs continue 4701fa225cbcSrjs ;; 4702fa225cbcSrjs 4703fa225cbcSrjs -Wc,*) 4704fa225cbcSrjs func_stripname '-Wc,' '' "$arg" 4705fa225cbcSrjs args=$func_stripname_result 4706fa225cbcSrjs arg= 4707fa225cbcSrjs save_ifs="$IFS"; IFS=',' 4708fa225cbcSrjs for flag in $args; do 4709fa225cbcSrjs IFS="$save_ifs" 4710fa225cbcSrjs func_quote_for_eval "$flag" 4711fa225cbcSrjs arg="$arg $wl$func_quote_for_eval_result" 4712fa225cbcSrjs compiler_flags="$compiler_flags $func_quote_for_eval_result" 4713fa225cbcSrjs done 4714fa225cbcSrjs IFS="$save_ifs" 4715fa225cbcSrjs func_stripname ' ' '' "$arg" 4716fa225cbcSrjs arg=$func_stripname_result 4717fa225cbcSrjs ;; 4718fa225cbcSrjs 4719fa225cbcSrjs -Wl,*) 4720fa225cbcSrjs func_stripname '-Wl,' '' "$arg" 4721fa225cbcSrjs args=$func_stripname_result 4722fa225cbcSrjs arg= 4723fa225cbcSrjs save_ifs="$IFS"; IFS=',' 4724fa225cbcSrjs for flag in $args; do 4725fa225cbcSrjs IFS="$save_ifs" 4726fa225cbcSrjs func_quote_for_eval "$flag" 4727fa225cbcSrjs arg="$arg $wl$func_quote_for_eval_result" 4728fa225cbcSrjs compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 4729fa225cbcSrjs linker_flags="$linker_flags $func_quote_for_eval_result" 4730fa225cbcSrjs done 4731fa225cbcSrjs IFS="$save_ifs" 4732fa225cbcSrjs func_stripname ' ' '' "$arg" 4733fa225cbcSrjs arg=$func_stripname_result 4734fa225cbcSrjs ;; 4735fa225cbcSrjs 4736fa225cbcSrjs -Xcompiler) 4737fa225cbcSrjs prev=xcompiler 4738fa225cbcSrjs continue 4739fa225cbcSrjs ;; 4740fa225cbcSrjs 4741fa225cbcSrjs -Xlinker) 4742fa225cbcSrjs prev=xlinker 4743fa225cbcSrjs continue 4744fa225cbcSrjs ;; 4745fa225cbcSrjs 4746fa225cbcSrjs -XCClinker) 4747fa225cbcSrjs prev=xcclinker 4748fa225cbcSrjs continue 4749fa225cbcSrjs ;; 4750fa225cbcSrjs 4751fa225cbcSrjs # -msg_* for osf cc 4752fa225cbcSrjs -msg_*) 4753fa225cbcSrjs func_quote_for_eval "$arg" 4754fa225cbcSrjs arg="$func_quote_for_eval_result" 4755fa225cbcSrjs ;; 4756fa225cbcSrjs 4757fa225cbcSrjs # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 4758fa225cbcSrjs # -r[0-9][0-9]* specifies the processor on the SGI compiler 4759fa225cbcSrjs # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 4760fa225cbcSrjs # +DA*, +DD* enable 64-bit mode on the HP compiler 4761fa225cbcSrjs # -q* pass through compiler args for the IBM compiler 4762fa225cbcSrjs # -m*, -t[45]*, -txscale* pass through architecture-specific 4763fa225cbcSrjs # compiler args for GCC 4764fa225cbcSrjs # -F/path gives path to uninstalled frameworks, gcc on darwin 4765fa225cbcSrjs # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 4766fa225cbcSrjs # @file GCC response files 4767fa225cbcSrjs -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 4768fa225cbcSrjs -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 4769fa225cbcSrjs func_quote_for_eval "$arg" 4770fa225cbcSrjs arg="$func_quote_for_eval_result" 4771fa225cbcSrjs func_append compile_command " $arg" 4772fa225cbcSrjs func_append finalize_command " $arg" 4773fa225cbcSrjs compiler_flags="$compiler_flags $arg" 4774fa225cbcSrjs continue 4775fa225cbcSrjs ;; 4776fa225cbcSrjs 4777fa225cbcSrjs # Some other compiler flag. 4778fa225cbcSrjs -* | +*) 4779fa225cbcSrjs func_quote_for_eval "$arg" 4780fa225cbcSrjs arg="$func_quote_for_eval_result" 4781fa225cbcSrjs ;; 4782fa225cbcSrjs 4783fa225cbcSrjs *.$objext) 4784fa225cbcSrjs # A standard object. 4785fa225cbcSrjs objs="$objs $arg" 4786fa225cbcSrjs ;; 4787fa225cbcSrjs 4788fa225cbcSrjs *.lo) 4789fa225cbcSrjs # A libtool-controlled object. 4790fa225cbcSrjs 4791fa225cbcSrjs # Check to see that this really is a libtool object. 4792fa225cbcSrjs if func_lalib_unsafe_p "$arg"; then 4793fa225cbcSrjs pic_object= 4794fa225cbcSrjs non_pic_object= 4795fa225cbcSrjs 4796fa225cbcSrjs # Read the .lo file 4797fa225cbcSrjs func_source "$arg" 4798fa225cbcSrjs 4799fa225cbcSrjs if test -z "$pic_object" || 4800fa225cbcSrjs test -z "$non_pic_object" || 4801fa225cbcSrjs test "$pic_object" = none && 4802fa225cbcSrjs test "$non_pic_object" = none; then 4803fa225cbcSrjs func_fatal_error "cannot find name of object for \`$arg'" 4804fa225cbcSrjs fi 4805fa225cbcSrjs 4806fa225cbcSrjs # Extract subdirectory from the argument. 4807fa225cbcSrjs func_dirname "$arg" "/" "" 4808fa225cbcSrjs xdir="$func_dirname_result" 4809fa225cbcSrjs 4810fa225cbcSrjs if test "$pic_object" != none; then 4811fa225cbcSrjs # Prepend the subdirectory the object is found in. 4812fa225cbcSrjs pic_object="$xdir$pic_object" 4813fa225cbcSrjs 4814fa225cbcSrjs if test "$prev" = dlfiles; then 4815fa225cbcSrjs if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 4816fa225cbcSrjs dlfiles="$dlfiles $pic_object" 4817fa225cbcSrjs prev= 4818fa225cbcSrjs continue 4819fa225cbcSrjs else 4820fa225cbcSrjs # If libtool objects are unsupported, then we need to preload. 4821fa225cbcSrjs prev=dlprefiles 4822fa225cbcSrjs fi 4823fa225cbcSrjs fi 4824fa225cbcSrjs 4825fa225cbcSrjs # CHECK ME: I think I busted this. -Ossama 4826fa225cbcSrjs if test "$prev" = dlprefiles; then 4827fa225cbcSrjs # Preload the old-style object. 4828fa225cbcSrjs dlprefiles="$dlprefiles $pic_object" 4829fa225cbcSrjs prev= 4830fa225cbcSrjs fi 4831fa225cbcSrjs 4832fa225cbcSrjs # A PIC object. 4833fa225cbcSrjs func_append libobjs " $pic_object" 4834fa225cbcSrjs arg="$pic_object" 4835fa225cbcSrjs fi 4836fa225cbcSrjs 4837fa225cbcSrjs # Non-PIC object. 4838fa225cbcSrjs if test "$non_pic_object" != none; then 4839fa225cbcSrjs # Prepend the subdirectory the object is found in. 4840fa225cbcSrjs non_pic_object="$xdir$non_pic_object" 4841fa225cbcSrjs 4842fa225cbcSrjs # A standard non-PIC object 4843fa225cbcSrjs func_append non_pic_objects " $non_pic_object" 4844fa225cbcSrjs if test -z "$pic_object" || test "$pic_object" = none ; then 4845fa225cbcSrjs arg="$non_pic_object" 4846fa225cbcSrjs fi 4847fa225cbcSrjs else 4848fa225cbcSrjs # If the PIC object exists, use it instead. 4849fa225cbcSrjs # $xdir was prepended to $pic_object above. 4850fa225cbcSrjs non_pic_object="$pic_object" 4851fa225cbcSrjs func_append non_pic_objects " $non_pic_object" 4852fa225cbcSrjs fi 4853fa225cbcSrjs else 4854fa225cbcSrjs # Only an error if not doing a dry-run. 4855fa225cbcSrjs if $opt_dry_run; then 4856fa225cbcSrjs # Extract subdirectory from the argument. 4857fa225cbcSrjs func_dirname "$arg" "/" "" 4858fa225cbcSrjs xdir="$func_dirname_result" 4859fa225cbcSrjs 4860fa225cbcSrjs func_lo2o "$arg" 4861fa225cbcSrjs pic_object=$xdir$objdir/$func_lo2o_result 4862fa225cbcSrjs non_pic_object=$xdir$func_lo2o_result 4863fa225cbcSrjs func_append libobjs " $pic_object" 4864fa225cbcSrjs func_append non_pic_objects " $non_pic_object" 4865fa225cbcSrjs else 4866fa225cbcSrjs func_fatal_error "\`$arg' is not a valid libtool object" 4867fa225cbcSrjs fi 4868fa225cbcSrjs fi 4869fa225cbcSrjs ;; 4870fa225cbcSrjs 4871fa225cbcSrjs *.$libext) 4872fa225cbcSrjs # An archive. 4873fa225cbcSrjs deplibs="$deplibs $arg" 4874fa225cbcSrjs old_deplibs="$old_deplibs $arg" 4875fa225cbcSrjs continue 4876fa225cbcSrjs ;; 4877fa225cbcSrjs 4878fa225cbcSrjs *.la) 4879fa225cbcSrjs # A libtool-controlled library. 4880fa225cbcSrjs 4881fa225cbcSrjs if test "$prev" = dlfiles; then 4882fa225cbcSrjs # This library was specified with -dlopen. 4883fa225cbcSrjs dlfiles="$dlfiles $arg" 4884fa225cbcSrjs prev= 4885fa225cbcSrjs elif test "$prev" = dlprefiles; then 4886fa225cbcSrjs # The library was specified with -dlpreopen. 4887fa225cbcSrjs dlprefiles="$dlprefiles $arg" 4888fa225cbcSrjs prev= 4889fa225cbcSrjs else 4890fa225cbcSrjs deplibs="$deplibs $arg" 4891fa225cbcSrjs fi 4892fa225cbcSrjs continue 4893fa225cbcSrjs ;; 4894fa225cbcSrjs 4895fa225cbcSrjs # Some other compiler argument. 4896fa225cbcSrjs *) 4897fa225cbcSrjs # Unknown arguments in both finalize_command and compile_command need 4898fa225cbcSrjs # to be aesthetically quoted because they are evaled later. 4899fa225cbcSrjs func_quote_for_eval "$arg" 4900fa225cbcSrjs arg="$func_quote_for_eval_result" 4901fa225cbcSrjs ;; 4902fa225cbcSrjs esac # arg 4903fa225cbcSrjs 4904fa225cbcSrjs # Now actually substitute the argument into the commands. 4905fa225cbcSrjs if test -n "$arg"; then 4906fa225cbcSrjs func_append compile_command " $arg" 4907fa225cbcSrjs func_append finalize_command " $arg" 4908fa225cbcSrjs fi 4909fa225cbcSrjs done # argument parsing loop 4910fa225cbcSrjs 4911fa225cbcSrjs test -n "$prev" && \ 4912fa225cbcSrjs func_fatal_help "the \`$prevarg' option requires an argument" 4913fa225cbcSrjs 4914fa225cbcSrjs if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 4915fa225cbcSrjs eval arg=\"$export_dynamic_flag_spec\" 4916fa225cbcSrjs func_append compile_command " $arg" 4917fa225cbcSrjs func_append finalize_command " $arg" 4918fa225cbcSrjs fi 4919fa225cbcSrjs 4920fa225cbcSrjs oldlibs= 4921fa225cbcSrjs # calculate the name of the file, without its directory 4922fa225cbcSrjs func_basename "$output" 4923fa225cbcSrjs outputname="$func_basename_result" 4924fa225cbcSrjs libobjs_save="$libobjs" 4925fa225cbcSrjs 4926fa225cbcSrjs if test -n "$shlibpath_var"; then 4927fa225cbcSrjs # get the directories listed in $shlibpath_var 4928fa225cbcSrjs eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 4929fa225cbcSrjs else 4930fa225cbcSrjs shlib_search_path= 4931fa225cbcSrjs fi 4932fa225cbcSrjs eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 4933fa225cbcSrjs eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 4934fa225cbcSrjs 4935fa225cbcSrjs func_dirname "$output" "/" "" 4936fa225cbcSrjs output_objdir="$func_dirname_result$objdir" 4937fa225cbcSrjs # Create the object directory. 4938fa225cbcSrjs func_mkdir_p "$output_objdir" 4939fa225cbcSrjs 4940fa225cbcSrjs # Determine the type of output 4941fa225cbcSrjs case $output in 4942fa225cbcSrjs "") 4943fa225cbcSrjs func_fatal_help "you must specify an output file" 4944fa225cbcSrjs ;; 4945fa225cbcSrjs *.$libext) linkmode=oldlib ;; 4946fa225cbcSrjs *.lo | *.$objext) linkmode=obj ;; 4947fa225cbcSrjs *.la) linkmode=lib ;; 4948fa225cbcSrjs *) linkmode=prog ;; # Anything else should be a program. 4949fa225cbcSrjs esac 4950fa225cbcSrjs 4951fa225cbcSrjs specialdeplibs= 4952fa225cbcSrjs 4953fa225cbcSrjs libs= 4954fa225cbcSrjs # Find all interdependent deplibs by searching for libraries 4955fa225cbcSrjs # that are linked more than once (e.g. -la -lb -la) 4956fa225cbcSrjs for deplib in $deplibs; do 4957fa225cbcSrjs if $opt_duplicate_deps ; then 4958fa225cbcSrjs case "$libs " in 4959fa225cbcSrjs *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 4960fa225cbcSrjs esac 4961fa225cbcSrjs fi 4962fa225cbcSrjs libs="$libs $deplib" 4963fa225cbcSrjs done 4964fa225cbcSrjs 4965fa225cbcSrjs if test "$linkmode" = lib; then 4966fa225cbcSrjs libs="$predeps $libs $compiler_lib_search_path $postdeps" 4967fa225cbcSrjs 4968fa225cbcSrjs # Compute libraries that are listed more than once in $predeps 4969fa225cbcSrjs # $postdeps and mark them as special (i.e., whose duplicates are 4970fa225cbcSrjs # not to be eliminated). 4971fa225cbcSrjs pre_post_deps= 4972fa225cbcSrjs if $opt_duplicate_compiler_generated_deps; then 4973fa225cbcSrjs for pre_post_dep in $predeps $postdeps; do 4974fa225cbcSrjs case "$pre_post_deps " in 4975fa225cbcSrjs *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 4976fa225cbcSrjs esac 4977fa225cbcSrjs pre_post_deps="$pre_post_deps $pre_post_dep" 4978fa225cbcSrjs done 4979fa225cbcSrjs fi 4980fa225cbcSrjs pre_post_deps= 4981fa225cbcSrjs fi 4982fa225cbcSrjs 4983fa225cbcSrjs deplibs= 4984fa225cbcSrjs newdependency_libs= 4985fa225cbcSrjs newlib_search_path= 4986fa225cbcSrjs need_relink=no # whether we're linking any uninstalled libtool libraries 4987fa225cbcSrjs notinst_deplibs= # not-installed libtool libraries 4988fa225cbcSrjs notinst_path= # paths that contain not-installed libtool libraries 4989fa225cbcSrjs 4990fa225cbcSrjs case $linkmode in 4991fa225cbcSrjs lib) 4992fa225cbcSrjs passes="conv dlpreopen link" 4993fa225cbcSrjs for file in $dlfiles $dlprefiles; do 4994fa225cbcSrjs case $file in 4995fa225cbcSrjs *.la) ;; 4996fa225cbcSrjs *) 4997fa225cbcSrjs func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 4998fa225cbcSrjs ;; 4999fa225cbcSrjs esac 5000fa225cbcSrjs done 5001fa225cbcSrjs ;; 5002fa225cbcSrjs prog) 5003fa225cbcSrjs compile_deplibs= 5004fa225cbcSrjs finalize_deplibs= 5005fa225cbcSrjs alldeplibs=no 5006fa225cbcSrjs newdlfiles= 5007fa225cbcSrjs newdlprefiles= 5008fa225cbcSrjs passes="conv scan dlopen dlpreopen link" 5009fa225cbcSrjs ;; 5010fa225cbcSrjs *) passes="conv" 5011fa225cbcSrjs ;; 5012fa225cbcSrjs esac 5013fa225cbcSrjs 5014fa225cbcSrjs for pass in $passes; do 5015fa225cbcSrjs # The preopen pass in lib mode reverses $deplibs; put it back here 5016fa225cbcSrjs # so that -L comes before libs that need it for instance... 5017fa225cbcSrjs if test "$linkmode,$pass" = "lib,link"; then 5018fa225cbcSrjs ## FIXME: Find the place where the list is rebuilt in the wrong 5019fa225cbcSrjs ## order, and fix it there properly 5020fa225cbcSrjs tmp_deplibs= 5021fa225cbcSrjs for deplib in $deplibs; do 5022fa225cbcSrjs tmp_deplibs="$deplib $tmp_deplibs" 5023fa225cbcSrjs done 5024fa225cbcSrjs deplibs="$tmp_deplibs" 5025fa225cbcSrjs fi 5026fa225cbcSrjs 5027fa225cbcSrjs if test "$linkmode,$pass" = "lib,link" || 5028fa225cbcSrjs test "$linkmode,$pass" = "prog,scan"; then 5029fa225cbcSrjs libs="$deplibs" 5030fa225cbcSrjs deplibs= 5031fa225cbcSrjs fi 5032fa225cbcSrjs if test "$linkmode" = prog; then 5033fa225cbcSrjs case $pass in 5034fa225cbcSrjs dlopen) libs="$dlfiles" ;; 5035fa225cbcSrjs dlpreopen) libs="$dlprefiles" ;; 5036fa225cbcSrjs link) 5037fa225cbcSrjs libs="$deplibs %DEPLIBS%" 5038fa225cbcSrjs test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" 5039fa225cbcSrjs ;; 5040fa225cbcSrjs esac 5041fa225cbcSrjs fi 5042fa225cbcSrjs if test "$linkmode,$pass" = "lib,dlpreopen"; then 5043fa225cbcSrjs # Collect and forward deplibs of preopened libtool libs 5044fa225cbcSrjs for lib in $dlprefiles; do 5045fa225cbcSrjs # Ignore non-libtool-libs 5046fa225cbcSrjs dependency_libs= 5047fa225cbcSrjs case $lib in 5048fa225cbcSrjs *.la) func_source "$lib" ;; 5049fa225cbcSrjs esac 5050fa225cbcSrjs 5051fa225cbcSrjs # Collect preopened libtool deplibs, except any this library 5052fa225cbcSrjs # has declared as weak libs 5053fa225cbcSrjs for deplib in $dependency_libs; do 5054fa225cbcSrjs deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` 5055fa225cbcSrjs case " $weak_libs " in 5056fa225cbcSrjs *" $deplib_base "*) ;; 5057fa225cbcSrjs *) deplibs="$deplibs $deplib" ;; 5058fa225cbcSrjs esac 5059fa225cbcSrjs done 5060fa225cbcSrjs done 5061fa225cbcSrjs libs="$dlprefiles" 5062fa225cbcSrjs fi 5063fa225cbcSrjs if test "$pass" = dlopen; then 5064fa225cbcSrjs # Collect dlpreopened libraries 5065fa225cbcSrjs save_deplibs="$deplibs" 5066fa225cbcSrjs deplibs= 5067fa225cbcSrjs fi 5068fa225cbcSrjs 5069fa225cbcSrjs for deplib in $libs; do 5070fa225cbcSrjs lib= 5071fa225cbcSrjs found=no 5072fa225cbcSrjs case $deplib in 5073fa225cbcSrjs -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 5074fa225cbcSrjs if test "$linkmode,$pass" = "prog,link"; then 5075fa225cbcSrjs compile_deplibs="$deplib $compile_deplibs" 5076fa225cbcSrjs finalize_deplibs="$deplib $finalize_deplibs" 5077fa225cbcSrjs else 5078fa225cbcSrjs compiler_flags="$compiler_flags $deplib" 5079fa225cbcSrjs if test "$linkmode" = lib ; then 5080fa225cbcSrjs case "$new_inherited_linker_flags " in 5081fa225cbcSrjs *" $deplib "*) ;; 5082fa225cbcSrjs * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 5083fa225cbcSrjs esac 5084fa225cbcSrjs fi 5085fa225cbcSrjs fi 5086fa225cbcSrjs continue 5087fa225cbcSrjs ;; 5088fa225cbcSrjs -l*) 5089fa225cbcSrjs if test "$linkmode" != lib && test "$linkmode" != prog; then 5090fa225cbcSrjs func_warning "\`-l' is ignored for archives/objects" 5091fa225cbcSrjs continue 5092fa225cbcSrjs fi 5093fa225cbcSrjs func_stripname '-l' '' "$deplib" 5094fa225cbcSrjs name=$func_stripname_result 5095fa225cbcSrjs if test "$linkmode" = lib; then 5096fa225cbcSrjs searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 5097fa225cbcSrjs else 5098fa225cbcSrjs searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 5099fa225cbcSrjs fi 5100fa225cbcSrjs for searchdir in $searchdirs; do 5101fa225cbcSrjs for search_ext in .la $std_shrext .so .a; do 5102fa225cbcSrjs # Search the libtool library 5103fa225cbcSrjs lib="$searchdir/lib${name}${search_ext}" 5104fa225cbcSrjs if test -f "$lib"; then 5105fa225cbcSrjs if test "$search_ext" = ".la"; then 5106fa225cbcSrjs found=yes 5107fa225cbcSrjs else 5108fa225cbcSrjs found=no 5109fa225cbcSrjs fi 5110fa225cbcSrjs break 2 5111fa225cbcSrjs fi 5112fa225cbcSrjs done 5113fa225cbcSrjs done 5114fa225cbcSrjs if test "$found" != yes; then 5115fa225cbcSrjs # deplib doesn't seem to be a libtool library 5116fa225cbcSrjs if test "$linkmode,$pass" = "prog,link"; then 5117fa225cbcSrjs compile_deplibs="$deplib $compile_deplibs" 5118fa225cbcSrjs finalize_deplibs="$deplib $finalize_deplibs" 5119fa225cbcSrjs else 5120fa225cbcSrjs deplibs="$deplib $deplibs" 5121fa225cbcSrjs test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 5122fa225cbcSrjs fi 5123fa225cbcSrjs continue 5124fa225cbcSrjs else # deplib is a libtool library 5125fa225cbcSrjs # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 5126fa225cbcSrjs # We need to do some special things here, and not later. 5127fa225cbcSrjs if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 5128fa225cbcSrjs case " $predeps $postdeps " in 5129fa225cbcSrjs *" $deplib "*) 5130fa225cbcSrjs if func_lalib_p "$lib"; then 5131fa225cbcSrjs library_names= 5132fa225cbcSrjs old_library= 5133fa225cbcSrjs func_source "$lib" 5134fa225cbcSrjs for l in $old_library $library_names; do 5135fa225cbcSrjs ll="$l" 5136fa225cbcSrjs done 5137fa225cbcSrjs if test "X$ll" = "X$old_library" ; then # only static version available 5138fa225cbcSrjs found=no 5139fa225cbcSrjs func_dirname "$lib" "" "." 5140fa225cbcSrjs ladir="$func_dirname_result" 5141fa225cbcSrjs lib=$ladir/$old_library 5142fa225cbcSrjs if test "$linkmode,$pass" = "prog,link"; then 5143fa225cbcSrjs compile_deplibs="$deplib $compile_deplibs" 5144fa225cbcSrjs finalize_deplibs="$deplib $finalize_deplibs" 5145fa225cbcSrjs else 5146fa225cbcSrjs deplibs="$deplib $deplibs" 5147fa225cbcSrjs test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 5148fa225cbcSrjs fi 5149fa225cbcSrjs continue 5150fa225cbcSrjs fi 5151fa225cbcSrjs fi 5152fa225cbcSrjs ;; 5153fa225cbcSrjs *) ;; 5154fa225cbcSrjs esac 5155fa225cbcSrjs fi 5156fa225cbcSrjs fi 5157fa225cbcSrjs ;; # -l 5158fa225cbcSrjs *.ltframework) 5159fa225cbcSrjs if test "$linkmode,$pass" = "prog,link"; then 5160fa225cbcSrjs compile_deplibs="$deplib $compile_deplibs" 5161fa225cbcSrjs finalize_deplibs="$deplib $finalize_deplibs" 5162fa225cbcSrjs else 5163fa225cbcSrjs deplibs="$deplib $deplibs" 5164fa225cbcSrjs if test "$linkmode" = lib ; then 5165fa225cbcSrjs case "$new_inherited_linker_flags " in 5166fa225cbcSrjs *" $deplib "*) ;; 5167fa225cbcSrjs * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 5168fa225cbcSrjs esac 5169fa225cbcSrjs fi 5170fa225cbcSrjs fi 5171fa225cbcSrjs continue 5172fa225cbcSrjs ;; 5173fa225cbcSrjs -L*) 5174fa225cbcSrjs case $linkmode in 5175fa225cbcSrjs lib) 5176fa225cbcSrjs deplibs="$deplib $deplibs" 5177fa225cbcSrjs test "$pass" = conv && continue 5178fa225cbcSrjs newdependency_libs="$deplib $newdependency_libs" 5179fa225cbcSrjs func_stripname '-L' '' "$deplib" 5180fa225cbcSrjs newlib_search_path="$newlib_search_path $func_stripname_result" 5181fa225cbcSrjs ;; 5182fa225cbcSrjs prog) 5183fa225cbcSrjs if test "$pass" = conv; then 5184fa225cbcSrjs deplibs="$deplib $deplibs" 5185fa225cbcSrjs continue 5186fa225cbcSrjs fi 5187fa225cbcSrjs if test "$pass" = scan; then 5188fa225cbcSrjs deplibs="$deplib $deplibs" 5189fa225cbcSrjs else 5190fa225cbcSrjs compile_deplibs="$deplib $compile_deplibs" 5191fa225cbcSrjs finalize_deplibs="$deplib $finalize_deplibs" 5192fa225cbcSrjs fi 5193fa225cbcSrjs func_stripname '-L' '' "$deplib" 5194fa225cbcSrjs newlib_search_path="$newlib_search_path $func_stripname_result" 5195fa225cbcSrjs ;; 5196fa225cbcSrjs *) 5197fa225cbcSrjs func_warning "\`-L' is ignored for archives/objects" 5198fa225cbcSrjs ;; 5199fa225cbcSrjs esac # linkmode 5200fa225cbcSrjs continue 5201fa225cbcSrjs ;; # -L 5202fa225cbcSrjs -R*) 5203fa225cbcSrjs if test "$pass" = link; then 5204fa225cbcSrjs func_stripname '-R' '' "$deplib" 5205fa225cbcSrjs dir=$func_stripname_result 5206fa225cbcSrjs # Make sure the xrpath contains only unique directories. 5207fa225cbcSrjs case "$xrpath " in 5208fa225cbcSrjs *" $dir "*) ;; 5209fa225cbcSrjs *) xrpath="$xrpath $dir" ;; 5210fa225cbcSrjs esac 5211fa225cbcSrjs fi 5212fa225cbcSrjs deplibs="$deplib $deplibs" 5213fa225cbcSrjs continue 5214fa225cbcSrjs ;; 5215fa225cbcSrjs *.la) lib="$deplib" ;; 5216fa225cbcSrjs *.$libext) 5217fa225cbcSrjs if test "$pass" = conv; then 5218fa225cbcSrjs deplibs="$deplib $deplibs" 5219fa225cbcSrjs continue 5220fa225cbcSrjs fi 5221fa225cbcSrjs case $linkmode in 5222fa225cbcSrjs lib) 5223fa225cbcSrjs # Linking convenience modules into shared libraries is allowed, 5224fa225cbcSrjs # but linking other static libraries is non-portable. 5225fa225cbcSrjs case " $dlpreconveniencelibs " in 5226fa225cbcSrjs *" $deplib "*) ;; 5227fa225cbcSrjs *) 5228fa225cbcSrjs valid_a_lib=no 5229fa225cbcSrjs case $deplibs_check_method in 5230fa225cbcSrjs match_pattern*) 5231fa225cbcSrjs set dummy $deplibs_check_method; shift 5232fa225cbcSrjs match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 5233fa225cbcSrjs if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ 5234fa225cbcSrjs | $EGREP "$match_pattern_regex" > /dev/null; then 5235fa225cbcSrjs valid_a_lib=yes 5236fa225cbcSrjs fi 5237fa225cbcSrjs ;; 5238fa225cbcSrjs pass_all) 5239fa225cbcSrjs valid_a_lib=yes 5240fa225cbcSrjs ;; 5241fa225cbcSrjs esac 5242fa225cbcSrjs if test "$valid_a_lib" != yes; then 5243fa225cbcSrjs $ECHO 5244fa225cbcSrjs $ECHO "*** Warning: Trying to link with static lib archive $deplib." 5245fa225cbcSrjs $ECHO "*** I have the capability to make that library automatically link in when" 5246fa225cbcSrjs $ECHO "*** you link to this library. But I can only do this if you have a" 5247fa225cbcSrjs $ECHO "*** shared version of the library, which you do not appear to have" 5248fa225cbcSrjs $ECHO "*** because the file extensions .$libext of this argument makes me believe" 5249fa225cbcSrjs $ECHO "*** that it is just a static archive that I should not use here." 5250fa225cbcSrjs else 5251fa225cbcSrjs $ECHO 5252fa225cbcSrjs $ECHO "*** Warning: Linking the shared library $output against the" 5253fa225cbcSrjs $ECHO "*** static library $deplib is not portable!" 5254fa225cbcSrjs deplibs="$deplib $deplibs" 5255fa225cbcSrjs fi 5256fa225cbcSrjs ;; 5257fa225cbcSrjs esac 5258fa225cbcSrjs continue 5259fa225cbcSrjs ;; 5260fa225cbcSrjs prog) 5261fa225cbcSrjs if test "$pass" != link; then 5262fa225cbcSrjs deplibs="$deplib $deplibs" 5263fa225cbcSrjs else 5264fa225cbcSrjs compile_deplibs="$deplib $compile_deplibs" 5265fa225cbcSrjs finalize_deplibs="$deplib $finalize_deplibs" 5266fa225cbcSrjs fi 5267fa225cbcSrjs continue 5268fa225cbcSrjs ;; 5269fa225cbcSrjs esac # linkmode 5270fa225cbcSrjs ;; # *.$libext 5271fa225cbcSrjs *.lo | *.$objext) 5272fa225cbcSrjs if test "$pass" = conv; then 5273fa225cbcSrjs deplibs="$deplib $deplibs" 5274fa225cbcSrjs elif test "$linkmode" = prog; then 5275fa225cbcSrjs if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 5276fa225cbcSrjs # If there is no dlopen support or we're linking statically, 5277fa225cbcSrjs # we need to preload. 5278fa225cbcSrjs newdlprefiles="$newdlprefiles $deplib" 5279fa225cbcSrjs compile_deplibs="$deplib $compile_deplibs" 5280fa225cbcSrjs finalize_deplibs="$deplib $finalize_deplibs" 5281fa225cbcSrjs else 5282fa225cbcSrjs newdlfiles="$newdlfiles $deplib" 5283fa225cbcSrjs fi 5284fa225cbcSrjs fi 5285fa225cbcSrjs continue 5286fa225cbcSrjs ;; 5287fa225cbcSrjs %DEPLIBS%) 5288fa225cbcSrjs alldeplibs=yes 5289fa225cbcSrjs continue 5290fa225cbcSrjs ;; 5291fa225cbcSrjs esac # case $deplib 5292fa225cbcSrjs 5293fa225cbcSrjs if test "$found" = yes || test -f "$lib"; then : 5294fa225cbcSrjs else 5295fa225cbcSrjs func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 5296fa225cbcSrjs fi 5297fa225cbcSrjs 5298fa225cbcSrjs # Check to see that this really is a libtool archive. 5299fa225cbcSrjs func_lalib_unsafe_p "$lib" \ 5300fa225cbcSrjs || func_fatal_error "\`$lib' is not a valid libtool archive" 5301fa225cbcSrjs 5302fa225cbcSrjs func_dirname "$lib" "" "." 5303fa225cbcSrjs ladir="$func_dirname_result" 5304fa225cbcSrjs 5305fa225cbcSrjs dlname= 5306fa225cbcSrjs dlopen= 5307fa225cbcSrjs dlpreopen= 5308fa225cbcSrjs libdir= 5309fa225cbcSrjs library_names= 5310fa225cbcSrjs old_library= 5311fa225cbcSrjs inherited_linker_flags= 5312fa225cbcSrjs # If the library was installed with an old release of libtool, 5313fa225cbcSrjs # it will not redefine variables installed, or shouldnotlink 5314fa225cbcSrjs installed=yes 5315fa225cbcSrjs shouldnotlink=no 5316fa225cbcSrjs avoidtemprpath= 5317fa225cbcSrjs 5318fa225cbcSrjs 5319fa225cbcSrjs # Read the .la file 5320fa225cbcSrjs func_source "$lib" 5321fa225cbcSrjs 5322fa225cbcSrjs # Convert "-framework foo" to "foo.ltframework" 5323fa225cbcSrjs if test -n "$inherited_linker_flags"; then 5324fa225cbcSrjs tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` 5325fa225cbcSrjs for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 5326fa225cbcSrjs case " $new_inherited_linker_flags " in 5327fa225cbcSrjs *" $tmp_inherited_linker_flag "*) ;; 5328fa225cbcSrjs *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 5329fa225cbcSrjs esac 5330fa225cbcSrjs done 5331fa225cbcSrjs fi 5332fa225cbcSrjs dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 5333fa225cbcSrjs if test "$linkmode,$pass" = "lib,link" || 5334fa225cbcSrjs test "$linkmode,$pass" = "prog,scan" || 5335fa225cbcSrjs { test "$linkmode" != prog && test "$linkmode" != lib; }; then 5336fa225cbcSrjs test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 5337fa225cbcSrjs test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 5338fa225cbcSrjs fi 5339fa225cbcSrjs 5340fa225cbcSrjs if test "$pass" = conv; then 5341fa225cbcSrjs # Only check for convenience libraries 5342fa225cbcSrjs deplibs="$lib $deplibs" 5343fa225cbcSrjs if test -z "$libdir"; then 5344fa225cbcSrjs if test -z "$old_library"; then 5345fa225cbcSrjs func_fatal_error "cannot find name of link library for \`$lib'" 5346fa225cbcSrjs fi 5347fa225cbcSrjs # It is a libtool convenience library, so add in its objects. 5348fa225cbcSrjs convenience="$convenience $ladir/$objdir/$old_library" 5349fa225cbcSrjs old_convenience="$old_convenience $ladir/$objdir/$old_library" 5350fa225cbcSrjs tmp_libs= 5351fa225cbcSrjs for deplib in $dependency_libs; do 5352fa225cbcSrjs deplibs="$deplib $deplibs" 5353fa225cbcSrjs if $opt_duplicate_deps ; then 5354fa225cbcSrjs case "$tmp_libs " in 5355fa225cbcSrjs *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 5356fa225cbcSrjs esac 5357fa225cbcSrjs fi 5358fa225cbcSrjs tmp_libs="$tmp_libs $deplib" 5359fa225cbcSrjs done 5360fa225cbcSrjs elif test "$linkmode" != prog && test "$linkmode" != lib; then 5361fa225cbcSrjs func_fatal_error "\`$lib' is not a convenience library" 5362fa225cbcSrjs fi 5363fa225cbcSrjs continue 5364fa225cbcSrjs fi # $pass = conv 5365fa225cbcSrjs 5366fa225cbcSrjs 5367fa225cbcSrjs # Get the name of the library we link against. 5368fa225cbcSrjs linklib= 5369fa225cbcSrjs for l in $old_library $library_names; do 5370fa225cbcSrjs linklib="$l" 5371fa225cbcSrjs done 5372fa225cbcSrjs if test -z "$linklib"; then 5373fa225cbcSrjs func_fatal_error "cannot find name of link library for \`$lib'" 5374fa225cbcSrjs fi 5375fa225cbcSrjs 5376fa225cbcSrjs # This library was specified with -dlopen. 5377fa225cbcSrjs if test "$pass" = dlopen; then 5378fa225cbcSrjs if test -z "$libdir"; then 5379fa225cbcSrjs func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 5380fa225cbcSrjs fi 5381fa225cbcSrjs if test -z "$dlname" || 5382fa225cbcSrjs test "$dlopen_support" != yes || 5383fa225cbcSrjs test "$build_libtool_libs" = no; then 5384fa225cbcSrjs # If there is no dlname, no dlopen support or we're linking 5385fa225cbcSrjs # statically, we need to preload. We also need to preload any 5386fa225cbcSrjs # dependent libraries so libltdl's deplib preloader doesn't 5387fa225cbcSrjs # bomb out in the load deplibs phase. 5388fa225cbcSrjs dlprefiles="$dlprefiles $lib $dependency_libs" 5389fa225cbcSrjs else 5390fa225cbcSrjs newdlfiles="$newdlfiles $lib" 5391fa225cbcSrjs fi 5392fa225cbcSrjs continue 5393fa225cbcSrjs fi # $pass = dlopen 5394fa225cbcSrjs 5395fa225cbcSrjs # We need an absolute path. 5396fa225cbcSrjs case $ladir in 5397fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 5398fa225cbcSrjs *) 5399fa225cbcSrjs abs_ladir=`cd "$ladir" && pwd` 5400fa225cbcSrjs if test -z "$abs_ladir"; then 5401fa225cbcSrjs func_warning "cannot determine absolute directory name of \`$ladir'" 5402fa225cbcSrjs func_warning "passing it literally to the linker, although it might fail" 5403fa225cbcSrjs abs_ladir="$ladir" 5404fa225cbcSrjs fi 5405fa225cbcSrjs ;; 5406fa225cbcSrjs esac 5407fa225cbcSrjs func_basename "$lib" 5408fa225cbcSrjs laname="$func_basename_result" 5409fa225cbcSrjs 5410fa225cbcSrjs # Find the relevant object directory and library name. 5411fa225cbcSrjs if test "X$installed" = Xyes; then 5412fa225cbcSrjs if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 5413fa225cbcSrjs func_warning "library \`$lib' was moved." 5414fa225cbcSrjs dir="$ladir" 5415fa225cbcSrjs absdir="$abs_ladir" 5416fa225cbcSrjs libdir="$abs_ladir" 5417fa225cbcSrjs else 5418fa225cbcSrjs dir="$libdir" 5419fa225cbcSrjs absdir="$libdir" 5420fa225cbcSrjs fi 5421fa225cbcSrjs test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 5422fa225cbcSrjs else 5423fa225cbcSrjs if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 5424fa225cbcSrjs dir="$ladir" 5425fa225cbcSrjs absdir="$abs_ladir" 5426fa225cbcSrjs # Remove this search path later 5427fa225cbcSrjs notinst_path="$notinst_path $abs_ladir" 5428fa225cbcSrjs else 5429fa225cbcSrjs dir="$ladir/$objdir" 5430fa225cbcSrjs absdir="$abs_ladir/$objdir" 5431fa225cbcSrjs # Remove this search path later 5432fa225cbcSrjs notinst_path="$notinst_path $abs_ladir" 5433fa225cbcSrjs fi 5434fa225cbcSrjs fi # $installed = yes 5435fa225cbcSrjs func_stripname 'lib' '.la' "$laname" 5436fa225cbcSrjs name=$func_stripname_result 5437fa225cbcSrjs 5438fa225cbcSrjs # This library was specified with -dlpreopen. 5439fa225cbcSrjs if test "$pass" = dlpreopen; then 5440fa225cbcSrjs if test -z "$libdir" && test "$linkmode" = prog; then 5441fa225cbcSrjs func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 5442fa225cbcSrjs fi 5443fa225cbcSrjs # Prefer using a static library (so that no silly _DYNAMIC symbols 5444fa225cbcSrjs # are required to link). 5445fa225cbcSrjs if test -n "$old_library"; then 5446fa225cbcSrjs newdlprefiles="$newdlprefiles $dir/$old_library" 5447fa225cbcSrjs # Keep a list of preopened convenience libraries to check 5448fa225cbcSrjs # that they are being used correctly in the link pass. 5449fa225cbcSrjs test -z "$libdir" && \ 5450fa225cbcSrjs dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 5451fa225cbcSrjs # Otherwise, use the dlname, so that lt_dlopen finds it. 5452fa225cbcSrjs elif test -n "$dlname"; then 5453fa225cbcSrjs newdlprefiles="$newdlprefiles $dir/$dlname" 5454fa225cbcSrjs else 5455fa225cbcSrjs newdlprefiles="$newdlprefiles $dir/$linklib" 5456fa225cbcSrjs fi 5457fa225cbcSrjs fi # $pass = dlpreopen 5458fa225cbcSrjs 5459fa225cbcSrjs if test -z "$libdir"; then 5460fa225cbcSrjs # Link the convenience library 5461fa225cbcSrjs if test "$linkmode" = lib; then 5462fa225cbcSrjs deplibs="$dir/$old_library $deplibs" 5463fa225cbcSrjs elif test "$linkmode,$pass" = "prog,link"; then 5464fa225cbcSrjs compile_deplibs="$dir/$old_library $compile_deplibs" 5465fa225cbcSrjs finalize_deplibs="$dir/$old_library $finalize_deplibs" 5466fa225cbcSrjs else 5467fa225cbcSrjs deplibs="$lib $deplibs" # used for prog,scan pass 5468fa225cbcSrjs fi 5469fa225cbcSrjs continue 5470fa225cbcSrjs fi 5471fa225cbcSrjs 5472fa225cbcSrjs 5473fa225cbcSrjs if test "$linkmode" = prog && test "$pass" != link; then 5474fa225cbcSrjs newlib_search_path="$newlib_search_path $ladir" 5475fa225cbcSrjs deplibs="$lib $deplibs" 5476fa225cbcSrjs 5477fa225cbcSrjs linkalldeplibs=no 5478fa225cbcSrjs if test "$link_all_deplibs" != no || test -z "$library_names" || 5479fa225cbcSrjs test "$build_libtool_libs" = no; then 5480fa225cbcSrjs linkalldeplibs=yes 5481fa225cbcSrjs fi 5482fa225cbcSrjs 5483fa225cbcSrjs tmp_libs= 5484fa225cbcSrjs for deplib in $dependency_libs; do 5485fa225cbcSrjs case $deplib in 5486fa225cbcSrjs -L*) func_stripname '-L' '' "$deplib" 5487fa225cbcSrjs newlib_search_path="$newlib_search_path $func_stripname_result" 5488fa225cbcSrjs ;; 5489fa225cbcSrjs esac 5490fa225cbcSrjs # Need to link against all dependency_libs? 5491fa225cbcSrjs if test "$linkalldeplibs" = yes; then 5492fa225cbcSrjs deplibs="$deplib $deplibs" 5493fa225cbcSrjs else 5494fa225cbcSrjs # Need to hardcode shared library paths 5495fa225cbcSrjs # or/and link against static libraries 5496fa225cbcSrjs newdependency_libs="$deplib $newdependency_libs" 5497fa225cbcSrjs fi 5498fa225cbcSrjs if $opt_duplicate_deps ; then 5499fa225cbcSrjs case "$tmp_libs " in 5500fa225cbcSrjs *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 5501fa225cbcSrjs esac 5502fa225cbcSrjs fi 5503fa225cbcSrjs tmp_libs="$tmp_libs $deplib" 5504fa225cbcSrjs done # for deplib 5505fa225cbcSrjs continue 5506fa225cbcSrjs fi # $linkmode = prog... 5507fa225cbcSrjs 5508fa225cbcSrjs if test "$linkmode,$pass" = "prog,link"; then 5509fa225cbcSrjs if test -n "$library_names" && 5510fa225cbcSrjs { { test "$prefer_static_libs" = no || 5511fa225cbcSrjs test "$prefer_static_libs,$installed" = "built,yes"; } || 5512fa225cbcSrjs test -z "$old_library"; }; then 5513fa225cbcSrjs # We need to hardcode the library path 5514fa225cbcSrjs if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 5515fa225cbcSrjs # Make sure the rpath contains only unique directories. 5516fa225cbcSrjs case "$temp_rpath:" in 5517fa225cbcSrjs *"$absdir:"*) ;; 5518fa225cbcSrjs *) temp_rpath="$temp_rpath$absdir:" ;; 5519fa225cbcSrjs esac 5520fa225cbcSrjs fi 5521fa225cbcSrjs 5522fa225cbcSrjs # Hardcode the library path. 5523fa225cbcSrjs # Skip directories that are in the system default run-time 5524fa225cbcSrjs # search path. 5525fa225cbcSrjs case " $sys_lib_dlsearch_path " in 5526fa225cbcSrjs *" $absdir "*) ;; 5527fa225cbcSrjs *) 5528fa225cbcSrjs case "$compile_rpath " in 5529fa225cbcSrjs *" $absdir "*) ;; 5530fa225cbcSrjs *) compile_rpath="$compile_rpath $absdir" 5531fa225cbcSrjs esac 5532fa225cbcSrjs ;; 5533fa225cbcSrjs esac 5534fa225cbcSrjs case " $sys_lib_dlsearch_path " in 5535fa225cbcSrjs *" $libdir "*) ;; 5536fa225cbcSrjs *) 5537fa225cbcSrjs case "$finalize_rpath " in 5538fa225cbcSrjs *" $libdir "*) ;; 5539fa225cbcSrjs *) finalize_rpath="$finalize_rpath $libdir" 5540fa225cbcSrjs esac 5541fa225cbcSrjs ;; 5542fa225cbcSrjs esac 5543fa225cbcSrjs fi # $linkmode,$pass = prog,link... 5544fa225cbcSrjs 5545fa225cbcSrjs if test "$alldeplibs" = yes && 5546fa225cbcSrjs { test "$deplibs_check_method" = pass_all || 5547fa225cbcSrjs { test "$build_libtool_libs" = yes && 5548fa225cbcSrjs test -n "$library_names"; }; }; then 5549fa225cbcSrjs # We only need to search for static libraries 5550fa225cbcSrjs continue 5551fa225cbcSrjs fi 5552fa225cbcSrjs fi 5553fa225cbcSrjs 5554fa225cbcSrjs link_static=no # Whether the deplib will be linked statically 5555fa225cbcSrjs use_static_libs=$prefer_static_libs 5556fa225cbcSrjs if test "$use_static_libs" = built && test "$installed" = yes; then 5557fa225cbcSrjs use_static_libs=no 5558fa225cbcSrjs fi 5559fa225cbcSrjs if test -n "$library_names" && 5560fa225cbcSrjs { test "$use_static_libs" = no || test -z "$old_library"; }; then 5561fa225cbcSrjs case $host in 5562fa225cbcSrjs *cygwin* | *mingw* | *cegcc*) 5563fa225cbcSrjs # No point in relinking DLLs because paths are not encoded 5564fa225cbcSrjs notinst_deplibs="$notinst_deplibs $lib" 5565fa225cbcSrjs need_relink=no 5566fa225cbcSrjs ;; 5567fa225cbcSrjs *) 5568fa225cbcSrjs if test "$installed" = no; then 5569fa225cbcSrjs notinst_deplibs="$notinst_deplibs $lib" 5570fa225cbcSrjs need_relink=yes 5571fa225cbcSrjs fi 5572fa225cbcSrjs ;; 5573fa225cbcSrjs esac 5574fa225cbcSrjs # This is a shared library 5575fa225cbcSrjs 5576fa225cbcSrjs # Warn about portability, can't link against -module's on some 5577fa225cbcSrjs # systems (darwin). Don't bleat about dlopened modules though! 5578fa225cbcSrjs dlopenmodule="" 5579fa225cbcSrjs for dlpremoduletest in $dlprefiles; do 5580fa225cbcSrjs if test "X$dlpremoduletest" = "X$lib"; then 5581fa225cbcSrjs dlopenmodule="$dlpremoduletest" 5582fa225cbcSrjs break 5583fa225cbcSrjs fi 5584fa225cbcSrjs done 5585fa225cbcSrjs if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 5586fa225cbcSrjs $ECHO 5587fa225cbcSrjs if test "$linkmode" = prog; then 5588fa225cbcSrjs $ECHO "*** Warning: Linking the executable $output against the loadable module" 5589fa225cbcSrjs else 5590fa225cbcSrjs $ECHO "*** Warning: Linking the shared library $output against the loadable module" 5591fa225cbcSrjs fi 5592fa225cbcSrjs $ECHO "*** $linklib is not portable!" 5593fa225cbcSrjs fi 5594fa225cbcSrjs if test "$linkmode" = lib && 5595fa225cbcSrjs test "$hardcode_into_libs" = yes; then 5596fa225cbcSrjs # Hardcode the library path. 5597fa225cbcSrjs # Skip directories that are in the system default run-time 5598fa225cbcSrjs # search path. 5599fa225cbcSrjs case " $sys_lib_dlsearch_path " in 5600fa225cbcSrjs *" $absdir "*) ;; 5601fa225cbcSrjs *) 5602fa225cbcSrjs case "$compile_rpath " in 5603fa225cbcSrjs *" $absdir "*) ;; 5604fa225cbcSrjs *) compile_rpath="$compile_rpath $absdir" 5605fa225cbcSrjs esac 5606fa225cbcSrjs ;; 5607fa225cbcSrjs esac 5608fa225cbcSrjs case " $sys_lib_dlsearch_path " in 5609fa225cbcSrjs *" $libdir "*) ;; 5610fa225cbcSrjs *) 5611fa225cbcSrjs case "$finalize_rpath " in 5612fa225cbcSrjs *" $libdir "*) ;; 5613fa225cbcSrjs *) finalize_rpath="$finalize_rpath $libdir" 5614fa225cbcSrjs esac 5615fa225cbcSrjs ;; 5616fa225cbcSrjs esac 5617fa225cbcSrjs fi 5618fa225cbcSrjs 5619fa225cbcSrjs if test -n "$old_archive_from_expsyms_cmds"; then 5620fa225cbcSrjs # figure out the soname 5621fa225cbcSrjs set dummy $library_names 5622fa225cbcSrjs shift 5623fa225cbcSrjs realname="$1" 5624fa225cbcSrjs shift 5625fa225cbcSrjs libname=`eval "\\$ECHO \"$libname_spec\""` 5626fa225cbcSrjs # use dlname if we got it. it's perfectly good, no? 5627fa225cbcSrjs if test -n "$dlname"; then 5628fa225cbcSrjs soname="$dlname" 5629fa225cbcSrjs elif test -n "$soname_spec"; then 5630fa225cbcSrjs # bleh windows 5631fa225cbcSrjs case $host in 5632fa225cbcSrjs *cygwin* | mingw* | *cegcc*) 5633fa225cbcSrjs func_arith $current - $age 5634fa225cbcSrjs major=$func_arith_result 5635fa225cbcSrjs versuffix="-$major" 5636fa225cbcSrjs ;; 5637fa225cbcSrjs esac 5638fa225cbcSrjs eval soname=\"$soname_spec\" 5639fa225cbcSrjs else 5640fa225cbcSrjs soname="$realname" 5641fa225cbcSrjs fi 5642fa225cbcSrjs 5643fa225cbcSrjs # Make a new name for the extract_expsyms_cmds to use 5644fa225cbcSrjs soroot="$soname" 5645fa225cbcSrjs func_basename "$soroot" 5646fa225cbcSrjs soname="$func_basename_result" 5647fa225cbcSrjs func_stripname 'lib' '.dll' "$soname" 5648fa225cbcSrjs newlib=libimp-$func_stripname_result.a 5649fa225cbcSrjs 5650fa225cbcSrjs # If the library has no export list, then create one now 5651fa225cbcSrjs if test -f "$output_objdir/$soname-def"; then : 5652fa225cbcSrjs else 5653fa225cbcSrjs func_verbose "extracting exported symbol list from \`$soname'" 5654fa225cbcSrjs func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 5655fa225cbcSrjs fi 5656fa225cbcSrjs 5657fa225cbcSrjs # Create $newlib 5658fa225cbcSrjs if test -f "$output_objdir/$newlib"; then :; else 5659fa225cbcSrjs func_verbose "generating import library for \`$soname'" 5660fa225cbcSrjs func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 5661fa225cbcSrjs fi 5662fa225cbcSrjs # make sure the library variables are pointing to the new library 5663fa225cbcSrjs dir=$output_objdir 5664fa225cbcSrjs linklib=$newlib 5665fa225cbcSrjs fi # test -n "$old_archive_from_expsyms_cmds" 5666fa225cbcSrjs 5667fa225cbcSrjs if test "$linkmode" = prog || test "$mode" != relink; then 5668fa225cbcSrjs add_shlibpath= 5669fa225cbcSrjs add_dir= 5670fa225cbcSrjs add= 5671fa225cbcSrjs lib_linked=yes 5672fa225cbcSrjs case $hardcode_action in 5673fa225cbcSrjs immediate | unsupported) 5674fa225cbcSrjs if test "$hardcode_direct" = no; then 5675fa225cbcSrjs add="$dir/$linklib" 5676fa225cbcSrjs case $host in 5677fa225cbcSrjs *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 5678fa225cbcSrjs *-*-sysv4*uw2*) add_dir="-L$dir" ;; 5679fa225cbcSrjs *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 5680fa225cbcSrjs *-*-unixware7*) add_dir="-L$dir" ;; 5681fa225cbcSrjs *-*-darwin* ) 5682fa225cbcSrjs # if the lib is a (non-dlopened) module then we can not 5683fa225cbcSrjs # link against it, someone is ignoring the earlier warnings 5684fa225cbcSrjs if /usr/bin/file -L $add 2> /dev/null | 5685fa225cbcSrjs $GREP ": [^:]* bundle" >/dev/null ; then 5686fa225cbcSrjs if test "X$dlopenmodule" != "X$lib"; then 5687fa225cbcSrjs $ECHO "*** Warning: lib $linklib is a module, not a shared library" 5688fa225cbcSrjs if test -z "$old_library" ; then 5689fa225cbcSrjs $ECHO 5690fa225cbcSrjs $ECHO "*** And there doesn't seem to be a static archive available" 5691fa225cbcSrjs $ECHO "*** The link will probably fail, sorry" 5692fa225cbcSrjs else 5693fa225cbcSrjs add="$dir/$old_library" 5694fa225cbcSrjs fi 5695fa225cbcSrjs elif test -n "$old_library"; then 5696fa225cbcSrjs add="$dir/$old_library" 5697fa225cbcSrjs fi 5698fa225cbcSrjs fi 5699fa225cbcSrjs esac 5700fa225cbcSrjs elif test "$hardcode_minus_L" = no; then 5701fa225cbcSrjs case $host in 5702fa225cbcSrjs *-*-sunos*) add_shlibpath="$dir" ;; 5703fa225cbcSrjs esac 5704fa225cbcSrjs add_dir="-L$dir" 5705fa225cbcSrjs add="-l$name" 5706fa225cbcSrjs elif test "$hardcode_shlibpath_var" = no; then 5707fa225cbcSrjs add_shlibpath="$dir" 5708fa225cbcSrjs add="-l$name" 5709fa225cbcSrjs else 5710fa225cbcSrjs lib_linked=no 5711fa225cbcSrjs fi 5712fa225cbcSrjs ;; 5713fa225cbcSrjs relink) 5714fa225cbcSrjs if test "$hardcode_direct" = yes && 5715fa225cbcSrjs test "$hardcode_direct_absolute" = no; then 5716fa225cbcSrjs add="$dir/$linklib" 5717fa225cbcSrjs elif test "$hardcode_minus_L" = yes; then 5718fa225cbcSrjs add_dir="-L$dir" 5719fa225cbcSrjs # Try looking first in the location we're being installed to. 5720fa225cbcSrjs if test -n "$inst_prefix_dir"; then 5721fa225cbcSrjs case $libdir in 5722fa225cbcSrjs [\\/]*) 5723fa225cbcSrjs add_dir="$add_dir -L$inst_prefix_dir$libdir" 5724fa225cbcSrjs ;; 5725fa225cbcSrjs esac 5726fa225cbcSrjs fi 5727fa225cbcSrjs add="-l$name" 5728fa225cbcSrjs elif test "$hardcode_shlibpath_var" = yes; then 5729fa225cbcSrjs add_shlibpath="$dir" 5730fa225cbcSrjs add="-l$name" 5731fa225cbcSrjs else 5732fa225cbcSrjs lib_linked=no 5733fa225cbcSrjs fi 5734fa225cbcSrjs ;; 5735fa225cbcSrjs *) lib_linked=no ;; 5736fa225cbcSrjs esac 5737fa225cbcSrjs 5738fa225cbcSrjs if test "$lib_linked" != yes; then 5739fa225cbcSrjs func_fatal_configuration "unsupported hardcode properties" 5740fa225cbcSrjs fi 5741fa225cbcSrjs 5742fa225cbcSrjs if test -n "$add_shlibpath"; then 5743fa225cbcSrjs case :$compile_shlibpath: in 5744fa225cbcSrjs *":$add_shlibpath:"*) ;; 5745fa225cbcSrjs *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 5746fa225cbcSrjs esac 5747fa225cbcSrjs fi 5748fa225cbcSrjs if test "$linkmode" = prog; then 5749fa225cbcSrjs test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 5750fa225cbcSrjs test -n "$add" && compile_deplibs="$add $compile_deplibs" 5751fa225cbcSrjs else 5752fa225cbcSrjs test -n "$add_dir" && deplibs="$add_dir $deplibs" 5753fa225cbcSrjs test -n "$add" && deplibs="$add $deplibs" 5754fa225cbcSrjs if test "$hardcode_direct" != yes && 5755fa225cbcSrjs test "$hardcode_minus_L" != yes && 5756fa225cbcSrjs test "$hardcode_shlibpath_var" = yes; then 5757fa225cbcSrjs case :$finalize_shlibpath: in 5758fa225cbcSrjs *":$libdir:"*) ;; 5759fa225cbcSrjs *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 5760fa225cbcSrjs esac 5761fa225cbcSrjs fi 5762fa225cbcSrjs fi 5763fa225cbcSrjs fi 5764fa225cbcSrjs 5765fa225cbcSrjs if test "$linkmode" = prog || test "$mode" = relink; then 5766fa225cbcSrjs add_shlibpath= 5767fa225cbcSrjs add_dir= 5768fa225cbcSrjs add= 5769fa225cbcSrjs # Finalize command for both is simple: just hardcode it. 5770fa225cbcSrjs if test "$hardcode_direct" = yes && 5771fa225cbcSrjs test "$hardcode_direct_absolute" = no; then 5772fa225cbcSrjs add="$libdir/$linklib" 5773fa225cbcSrjs elif test "$hardcode_minus_L" = yes; then 5774fa225cbcSrjs add_dir="-L$libdir" 5775fa225cbcSrjs add="-l$name" 5776fa225cbcSrjs elif test "$hardcode_shlibpath_var" = yes; then 5777fa225cbcSrjs case :$finalize_shlibpath: in 5778fa225cbcSrjs *":$libdir:"*) ;; 5779fa225cbcSrjs *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 5780fa225cbcSrjs esac 5781fa225cbcSrjs add="-l$name" 5782fa225cbcSrjs elif test "$hardcode_automatic" = yes; then 5783fa225cbcSrjs if test -n "$inst_prefix_dir" && 5784fa225cbcSrjs test -f "$inst_prefix_dir$libdir/$linklib" ; then 5785fa225cbcSrjs add="$inst_prefix_dir$libdir/$linklib" 5786fa225cbcSrjs else 5787fa225cbcSrjs add="$libdir/$linklib" 5788fa225cbcSrjs fi 5789fa225cbcSrjs else 5790fa225cbcSrjs # We cannot seem to hardcode it, guess we'll fake it. 5791fa225cbcSrjs add_dir="-L$libdir" 5792fa225cbcSrjs # Try looking first in the location we're being installed to. 5793fa225cbcSrjs if test -n "$inst_prefix_dir"; then 5794fa225cbcSrjs case $libdir in 5795fa225cbcSrjs [\\/]*) 5796fa225cbcSrjs add_dir="$add_dir -L$inst_prefix_dir$libdir" 5797fa225cbcSrjs ;; 5798fa225cbcSrjs esac 5799fa225cbcSrjs fi 5800fa225cbcSrjs add="-l$name" 5801fa225cbcSrjs fi 5802fa225cbcSrjs 5803fa225cbcSrjs if test "$linkmode" = prog; then 5804fa225cbcSrjs test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 5805fa225cbcSrjs test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 5806fa225cbcSrjs else 5807fa225cbcSrjs test -n "$add_dir" && deplibs="$add_dir $deplibs" 5808fa225cbcSrjs test -n "$add" && deplibs="$add $deplibs" 5809fa225cbcSrjs fi 5810fa225cbcSrjs fi 5811fa225cbcSrjs elif test "$linkmode" = prog; then 5812fa225cbcSrjs # Here we assume that one of hardcode_direct or hardcode_minus_L 5813fa225cbcSrjs # is not unsupported. This is valid on all known static and 5814fa225cbcSrjs # shared platforms. 5815fa225cbcSrjs if test "$hardcode_direct" != unsupported; then 5816fa225cbcSrjs test -n "$old_library" && linklib="$old_library" 5817fa225cbcSrjs compile_deplibs="$dir/$linklib $compile_deplibs" 5818fa225cbcSrjs finalize_deplibs="$dir/$linklib $finalize_deplibs" 5819fa225cbcSrjs else 5820fa225cbcSrjs compile_deplibs="-l$name -L$dir $compile_deplibs" 5821fa225cbcSrjs finalize_deplibs="-l$name -L$dir $finalize_deplibs" 5822fa225cbcSrjs fi 5823fa225cbcSrjs elif test "$build_libtool_libs" = yes; then 5824fa225cbcSrjs # Not a shared library 5825fa225cbcSrjs if test "$deplibs_check_method" != pass_all; then 5826fa225cbcSrjs # We're trying link a shared library against a static one 5827fa225cbcSrjs # but the system doesn't support it. 5828fa225cbcSrjs 5829fa225cbcSrjs # Just print a warning and add the library to dependency_libs so 5830fa225cbcSrjs # that the program can be linked against the static library. 5831fa225cbcSrjs $ECHO 5832fa225cbcSrjs $ECHO "*** Warning: This system can not link to static lib archive $lib." 5833fa225cbcSrjs $ECHO "*** I have the capability to make that library automatically link in when" 5834fa225cbcSrjs $ECHO "*** you link to this library. But I can only do this if you have a" 5835fa225cbcSrjs $ECHO "*** shared version of the library, which you do not appear to have." 5836fa225cbcSrjs if test "$module" = yes; then 5837fa225cbcSrjs $ECHO "*** But as you try to build a module library, libtool will still create " 5838fa225cbcSrjs $ECHO "*** a static module, that should work as long as the dlopening application" 5839fa225cbcSrjs $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." 5840fa225cbcSrjs if test -z "$global_symbol_pipe"; then 5841fa225cbcSrjs $ECHO 5842fa225cbcSrjs $ECHO "*** However, this would only work if libtool was able to extract symbol" 5843fa225cbcSrjs $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 5844fa225cbcSrjs $ECHO "*** not find such a program. So, this module is probably useless." 5845fa225cbcSrjs $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 5846fa225cbcSrjs fi 5847fa225cbcSrjs if test "$build_old_libs" = no; then 5848fa225cbcSrjs build_libtool_libs=module 5849fa225cbcSrjs build_old_libs=yes 5850fa225cbcSrjs else 5851fa225cbcSrjs build_libtool_libs=no 5852fa225cbcSrjs fi 5853fa225cbcSrjs fi 5854fa225cbcSrjs else 5855fa225cbcSrjs deplibs="$dir/$old_library $deplibs" 5856fa225cbcSrjs link_static=yes 5857fa225cbcSrjs fi 5858fa225cbcSrjs fi # link shared/static library? 5859fa225cbcSrjs 5860fa225cbcSrjs if test "$linkmode" = lib; then 5861fa225cbcSrjs if test -n "$dependency_libs" && 5862fa225cbcSrjs { test "$hardcode_into_libs" != yes || 5863fa225cbcSrjs test "$build_old_libs" = yes || 5864fa225cbcSrjs test "$link_static" = yes; }; then 5865fa225cbcSrjs # Extract -R from dependency_libs 5866fa225cbcSrjs temp_deplibs= 5867fa225cbcSrjs for libdir in $dependency_libs; do 5868fa225cbcSrjs case $libdir in 5869fa225cbcSrjs -R*) func_stripname '-R' '' "$libdir" 5870fa225cbcSrjs temp_xrpath=$func_stripname_result 5871fa225cbcSrjs case " $xrpath " in 5872fa225cbcSrjs *" $temp_xrpath "*) ;; 5873fa225cbcSrjs *) xrpath="$xrpath $temp_xrpath";; 5874fa225cbcSrjs esac;; 5875fa225cbcSrjs *) temp_deplibs="$temp_deplibs $libdir";; 5876fa225cbcSrjs esac 5877fa225cbcSrjs done 5878fa225cbcSrjs dependency_libs="$temp_deplibs" 5879fa225cbcSrjs fi 5880fa225cbcSrjs 5881fa225cbcSrjs newlib_search_path="$newlib_search_path $absdir" 5882fa225cbcSrjs # Link against this library 5883fa225cbcSrjs test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 5884fa225cbcSrjs # ... and its dependency_libs 5885fa225cbcSrjs tmp_libs= 5886fa225cbcSrjs for deplib in $dependency_libs; do 5887fa225cbcSrjs newdependency_libs="$deplib $newdependency_libs" 5888fa225cbcSrjs if $opt_duplicate_deps ; then 5889fa225cbcSrjs case "$tmp_libs " in 5890fa225cbcSrjs *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 5891fa225cbcSrjs esac 5892fa225cbcSrjs fi 5893fa225cbcSrjs tmp_libs="$tmp_libs $deplib" 5894fa225cbcSrjs done 5895fa225cbcSrjs 5896fa225cbcSrjs if test "$link_all_deplibs" != no; then 5897fa225cbcSrjs # Add the search paths of all dependency libraries 5898fa225cbcSrjs for deplib in $dependency_libs; do 5899fa225cbcSrjs path= 5900fa225cbcSrjs case $deplib in 5901fa225cbcSrjs -L*) path="$deplib" ;; 5902fa225cbcSrjs *.la) 5903fa225cbcSrjs func_dirname "$deplib" "" "." 5904fa225cbcSrjs dir="$func_dirname_result" 5905fa225cbcSrjs # We need an absolute path. 5906fa225cbcSrjs case $dir in 5907fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 5908fa225cbcSrjs *) 5909fa225cbcSrjs absdir=`cd "$dir" && pwd` 5910fa225cbcSrjs if test -z "$absdir"; then 5911fa225cbcSrjs func_warning "cannot determine absolute directory name of \`$dir'" 5912fa225cbcSrjs absdir="$dir" 5913fa225cbcSrjs fi 5914fa225cbcSrjs ;; 5915fa225cbcSrjs esac 5916fa225cbcSrjs if $GREP "^installed=no" $deplib > /dev/null; then 5917fa225cbcSrjs case $host in 5918fa225cbcSrjs *-*-darwin*) 5919fa225cbcSrjs depdepl= 5920fa225cbcSrjs eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 5921fa225cbcSrjs if test -n "$deplibrary_names" ; then 5922fa225cbcSrjs for tmp in $deplibrary_names ; do 5923fa225cbcSrjs depdepl=$tmp 5924fa225cbcSrjs done 5925fa225cbcSrjs if test -f "$absdir/$objdir/$depdepl" ; then 5926fa225cbcSrjs depdepl="$absdir/$objdir/$depdepl" 5927fa225cbcSrjs darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 5928fa225cbcSrjs if test -z "$darwin_install_name"; then 5929fa225cbcSrjs darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 5930fa225cbcSrjs fi 5931fa225cbcSrjs compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 5932fa225cbcSrjs linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 5933fa225cbcSrjs path= 5934fa225cbcSrjs fi 5935fa225cbcSrjs fi 5936fa225cbcSrjs ;; 5937fa225cbcSrjs *) 5938fa225cbcSrjs path="-L$absdir/$objdir" 5939fa225cbcSrjs ;; 5940fa225cbcSrjs esac 5941fa225cbcSrjs else 5942fa225cbcSrjs eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5943fa225cbcSrjs test -z "$libdir" && \ 5944fa225cbcSrjs func_fatal_error "\`$deplib' is not a valid libtool archive" 5945fa225cbcSrjs test "$absdir" != "$libdir" && \ 5946fa225cbcSrjs func_warning "\`$deplib' seems to be moved" 5947fa225cbcSrjs 5948fa225cbcSrjs path="-L$absdir" 5949fa225cbcSrjs fi 5950fa225cbcSrjs ;; 5951fa225cbcSrjs esac 5952fa225cbcSrjs case " $deplibs " in 5953fa225cbcSrjs *" $path "*) ;; 5954fa225cbcSrjs *) deplibs="$path $deplibs" ;; 5955fa225cbcSrjs esac 5956fa225cbcSrjs done 5957fa225cbcSrjs fi # link_all_deplibs != no 5958fa225cbcSrjs fi # linkmode = lib 5959fa225cbcSrjs done # for deplib in $libs 5960fa225cbcSrjs if test "$pass" = link; then 5961fa225cbcSrjs if test "$linkmode" = "prog"; then 5962fa225cbcSrjs compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 5963fa225cbcSrjs finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 5964fa225cbcSrjs else 5965fa225cbcSrjs compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 5966fa225cbcSrjs fi 5967fa225cbcSrjs fi 5968fa225cbcSrjs dependency_libs="$newdependency_libs" 5969fa225cbcSrjs if test "$pass" = dlpreopen; then 5970fa225cbcSrjs # Link the dlpreopened libraries before other libraries 5971fa225cbcSrjs for deplib in $save_deplibs; do 5972fa225cbcSrjs deplibs="$deplib $deplibs" 5973fa225cbcSrjs done 5974fa225cbcSrjs fi 5975fa225cbcSrjs if test "$pass" != dlopen; then 5976fa225cbcSrjs if test "$pass" != conv; then 5977fa225cbcSrjs # Make sure lib_search_path contains only unique directories. 5978fa225cbcSrjs lib_search_path= 5979fa225cbcSrjs for dir in $newlib_search_path; do 5980fa225cbcSrjs case "$lib_search_path " in 5981fa225cbcSrjs *" $dir "*) ;; 5982fa225cbcSrjs *) lib_search_path="$lib_search_path $dir" ;; 5983fa225cbcSrjs esac 5984fa225cbcSrjs done 5985fa225cbcSrjs newlib_search_path= 5986fa225cbcSrjs fi 5987fa225cbcSrjs 5988fa225cbcSrjs if test "$linkmode,$pass" != "prog,link"; then 5989fa225cbcSrjs vars="deplibs" 5990fa225cbcSrjs else 5991fa225cbcSrjs vars="compile_deplibs finalize_deplibs" 5992fa225cbcSrjs fi 5993fa225cbcSrjs for var in $vars dependency_libs; do 5994fa225cbcSrjs # Add libraries to $var in reverse order 5995fa225cbcSrjs eval tmp_libs=\"\$$var\" 5996fa225cbcSrjs new_libs= 5997fa225cbcSrjs for deplib in $tmp_libs; do 5998fa225cbcSrjs # FIXME: Pedantically, this is the right thing to do, so 5999fa225cbcSrjs # that some nasty dependency loop isn't accidentally 6000fa225cbcSrjs # broken: 6001fa225cbcSrjs #new_libs="$deplib $new_libs" 6002fa225cbcSrjs # Pragmatically, this seems to cause very few problems in 6003fa225cbcSrjs # practice: 6004fa225cbcSrjs case $deplib in 6005fa225cbcSrjs -L*) new_libs="$deplib $new_libs" ;; 6006fa225cbcSrjs -R*) ;; 6007fa225cbcSrjs *) 6008fa225cbcSrjs # And here is the reason: when a library appears more 6009fa225cbcSrjs # than once as an explicit dependence of a library, or 6010fa225cbcSrjs # is implicitly linked in more than once by the 6011fa225cbcSrjs # compiler, it is considered special, and multiple 6012fa225cbcSrjs # occurrences thereof are not removed. Compare this 6013fa225cbcSrjs # with having the same library being listed as a 6014fa225cbcSrjs # dependency of multiple other libraries: in this case, 6015fa225cbcSrjs # we know (pedantically, we assume) the library does not 6016fa225cbcSrjs # need to be listed more than once, so we keep only the 6017fa225cbcSrjs # last copy. This is not always right, but it is rare 6018fa225cbcSrjs # enough that we require users that really mean to play 6019fa225cbcSrjs # such unportable linking tricks to link the library 6020fa225cbcSrjs # using -Wl,-lname, so that libtool does not consider it 6021fa225cbcSrjs # for duplicate removal. 6022fa225cbcSrjs case " $specialdeplibs " in 6023fa225cbcSrjs *" $deplib "*) new_libs="$deplib $new_libs" ;; 6024fa225cbcSrjs *) 6025fa225cbcSrjs case " $new_libs " in 6026fa225cbcSrjs *" $deplib "*) ;; 6027fa225cbcSrjs *) new_libs="$deplib $new_libs" ;; 6028fa225cbcSrjs esac 6029fa225cbcSrjs ;; 6030fa225cbcSrjs esac 6031fa225cbcSrjs ;; 6032fa225cbcSrjs esac 6033fa225cbcSrjs done 6034fa225cbcSrjs tmp_libs= 6035fa225cbcSrjs for deplib in $new_libs; do 6036fa225cbcSrjs case $deplib in 6037fa225cbcSrjs -L*) 6038fa225cbcSrjs case " $tmp_libs " in 6039fa225cbcSrjs *" $deplib "*) ;; 6040fa225cbcSrjs *) tmp_libs="$tmp_libs $deplib" ;; 6041fa225cbcSrjs esac 6042fa225cbcSrjs ;; 6043fa225cbcSrjs *) tmp_libs="$tmp_libs $deplib" ;; 6044fa225cbcSrjs esac 6045fa225cbcSrjs done 6046fa225cbcSrjs eval $var=\"$tmp_libs\" 6047fa225cbcSrjs done # for var 6048fa225cbcSrjs fi 6049fa225cbcSrjs # Last step: remove runtime libs from dependency_libs 6050fa225cbcSrjs # (they stay in deplibs) 6051fa225cbcSrjs tmp_libs= 6052fa225cbcSrjs for i in $dependency_libs ; do 6053fa225cbcSrjs case " $predeps $postdeps $compiler_lib_search_path " in 6054fa225cbcSrjs *" $i "*) 6055fa225cbcSrjs i="" 6056fa225cbcSrjs ;; 6057fa225cbcSrjs esac 6058fa225cbcSrjs if test -n "$i" ; then 6059fa225cbcSrjs tmp_libs="$tmp_libs $i" 6060fa225cbcSrjs fi 6061fa225cbcSrjs done 6062fa225cbcSrjs dependency_libs=$tmp_libs 6063fa225cbcSrjs done # for pass 6064fa225cbcSrjs if test "$linkmode" = prog; then 6065fa225cbcSrjs dlfiles="$newdlfiles" 6066fa225cbcSrjs fi 6067fa225cbcSrjs if test "$linkmode" = prog || test "$linkmode" = lib; then 6068fa225cbcSrjs dlprefiles="$newdlprefiles" 6069fa225cbcSrjs fi 6070fa225cbcSrjs 6071fa225cbcSrjs case $linkmode in 6072fa225cbcSrjs oldlib) 6073fa225cbcSrjs if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 6074fa225cbcSrjs func_warning "\`-dlopen' is ignored for archives" 6075fa225cbcSrjs fi 6076fa225cbcSrjs 6077fa225cbcSrjs case " $deplibs" in 6078fa225cbcSrjs *\ -l* | *\ -L*) 6079fa225cbcSrjs func_warning "\`-l' and \`-L' are ignored for archives" ;; 6080fa225cbcSrjs esac 6081fa225cbcSrjs 6082fa225cbcSrjs test -n "$rpath" && \ 6083fa225cbcSrjs func_warning "\`-rpath' is ignored for archives" 6084fa225cbcSrjs 6085fa225cbcSrjs test -n "$xrpath" && \ 6086fa225cbcSrjs func_warning "\`-R' is ignored for archives" 6087fa225cbcSrjs 6088fa225cbcSrjs test -n "$vinfo" && \ 6089fa225cbcSrjs func_warning "\`-version-info/-version-number' is ignored for archives" 6090fa225cbcSrjs 6091fa225cbcSrjs test -n "$release" && \ 6092fa225cbcSrjs func_warning "\`-release' is ignored for archives" 6093fa225cbcSrjs 6094fa225cbcSrjs test -n "$export_symbols$export_symbols_regex" && \ 6095fa225cbcSrjs func_warning "\`-export-symbols' is ignored for archives" 6096fa225cbcSrjs 6097fa225cbcSrjs # Now set the variables for building old libraries. 6098fa225cbcSrjs build_libtool_libs=no 6099fa225cbcSrjs oldlibs="$output" 6100fa225cbcSrjs objs="$objs$old_deplibs" 6101fa225cbcSrjs ;; 6102fa225cbcSrjs 6103fa225cbcSrjs lib) 6104fa225cbcSrjs # Make sure we only generate libraries of the form `libNAME.la'. 6105fa225cbcSrjs case $outputname in 6106fa225cbcSrjs lib*) 6107fa225cbcSrjs func_stripname 'lib' '.la' "$outputname" 6108fa225cbcSrjs name=$func_stripname_result 6109fa225cbcSrjs eval shared_ext=\"$shrext_cmds\" 6110fa225cbcSrjs eval libname=\"$libname_spec\" 6111fa225cbcSrjs ;; 6112fa225cbcSrjs *) 6113fa225cbcSrjs test "$module" = no && \ 6114fa225cbcSrjs func_fatal_help "libtool library \`$output' must begin with \`lib'" 6115fa225cbcSrjs 6116fa225cbcSrjs if test "$need_lib_prefix" != no; then 6117fa225cbcSrjs # Add the "lib" prefix for modules if required 6118fa225cbcSrjs func_stripname '' '.la' "$outputname" 6119fa225cbcSrjs name=$func_stripname_result 6120fa225cbcSrjs eval shared_ext=\"$shrext_cmds\" 6121fa225cbcSrjs eval libname=\"$libname_spec\" 6122fa225cbcSrjs else 6123fa225cbcSrjs func_stripname '' '.la' "$outputname" 6124fa225cbcSrjs libname=$func_stripname_result 6125fa225cbcSrjs fi 6126fa225cbcSrjs ;; 6127fa225cbcSrjs esac 6128fa225cbcSrjs 6129fa225cbcSrjs if test -n "$objs"; then 6130fa225cbcSrjs if test "$deplibs_check_method" != pass_all; then 6131fa225cbcSrjs func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 6132fa225cbcSrjs else 6133fa225cbcSrjs $ECHO 6134fa225cbcSrjs $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 6135fa225cbcSrjs $ECHO "*** objects $objs is not portable!" 6136fa225cbcSrjs libobjs="$libobjs $objs" 6137fa225cbcSrjs fi 6138fa225cbcSrjs fi 6139fa225cbcSrjs 6140fa225cbcSrjs test "$dlself" != no && \ 6141fa225cbcSrjs func_warning "\`-dlopen self' is ignored for libtool libraries" 6142fa225cbcSrjs 6143fa225cbcSrjs set dummy $rpath 6144fa225cbcSrjs shift 6145fa225cbcSrjs test "$#" -gt 1 && \ 6146fa225cbcSrjs func_warning "ignoring multiple \`-rpath's for a libtool library" 6147fa225cbcSrjs 6148fa225cbcSrjs install_libdir="$1" 6149fa225cbcSrjs 6150fa225cbcSrjs oldlibs= 6151fa225cbcSrjs if test -z "$rpath"; then 6152fa225cbcSrjs if test "$build_libtool_libs" = yes; then 6153fa225cbcSrjs # Building a libtool convenience library. 6154fa225cbcSrjs # Some compilers have problems with a `.al' extension so 6155fa225cbcSrjs # convenience libraries should have the same extension an 6156fa225cbcSrjs # archive normally would. 6157fa225cbcSrjs oldlibs="$output_objdir/$libname.$libext $oldlibs" 6158fa225cbcSrjs build_libtool_libs=convenience 6159fa225cbcSrjs build_old_libs=yes 6160fa225cbcSrjs fi 6161fa225cbcSrjs 6162fa225cbcSrjs test -n "$vinfo" && \ 6163fa225cbcSrjs func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 6164fa225cbcSrjs 6165fa225cbcSrjs test -n "$release" && \ 6166fa225cbcSrjs func_warning "\`-release' is ignored for convenience libraries" 6167fa225cbcSrjs else 6168fa225cbcSrjs 6169fa225cbcSrjs # Parse the version information argument. 6170fa225cbcSrjs save_ifs="$IFS"; IFS=':' 6171fa225cbcSrjs set dummy $vinfo 0 0 0 6172fa225cbcSrjs shift 6173fa225cbcSrjs IFS="$save_ifs" 6174fa225cbcSrjs 6175fa225cbcSrjs test -n "$7" && \ 6176fa225cbcSrjs func_fatal_help "too many parameters to \`-version-info'" 6177fa225cbcSrjs 6178fa225cbcSrjs # convert absolute version numbers to libtool ages 6179fa225cbcSrjs # this retains compatibility with .la files and attempts 6180fa225cbcSrjs # to make the code below a bit more comprehensible 6181fa225cbcSrjs 6182fa225cbcSrjs case $vinfo_number in 6183fa225cbcSrjs yes) 6184fa225cbcSrjs number_major="$1" 6185fa225cbcSrjs number_minor="$2" 6186fa225cbcSrjs number_revision="$3" 6187fa225cbcSrjs # 6188fa225cbcSrjs # There are really only two kinds -- those that 6189fa225cbcSrjs # use the current revision as the major version 6190fa225cbcSrjs # and those that subtract age and use age as 6191fa225cbcSrjs # a minor version. But, then there is irix 6192fa225cbcSrjs # which has an extra 1 added just for fun 6193fa225cbcSrjs # 6194fa225cbcSrjs case $version_type in 6195fa225cbcSrjs darwin|linux|osf|windows|none) 6196fa225cbcSrjs func_arith $number_major + $number_minor 6197fa225cbcSrjs current=$func_arith_result 6198fa225cbcSrjs age="$number_minor" 6199fa225cbcSrjs revision="$number_revision" 6200fa225cbcSrjs ;; 6201fa225cbcSrjs freebsd-aout|freebsd-elf|sunos) 6202fa225cbcSrjs current="$number_major" 6203fa225cbcSrjs revision="$number_minor" 6204fa225cbcSrjs age="0" 6205fa225cbcSrjs ;; 6206fa225cbcSrjs irix|nonstopux) 6207fa225cbcSrjs func_arith $number_major + $number_minor 6208fa225cbcSrjs current=$func_arith_result 6209fa225cbcSrjs age="$number_minor" 6210fa225cbcSrjs revision="$number_minor" 6211fa225cbcSrjs lt_irix_increment=no 6212fa225cbcSrjs ;; 6213fa225cbcSrjs *) 6214fa225cbcSrjs func_fatal_configuration "$modename: unknown library version type \`$version_type'" 6215fa225cbcSrjs ;; 6216fa225cbcSrjs esac 6217fa225cbcSrjs ;; 6218fa225cbcSrjs no) 6219fa225cbcSrjs current="$1" 6220fa225cbcSrjs revision="$2" 6221fa225cbcSrjs age="$3" 6222fa225cbcSrjs ;; 6223fa225cbcSrjs esac 6224fa225cbcSrjs 6225fa225cbcSrjs # Check that each of the things are valid numbers. 6226fa225cbcSrjs case $current in 6227fa225cbcSrjs 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]) ;; 6228fa225cbcSrjs *) 6229fa225cbcSrjs func_error "CURRENT \`$current' must be a nonnegative integer" 6230fa225cbcSrjs func_fatal_error "\`$vinfo' is not valid version information" 6231fa225cbcSrjs ;; 6232fa225cbcSrjs esac 6233fa225cbcSrjs 6234fa225cbcSrjs case $revision in 6235fa225cbcSrjs 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]) ;; 6236fa225cbcSrjs *) 6237fa225cbcSrjs func_error "REVISION \`$revision' must be a nonnegative integer" 6238fa225cbcSrjs func_fatal_error "\`$vinfo' is not valid version information" 6239fa225cbcSrjs ;; 6240fa225cbcSrjs esac 6241fa225cbcSrjs 6242fa225cbcSrjs case $age in 6243fa225cbcSrjs 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]) ;; 6244fa225cbcSrjs *) 6245fa225cbcSrjs func_error "AGE \`$age' must be a nonnegative integer" 6246fa225cbcSrjs func_fatal_error "\`$vinfo' is not valid version information" 6247fa225cbcSrjs ;; 6248fa225cbcSrjs esac 6249fa225cbcSrjs 6250fa225cbcSrjs if test "$age" -gt "$current"; then 6251fa225cbcSrjs func_error "AGE \`$age' is greater than the current interface number \`$current'" 6252fa225cbcSrjs func_fatal_error "\`$vinfo' is not valid version information" 6253fa225cbcSrjs fi 6254fa225cbcSrjs 6255fa225cbcSrjs # Calculate the version variables. 6256fa225cbcSrjs major= 6257fa225cbcSrjs versuffix= 6258fa225cbcSrjs verstring= 6259fa225cbcSrjs case $version_type in 6260fa225cbcSrjs none) ;; 6261fa225cbcSrjs 6262fa225cbcSrjs darwin) 6263fa225cbcSrjs # Like Linux, but with the current version available in 6264fa225cbcSrjs # verstring for coding it into the library header 6265fa225cbcSrjs func_arith $current - $age 6266fa225cbcSrjs major=.$func_arith_result 6267fa225cbcSrjs versuffix="$major.$age.$revision" 6268fa225cbcSrjs # Darwin ld doesn't like 0 for these options... 6269fa225cbcSrjs func_arith $current + 1 6270fa225cbcSrjs minor_current=$func_arith_result 6271fa225cbcSrjs xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 6272fa225cbcSrjs verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 6273fa225cbcSrjs ;; 6274fa225cbcSrjs 6275fa225cbcSrjs freebsd-aout) 6276fa225cbcSrjs major=".$current" 6277fa225cbcSrjs versuffix=".$current.$revision"; 6278fa225cbcSrjs ;; 6279fa225cbcSrjs 6280fa225cbcSrjs freebsd-elf) 6281fa225cbcSrjs major=".$current" 6282fa225cbcSrjs versuffix=".$current" 6283fa225cbcSrjs ;; 6284fa225cbcSrjs 6285fa225cbcSrjs irix | nonstopux) 6286fa225cbcSrjs if test "X$lt_irix_increment" = "Xno"; then 6287fa225cbcSrjs func_arith $current - $age 6288fa225cbcSrjs else 6289fa225cbcSrjs func_arith $current - $age + 1 6290fa225cbcSrjs fi 6291fa225cbcSrjs major=$func_arith_result 6292fa225cbcSrjs 6293fa225cbcSrjs case $version_type in 6294fa225cbcSrjs nonstopux) verstring_prefix=nonstopux ;; 6295fa225cbcSrjs *) verstring_prefix=sgi ;; 6296fa225cbcSrjs esac 6297fa225cbcSrjs verstring="$verstring_prefix$major.$revision" 6298fa225cbcSrjs 6299fa225cbcSrjs # Add in all the interfaces that we are compatible with. 6300fa225cbcSrjs loop=$revision 6301fa225cbcSrjs while test "$loop" -ne 0; do 6302fa225cbcSrjs func_arith $revision - $loop 6303fa225cbcSrjs iface=$func_arith_result 6304fa225cbcSrjs func_arith $loop - 1 6305fa225cbcSrjs loop=$func_arith_result 6306fa225cbcSrjs verstring="$verstring_prefix$major.$iface:$verstring" 6307fa225cbcSrjs done 6308fa225cbcSrjs 6309fa225cbcSrjs # Before this point, $major must not contain `.'. 6310fa225cbcSrjs major=.$major 6311fa225cbcSrjs versuffix="$major.$revision" 6312fa225cbcSrjs ;; 6313fa225cbcSrjs 6314fa225cbcSrjs linux) 6315fa225cbcSrjs func_arith $current - $age 6316fa225cbcSrjs major=.$func_arith_result 6317fa225cbcSrjs versuffix="$major.$age.$revision" 6318fa225cbcSrjs ;; 6319fa225cbcSrjs 6320fa225cbcSrjs osf) 6321fa225cbcSrjs func_arith $current - $age 6322fa225cbcSrjs major=.$func_arith_result 6323fa225cbcSrjs versuffix=".$current.$age.$revision" 6324fa225cbcSrjs verstring="$current.$age.$revision" 6325fa225cbcSrjs 6326fa225cbcSrjs # Add in all the interfaces that we are compatible with. 6327fa225cbcSrjs loop=$age 6328fa225cbcSrjs while test "$loop" -ne 0; do 6329fa225cbcSrjs func_arith $current - $loop 6330fa225cbcSrjs iface=$func_arith_result 6331fa225cbcSrjs func_arith $loop - 1 6332fa225cbcSrjs loop=$func_arith_result 6333fa225cbcSrjs verstring="$verstring:${iface}.0" 6334fa225cbcSrjs done 6335fa225cbcSrjs 6336fa225cbcSrjs # Make executables depend on our current version. 6337fa225cbcSrjs verstring="$verstring:${current}.0" 6338fa225cbcSrjs ;; 6339fa225cbcSrjs 6340fa225cbcSrjs qnx) 6341fa225cbcSrjs major=".$current" 6342fa225cbcSrjs versuffix=".$current" 6343fa225cbcSrjs ;; 6344fa225cbcSrjs 6345fa225cbcSrjs sunos) 6346fa225cbcSrjs major=".$current" 6347fa225cbcSrjs versuffix=".$current.$revision" 6348fa225cbcSrjs ;; 6349fa225cbcSrjs 6350fa225cbcSrjs windows) 6351fa225cbcSrjs # Use '-' rather than '.', since we only want one 6352fa225cbcSrjs # extension on DOS 8.3 filesystems. 6353fa225cbcSrjs func_arith $current - $age 6354fa225cbcSrjs major=$func_arith_result 6355fa225cbcSrjs versuffix="-$major" 6356fa225cbcSrjs ;; 6357fa225cbcSrjs 6358fa225cbcSrjs *) 6359fa225cbcSrjs func_fatal_configuration "unknown library version type \`$version_type'" 6360fa225cbcSrjs ;; 6361fa225cbcSrjs esac 6362fa225cbcSrjs 6363fa225cbcSrjs # Clear the version info if we defaulted, and they specified a release. 6364fa225cbcSrjs if test -z "$vinfo" && test -n "$release"; then 6365fa225cbcSrjs major= 6366fa225cbcSrjs case $version_type in 6367fa225cbcSrjs darwin) 6368fa225cbcSrjs # we can't check for "0.0" in archive_cmds due to quoting 6369fa225cbcSrjs # problems, so we reset it completely 6370fa225cbcSrjs verstring= 6371fa225cbcSrjs ;; 6372fa225cbcSrjs *) 6373fa225cbcSrjs verstring="0.0" 6374fa225cbcSrjs ;; 6375fa225cbcSrjs esac 6376fa225cbcSrjs if test "$need_version" = no; then 6377fa225cbcSrjs versuffix= 6378fa225cbcSrjs else 6379fa225cbcSrjs versuffix=".0.0" 6380fa225cbcSrjs fi 6381fa225cbcSrjs fi 6382fa225cbcSrjs 6383fa225cbcSrjs # Remove version info from name if versioning should be avoided 6384fa225cbcSrjs if test "$avoid_version" = yes && test "$need_version" = no; then 6385fa225cbcSrjs major= 6386fa225cbcSrjs versuffix= 6387fa225cbcSrjs verstring="" 6388fa225cbcSrjs fi 6389fa225cbcSrjs 6390fa225cbcSrjs # Check to see if the archive will have undefined symbols. 6391fa225cbcSrjs if test "$allow_undefined" = yes; then 6392fa225cbcSrjs if test "$allow_undefined_flag" = unsupported; then 6393fa225cbcSrjs func_warning "undefined symbols not allowed in $host shared libraries" 6394fa225cbcSrjs build_libtool_libs=no 6395fa225cbcSrjs build_old_libs=yes 6396fa225cbcSrjs fi 6397fa225cbcSrjs else 6398fa225cbcSrjs # Don't allow undefined symbols. 6399fa225cbcSrjs allow_undefined_flag="$no_undefined_flag" 6400fa225cbcSrjs fi 6401fa225cbcSrjs 6402fa225cbcSrjs fi 6403fa225cbcSrjs 6404fa225cbcSrjs func_generate_dlsyms "$libname" "$libname" "yes" 6405fa225cbcSrjs libobjs="$libobjs $symfileobj" 6406fa225cbcSrjs test "X$libobjs" = "X " && libobjs= 6407fa225cbcSrjs 6408fa225cbcSrjs if test "$mode" != relink; then 6409fa225cbcSrjs # Remove our outputs, but don't remove object files since they 6410fa225cbcSrjs # may have been created when compiling PIC objects. 6411fa225cbcSrjs removelist= 6412fa225cbcSrjs tempremovelist=`$ECHO "$output_objdir/*"` 6413fa225cbcSrjs for p in $tempremovelist; do 6414fa225cbcSrjs case $p in 6415fa225cbcSrjs *.$objext | *.gcno) 6416fa225cbcSrjs ;; 6417fa225cbcSrjs $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 6418fa225cbcSrjs if test "X$precious_files_regex" != "X"; then 6419fa225cbcSrjs if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 6420fa225cbcSrjs then 6421fa225cbcSrjs continue 6422fa225cbcSrjs fi 6423fa225cbcSrjs fi 6424fa225cbcSrjs removelist="$removelist $p" 6425fa225cbcSrjs ;; 6426fa225cbcSrjs *) ;; 6427fa225cbcSrjs esac 6428fa225cbcSrjs done 6429fa225cbcSrjs test -n "$removelist" && \ 6430fa225cbcSrjs func_show_eval "${RM}r \$removelist" 6431fa225cbcSrjs fi 6432fa225cbcSrjs 6433fa225cbcSrjs # Now set the variables for building old libraries. 6434fa225cbcSrjs if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 6435fa225cbcSrjs oldlibs="$oldlibs $output_objdir/$libname.$libext" 6436fa225cbcSrjs 6437fa225cbcSrjs # Transform .lo files to .o files. 6438fa225cbcSrjs oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 6439fa225cbcSrjs fi 6440fa225cbcSrjs 6441fa225cbcSrjs # Eliminate all temporary directories. 6442fa225cbcSrjs #for path in $notinst_path; do 6443fa225cbcSrjs # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` 6444fa225cbcSrjs # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` 6445fa225cbcSrjs # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` 6446fa225cbcSrjs #done 6447fa225cbcSrjs 6448fa225cbcSrjs if test -n "$xrpath"; then 6449fa225cbcSrjs # If the user specified any rpath flags, then add them. 6450fa225cbcSrjs temp_xrpath= 6451fa225cbcSrjs for libdir in $xrpath; do 6452fa225cbcSrjs temp_xrpath="$temp_xrpath -R$libdir" 6453fa225cbcSrjs case "$finalize_rpath " in 6454fa225cbcSrjs *" $libdir "*) ;; 6455fa225cbcSrjs *) finalize_rpath="$finalize_rpath $libdir" ;; 6456fa225cbcSrjs esac 6457fa225cbcSrjs done 6458fa225cbcSrjs if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 6459fa225cbcSrjs dependency_libs="$temp_xrpath $dependency_libs" 6460fa225cbcSrjs fi 6461fa225cbcSrjs fi 6462fa225cbcSrjs 6463fa225cbcSrjs # Make sure dlfiles contains only unique files that won't be dlpreopened 6464fa225cbcSrjs old_dlfiles="$dlfiles" 6465fa225cbcSrjs dlfiles= 6466fa225cbcSrjs for lib in $old_dlfiles; do 6467fa225cbcSrjs case " $dlprefiles $dlfiles " in 6468fa225cbcSrjs *" $lib "*) ;; 6469fa225cbcSrjs *) dlfiles="$dlfiles $lib" ;; 6470fa225cbcSrjs esac 6471fa225cbcSrjs done 6472fa225cbcSrjs 6473fa225cbcSrjs # Make sure dlprefiles contains only unique files 6474fa225cbcSrjs old_dlprefiles="$dlprefiles" 6475fa225cbcSrjs dlprefiles= 6476fa225cbcSrjs for lib in $old_dlprefiles; do 6477fa225cbcSrjs case "$dlprefiles " in 6478fa225cbcSrjs *" $lib "*) ;; 6479fa225cbcSrjs *) dlprefiles="$dlprefiles $lib" ;; 6480fa225cbcSrjs esac 6481fa225cbcSrjs done 6482fa225cbcSrjs 6483fa225cbcSrjs if test "$build_libtool_libs" = yes; then 6484fa225cbcSrjs if test -n "$rpath"; then 6485fa225cbcSrjs case $host in 6486fa225cbcSrjs *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) 6487fa225cbcSrjs # these systems don't actually have a c library (as such)! 6488fa225cbcSrjs ;; 6489fa225cbcSrjs *-*-rhapsody* | *-*-darwin1.[012]) 6490fa225cbcSrjs # Rhapsody C library is in the System framework 6491fa225cbcSrjs deplibs="$deplibs System.ltframework" 6492fa225cbcSrjs ;; 6493fa225cbcSrjs *-*-netbsd*) 6494fa225cbcSrjs # Don't link with libc until the a.out ld.so is fixed. 6495fa225cbcSrjs ;; 6496fa225cbcSrjs *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 6497fa225cbcSrjs # Do not include libc due to us having libc/libc_r. 6498fa225cbcSrjs ;; 6499fa225cbcSrjs *-*-sco3.2v5* | *-*-sco5v6*) 6500fa225cbcSrjs # Causes problems with __ctype 6501fa225cbcSrjs ;; 6502fa225cbcSrjs *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 6503fa225cbcSrjs # Compiler inserts libc in the correct place for threads to work 6504fa225cbcSrjs ;; 6505fa225cbcSrjs *) 6506fa225cbcSrjs # Add libc to deplibs on all other systems if necessary. 6507fa225cbcSrjs if test "$build_libtool_need_lc" = "yes"; then 6508fa225cbcSrjs deplibs="$deplibs -lc" 6509fa225cbcSrjs fi 6510fa225cbcSrjs ;; 6511fa225cbcSrjs esac 6512fa225cbcSrjs fi 6513fa225cbcSrjs 6514fa225cbcSrjs # Transform deplibs into only deplibs that can be linked in shared. 6515fa225cbcSrjs name_save=$name 6516fa225cbcSrjs libname_save=$libname 6517fa225cbcSrjs release_save=$release 6518fa225cbcSrjs versuffix_save=$versuffix 6519fa225cbcSrjs major_save=$major 6520fa225cbcSrjs # I'm not sure if I'm treating the release correctly. I think 6521fa225cbcSrjs # release should show up in the -l (ie -lgmp5) so we don't want to 6522fa225cbcSrjs # add it in twice. Is that correct? 6523fa225cbcSrjs release="" 6524fa225cbcSrjs versuffix="" 6525fa225cbcSrjs major="" 6526fa225cbcSrjs newdeplibs= 6527fa225cbcSrjs droppeddeps=no 6528fa225cbcSrjs case $deplibs_check_method in 6529fa225cbcSrjs pass_all) 6530fa225cbcSrjs # Don't check for shared/static. Everything works. 6531fa225cbcSrjs # This might be a little naive. We might want to check 6532fa225cbcSrjs # whether the library exists or not. But this is on 6533fa225cbcSrjs # osf3 & osf4 and I'm not really sure... Just 6534fa225cbcSrjs # implementing what was already the behavior. 6535fa225cbcSrjs newdeplibs=$deplibs 6536fa225cbcSrjs ;; 6537fa225cbcSrjs test_compile) 6538fa225cbcSrjs # This code stresses the "libraries are programs" paradigm to its 6539fa225cbcSrjs # limits. Maybe even breaks it. We compile a program, linking it 6540fa225cbcSrjs # against the deplibs as a proxy for the library. Then we can check 6541fa225cbcSrjs # whether they linked in statically or dynamically with ldd. 6542fa225cbcSrjs $opt_dry_run || $RM conftest.c 6543fa225cbcSrjs cat > conftest.c <<EOF 6544fa225cbcSrjs int main() { return 0; } 6545fa225cbcSrjsEOF 6546fa225cbcSrjs $opt_dry_run || $RM conftest 6547fa225cbcSrjs if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 6548fa225cbcSrjs ldd_output=`ldd conftest` 6549fa225cbcSrjs for i in $deplibs; do 6550fa225cbcSrjs case $i in 6551fa225cbcSrjs -l*) 6552fa225cbcSrjs func_stripname -l '' "$i" 6553fa225cbcSrjs name=$func_stripname_result 6554fa225cbcSrjs if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6555fa225cbcSrjs case " $predeps $postdeps " in 6556fa225cbcSrjs *" $i "*) 6557fa225cbcSrjs newdeplibs="$newdeplibs $i" 6558fa225cbcSrjs i="" 6559fa225cbcSrjs ;; 6560fa225cbcSrjs esac 6561fa225cbcSrjs fi 6562fa225cbcSrjs if test -n "$i" ; then 6563fa225cbcSrjs libname=`eval "\\$ECHO \"$libname_spec\""` 6564fa225cbcSrjs deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 6565fa225cbcSrjs set dummy $deplib_matches; shift 6566fa225cbcSrjs deplib_match=$1 6567fa225cbcSrjs if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 6568fa225cbcSrjs newdeplibs="$newdeplibs $i" 6569fa225cbcSrjs else 6570fa225cbcSrjs droppeddeps=yes 6571fa225cbcSrjs $ECHO 6572fa225cbcSrjs $ECHO "*** Warning: dynamic linker does not accept needed library $i." 6573fa225cbcSrjs $ECHO "*** I have the capability to make that library automatically link in when" 6574fa225cbcSrjs $ECHO "*** you link to this library. But I can only do this if you have a" 6575fa225cbcSrjs $ECHO "*** shared version of the library, which I believe you do not have" 6576fa225cbcSrjs $ECHO "*** because a test_compile did reveal that the linker did not use it for" 6577fa225cbcSrjs $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." 6578fa225cbcSrjs fi 6579fa225cbcSrjs fi 6580fa225cbcSrjs ;; 6581fa225cbcSrjs *) 6582fa225cbcSrjs newdeplibs="$newdeplibs $i" 6583fa225cbcSrjs ;; 6584fa225cbcSrjs esac 6585fa225cbcSrjs done 6586fa225cbcSrjs else 6587fa225cbcSrjs # Error occurred in the first compile. Let's try to salvage 6588fa225cbcSrjs # the situation: Compile a separate program for each library. 6589fa225cbcSrjs for i in $deplibs; do 6590fa225cbcSrjs case $i in 6591fa225cbcSrjs -l*) 6592fa225cbcSrjs func_stripname -l '' "$i" 6593fa225cbcSrjs name=$func_stripname_result 6594fa225cbcSrjs $opt_dry_run || $RM conftest 6595fa225cbcSrjs if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 6596fa225cbcSrjs ldd_output=`ldd conftest` 6597fa225cbcSrjs if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6598fa225cbcSrjs case " $predeps $postdeps " in 6599fa225cbcSrjs *" $i "*) 6600fa225cbcSrjs newdeplibs="$newdeplibs $i" 6601fa225cbcSrjs i="" 6602fa225cbcSrjs ;; 6603fa225cbcSrjs esac 6604fa225cbcSrjs fi 6605fa225cbcSrjs if test -n "$i" ; then 6606fa225cbcSrjs libname=`eval "\\$ECHO \"$libname_spec\""` 6607fa225cbcSrjs deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 6608fa225cbcSrjs set dummy $deplib_matches; shift 6609fa225cbcSrjs deplib_match=$1 6610fa225cbcSrjs if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 6611fa225cbcSrjs newdeplibs="$newdeplibs $i" 6612fa225cbcSrjs else 6613fa225cbcSrjs droppeddeps=yes 6614fa225cbcSrjs $ECHO 6615fa225cbcSrjs $ECHO "*** Warning: dynamic linker does not accept needed library $i." 6616fa225cbcSrjs $ECHO "*** I have the capability to make that library automatically link in when" 6617fa225cbcSrjs $ECHO "*** you link to this library. But I can only do this if you have a" 6618fa225cbcSrjs $ECHO "*** shared version of the library, which you do not appear to have" 6619fa225cbcSrjs $ECHO "*** because a test_compile did reveal that the linker did not use this one" 6620fa225cbcSrjs $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." 6621fa225cbcSrjs fi 6622fa225cbcSrjs fi 6623fa225cbcSrjs else 6624fa225cbcSrjs droppeddeps=yes 6625fa225cbcSrjs $ECHO 6626fa225cbcSrjs $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 6627fa225cbcSrjs $ECHO "*** make it link in! You will probably need to install it or some" 6628fa225cbcSrjs $ECHO "*** library that it depends on before this library will be fully" 6629fa225cbcSrjs $ECHO "*** functional. Installing it before continuing would be even better." 6630fa225cbcSrjs fi 6631fa225cbcSrjs ;; 6632fa225cbcSrjs *) 6633fa225cbcSrjs newdeplibs="$newdeplibs $i" 6634fa225cbcSrjs ;; 6635fa225cbcSrjs esac 6636fa225cbcSrjs done 6637fa225cbcSrjs fi 6638fa225cbcSrjs ;; 6639fa225cbcSrjs file_magic*) 6640fa225cbcSrjs set dummy $deplibs_check_method; shift 6641fa225cbcSrjs file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 6642fa225cbcSrjs for a_deplib in $deplibs; do 6643fa225cbcSrjs case $a_deplib in 6644fa225cbcSrjs -l*) 6645fa225cbcSrjs func_stripname -l '' "$a_deplib" 6646fa225cbcSrjs name=$func_stripname_result 6647fa225cbcSrjs if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6648fa225cbcSrjs case " $predeps $postdeps " in 6649fa225cbcSrjs *" $a_deplib "*) 6650fa225cbcSrjs newdeplibs="$newdeplibs $a_deplib" 6651fa225cbcSrjs a_deplib="" 6652fa225cbcSrjs ;; 6653fa225cbcSrjs esac 6654fa225cbcSrjs fi 6655fa225cbcSrjs if test -n "$a_deplib" ; then 6656fa225cbcSrjs libname=`eval "\\$ECHO \"$libname_spec\""` 6657fa225cbcSrjs for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 6658fa225cbcSrjs potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 6659fa225cbcSrjs for potent_lib in $potential_libs; do 6660fa225cbcSrjs # Follow soft links. 6661fa225cbcSrjs if ls -lLd "$potent_lib" 2>/dev/null | 6662fa225cbcSrjs $GREP " -> " >/dev/null; then 6663fa225cbcSrjs continue 6664fa225cbcSrjs fi 6665fa225cbcSrjs # The statement above tries to avoid entering an 6666fa225cbcSrjs # endless loop below, in case of cyclic links. 6667fa225cbcSrjs # We might still enter an endless loop, since a link 6668fa225cbcSrjs # loop can be closed while we follow links, 6669fa225cbcSrjs # but so what? 6670fa225cbcSrjs potlib="$potent_lib" 6671fa225cbcSrjs while test -h "$potlib" 2>/dev/null; do 6672fa225cbcSrjs potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 6673fa225cbcSrjs case $potliblink in 6674fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 6675fa225cbcSrjs *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 6676fa225cbcSrjs esac 6677fa225cbcSrjs done 6678fa225cbcSrjs if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 6679fa225cbcSrjs $SED -e 10q | 6680fa225cbcSrjs $EGREP "$file_magic_regex" > /dev/null; then 6681fa225cbcSrjs newdeplibs="$newdeplibs $a_deplib" 6682fa225cbcSrjs a_deplib="" 6683fa225cbcSrjs break 2 6684fa225cbcSrjs fi 6685fa225cbcSrjs done 6686fa225cbcSrjs done 6687fa225cbcSrjs fi 6688fa225cbcSrjs if test -n "$a_deplib" ; then 6689fa225cbcSrjs droppeddeps=yes 6690fa225cbcSrjs $ECHO 6691fa225cbcSrjs $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 6692fa225cbcSrjs $ECHO "*** I have the capability to make that library automatically link in when" 6693fa225cbcSrjs $ECHO "*** you link to this library. But I can only do this if you have a" 6694fa225cbcSrjs $ECHO "*** shared version of the library, which you do not appear to have" 6695fa225cbcSrjs $ECHO "*** because I did check the linker path looking for a file starting" 6696fa225cbcSrjs if test -z "$potlib" ; then 6697fa225cbcSrjs $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 6698fa225cbcSrjs else 6699fa225cbcSrjs $ECHO "*** with $libname and none of the candidates passed a file format test" 6700fa225cbcSrjs $ECHO "*** using a file magic. Last file checked: $potlib" 6701fa225cbcSrjs fi 6702fa225cbcSrjs fi 6703fa225cbcSrjs ;; 6704fa225cbcSrjs *) 6705fa225cbcSrjs # Add a -L argument. 6706fa225cbcSrjs newdeplibs="$newdeplibs $a_deplib" 6707fa225cbcSrjs ;; 6708fa225cbcSrjs esac 6709fa225cbcSrjs done # Gone through all deplibs. 6710fa225cbcSrjs ;; 6711fa225cbcSrjs match_pattern*) 6712fa225cbcSrjs set dummy $deplibs_check_method; shift 6713fa225cbcSrjs match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 6714fa225cbcSrjs for a_deplib in $deplibs; do 6715fa225cbcSrjs case $a_deplib in 6716fa225cbcSrjs -l*) 6717fa225cbcSrjs func_stripname -l '' "$a_deplib" 6718fa225cbcSrjs name=$func_stripname_result 6719fa225cbcSrjs if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6720fa225cbcSrjs case " $predeps $postdeps " in 6721fa225cbcSrjs *" $a_deplib "*) 6722fa225cbcSrjs newdeplibs="$newdeplibs $a_deplib" 6723fa225cbcSrjs a_deplib="" 6724fa225cbcSrjs ;; 6725fa225cbcSrjs esac 6726fa225cbcSrjs fi 6727fa225cbcSrjs if test -n "$a_deplib" ; then 6728fa225cbcSrjs libname=`eval "\\$ECHO \"$libname_spec\""` 6729fa225cbcSrjs for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 6730fa225cbcSrjs potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 6731fa225cbcSrjs for potent_lib in $potential_libs; do 6732fa225cbcSrjs potlib="$potent_lib" # see symlink-check above in file_magic test 6733fa225cbcSrjs if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ 6734fa225cbcSrjs $EGREP "$match_pattern_regex" > /dev/null; then 6735fa225cbcSrjs newdeplibs="$newdeplibs $a_deplib" 6736fa225cbcSrjs a_deplib="" 6737fa225cbcSrjs break 2 6738fa225cbcSrjs fi 6739fa225cbcSrjs done 6740fa225cbcSrjs done 6741fa225cbcSrjs fi 6742fa225cbcSrjs if test -n "$a_deplib" ; then 6743fa225cbcSrjs droppeddeps=yes 6744fa225cbcSrjs $ECHO 6745fa225cbcSrjs $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 6746fa225cbcSrjs $ECHO "*** I have the capability to make that library automatically link in when" 6747fa225cbcSrjs $ECHO "*** you link to this library. But I can only do this if you have a" 6748fa225cbcSrjs $ECHO "*** shared version of the library, which you do not appear to have" 6749fa225cbcSrjs $ECHO "*** because I did check the linker path looking for a file starting" 6750fa225cbcSrjs if test -z "$potlib" ; then 6751fa225cbcSrjs $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 6752fa225cbcSrjs else 6753fa225cbcSrjs $ECHO "*** with $libname and none of the candidates passed a file format test" 6754fa225cbcSrjs $ECHO "*** using a regex pattern. Last file checked: $potlib" 6755fa225cbcSrjs fi 6756fa225cbcSrjs fi 6757fa225cbcSrjs ;; 6758fa225cbcSrjs *) 6759fa225cbcSrjs # Add a -L argument. 6760fa225cbcSrjs newdeplibs="$newdeplibs $a_deplib" 6761fa225cbcSrjs ;; 6762fa225cbcSrjs esac 6763fa225cbcSrjs done # Gone through all deplibs. 6764fa225cbcSrjs ;; 6765fa225cbcSrjs none | unknown | *) 6766fa225cbcSrjs newdeplibs="" 6767fa225cbcSrjs tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ 6768fa225cbcSrjs -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` 6769fa225cbcSrjs if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6770fa225cbcSrjs for i in $predeps $postdeps ; do 6771fa225cbcSrjs # can't use Xsed below, because $i might contain '/' 6772fa225cbcSrjs tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` 6773fa225cbcSrjs done 6774fa225cbcSrjs fi 6775fa225cbcSrjs if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | 6776fa225cbcSrjs $GREP . >/dev/null; then 6777fa225cbcSrjs $ECHO 6778fa225cbcSrjs if test "X$deplibs_check_method" = "Xnone"; then 6779fa225cbcSrjs $ECHO "*** Warning: inter-library dependencies are not supported in this platform." 6780fa225cbcSrjs else 6781fa225cbcSrjs $ECHO "*** Warning: inter-library dependencies are not known to be supported." 6782fa225cbcSrjs fi 6783fa225cbcSrjs $ECHO "*** All declared inter-library dependencies are being dropped." 6784fa225cbcSrjs droppeddeps=yes 6785fa225cbcSrjs fi 6786fa225cbcSrjs ;; 6787fa225cbcSrjs esac 6788fa225cbcSrjs versuffix=$versuffix_save 6789fa225cbcSrjs major=$major_save 6790fa225cbcSrjs release=$release_save 6791fa225cbcSrjs libname=$libname_save 6792fa225cbcSrjs name=$name_save 6793fa225cbcSrjs 6794fa225cbcSrjs case $host in 6795fa225cbcSrjs *-*-rhapsody* | *-*-darwin1.[012]) 6796fa225cbcSrjs # On Rhapsody replace the C library with the System framework 6797fa225cbcSrjs newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 6798fa225cbcSrjs ;; 6799fa225cbcSrjs esac 6800fa225cbcSrjs 6801fa225cbcSrjs if test "$droppeddeps" = yes; then 6802fa225cbcSrjs if test "$module" = yes; then 6803fa225cbcSrjs $ECHO 6804fa225cbcSrjs $ECHO "*** Warning: libtool could not satisfy all declared inter-library" 6805fa225cbcSrjs $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 6806fa225cbcSrjs $ECHO "*** a static module, that should work as long as the dlopening" 6807fa225cbcSrjs $ECHO "*** application is linked with the -dlopen flag." 6808fa225cbcSrjs if test -z "$global_symbol_pipe"; then 6809fa225cbcSrjs $ECHO 6810fa225cbcSrjs $ECHO "*** However, this would only work if libtool was able to extract symbol" 6811fa225cbcSrjs $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 6812fa225cbcSrjs $ECHO "*** not find such a program. So, this module is probably useless." 6813fa225cbcSrjs $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 6814fa225cbcSrjs fi 6815fa225cbcSrjs if test "$build_old_libs" = no; then 6816fa225cbcSrjs oldlibs="$output_objdir/$libname.$libext" 6817fa225cbcSrjs build_libtool_libs=module 6818fa225cbcSrjs build_old_libs=yes 6819fa225cbcSrjs else 6820fa225cbcSrjs build_libtool_libs=no 6821fa225cbcSrjs fi 6822fa225cbcSrjs else 6823fa225cbcSrjs $ECHO "*** The inter-library dependencies that have been dropped here will be" 6824fa225cbcSrjs $ECHO "*** automatically added whenever a program is linked with this library" 6825fa225cbcSrjs $ECHO "*** or is declared to -dlopen it." 6826fa225cbcSrjs 6827fa225cbcSrjs if test "$allow_undefined" = no; then 6828fa225cbcSrjs $ECHO 6829fa225cbcSrjs $ECHO "*** Since this library must not contain undefined symbols," 6830fa225cbcSrjs $ECHO "*** because either the platform does not support them or" 6831fa225cbcSrjs $ECHO "*** it was explicitly requested with -no-undefined," 6832fa225cbcSrjs $ECHO "*** libtool will only create a static version of it." 6833fa225cbcSrjs if test "$build_old_libs" = no; then 6834fa225cbcSrjs oldlibs="$output_objdir/$libname.$libext" 6835fa225cbcSrjs build_libtool_libs=module 6836fa225cbcSrjs build_old_libs=yes 6837fa225cbcSrjs else 6838fa225cbcSrjs build_libtool_libs=no 6839fa225cbcSrjs fi 6840fa225cbcSrjs fi 6841fa225cbcSrjs fi 6842fa225cbcSrjs fi 6843fa225cbcSrjs # Done checking deplibs! 6844fa225cbcSrjs deplibs=$newdeplibs 6845fa225cbcSrjs fi 6846fa225cbcSrjs # Time to change all our "foo.ltframework" stuff back to "-framework foo" 6847fa225cbcSrjs case $host in 6848fa225cbcSrjs *-*-darwin*) 6849fa225cbcSrjs newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6850fa225cbcSrjs new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6851fa225cbcSrjs deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6852fa225cbcSrjs ;; 6853fa225cbcSrjs esac 6854fa225cbcSrjs 6855fa225cbcSrjs # move library search paths that coincide with paths to not yet 6856fa225cbcSrjs # installed libraries to the beginning of the library search list 6857fa225cbcSrjs new_libs= 6858fa225cbcSrjs for path in $notinst_path; do 6859fa225cbcSrjs case " $new_libs " in 6860fa225cbcSrjs *" -L$path/$objdir "*) ;; 6861fa225cbcSrjs *) 6862fa225cbcSrjs case " $deplibs " in 6863fa225cbcSrjs *" -L$path/$objdir "*) 6864fa225cbcSrjs new_libs="$new_libs -L$path/$objdir" ;; 6865fa225cbcSrjs esac 6866fa225cbcSrjs ;; 6867fa225cbcSrjs esac 6868fa225cbcSrjs done 6869fa225cbcSrjs for deplib in $deplibs; do 6870fa225cbcSrjs case $deplib in 6871fa225cbcSrjs -L*) 6872fa225cbcSrjs case " $new_libs " in 6873fa225cbcSrjs *" $deplib "*) ;; 6874fa225cbcSrjs *) new_libs="$new_libs $deplib" ;; 6875fa225cbcSrjs esac 6876fa225cbcSrjs ;; 6877fa225cbcSrjs *) new_libs="$new_libs $deplib" ;; 6878fa225cbcSrjs esac 6879fa225cbcSrjs done 6880fa225cbcSrjs deplibs="$new_libs" 6881fa225cbcSrjs 6882fa225cbcSrjs # All the library-specific variables (install_libdir is set above). 6883fa225cbcSrjs library_names= 6884fa225cbcSrjs old_library= 6885fa225cbcSrjs dlname= 6886fa225cbcSrjs 6887fa225cbcSrjs # Test again, we may have decided not to build it any more 6888fa225cbcSrjs if test "$build_libtool_libs" = yes; then 6889fa225cbcSrjs if test "$hardcode_into_libs" = yes; then 6890fa225cbcSrjs # Hardcode the library paths 6891fa225cbcSrjs hardcode_libdirs= 6892fa225cbcSrjs dep_rpath= 6893fa225cbcSrjs rpath="$finalize_rpath" 6894fa225cbcSrjs test "$mode" != relink && rpath="$compile_rpath$rpath" 6895fa225cbcSrjs for libdir in $rpath; do 6896fa225cbcSrjs if test -n "$hardcode_libdir_flag_spec"; then 6897fa225cbcSrjs if test -n "$hardcode_libdir_separator"; then 6898fa225cbcSrjs if test -z "$hardcode_libdirs"; then 6899fa225cbcSrjs hardcode_libdirs="$libdir" 6900fa225cbcSrjs else 6901fa225cbcSrjs # Just accumulate the unique libdirs. 6902fa225cbcSrjs case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 6903fa225cbcSrjs *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 6904fa225cbcSrjs ;; 6905fa225cbcSrjs *) 6906fa225cbcSrjs hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 6907fa225cbcSrjs ;; 6908fa225cbcSrjs esac 6909fa225cbcSrjs fi 6910fa225cbcSrjs else 6911fa225cbcSrjs eval flag=\"$hardcode_libdir_flag_spec\" 6912fa225cbcSrjs dep_rpath="$dep_rpath $flag" 6913fa225cbcSrjs fi 6914fa225cbcSrjs elif test -n "$runpath_var"; then 6915fa225cbcSrjs case "$perm_rpath " in 6916fa225cbcSrjs *" $libdir "*) ;; 6917fa225cbcSrjs *) perm_rpath="$perm_rpath $libdir" ;; 6918fa225cbcSrjs esac 6919fa225cbcSrjs fi 6920fa225cbcSrjs done 6921fa225cbcSrjs # Substitute the hardcoded libdirs into the rpath. 6922fa225cbcSrjs if test -n "$hardcode_libdir_separator" && 6923fa225cbcSrjs test -n "$hardcode_libdirs"; then 6924fa225cbcSrjs libdir="$hardcode_libdirs" 6925fa225cbcSrjs if test -n "$hardcode_libdir_flag_spec_ld"; then 6926fa225cbcSrjs eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 6927fa225cbcSrjs else 6928fa225cbcSrjs eval dep_rpath=\"$hardcode_libdir_flag_spec\" 6929fa225cbcSrjs fi 6930fa225cbcSrjs fi 6931fa225cbcSrjs if test -n "$runpath_var" && test -n "$perm_rpath"; then 6932fa225cbcSrjs # We should set the runpath_var. 6933fa225cbcSrjs rpath= 6934fa225cbcSrjs for dir in $perm_rpath; do 6935fa225cbcSrjs rpath="$rpath$dir:" 6936fa225cbcSrjs done 6937fa225cbcSrjs eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 6938fa225cbcSrjs fi 6939fa225cbcSrjs test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 6940fa225cbcSrjs fi 6941fa225cbcSrjs 6942fa225cbcSrjs shlibpath="$finalize_shlibpath" 6943fa225cbcSrjs test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 6944fa225cbcSrjs if test -n "$shlibpath"; then 6945fa225cbcSrjs eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 6946fa225cbcSrjs fi 6947fa225cbcSrjs 6948fa225cbcSrjs # Get the real and link names of the library. 6949fa225cbcSrjs eval shared_ext=\"$shrext_cmds\" 6950fa225cbcSrjs eval library_names=\"$library_names_spec\" 6951fa225cbcSrjs set dummy $library_names 6952fa225cbcSrjs shift 6953fa225cbcSrjs realname="$1" 6954fa225cbcSrjs shift 6955fa225cbcSrjs 6956fa225cbcSrjs if test -n "$soname_spec"; then 6957fa225cbcSrjs eval soname=\"$soname_spec\" 6958fa225cbcSrjs else 6959fa225cbcSrjs soname="$realname" 6960fa225cbcSrjs fi 6961fa225cbcSrjs if test -z "$dlname"; then 6962fa225cbcSrjs dlname=$soname 6963fa225cbcSrjs fi 6964fa225cbcSrjs 6965fa225cbcSrjs lib="$output_objdir/$realname" 6966fa225cbcSrjs linknames= 6967fa225cbcSrjs for link 6968fa225cbcSrjs do 6969fa225cbcSrjs linknames="$linknames $link" 6970fa225cbcSrjs done 6971fa225cbcSrjs 6972fa225cbcSrjs # Use standard objects if they are pic 6973fa225cbcSrjs test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 6974fa225cbcSrjs test "X$libobjs" = "X " && libobjs= 6975fa225cbcSrjs 6976fa225cbcSrjs delfiles= 6977fa225cbcSrjs if test -n "$export_symbols" && test -n "$include_expsyms"; then 6978fa225cbcSrjs $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 6979fa225cbcSrjs export_symbols="$output_objdir/$libname.uexp" 6980fa225cbcSrjs delfiles="$delfiles $export_symbols" 6981fa225cbcSrjs fi 6982fa225cbcSrjs 6983fa225cbcSrjs orig_export_symbols= 6984fa225cbcSrjs case $host_os in 6985fa225cbcSrjs cygwin* | mingw* | cegcc*) 6986fa225cbcSrjs if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 6987fa225cbcSrjs # exporting using user supplied symfile 6988fa225cbcSrjs if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 6989fa225cbcSrjs # and it's NOT already a .def file. Must figure out 6990fa225cbcSrjs # which of the given symbols are data symbols and tag 6991fa225cbcSrjs # them as such. So, trigger use of export_symbols_cmds. 6992fa225cbcSrjs # export_symbols gets reassigned inside the "prepare 6993fa225cbcSrjs # the list of exported symbols" if statement, so the 6994fa225cbcSrjs # include_expsyms logic still works. 6995fa225cbcSrjs orig_export_symbols="$export_symbols" 6996fa225cbcSrjs export_symbols= 6997fa225cbcSrjs always_export_symbols=yes 6998fa225cbcSrjs fi 6999fa225cbcSrjs fi 7000fa225cbcSrjs ;; 7001fa225cbcSrjs esac 7002fa225cbcSrjs 7003fa225cbcSrjs # Prepare the list of exported symbols 7004fa225cbcSrjs if test -z "$export_symbols"; then 7005fa225cbcSrjs if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 7006fa225cbcSrjs func_verbose "generating symbol list for \`$libname.la'" 7007fa225cbcSrjs export_symbols="$output_objdir/$libname.exp" 7008fa225cbcSrjs $opt_dry_run || $RM $export_symbols 7009fa225cbcSrjs cmds=$export_symbols_cmds 7010fa225cbcSrjs save_ifs="$IFS"; IFS='~' 7011fa225cbcSrjs for cmd in $cmds; do 7012fa225cbcSrjs IFS="$save_ifs" 7013fa225cbcSrjs eval cmd=\"$cmd\" 7014fa225cbcSrjs func_len " $cmd" 7015fa225cbcSrjs len=$func_len_result 7016fa225cbcSrjs if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 7017fa225cbcSrjs func_show_eval "$cmd" 'exit $?' 7018fa225cbcSrjs skipped_export=false 7019fa225cbcSrjs else 7020fa225cbcSrjs # The command line is too long to execute in one step. 7021fa225cbcSrjs func_verbose "using reloadable object file for export list..." 7022fa225cbcSrjs skipped_export=: 7023fa225cbcSrjs # Break out early, otherwise skipped_export may be 7024fa225cbcSrjs # set to false by a later but shorter cmd. 7025fa225cbcSrjs break 7026fa225cbcSrjs fi 7027fa225cbcSrjs done 7028fa225cbcSrjs IFS="$save_ifs" 7029fa225cbcSrjs if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 7030fa225cbcSrjs func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 7031fa225cbcSrjs func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 7032fa225cbcSrjs fi 7033fa225cbcSrjs fi 7034fa225cbcSrjs fi 7035fa225cbcSrjs 7036fa225cbcSrjs if test -n "$export_symbols" && test -n "$include_expsyms"; then 7037fa225cbcSrjs tmp_export_symbols="$export_symbols" 7038fa225cbcSrjs test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 7039fa225cbcSrjs $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 7040fa225cbcSrjs fi 7041fa225cbcSrjs 7042fa225cbcSrjs if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 7043fa225cbcSrjs # The given exports_symbols file has to be filtered, so filter it. 7044fa225cbcSrjs func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 7045fa225cbcSrjs # FIXME: $output_objdir/$libname.filter potentially contains lots of 7046fa225cbcSrjs # 's' commands which not all seds can handle. GNU sed should be fine 7047fa225cbcSrjs # though. Also, the filter scales superlinearly with the number of 7048fa225cbcSrjs # global variables. join(1) would be nice here, but unfortunately 7049fa225cbcSrjs # isn't a blessed tool. 7050fa225cbcSrjs $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 7051fa225cbcSrjs delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 7052fa225cbcSrjs export_symbols=$output_objdir/$libname.def 7053fa225cbcSrjs $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 7054fa225cbcSrjs fi 7055fa225cbcSrjs 7056fa225cbcSrjs tmp_deplibs= 7057fa225cbcSrjs for test_deplib in $deplibs; do 7058fa225cbcSrjs case " $convenience " in 7059fa225cbcSrjs *" $test_deplib "*) ;; 7060fa225cbcSrjs *) 7061fa225cbcSrjs tmp_deplibs="$tmp_deplibs $test_deplib" 7062fa225cbcSrjs ;; 7063fa225cbcSrjs esac 7064fa225cbcSrjs done 7065fa225cbcSrjs deplibs="$tmp_deplibs" 7066fa225cbcSrjs 7067fa225cbcSrjs if test -n "$convenience"; then 7068fa225cbcSrjs if test -n "$whole_archive_flag_spec" && 7069fa225cbcSrjs test "$compiler_needs_object" = yes && 7070fa225cbcSrjs test -z "$libobjs"; then 7071fa225cbcSrjs # extract the archives, so we have objects to list. 7072fa225cbcSrjs # TODO: could optimize this to just extract one archive. 7073fa225cbcSrjs whole_archive_flag_spec= 7074fa225cbcSrjs fi 7075fa225cbcSrjs if test -n "$whole_archive_flag_spec"; then 7076fa225cbcSrjs save_libobjs=$libobjs 7077fa225cbcSrjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 7078fa225cbcSrjs test "X$libobjs" = "X " && libobjs= 7079fa225cbcSrjs else 7080fa225cbcSrjs gentop="$output_objdir/${outputname}x" 7081fa225cbcSrjs generated="$generated $gentop" 7082fa225cbcSrjs 7083fa225cbcSrjs func_extract_archives $gentop $convenience 7084fa225cbcSrjs libobjs="$libobjs $func_extract_archives_result" 7085fa225cbcSrjs test "X$libobjs" = "X " && libobjs= 7086fa225cbcSrjs fi 7087fa225cbcSrjs fi 7088fa225cbcSrjs 7089fa225cbcSrjs if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 7090fa225cbcSrjs eval flag=\"$thread_safe_flag_spec\" 7091fa225cbcSrjs linker_flags="$linker_flags $flag" 7092fa225cbcSrjs fi 7093fa225cbcSrjs 7094fa225cbcSrjs # Make a backup of the uninstalled library when relinking 7095fa225cbcSrjs if test "$mode" = relink; then 7096fa225cbcSrjs $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 7097fa225cbcSrjs fi 7098fa225cbcSrjs 7099fa225cbcSrjs # Do each of the archive commands. 7100fa225cbcSrjs if test "$module" = yes && test -n "$module_cmds" ; then 7101fa225cbcSrjs if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 7102fa225cbcSrjs eval test_cmds=\"$module_expsym_cmds\" 7103fa225cbcSrjs cmds=$module_expsym_cmds 7104fa225cbcSrjs else 7105fa225cbcSrjs eval test_cmds=\"$module_cmds\" 7106fa225cbcSrjs cmds=$module_cmds 7107fa225cbcSrjs fi 7108fa225cbcSrjs else 7109fa225cbcSrjs if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 7110fa225cbcSrjs eval test_cmds=\"$archive_expsym_cmds\" 7111fa225cbcSrjs cmds=$archive_expsym_cmds 7112fa225cbcSrjs else 7113fa225cbcSrjs eval test_cmds=\"$archive_cmds\" 7114fa225cbcSrjs cmds=$archive_cmds 7115fa225cbcSrjs fi 7116fa225cbcSrjs fi 7117fa225cbcSrjs 7118fa225cbcSrjs if test "X$skipped_export" != "X:" && 7119fa225cbcSrjs func_len " $test_cmds" && 7120fa225cbcSrjs len=$func_len_result && 7121fa225cbcSrjs test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 7122fa225cbcSrjs : 7123fa225cbcSrjs else 7124fa225cbcSrjs # The command line is too long to link in one step, link piecewise 7125fa225cbcSrjs # or, if using GNU ld and skipped_export is not :, use a linker 7126fa225cbcSrjs # script. 7127fa225cbcSrjs 7128fa225cbcSrjs # Save the value of $output and $libobjs because we want to 7129fa225cbcSrjs # use them later. If we have whole_archive_flag_spec, we 7130fa225cbcSrjs # want to use save_libobjs as it was before 7131fa225cbcSrjs # whole_archive_flag_spec was expanded, because we can't 7132fa225cbcSrjs # assume the linker understands whole_archive_flag_spec. 7133fa225cbcSrjs # This may have to be revisited, in case too many 7134fa225cbcSrjs # convenience libraries get linked in and end up exceeding 7135fa225cbcSrjs # the spec. 7136fa225cbcSrjs if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 7137fa225cbcSrjs save_libobjs=$libobjs 7138fa225cbcSrjs fi 7139fa225cbcSrjs save_output=$output 7140fa225cbcSrjs output_la=`$ECHO "X$output" | $Xsed -e "$basename"` 7141fa225cbcSrjs 7142fa225cbcSrjs # Clear the reloadable object creation command queue and 7143fa225cbcSrjs # initialize k to one. 7144fa225cbcSrjs test_cmds= 7145fa225cbcSrjs concat_cmds= 7146fa225cbcSrjs objlist= 7147fa225cbcSrjs last_robj= 7148fa225cbcSrjs k=1 7149fa225cbcSrjs 7150fa225cbcSrjs if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 7151fa225cbcSrjs output=${output_objdir}/${output_la}.lnkscript 7152fa225cbcSrjs func_verbose "creating GNU ld script: $output" 7153fa225cbcSrjs $ECHO 'INPUT (' > $output 7154fa225cbcSrjs for obj in $save_libobjs 7155fa225cbcSrjs do 7156fa225cbcSrjs $ECHO "$obj" >> $output 7157fa225cbcSrjs done 7158fa225cbcSrjs $ECHO ')' >> $output 7159fa225cbcSrjs delfiles="$delfiles $output" 7160fa225cbcSrjs elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 7161fa225cbcSrjs output=${output_objdir}/${output_la}.lnk 7162fa225cbcSrjs func_verbose "creating linker input file list: $output" 7163fa225cbcSrjs : > $output 7164fa225cbcSrjs set x $save_libobjs 7165fa225cbcSrjs shift 7166fa225cbcSrjs firstobj= 7167fa225cbcSrjs if test "$compiler_needs_object" = yes; then 7168fa225cbcSrjs firstobj="$1 " 7169fa225cbcSrjs shift 7170fa225cbcSrjs fi 7171fa225cbcSrjs for obj 7172fa225cbcSrjs do 7173fa225cbcSrjs $ECHO "$obj" >> $output 7174fa225cbcSrjs done 7175fa225cbcSrjs delfiles="$delfiles $output" 7176fa225cbcSrjs output=$firstobj\"$file_list_spec$output\" 7177fa225cbcSrjs else 7178fa225cbcSrjs if test -n "$save_libobjs"; then 7179fa225cbcSrjs func_verbose "creating reloadable object files..." 7180fa225cbcSrjs output=$output_objdir/$output_la-${k}.$objext 7181fa225cbcSrjs eval test_cmds=\"$reload_cmds\" 7182fa225cbcSrjs func_len " $test_cmds" 7183fa225cbcSrjs len0=$func_len_result 7184fa225cbcSrjs len=$len0 7185fa225cbcSrjs 7186fa225cbcSrjs # Loop over the list of objects to be linked. 7187fa225cbcSrjs for obj in $save_libobjs 7188fa225cbcSrjs do 7189fa225cbcSrjs func_len " $obj" 7190fa225cbcSrjs func_arith $len + $func_len_result 7191fa225cbcSrjs len=$func_arith_result 7192fa225cbcSrjs if test "X$objlist" = X || 7193fa225cbcSrjs test "$len" -lt "$max_cmd_len"; then 7194fa225cbcSrjs func_append objlist " $obj" 7195fa225cbcSrjs else 7196fa225cbcSrjs # The command $test_cmds is almost too long, add a 7197fa225cbcSrjs # command to the queue. 7198fa225cbcSrjs if test "$k" -eq 1 ; then 7199fa225cbcSrjs # The first file doesn't have a previous command to add. 7200fa225cbcSrjs eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 7201fa225cbcSrjs else 7202fa225cbcSrjs # All subsequent reloadable object files will link in 7203fa225cbcSrjs # the last one created. 7204fa225cbcSrjs eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" 7205fa225cbcSrjs fi 7206fa225cbcSrjs last_robj=$output_objdir/$output_la-${k}.$objext 7207fa225cbcSrjs func_arith $k + 1 7208fa225cbcSrjs k=$func_arith_result 7209fa225cbcSrjs output=$output_objdir/$output_la-${k}.$objext 7210fa225cbcSrjs objlist=$obj 7211fa225cbcSrjs func_len " $last_robj" 7212fa225cbcSrjs func_arith $len0 + $func_len_result 7213fa225cbcSrjs len=$func_arith_result 7214fa225cbcSrjs fi 7215fa225cbcSrjs done 7216fa225cbcSrjs # Handle the remaining objects by creating one last 7217fa225cbcSrjs # reloadable object file. All subsequent reloadable object 7218fa225cbcSrjs # files will link in the last one created. 7219fa225cbcSrjs test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 7220fa225cbcSrjs eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 7221fa225cbcSrjs if test -n "$last_robj"; then 7222fa225cbcSrjs eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 7223fa225cbcSrjs fi 7224fa225cbcSrjs delfiles="$delfiles $output" 7225fa225cbcSrjs 7226fa225cbcSrjs else 7227fa225cbcSrjs output= 7228fa225cbcSrjs fi 7229fa225cbcSrjs 7230fa225cbcSrjs if ${skipped_export-false}; then 7231fa225cbcSrjs func_verbose "generating symbol list for \`$libname.la'" 7232fa225cbcSrjs export_symbols="$output_objdir/$libname.exp" 7233fa225cbcSrjs $opt_dry_run || $RM $export_symbols 7234fa225cbcSrjs libobjs=$output 7235fa225cbcSrjs # Append the command to create the export file. 7236fa225cbcSrjs test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 7237fa225cbcSrjs eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 7238fa225cbcSrjs if test -n "$last_robj"; then 7239fa225cbcSrjs eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 7240fa225cbcSrjs fi 7241fa225cbcSrjs fi 7242fa225cbcSrjs 7243fa225cbcSrjs test -n "$save_libobjs" && 7244fa225cbcSrjs func_verbose "creating a temporary reloadable object file: $output" 7245fa225cbcSrjs 7246fa225cbcSrjs # Loop through the commands generated above and execute them. 7247fa225cbcSrjs save_ifs="$IFS"; IFS='~' 7248fa225cbcSrjs for cmd in $concat_cmds; do 7249fa225cbcSrjs IFS="$save_ifs" 7250fa225cbcSrjs $opt_silent || { 7251fa225cbcSrjs func_quote_for_expand "$cmd" 7252fa225cbcSrjs eval "func_echo $func_quote_for_expand_result" 7253fa225cbcSrjs } 7254fa225cbcSrjs $opt_dry_run || eval "$cmd" || { 7255fa225cbcSrjs lt_exit=$? 7256fa225cbcSrjs 7257fa225cbcSrjs # Restore the uninstalled library and exit 7258fa225cbcSrjs if test "$mode" = relink; then 7259fa225cbcSrjs ( cd "$output_objdir" && \ 7260fa225cbcSrjs $RM "${realname}T" && \ 7261fa225cbcSrjs $MV "${realname}U" "$realname" ) 7262fa225cbcSrjs fi 7263fa225cbcSrjs 7264fa225cbcSrjs exit $lt_exit 7265fa225cbcSrjs } 7266fa225cbcSrjs done 7267fa225cbcSrjs IFS="$save_ifs" 7268fa225cbcSrjs 7269fa225cbcSrjs if test -n "$export_symbols_regex" && ${skipped_export-false}; then 7270fa225cbcSrjs func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 7271fa225cbcSrjs func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 7272fa225cbcSrjs fi 7273fa225cbcSrjs fi 7274fa225cbcSrjs 7275fa225cbcSrjs if ${skipped_export-false}; then 7276fa225cbcSrjs if test -n "$export_symbols" && test -n "$include_expsyms"; then 7277fa225cbcSrjs tmp_export_symbols="$export_symbols" 7278fa225cbcSrjs test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 7279fa225cbcSrjs $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 7280fa225cbcSrjs fi 7281fa225cbcSrjs 7282fa225cbcSrjs if test -n "$orig_export_symbols"; then 7283fa225cbcSrjs # The given exports_symbols file has to be filtered, so filter it. 7284fa225cbcSrjs func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 7285fa225cbcSrjs # FIXME: $output_objdir/$libname.filter potentially contains lots of 7286fa225cbcSrjs # 's' commands which not all seds can handle. GNU sed should be fine 7287fa225cbcSrjs # though. Also, the filter scales superlinearly with the number of 7288fa225cbcSrjs # global variables. join(1) would be nice here, but unfortunately 7289fa225cbcSrjs # isn't a blessed tool. 7290fa225cbcSrjs $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 7291fa225cbcSrjs delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 7292fa225cbcSrjs export_symbols=$output_objdir/$libname.def 7293fa225cbcSrjs $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 7294fa225cbcSrjs fi 7295fa225cbcSrjs fi 7296fa225cbcSrjs 7297fa225cbcSrjs libobjs=$output 7298fa225cbcSrjs # Restore the value of output. 7299fa225cbcSrjs output=$save_output 7300fa225cbcSrjs 7301fa225cbcSrjs if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 7302fa225cbcSrjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 7303fa225cbcSrjs test "X$libobjs" = "X " && libobjs= 7304fa225cbcSrjs fi 7305fa225cbcSrjs # Expand the library linking commands again to reset the 7306fa225cbcSrjs # value of $libobjs for piecewise linking. 7307fa225cbcSrjs 7308fa225cbcSrjs # Do each of the archive commands. 7309fa225cbcSrjs if test "$module" = yes && test -n "$module_cmds" ; then 7310fa225cbcSrjs if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 7311fa225cbcSrjs cmds=$module_expsym_cmds 7312fa225cbcSrjs else 7313fa225cbcSrjs cmds=$module_cmds 7314fa225cbcSrjs fi 7315fa225cbcSrjs else 7316fa225cbcSrjs if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 7317fa225cbcSrjs cmds=$archive_expsym_cmds 7318fa225cbcSrjs else 7319fa225cbcSrjs cmds=$archive_cmds 7320fa225cbcSrjs fi 7321fa225cbcSrjs fi 7322fa225cbcSrjs fi 7323fa225cbcSrjs 7324fa225cbcSrjs if test -n "$delfiles"; then 7325fa225cbcSrjs # Append the command to remove temporary files to $cmds. 7326fa225cbcSrjs eval cmds=\"\$cmds~\$RM $delfiles\" 7327fa225cbcSrjs fi 7328fa225cbcSrjs 7329fa225cbcSrjs # Add any objects from preloaded convenience libraries 7330fa225cbcSrjs if test -n "$dlprefiles"; then 7331fa225cbcSrjs gentop="$output_objdir/${outputname}x" 7332fa225cbcSrjs generated="$generated $gentop" 7333fa225cbcSrjs 7334fa225cbcSrjs func_extract_archives $gentop $dlprefiles 7335fa225cbcSrjs libobjs="$libobjs $func_extract_archives_result" 7336fa225cbcSrjs test "X$libobjs" = "X " && libobjs= 7337fa225cbcSrjs fi 7338fa225cbcSrjs 7339fa225cbcSrjs save_ifs="$IFS"; IFS='~' 7340fa225cbcSrjs for cmd in $cmds; do 7341fa225cbcSrjs IFS="$save_ifs" 7342fa225cbcSrjs eval cmd=\"$cmd\" 7343fa225cbcSrjs $opt_silent || { 7344fa225cbcSrjs func_quote_for_expand "$cmd" 7345fa225cbcSrjs eval "func_echo $func_quote_for_expand_result" 7346fa225cbcSrjs } 7347fa225cbcSrjs $opt_dry_run || eval "$cmd" || { 7348fa225cbcSrjs lt_exit=$? 7349fa225cbcSrjs 7350fa225cbcSrjs # Restore the uninstalled library and exit 7351fa225cbcSrjs if test "$mode" = relink; then 7352fa225cbcSrjs ( cd "$output_objdir" && \ 7353fa225cbcSrjs $RM "${realname}T" && \ 7354fa225cbcSrjs $MV "${realname}U" "$realname" ) 7355fa225cbcSrjs fi 7356fa225cbcSrjs 7357fa225cbcSrjs exit $lt_exit 7358fa225cbcSrjs } 7359fa225cbcSrjs done 7360fa225cbcSrjs IFS="$save_ifs" 7361fa225cbcSrjs 7362fa225cbcSrjs # Restore the uninstalled library and exit 7363fa225cbcSrjs if test "$mode" = relink; then 7364fa225cbcSrjs $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 7365fa225cbcSrjs 7366fa225cbcSrjs if test -n "$convenience"; then 7367fa225cbcSrjs if test -z "$whole_archive_flag_spec"; then 7368fa225cbcSrjs func_show_eval '${RM}r "$gentop"' 7369fa225cbcSrjs fi 7370fa225cbcSrjs fi 7371fa225cbcSrjs 7372fa225cbcSrjs exit $EXIT_SUCCESS 7373fa225cbcSrjs fi 7374fa225cbcSrjs 7375fa225cbcSrjs # Create links to the real library. 7376fa225cbcSrjs for linkname in $linknames; do 7377fa225cbcSrjs if test "$realname" != "$linkname"; then 7378fa225cbcSrjs func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 7379fa225cbcSrjs fi 7380fa225cbcSrjs done 7381fa225cbcSrjs 7382fa225cbcSrjs # If -module or -export-dynamic was specified, set the dlname. 7383fa225cbcSrjs if test "$module" = yes || test "$export_dynamic" = yes; then 7384fa225cbcSrjs # On all known operating systems, these are identical. 7385fa225cbcSrjs dlname="$soname" 7386fa225cbcSrjs fi 7387fa225cbcSrjs fi 7388fa225cbcSrjs ;; 7389fa225cbcSrjs 7390fa225cbcSrjs obj) 7391fa225cbcSrjs if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7392fa225cbcSrjs func_warning "\`-dlopen' is ignored for objects" 7393fa225cbcSrjs fi 7394fa225cbcSrjs 7395fa225cbcSrjs case " $deplibs" in 7396fa225cbcSrjs *\ -l* | *\ -L*) 7397fa225cbcSrjs func_warning "\`-l' and \`-L' are ignored for objects" ;; 7398fa225cbcSrjs esac 7399fa225cbcSrjs 7400fa225cbcSrjs test -n "$rpath" && \ 7401fa225cbcSrjs func_warning "\`-rpath' is ignored for objects" 7402fa225cbcSrjs 7403fa225cbcSrjs test -n "$xrpath" && \ 7404fa225cbcSrjs func_warning "\`-R' is ignored for objects" 7405fa225cbcSrjs 7406fa225cbcSrjs test -n "$vinfo" && \ 7407fa225cbcSrjs func_warning "\`-version-info' is ignored for objects" 7408fa225cbcSrjs 7409fa225cbcSrjs test -n "$release" && \ 7410fa225cbcSrjs func_warning "\`-release' is ignored for objects" 7411fa225cbcSrjs 7412fa225cbcSrjs case $output in 7413fa225cbcSrjs *.lo) 7414fa225cbcSrjs test -n "$objs$old_deplibs" && \ 7415fa225cbcSrjs func_fatal_error "cannot build library object \`$output' from non-libtool objects" 7416fa225cbcSrjs 7417fa225cbcSrjs libobj=$output 7418fa225cbcSrjs func_lo2o "$libobj" 7419fa225cbcSrjs obj=$func_lo2o_result 7420fa225cbcSrjs ;; 7421fa225cbcSrjs *) 7422fa225cbcSrjs libobj= 7423fa225cbcSrjs obj="$output" 7424fa225cbcSrjs ;; 7425fa225cbcSrjs esac 7426fa225cbcSrjs 7427fa225cbcSrjs # Delete the old objects. 7428fa225cbcSrjs $opt_dry_run || $RM $obj $libobj 7429fa225cbcSrjs 7430fa225cbcSrjs # Objects from convenience libraries. This assumes 7431fa225cbcSrjs # single-version convenience libraries. Whenever we create 7432fa225cbcSrjs # different ones for PIC/non-PIC, this we'll have to duplicate 7433fa225cbcSrjs # the extraction. 7434fa225cbcSrjs reload_conv_objs= 7435fa225cbcSrjs gentop= 7436fa225cbcSrjs # reload_cmds runs $LD directly, so let us get rid of 7437fa225cbcSrjs # -Wl from whole_archive_flag_spec and hope we can get by with 7438fa225cbcSrjs # turning comma into space.. 7439fa225cbcSrjs wl= 7440fa225cbcSrjs 7441fa225cbcSrjs if test -n "$convenience"; then 7442fa225cbcSrjs if test -n "$whole_archive_flag_spec"; then 7443fa225cbcSrjs eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 7444fa225cbcSrjs reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 7445fa225cbcSrjs else 7446fa225cbcSrjs gentop="$output_objdir/${obj}x" 7447fa225cbcSrjs generated="$generated $gentop" 7448fa225cbcSrjs 7449fa225cbcSrjs func_extract_archives $gentop $convenience 7450fa225cbcSrjs reload_conv_objs="$reload_objs $func_extract_archives_result" 7451fa225cbcSrjs fi 7452fa225cbcSrjs fi 7453fa225cbcSrjs 7454fa225cbcSrjs # Create the old-style object. 7455fa225cbcSrjs 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 7456fa225cbcSrjs 7457fa225cbcSrjs output="$obj" 7458fa225cbcSrjs func_execute_cmds "$reload_cmds" 'exit $?' 7459fa225cbcSrjs 7460fa225cbcSrjs # Exit if we aren't doing a library object file. 7461fa225cbcSrjs if test -z "$libobj"; then 7462fa225cbcSrjs if test -n "$gentop"; then 7463fa225cbcSrjs func_show_eval '${RM}r "$gentop"' 7464fa225cbcSrjs fi 7465fa225cbcSrjs 7466fa225cbcSrjs exit $EXIT_SUCCESS 7467fa225cbcSrjs fi 7468fa225cbcSrjs 7469fa225cbcSrjs if test "$build_libtool_libs" != yes; then 7470fa225cbcSrjs if test -n "$gentop"; then 7471fa225cbcSrjs func_show_eval '${RM}r "$gentop"' 7472fa225cbcSrjs fi 7473fa225cbcSrjs 7474fa225cbcSrjs # Create an invalid libtool object if no PIC, so that we don't 7475fa225cbcSrjs # accidentally link it into a program. 7476fa225cbcSrjs # $show "echo timestamp > $libobj" 7477fa225cbcSrjs # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 7478fa225cbcSrjs exit $EXIT_SUCCESS 7479fa225cbcSrjs fi 7480fa225cbcSrjs 7481fa225cbcSrjs if test -n "$pic_flag" || test "$pic_mode" != default; then 7482fa225cbcSrjs # Only do commands if we really have different PIC objects. 7483fa225cbcSrjs reload_objs="$libobjs $reload_conv_objs" 7484fa225cbcSrjs output="$libobj" 7485fa225cbcSrjs func_execute_cmds "$reload_cmds" 'exit $?' 7486fa225cbcSrjs fi 7487fa225cbcSrjs 7488fa225cbcSrjs if test -n "$gentop"; then 7489fa225cbcSrjs func_show_eval '${RM}r "$gentop"' 7490fa225cbcSrjs fi 7491fa225cbcSrjs 7492fa225cbcSrjs exit $EXIT_SUCCESS 7493fa225cbcSrjs ;; 7494fa225cbcSrjs 7495fa225cbcSrjs prog) 7496fa225cbcSrjs case $host in 7497fa225cbcSrjs *cygwin*) func_stripname '' '.exe' "$output" 7498fa225cbcSrjs output=$func_stripname_result.exe;; 7499fa225cbcSrjs esac 7500fa225cbcSrjs test -n "$vinfo" && \ 7501fa225cbcSrjs func_warning "\`-version-info' is ignored for programs" 7502fa225cbcSrjs 7503fa225cbcSrjs test -n "$release" && \ 7504fa225cbcSrjs func_warning "\`-release' is ignored for programs" 7505fa225cbcSrjs 7506fa225cbcSrjs test "$preload" = yes \ 7507fa225cbcSrjs && test "$dlopen_support" = unknown \ 7508fa225cbcSrjs && test "$dlopen_self" = unknown \ 7509fa225cbcSrjs && test "$dlopen_self_static" = unknown && \ 7510fa225cbcSrjs func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 7511fa225cbcSrjs 7512fa225cbcSrjs case $host in 7513fa225cbcSrjs *-*-rhapsody* | *-*-darwin1.[012]) 7514fa225cbcSrjs # On Rhapsody replace the C library is the System framework 7515fa225cbcSrjs compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 7516fa225cbcSrjs finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 7517fa225cbcSrjs ;; 7518fa225cbcSrjs esac 7519fa225cbcSrjs 7520fa225cbcSrjs case $host in 7521fa225cbcSrjs *-*-darwin*) 7522fa225cbcSrjs # Don't allow lazy linking, it breaks C++ global constructors 7523fa225cbcSrjs # But is supposedly fixed on 10.4 or later (yay!). 7524fa225cbcSrjs if test "$tagname" = CXX ; then 7525fa225cbcSrjs case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 7526fa225cbcSrjs 10.[0123]) 7527fa225cbcSrjs compile_command="$compile_command ${wl}-bind_at_load" 7528fa225cbcSrjs finalize_command="$finalize_command ${wl}-bind_at_load" 7529fa225cbcSrjs ;; 7530fa225cbcSrjs esac 7531fa225cbcSrjs fi 7532fa225cbcSrjs # Time to change all our "foo.ltframework" stuff back to "-framework foo" 7533fa225cbcSrjs compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 7534fa225cbcSrjs finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 7535fa225cbcSrjs ;; 7536fa225cbcSrjs esac 7537fa225cbcSrjs 7538fa225cbcSrjs 7539fa225cbcSrjs # move library search paths that coincide with paths to not yet 7540fa225cbcSrjs # installed libraries to the beginning of the library search list 7541fa225cbcSrjs new_libs= 7542fa225cbcSrjs for path in $notinst_path; do 7543fa225cbcSrjs case " $new_libs " in 7544fa225cbcSrjs *" -L$path/$objdir "*) ;; 7545fa225cbcSrjs *) 7546fa225cbcSrjs case " $compile_deplibs " in 7547fa225cbcSrjs *" -L$path/$objdir "*) 7548fa225cbcSrjs new_libs="$new_libs -L$path/$objdir" ;; 7549fa225cbcSrjs esac 7550fa225cbcSrjs ;; 7551fa225cbcSrjs esac 7552fa225cbcSrjs done 7553fa225cbcSrjs for deplib in $compile_deplibs; do 7554fa225cbcSrjs case $deplib in 7555fa225cbcSrjs -L*) 7556fa225cbcSrjs case " $new_libs " in 7557fa225cbcSrjs *" $deplib "*) ;; 7558fa225cbcSrjs *) new_libs="$new_libs $deplib" ;; 7559fa225cbcSrjs esac 7560fa225cbcSrjs ;; 7561fa225cbcSrjs *) new_libs="$new_libs $deplib" ;; 7562fa225cbcSrjs esac 7563fa225cbcSrjs done 7564fa225cbcSrjs compile_deplibs="$new_libs" 7565fa225cbcSrjs 7566fa225cbcSrjs 7567fa225cbcSrjs compile_command="$compile_command $compile_deplibs" 7568fa225cbcSrjs finalize_command="$finalize_command $finalize_deplibs" 7569fa225cbcSrjs 7570fa225cbcSrjs if test -n "$rpath$xrpath"; then 7571fa225cbcSrjs # If the user specified any rpath flags, then add them. 7572fa225cbcSrjs for libdir in $rpath $xrpath; do 7573fa225cbcSrjs # This is the magic to use -rpath. 7574fa225cbcSrjs case "$finalize_rpath " in 7575fa225cbcSrjs *" $libdir "*) ;; 7576fa225cbcSrjs *) finalize_rpath="$finalize_rpath $libdir" ;; 7577fa225cbcSrjs esac 7578fa225cbcSrjs done 7579fa225cbcSrjs fi 7580fa225cbcSrjs 7581fa225cbcSrjs # Now hardcode the library paths 7582fa225cbcSrjs rpath= 7583fa225cbcSrjs hardcode_libdirs= 7584fa225cbcSrjs for libdir in $compile_rpath $finalize_rpath; do 7585fa225cbcSrjs if test -n "$hardcode_libdir_flag_spec"; then 7586fa225cbcSrjs if test -n "$hardcode_libdir_separator"; then 7587fa225cbcSrjs if test -z "$hardcode_libdirs"; then 7588fa225cbcSrjs hardcode_libdirs="$libdir" 7589fa225cbcSrjs else 7590fa225cbcSrjs # Just accumulate the unique libdirs. 7591fa225cbcSrjs case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 7592fa225cbcSrjs *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 7593fa225cbcSrjs ;; 7594fa225cbcSrjs *) 7595fa225cbcSrjs hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 7596fa225cbcSrjs ;; 7597fa225cbcSrjs esac 7598fa225cbcSrjs fi 7599fa225cbcSrjs else 7600fa225cbcSrjs eval flag=\"$hardcode_libdir_flag_spec\" 7601fa225cbcSrjs rpath="$rpath $flag" 7602fa225cbcSrjs fi 7603fa225cbcSrjs elif test -n "$runpath_var"; then 7604fa225cbcSrjs case "$perm_rpath " in 7605fa225cbcSrjs *" $libdir "*) ;; 7606fa225cbcSrjs *) perm_rpath="$perm_rpath $libdir" ;; 7607fa225cbcSrjs esac 7608fa225cbcSrjs fi 7609fa225cbcSrjs case $host in 7610fa225cbcSrjs *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 7611fa225cbcSrjs testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 7612fa225cbcSrjs case :$dllsearchpath: in 7613fa225cbcSrjs *":$libdir:"*) ;; 7614fa225cbcSrjs ::) dllsearchpath=$libdir;; 7615fa225cbcSrjs *) dllsearchpath="$dllsearchpath:$libdir";; 7616fa225cbcSrjs esac 7617fa225cbcSrjs case :$dllsearchpath: in 7618fa225cbcSrjs *":$testbindir:"*) ;; 7619fa225cbcSrjs ::) dllsearchpath=$testbindir;; 7620fa225cbcSrjs *) dllsearchpath="$dllsearchpath:$testbindir";; 7621fa225cbcSrjs esac 7622fa225cbcSrjs ;; 7623fa225cbcSrjs esac 7624fa225cbcSrjs done 7625fa225cbcSrjs # Substitute the hardcoded libdirs into the rpath. 7626fa225cbcSrjs if test -n "$hardcode_libdir_separator" && 7627fa225cbcSrjs test -n "$hardcode_libdirs"; then 7628fa225cbcSrjs libdir="$hardcode_libdirs" 7629fa225cbcSrjs eval rpath=\" $hardcode_libdir_flag_spec\" 7630fa225cbcSrjs fi 7631fa225cbcSrjs compile_rpath="$rpath" 7632fa225cbcSrjs 7633fa225cbcSrjs rpath= 7634fa225cbcSrjs hardcode_libdirs= 7635fa225cbcSrjs for libdir in $finalize_rpath; do 7636fa225cbcSrjs if test -n "$hardcode_libdir_flag_spec"; then 7637fa225cbcSrjs if test -n "$hardcode_libdir_separator"; then 7638fa225cbcSrjs if test -z "$hardcode_libdirs"; then 7639fa225cbcSrjs hardcode_libdirs="$libdir" 7640fa225cbcSrjs else 7641fa225cbcSrjs # Just accumulate the unique libdirs. 7642fa225cbcSrjs case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 7643fa225cbcSrjs *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 7644fa225cbcSrjs ;; 7645fa225cbcSrjs *) 7646fa225cbcSrjs hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 7647fa225cbcSrjs ;; 7648fa225cbcSrjs esac 7649fa225cbcSrjs fi 7650fa225cbcSrjs else 7651fa225cbcSrjs eval flag=\"$hardcode_libdir_flag_spec\" 7652fa225cbcSrjs rpath="$rpath $flag" 7653fa225cbcSrjs fi 7654fa225cbcSrjs elif test -n "$runpath_var"; then 7655fa225cbcSrjs case "$finalize_perm_rpath " in 7656fa225cbcSrjs *" $libdir "*) ;; 7657fa225cbcSrjs *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 7658fa225cbcSrjs esac 7659fa225cbcSrjs fi 7660fa225cbcSrjs done 7661fa225cbcSrjs # Substitute the hardcoded libdirs into the rpath. 7662fa225cbcSrjs if test -n "$hardcode_libdir_separator" && 7663fa225cbcSrjs test -n "$hardcode_libdirs"; then 7664fa225cbcSrjs libdir="$hardcode_libdirs" 7665fa225cbcSrjs eval rpath=\" $hardcode_libdir_flag_spec\" 7666fa225cbcSrjs fi 7667fa225cbcSrjs finalize_rpath="$rpath" 7668fa225cbcSrjs 7669fa225cbcSrjs if test -n "$libobjs" && test "$build_old_libs" = yes; then 7670fa225cbcSrjs # Transform all the library objects into standard objects. 7671fa225cbcSrjs compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 7672fa225cbcSrjs finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 7673fa225cbcSrjs fi 7674fa225cbcSrjs 7675fa225cbcSrjs func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 7676fa225cbcSrjs 7677fa225cbcSrjs # template prelinking step 7678fa225cbcSrjs if test -n "$prelink_cmds"; then 7679fa225cbcSrjs func_execute_cmds "$prelink_cmds" 'exit $?' 7680fa225cbcSrjs fi 7681fa225cbcSrjs 7682fa225cbcSrjs wrappers_required=yes 7683fa225cbcSrjs case $host in 7684fa225cbcSrjs *cygwin* | *mingw* ) 7685fa225cbcSrjs if test "$build_libtool_libs" != yes; then 7686fa225cbcSrjs wrappers_required=no 7687fa225cbcSrjs fi 7688fa225cbcSrjs ;; 7689fa225cbcSrjs *cegcc) 7690fa225cbcSrjs # Disable wrappers for cegcc, we are cross compiling anyway. 7691fa225cbcSrjs wrappers_required=no 7692fa225cbcSrjs ;; 7693fa225cbcSrjs *) 7694fa225cbcSrjs if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 7695fa225cbcSrjs wrappers_required=no 7696fa225cbcSrjs fi 7697fa225cbcSrjs ;; 7698fa225cbcSrjs esac 7699fa225cbcSrjs if test "$wrappers_required" = no; then 7700fa225cbcSrjs # Replace the output file specification. 7701fa225cbcSrjs compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 7702fa225cbcSrjs link_command="$compile_command$compile_rpath" 7703fa225cbcSrjs 7704fa225cbcSrjs # We have no uninstalled library dependencies, so finalize right now. 7705fa225cbcSrjs exit_status=0 7706fa225cbcSrjs func_show_eval "$link_command" 'exit_status=$?' 7707fa225cbcSrjs 7708fa225cbcSrjs # Delete the generated files. 7709fa225cbcSrjs if test -f "$output_objdir/${outputname}S.${objext}"; then 7710fa225cbcSrjs func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 7711fa225cbcSrjs fi 7712fa225cbcSrjs 7713fa225cbcSrjs exit $exit_status 7714fa225cbcSrjs fi 7715fa225cbcSrjs 7716fa225cbcSrjs if test -n "$compile_shlibpath$finalize_shlibpath"; then 7717fa225cbcSrjs compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 7718fa225cbcSrjs fi 7719fa225cbcSrjs if test -n "$finalize_shlibpath"; then 7720fa225cbcSrjs finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 7721fa225cbcSrjs fi 7722fa225cbcSrjs 7723fa225cbcSrjs compile_var= 7724fa225cbcSrjs finalize_var= 7725fa225cbcSrjs if test -n "$runpath_var"; then 7726fa225cbcSrjs if test -n "$perm_rpath"; then 7727fa225cbcSrjs # We should set the runpath_var. 7728fa225cbcSrjs rpath= 7729fa225cbcSrjs for dir in $perm_rpath; do 7730fa225cbcSrjs rpath="$rpath$dir:" 7731fa225cbcSrjs done 7732fa225cbcSrjs compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 7733fa225cbcSrjs fi 7734fa225cbcSrjs if test -n "$finalize_perm_rpath"; then 7735fa225cbcSrjs # We should set the runpath_var. 7736fa225cbcSrjs rpath= 7737fa225cbcSrjs for dir in $finalize_perm_rpath; do 7738fa225cbcSrjs rpath="$rpath$dir:" 7739fa225cbcSrjs done 7740fa225cbcSrjs finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 7741fa225cbcSrjs fi 7742fa225cbcSrjs fi 7743fa225cbcSrjs 7744fa225cbcSrjs if test "$no_install" = yes; then 7745fa225cbcSrjs # We don't need to create a wrapper script. 7746fa225cbcSrjs link_command="$compile_var$compile_command$compile_rpath" 7747fa225cbcSrjs # Replace the output file specification. 7748fa225cbcSrjs link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 7749fa225cbcSrjs # Delete the old output file. 7750fa225cbcSrjs $opt_dry_run || $RM $output 7751fa225cbcSrjs # Link the executable and exit 7752fa225cbcSrjs func_show_eval "$link_command" 'exit $?' 7753fa225cbcSrjs exit $EXIT_SUCCESS 7754fa225cbcSrjs fi 7755fa225cbcSrjs 7756fa225cbcSrjs if test "$hardcode_action" = relink; then 7757fa225cbcSrjs # Fast installation is not supported 7758fa225cbcSrjs link_command="$compile_var$compile_command$compile_rpath" 7759fa225cbcSrjs relink_command="$finalize_var$finalize_command$finalize_rpath" 7760fa225cbcSrjs 7761fa225cbcSrjs func_warning "this platform does not like uninstalled shared libraries" 7762fa225cbcSrjs func_warning "\`$output' will be relinked during installation" 7763fa225cbcSrjs else 7764fa225cbcSrjs if test "$fast_install" != no; then 7765fa225cbcSrjs link_command="$finalize_var$compile_command$finalize_rpath" 7766fa225cbcSrjs if test "$fast_install" = yes; then 7767fa225cbcSrjs relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 7768fa225cbcSrjs else 7769fa225cbcSrjs # fast_install is set to needless 7770fa225cbcSrjs relink_command= 7771fa225cbcSrjs fi 7772fa225cbcSrjs else 7773fa225cbcSrjs link_command="$compile_var$compile_command$compile_rpath" 7774fa225cbcSrjs relink_command="$finalize_var$finalize_command$finalize_rpath" 7775fa225cbcSrjs fi 7776fa225cbcSrjs fi 7777fa225cbcSrjs 7778fa225cbcSrjs # Replace the output file specification. 7779fa225cbcSrjs link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 7780fa225cbcSrjs 7781fa225cbcSrjs # Delete the old output files. 7782fa225cbcSrjs $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 7783fa225cbcSrjs 7784fa225cbcSrjs func_show_eval "$link_command" 'exit $?' 7785fa225cbcSrjs 7786fa225cbcSrjs # Now create the wrapper script. 7787fa225cbcSrjs func_verbose "creating $output" 7788fa225cbcSrjs 7789fa225cbcSrjs # Quote the relink command for shipping. 7790fa225cbcSrjs if test -n "$relink_command"; then 7791fa225cbcSrjs # Preserve any variables that may affect compiler behavior 7792fa225cbcSrjs for var in $variables_saved_for_relink; do 7793fa225cbcSrjs if eval test -z \"\${$var+set}\"; then 7794fa225cbcSrjs relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 7795fa225cbcSrjs elif eval var_value=\$$var; test -z "$var_value"; then 7796fa225cbcSrjs relink_command="$var=; export $var; $relink_command" 7797fa225cbcSrjs else 7798fa225cbcSrjs func_quote_for_eval "$var_value" 7799fa225cbcSrjs relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 7800fa225cbcSrjs fi 7801fa225cbcSrjs done 7802fa225cbcSrjs relink_command="(cd `pwd`; $relink_command)" 7803fa225cbcSrjs relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 7804fa225cbcSrjs fi 7805fa225cbcSrjs 7806fa225cbcSrjs # Quote $ECHO for shipping. 7807fa225cbcSrjs if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then 7808fa225cbcSrjs case $progpath in 7809fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 7810fa225cbcSrjs *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 7811fa225cbcSrjs esac 7812fa225cbcSrjs qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` 7813fa225cbcSrjs else 7814fa225cbcSrjs qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` 7815fa225cbcSrjs fi 7816fa225cbcSrjs 7817fa225cbcSrjs # Only actually do things if not in dry run mode. 7818fa225cbcSrjs $opt_dry_run || { 7819fa225cbcSrjs # win32 will think the script is a binary if it has 7820fa225cbcSrjs # a .exe suffix, so we strip it off here. 7821fa225cbcSrjs case $output in 7822fa225cbcSrjs *.exe) func_stripname '' '.exe' "$output" 7823fa225cbcSrjs output=$func_stripname_result ;; 7824fa225cbcSrjs esac 7825fa225cbcSrjs # test for cygwin because mv fails w/o .exe extensions 7826fa225cbcSrjs case $host in 7827fa225cbcSrjs *cygwin*) 7828fa225cbcSrjs exeext=.exe 7829fa225cbcSrjs func_stripname '' '.exe' "$outputname" 7830fa225cbcSrjs outputname=$func_stripname_result ;; 7831fa225cbcSrjs *) exeext= ;; 7832fa225cbcSrjs esac 7833fa225cbcSrjs case $host in 7834fa225cbcSrjs *cygwin* | *mingw* ) 7835fa225cbcSrjs func_dirname_and_basename "$output" "" "." 7836fa225cbcSrjs output_name=$func_basename_result 7837fa225cbcSrjs output_path=$func_dirname_result 7838fa225cbcSrjs cwrappersource="$output_path/$objdir/lt-$output_name.c" 7839fa225cbcSrjs cwrapper="$output_path/$output_name.exe" 7840fa225cbcSrjs $RM $cwrappersource $cwrapper 7841fa225cbcSrjs trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 7842fa225cbcSrjs 7843fa225cbcSrjs func_emit_cwrapperexe_src > $cwrappersource 7844fa225cbcSrjs 7845fa225cbcSrjs # The wrapper executable is built using the $host compiler, 7846fa225cbcSrjs # because it contains $host paths and files. If cross- 7847fa225cbcSrjs # compiling, it, like the target executable, must be 7848fa225cbcSrjs # executed on the $host or under an emulation environment. 7849fa225cbcSrjs $opt_dry_run || { 7850fa225cbcSrjs $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 7851fa225cbcSrjs $STRIP $cwrapper 7852fa225cbcSrjs } 7853fa225cbcSrjs 7854fa225cbcSrjs # Now, create the wrapper script for func_source use: 7855fa225cbcSrjs func_ltwrapper_scriptname $cwrapper 7856fa225cbcSrjs $RM $func_ltwrapper_scriptname_result 7857fa225cbcSrjs trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 7858fa225cbcSrjs $opt_dry_run || { 7859fa225cbcSrjs # note: this script will not be executed, so do not chmod. 7860fa225cbcSrjs if test "x$build" = "x$host" ; then 7861fa225cbcSrjs $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 7862fa225cbcSrjs else 7863fa225cbcSrjs func_emit_wrapper no > $func_ltwrapper_scriptname_result 7864fa225cbcSrjs fi 7865fa225cbcSrjs } 7866fa225cbcSrjs ;; 7867fa225cbcSrjs * ) 7868fa225cbcSrjs $RM $output 7869fa225cbcSrjs trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 7870fa225cbcSrjs 7871fa225cbcSrjs func_emit_wrapper no > $output 7872fa225cbcSrjs chmod +x $output 7873fa225cbcSrjs ;; 7874fa225cbcSrjs esac 7875fa225cbcSrjs } 7876fa225cbcSrjs exit $EXIT_SUCCESS 7877fa225cbcSrjs ;; 7878fa225cbcSrjs esac 7879fa225cbcSrjs 7880fa225cbcSrjs # See if we need to build an old-fashioned archive. 7881fa225cbcSrjs for oldlib in $oldlibs; do 7882fa225cbcSrjs 7883fa225cbcSrjs if test "$build_libtool_libs" = convenience; then 7884fa225cbcSrjs oldobjs="$libobjs_save $symfileobj" 7885fa225cbcSrjs addlibs="$convenience" 7886fa225cbcSrjs build_libtool_libs=no 7887fa225cbcSrjs else 7888fa225cbcSrjs if test "$build_libtool_libs" = module; then 7889fa225cbcSrjs oldobjs="$libobjs_save" 7890fa225cbcSrjs build_libtool_libs=no 7891fa225cbcSrjs else 7892fa225cbcSrjs oldobjs="$old_deplibs $non_pic_objects" 7893fa225cbcSrjs if test "$preload" = yes && test -f "$symfileobj"; then 7894fa225cbcSrjs oldobjs="$oldobjs $symfileobj" 7895fa225cbcSrjs fi 7896fa225cbcSrjs fi 7897fa225cbcSrjs addlibs="$old_convenience" 7898fa225cbcSrjs fi 7899fa225cbcSrjs 7900fa225cbcSrjs if test -n "$addlibs"; then 7901fa225cbcSrjs gentop="$output_objdir/${outputname}x" 7902fa225cbcSrjs generated="$generated $gentop" 7903fa225cbcSrjs 7904fa225cbcSrjs func_extract_archives $gentop $addlibs 7905fa225cbcSrjs oldobjs="$oldobjs $func_extract_archives_result" 7906fa225cbcSrjs fi 7907fa225cbcSrjs 7908fa225cbcSrjs # Do each command in the archive commands. 7909fa225cbcSrjs if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 7910fa225cbcSrjs cmds=$old_archive_from_new_cmds 7911fa225cbcSrjs else 7912fa225cbcSrjs 7913fa225cbcSrjs # Add any objects from preloaded convenience libraries 7914fa225cbcSrjs if test -n "$dlprefiles"; then 7915fa225cbcSrjs gentop="$output_objdir/${outputname}x" 7916fa225cbcSrjs generated="$generated $gentop" 7917fa225cbcSrjs 7918fa225cbcSrjs func_extract_archives $gentop $dlprefiles 7919fa225cbcSrjs oldobjs="$oldobjs $func_extract_archives_result" 7920fa225cbcSrjs fi 7921fa225cbcSrjs 7922fa225cbcSrjs # POSIX demands no paths to be encoded in archives. We have 7923fa225cbcSrjs # to avoid creating archives with duplicate basenames if we 7924fa225cbcSrjs # might have to extract them afterwards, e.g., when creating a 7925fa225cbcSrjs # static archive out of a convenience library, or when linking 7926fa225cbcSrjs # the entirety of a libtool archive into another (currently 7927fa225cbcSrjs # not supported by libtool). 7928fa225cbcSrjs if (for obj in $oldobjs 7929fa225cbcSrjs do 7930fa225cbcSrjs func_basename "$obj" 7931fa225cbcSrjs $ECHO "$func_basename_result" 7932fa225cbcSrjs done | sort | sort -uc >/dev/null 2>&1); then 7933fa225cbcSrjs : 7934fa225cbcSrjs else 7935fa225cbcSrjs $ECHO "copying selected object files to avoid basename conflicts..." 7936fa225cbcSrjs gentop="$output_objdir/${outputname}x" 7937fa225cbcSrjs generated="$generated $gentop" 7938fa225cbcSrjs func_mkdir_p "$gentop" 7939fa225cbcSrjs save_oldobjs=$oldobjs 7940fa225cbcSrjs oldobjs= 7941fa225cbcSrjs counter=1 7942fa225cbcSrjs for obj in $save_oldobjs 7943fa225cbcSrjs do 7944fa225cbcSrjs func_basename "$obj" 7945fa225cbcSrjs objbase="$func_basename_result" 7946fa225cbcSrjs case " $oldobjs " in 7947fa225cbcSrjs " ") oldobjs=$obj ;; 7948fa225cbcSrjs *[\ /]"$objbase "*) 7949fa225cbcSrjs while :; do 7950fa225cbcSrjs # Make sure we don't pick an alternate name that also 7951fa225cbcSrjs # overlaps. 7952fa225cbcSrjs newobj=lt$counter-$objbase 7953fa225cbcSrjs func_arith $counter + 1 7954fa225cbcSrjs counter=$func_arith_result 7955fa225cbcSrjs case " $oldobjs " in 7956fa225cbcSrjs *[\ /]"$newobj "*) ;; 7957fa225cbcSrjs *) if test ! -f "$gentop/$newobj"; then break; fi ;; 7958fa225cbcSrjs esac 7959fa225cbcSrjs done 7960fa225cbcSrjs func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 7961fa225cbcSrjs oldobjs="$oldobjs $gentop/$newobj" 7962fa225cbcSrjs ;; 7963fa225cbcSrjs *) oldobjs="$oldobjs $obj" ;; 7964fa225cbcSrjs esac 7965fa225cbcSrjs done 7966fa225cbcSrjs fi 7967fa225cbcSrjs eval cmds=\"$old_archive_cmds\" 7968fa225cbcSrjs 7969fa225cbcSrjs func_len " $cmds" 7970fa225cbcSrjs len=$func_len_result 7971fa225cbcSrjs if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 7972fa225cbcSrjs cmds=$old_archive_cmds 7973fa225cbcSrjs else 7974fa225cbcSrjs # the command line is too long to link in one step, link in parts 7975fa225cbcSrjs func_verbose "using piecewise archive linking..." 7976fa225cbcSrjs save_RANLIB=$RANLIB 7977fa225cbcSrjs RANLIB=: 7978fa225cbcSrjs objlist= 7979fa225cbcSrjs concat_cmds= 7980fa225cbcSrjs save_oldobjs=$oldobjs 7981fa225cbcSrjs oldobjs= 7982fa225cbcSrjs # Is there a better way of finding the last object in the list? 7983fa225cbcSrjs for obj in $save_oldobjs 7984fa225cbcSrjs do 7985fa225cbcSrjs last_oldobj=$obj 7986fa225cbcSrjs done 7987fa225cbcSrjs eval test_cmds=\"$old_archive_cmds\" 7988fa225cbcSrjs func_len " $test_cmds" 7989fa225cbcSrjs len0=$func_len_result 7990fa225cbcSrjs len=$len0 7991fa225cbcSrjs for obj in $save_oldobjs 7992fa225cbcSrjs do 7993fa225cbcSrjs func_len " $obj" 7994fa225cbcSrjs func_arith $len + $func_len_result 7995fa225cbcSrjs len=$func_arith_result 7996fa225cbcSrjs func_append objlist " $obj" 7997fa225cbcSrjs if test "$len" -lt "$max_cmd_len"; then 7998fa225cbcSrjs : 7999fa225cbcSrjs else 8000fa225cbcSrjs # the above command should be used before it gets too long 8001fa225cbcSrjs oldobjs=$objlist 8002fa225cbcSrjs if test "$obj" = "$last_oldobj" ; then 8003fa225cbcSrjs RANLIB=$save_RANLIB 8004fa225cbcSrjs fi 8005fa225cbcSrjs test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8006fa225cbcSrjs eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 8007fa225cbcSrjs objlist= 8008fa225cbcSrjs len=$len0 8009fa225cbcSrjs fi 8010fa225cbcSrjs done 8011fa225cbcSrjs RANLIB=$save_RANLIB 8012fa225cbcSrjs oldobjs=$objlist 8013fa225cbcSrjs if test "X$oldobjs" = "X" ; then 8014fa225cbcSrjs eval cmds=\"\$concat_cmds\" 8015fa225cbcSrjs else 8016fa225cbcSrjs eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 8017fa225cbcSrjs fi 8018fa225cbcSrjs fi 8019fa225cbcSrjs fi 8020fa225cbcSrjs func_execute_cmds "$cmds" 'exit $?' 8021fa225cbcSrjs done 8022fa225cbcSrjs 8023fa225cbcSrjs test -n "$generated" && \ 8024fa225cbcSrjs func_show_eval "${RM}r$generated" 8025fa225cbcSrjs 8026fa225cbcSrjs # Now create the libtool archive. 8027fa225cbcSrjs case $output in 8028fa225cbcSrjs *.la) 8029fa225cbcSrjs old_library= 8030fa225cbcSrjs test "$build_old_libs" = yes && old_library="$libname.$libext" 8031fa225cbcSrjs func_verbose "creating $output" 8032fa225cbcSrjs 8033fa225cbcSrjs # Preserve any variables that may affect compiler behavior 8034fa225cbcSrjs for var in $variables_saved_for_relink; do 8035fa225cbcSrjs if eval test -z \"\${$var+set}\"; then 8036fa225cbcSrjs relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 8037fa225cbcSrjs elif eval var_value=\$$var; test -z "$var_value"; then 8038fa225cbcSrjs relink_command="$var=; export $var; $relink_command" 8039fa225cbcSrjs else 8040fa225cbcSrjs func_quote_for_eval "$var_value" 8041fa225cbcSrjs relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8042fa225cbcSrjs fi 8043fa225cbcSrjs done 8044fa225cbcSrjs # Quote the link command for shipping. 8045fa225cbcSrjs relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 8046fa225cbcSrjs relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 8047fa225cbcSrjs if test "$hardcode_automatic" = yes ; then 8048fa225cbcSrjs relink_command= 8049fa225cbcSrjs fi 8050fa225cbcSrjs 8051fa225cbcSrjs # Only create the output if not a dry run. 8052fa225cbcSrjs $opt_dry_run || { 8053fa225cbcSrjs for installed in no yes; do 8054fa225cbcSrjs if test "$installed" = yes; then 8055fa225cbcSrjs if test -z "$install_libdir"; then 8056fa225cbcSrjs break 8057fa225cbcSrjs fi 8058fa225cbcSrjs output="$output_objdir/$outputname"i 8059fa225cbcSrjs # Replace all uninstalled libtool libraries with the installed ones 8060fa225cbcSrjs newdependency_libs= 8061fa225cbcSrjs for deplib in $dependency_libs; do 8062fa225cbcSrjs case $deplib in 8063fa225cbcSrjs *.la) 8064fa225cbcSrjs func_basename "$deplib" 8065fa225cbcSrjs name="$func_basename_result" 8066fa225cbcSrjs eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 8067fa225cbcSrjs test -z "$libdir" && \ 8068fa225cbcSrjs func_fatal_error "\`$deplib' is not a valid libtool archive" 8069fa225cbcSrjs newdependency_libs="$newdependency_libs $libdir/$name" 8070fa225cbcSrjs ;; 8071fa225cbcSrjs *) newdependency_libs="$newdependency_libs $deplib" ;; 8072fa225cbcSrjs esac 8073fa225cbcSrjs done 8074fa225cbcSrjs dependency_libs="$newdependency_libs" 8075fa225cbcSrjs newdlfiles= 8076fa225cbcSrjs 8077fa225cbcSrjs for lib in $dlfiles; do 8078fa225cbcSrjs case $lib in 8079fa225cbcSrjs *.la) 8080fa225cbcSrjs func_basename "$lib" 8081fa225cbcSrjs name="$func_basename_result" 8082fa225cbcSrjs eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 8083fa225cbcSrjs test -z "$libdir" && \ 8084fa225cbcSrjs func_fatal_error "\`$lib' is not a valid libtool archive" 8085fa225cbcSrjs newdlfiles="$newdlfiles $libdir/$name" 8086fa225cbcSrjs ;; 8087fa225cbcSrjs *) newdlfiles="$newdlfiles $lib" ;; 8088fa225cbcSrjs esac 8089fa225cbcSrjs done 8090fa225cbcSrjs dlfiles="$newdlfiles" 8091fa225cbcSrjs newdlprefiles= 8092fa225cbcSrjs for lib in $dlprefiles; do 8093fa225cbcSrjs case $lib in 8094fa225cbcSrjs *.la) 8095fa225cbcSrjs # Only pass preopened files to the pseudo-archive (for 8096fa225cbcSrjs # eventual linking with the app. that links it) if we 8097fa225cbcSrjs # didn't already link the preopened objects directly into 8098fa225cbcSrjs # the library: 8099fa225cbcSrjs func_basename "$lib" 8100fa225cbcSrjs name="$func_basename_result" 8101fa225cbcSrjs eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 8102fa225cbcSrjs test -z "$libdir" && \ 8103fa225cbcSrjs func_fatal_error "\`$lib' is not a valid libtool archive" 8104fa225cbcSrjs newdlprefiles="$newdlprefiles $libdir/$name" 8105fa225cbcSrjs ;; 8106fa225cbcSrjs esac 8107fa225cbcSrjs done 8108fa225cbcSrjs dlprefiles="$newdlprefiles" 8109fa225cbcSrjs else 8110fa225cbcSrjs newdlfiles= 8111fa225cbcSrjs for lib in $dlfiles; do 8112fa225cbcSrjs case $lib in 8113fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 8114fa225cbcSrjs *) abs=`pwd`"/$lib" ;; 8115fa225cbcSrjs esac 8116fa225cbcSrjs newdlfiles="$newdlfiles $abs" 8117fa225cbcSrjs done 8118fa225cbcSrjs dlfiles="$newdlfiles" 8119fa225cbcSrjs newdlprefiles= 8120fa225cbcSrjs for lib in $dlprefiles; do 8121fa225cbcSrjs case $lib in 8122fa225cbcSrjs [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 8123fa225cbcSrjs *) abs=`pwd`"/$lib" ;; 8124fa225cbcSrjs esac 8125fa225cbcSrjs newdlprefiles="$newdlprefiles $abs" 8126fa225cbcSrjs done 8127fa225cbcSrjs dlprefiles="$newdlprefiles" 8128fa225cbcSrjs fi 8129fa225cbcSrjs $RM $output 8130fa225cbcSrjs # place dlname in correct position for cygwin 8131fa225cbcSrjs tdlname=$dlname 8132fa225cbcSrjs case $host,$output,$installed,$module,$dlname in 8133fa225cbcSrjs *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 8134fa225cbcSrjs esac 8135fa225cbcSrjs $ECHO > $output "\ 8136fa225cbcSrjs# $outputname - a libtool library file 8137fa225cbcSrjs# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 8138fa225cbcSrjs# 8139fa225cbcSrjs# Please DO NOT delete this file! 8140fa225cbcSrjs# It is necessary for linking the library. 8141fa225cbcSrjs 8142fa225cbcSrjs# The name that we can dlopen(3). 8143fa225cbcSrjsdlname='$tdlname' 8144fa225cbcSrjs 8145fa225cbcSrjs# Names of this library. 8146fa225cbcSrjslibrary_names='$library_names' 8147fa225cbcSrjs 8148fa225cbcSrjs# The name of the static archive. 8149fa225cbcSrjsold_library='$old_library' 8150fa225cbcSrjs 8151fa225cbcSrjs# Linker flags that can not go in dependency_libs. 8152fa225cbcSrjsinherited_linker_flags='$new_inherited_linker_flags' 8153fa225cbcSrjs 8154fa225cbcSrjs# Libraries that this one depends upon. 8155fa225cbcSrjsdependency_libs='$dependency_libs' 8156fa225cbcSrjs 8157fa225cbcSrjs# Names of additional weak libraries provided by this library 8158fa225cbcSrjsweak_library_names='$weak_libs' 8159fa225cbcSrjs 8160fa225cbcSrjs# Version information for $libname. 8161fa225cbcSrjscurrent=$current 8162fa225cbcSrjsage=$age 8163fa225cbcSrjsrevision=$revision 8164fa225cbcSrjs 8165fa225cbcSrjs# Is this an already installed library? 8166fa225cbcSrjsinstalled=$installed 8167fa225cbcSrjs 8168fa225cbcSrjs# Should we warn about portability when linking against -modules? 8169fa225cbcSrjsshouldnotlink=$module 8170fa225cbcSrjs 8171fa225cbcSrjs# Files to dlopen/dlpreopen 8172fa225cbcSrjsdlopen='$dlfiles' 8173fa225cbcSrjsdlpreopen='$dlprefiles' 8174fa225cbcSrjs 8175fa225cbcSrjs# Directory that this library needs to be installed in: 8176fa225cbcSrjslibdir='$install_libdir'" 8177fa225cbcSrjs if test "$installed" = no && test "$need_relink" = yes; then 8178fa225cbcSrjs $ECHO >> $output "\ 8179fa225cbcSrjsrelink_command=\"$relink_command\"" 8180fa225cbcSrjs fi 8181fa225cbcSrjs done 8182fa225cbcSrjs } 8183fa225cbcSrjs 8184fa225cbcSrjs # Do a symbolic link so that the libtool archive can be found in 8185fa225cbcSrjs # LD_LIBRARY_PATH before the program is installed. 8186fa225cbcSrjs func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 8187fa225cbcSrjs ;; 8188fa225cbcSrjs esac 8189fa225cbcSrjs exit $EXIT_SUCCESS 8190fa225cbcSrjs} 8191fa225cbcSrjs 8192fa225cbcSrjs{ test "$mode" = link || test "$mode" = relink; } && 8193fa225cbcSrjs func_mode_link ${1+"$@"} 8194fa225cbcSrjs 8195fa225cbcSrjs 8196fa225cbcSrjs# func_mode_uninstall arg... 8197fa225cbcSrjsfunc_mode_uninstall () 8198fa225cbcSrjs{ 8199fa225cbcSrjs $opt_debug 8200fa225cbcSrjs RM="$nonopt" 8201fa225cbcSrjs files= 8202fa225cbcSrjs rmforce= 8203fa225cbcSrjs exit_status=0 8204fa225cbcSrjs 8205fa225cbcSrjs # This variable tells wrapper scripts just to set variables rather 8206fa225cbcSrjs # than running their programs. 8207fa225cbcSrjs libtool_install_magic="$magic" 8208fa225cbcSrjs 8209fa225cbcSrjs for arg 8210fa225cbcSrjs do 8211fa225cbcSrjs case $arg in 8212fa225cbcSrjs -f) RM="$RM $arg"; rmforce=yes ;; 8213fa225cbcSrjs -*) RM="$RM $arg" ;; 8214fa225cbcSrjs *) files="$files $arg" ;; 8215fa225cbcSrjs esac 8216fa225cbcSrjs done 8217fa225cbcSrjs 8218fa225cbcSrjs test -z "$RM" && \ 8219fa225cbcSrjs func_fatal_help "you must specify an RM program" 8220fa225cbcSrjs 8221fa225cbcSrjs rmdirs= 8222fa225cbcSrjs 8223fa225cbcSrjs origobjdir="$objdir" 8224fa225cbcSrjs for file in $files; do 8225fa225cbcSrjs func_dirname "$file" "" "." 8226fa225cbcSrjs dir="$func_dirname_result" 8227fa225cbcSrjs if test "X$dir" = X.; then 8228fa225cbcSrjs objdir="$origobjdir" 8229fa225cbcSrjs else 8230fa225cbcSrjs objdir="$dir/$origobjdir" 8231fa225cbcSrjs fi 8232fa225cbcSrjs func_basename "$file" 8233fa225cbcSrjs name="$func_basename_result" 8234fa225cbcSrjs test "$mode" = uninstall && objdir="$dir" 8235fa225cbcSrjs 8236fa225cbcSrjs # Remember objdir for removal later, being careful to avoid duplicates 8237fa225cbcSrjs if test "$mode" = clean; then 8238fa225cbcSrjs case " $rmdirs " in 8239fa225cbcSrjs *" $objdir "*) ;; 8240fa225cbcSrjs *) rmdirs="$rmdirs $objdir" ;; 8241fa225cbcSrjs esac 8242fa225cbcSrjs fi 8243fa225cbcSrjs 8244fa225cbcSrjs # Don't error if the file doesn't exist and rm -f was used. 8245fa225cbcSrjs if { test -L "$file"; } >/dev/null 2>&1 || 8246fa225cbcSrjs { test -h "$file"; } >/dev/null 2>&1 || 8247fa225cbcSrjs test -f "$file"; then 8248fa225cbcSrjs : 8249fa225cbcSrjs elif test -d "$file"; then 8250fa225cbcSrjs exit_status=1 8251fa225cbcSrjs continue 8252fa225cbcSrjs elif test "$rmforce" = yes; then 8253fa225cbcSrjs continue 8254fa225cbcSrjs fi 8255fa225cbcSrjs 8256fa225cbcSrjs rmfiles="$file" 8257fa225cbcSrjs 8258fa225cbcSrjs case $name in 8259fa225cbcSrjs *.la) 8260fa225cbcSrjs # Possibly a libtool archive, so verify it. 8261fa225cbcSrjs if func_lalib_p "$file"; then 8262fa225cbcSrjs func_source $dir/$name 8263fa225cbcSrjs 8264fa225cbcSrjs # Delete the libtool libraries and symlinks. 8265fa225cbcSrjs for n in $library_names; do 8266fa225cbcSrjs rmfiles="$rmfiles $objdir/$n" 8267fa225cbcSrjs done 8268fa225cbcSrjs test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 8269fa225cbcSrjs 8270fa225cbcSrjs case "$mode" in 8271fa225cbcSrjs clean) 8272fa225cbcSrjs case " $library_names " in 8273fa225cbcSrjs # " " in the beginning catches empty $dlname 8274fa225cbcSrjs *" $dlname "*) ;; 8275fa225cbcSrjs *) rmfiles="$rmfiles $objdir/$dlname" ;; 8276fa225cbcSrjs esac 8277fa225cbcSrjs test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 8278fa225cbcSrjs ;; 8279fa225cbcSrjs uninstall) 8280fa225cbcSrjs if test -n "$library_names"; then 8281fa225cbcSrjs # Do each command in the postuninstall commands. 8282fa225cbcSrjs func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8283fa225cbcSrjs fi 8284fa225cbcSrjs 8285fa225cbcSrjs if test -n "$old_library"; then 8286fa225cbcSrjs # Do each command in the old_postuninstall commands. 8287fa225cbcSrjs func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 8288fa225cbcSrjs fi 8289fa225cbcSrjs # FIXME: should reinstall the best remaining shared library. 8290fa225cbcSrjs ;; 8291fa225cbcSrjs esac 8292fa225cbcSrjs fi 8293fa225cbcSrjs ;; 8294fa225cbcSrjs 8295fa225cbcSrjs *.lo) 8296fa225cbcSrjs # Possibly a libtool object, so verify it. 8297fa225cbcSrjs if func_lalib_p "$file"; then 8298fa225cbcSrjs 8299fa225cbcSrjs # Read the .lo file 8300fa225cbcSrjs func_source $dir/$name 8301fa225cbcSrjs 8302fa225cbcSrjs # Add PIC object to the list of files to remove. 8303fa225cbcSrjs if test -n "$pic_object" && 8304fa225cbcSrjs test "$pic_object" != none; then 8305fa225cbcSrjs rmfiles="$rmfiles $dir/$pic_object" 8306fa225cbcSrjs fi 8307fa225cbcSrjs 8308fa225cbcSrjs # Add non-PIC object to the list of files to remove. 8309fa225cbcSrjs if test -n "$non_pic_object" && 8310fa225cbcSrjs test "$non_pic_object" != none; then 8311fa225cbcSrjs rmfiles="$rmfiles $dir/$non_pic_object" 8312fa225cbcSrjs fi 8313fa225cbcSrjs fi 8314fa225cbcSrjs ;; 8315fa225cbcSrjs 8316fa225cbcSrjs *) 8317fa225cbcSrjs if test "$mode" = clean ; then 8318fa225cbcSrjs noexename=$name 8319fa225cbcSrjs case $file in 8320fa225cbcSrjs *.exe) 8321fa225cbcSrjs func_stripname '' '.exe' "$file" 8322fa225cbcSrjs file=$func_stripname_result 8323fa225cbcSrjs func_stripname '' '.exe' "$name" 8324fa225cbcSrjs noexename=$func_stripname_result 8325fa225cbcSrjs # $file with .exe has already been added to rmfiles, 8326fa225cbcSrjs # add $file without .exe 8327fa225cbcSrjs rmfiles="$rmfiles $file" 8328fa225cbcSrjs ;; 8329fa225cbcSrjs esac 8330fa225cbcSrjs # Do a test to see if this is a libtool program. 8331fa225cbcSrjs if func_ltwrapper_p "$file"; then 8332fa225cbcSrjs if func_ltwrapper_executable_p "$file"; then 8333fa225cbcSrjs func_ltwrapper_scriptname "$file" 8334fa225cbcSrjs relink_command= 8335fa225cbcSrjs func_source $func_ltwrapper_scriptname_result 8336fa225cbcSrjs rmfiles="$rmfiles $func_ltwrapper_scriptname_result" 8337fa225cbcSrjs else 8338fa225cbcSrjs relink_command= 8339fa225cbcSrjs func_source $dir/$noexename 8340fa225cbcSrjs fi 8341fa225cbcSrjs 8342fa225cbcSrjs # note $name still contains .exe if it was in $file originally 8343fa225cbcSrjs # as does the version of $file that was added into $rmfiles 8344fa225cbcSrjs rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 8345fa225cbcSrjs if test "$fast_install" = yes && test -n "$relink_command"; then 8346fa225cbcSrjs rmfiles="$rmfiles $objdir/lt-$name" 8347fa225cbcSrjs fi 8348fa225cbcSrjs if test "X$noexename" != "X$name" ; then 8349fa225cbcSrjs rmfiles="$rmfiles $objdir/lt-${noexename}.c" 8350fa225cbcSrjs fi 8351fa225cbcSrjs fi 8352fa225cbcSrjs fi 8353fa225cbcSrjs ;; 8354fa225cbcSrjs esac 8355fa225cbcSrjs func_show_eval "$RM $rmfiles" 'exit_status=1' 8356fa225cbcSrjs done 8357fa225cbcSrjs objdir="$origobjdir" 8358fa225cbcSrjs 8359fa225cbcSrjs # Try to remove the ${objdir}s in the directories where we deleted files 8360fa225cbcSrjs for dir in $rmdirs; do 8361fa225cbcSrjs if test -d "$dir"; then 8362fa225cbcSrjs func_show_eval "rmdir $dir >/dev/null 2>&1" 8363fa225cbcSrjs fi 8364fa225cbcSrjs done 8365fa225cbcSrjs 8366fa225cbcSrjs exit $exit_status 8367fa225cbcSrjs} 8368fa225cbcSrjs 8369fa225cbcSrjs{ test "$mode" = uninstall || test "$mode" = clean; } && 8370fa225cbcSrjs func_mode_uninstall ${1+"$@"} 8371fa225cbcSrjs 8372fa225cbcSrjstest -z "$mode" && { 8373fa225cbcSrjs help="$generic_help" 8374fa225cbcSrjs func_fatal_help "you must specify a MODE" 8375fa225cbcSrjs} 8376fa225cbcSrjs 8377fa225cbcSrjstest -z "$exec_cmd" && \ 8378fa225cbcSrjs func_fatal_help "invalid operation mode \`$mode'" 8379fa225cbcSrjs 8380fa225cbcSrjsif test -n "$exec_cmd"; then 8381fa225cbcSrjs eval exec "$exec_cmd" 8382fa225cbcSrjs exit $EXIT_FAILURE 8383fa225cbcSrjsfi 8384fa225cbcSrjs 8385fa225cbcSrjsexit $exit_status 8386fa225cbcSrjs 8387fa225cbcSrjs 8388fa225cbcSrjs# The TAGs below are defined such that we never get into a situation 8389fa225cbcSrjs# in which we disable both kinds of libraries. Given conflicting 8390fa225cbcSrjs# choices, we go for a static library, that is the most portable, 8391fa225cbcSrjs# since we can't tell whether shared libraries were disabled because 8392fa225cbcSrjs# the user asked for that or because the platform doesn't support 8393fa225cbcSrjs# them. This is particularly important on AIX, because we don't 8394fa225cbcSrjs# support having both static and shared libraries enabled at the same 8395fa225cbcSrjs# time on that platform, so we default to a shared-only configuration. 8396fa225cbcSrjs# If a disable-shared tag is given, we'll fallback to a static-only 8397fa225cbcSrjs# configuration. But we'll never go from static-only to shared-only. 8398fa225cbcSrjs 8399fa225cbcSrjs# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 8400fa225cbcSrjsbuild_libtool_libs=no 8401fa225cbcSrjsbuild_old_libs=yes 8402fa225cbcSrjs# ### END LIBTOOL TAG CONFIG: disable-shared 8403fa225cbcSrjs 8404fa225cbcSrjs# ### BEGIN LIBTOOL TAG CONFIG: disable-static 8405fa225cbcSrjsbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 8406fa225cbcSrjs# ### END LIBTOOL TAG CONFIG: disable-static 8407fa225cbcSrjs 8408fa225cbcSrjs# Local Variables: 8409fa225cbcSrjs# mode:shell-script 8410fa225cbcSrjs# sh-indentation:2 8411fa225cbcSrjs# End: 8412fa225cbcSrjs# vi:sw=2 8413fa225cbcSrjs 8414