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