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