ltmain.sh revision 302b15bd
1b85037dbSmrg 2302b15bdSmrg# libtool (GNU libtool) 2.4 3b85037dbSmrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 4b85037dbSmrg 5b85037dbSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 6b85037dbSmrg# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 7b85037dbSmrg# This is free software; see the source for copying conditions. There is NO 8b85037dbSmrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9b85037dbSmrg 10b85037dbSmrg# GNU Libtool is free software; you can redistribute it and/or modify 11b85037dbSmrg# it under the terms of the GNU General Public License as published by 12b85037dbSmrg# the Free Software Foundation; either version 2 of the License, or 13b85037dbSmrg# (at your option) any later version. 14b85037dbSmrg# 15b85037dbSmrg# As a special exception to the GNU General Public License, 16b85037dbSmrg# if you distribute this file as part of a program or library that 17b85037dbSmrg# is built using GNU Libtool, you may include this file under the 18b85037dbSmrg# same distribution terms that you use for the rest of that program. 19b85037dbSmrg# 20b85037dbSmrg# GNU Libtool is distributed in the hope that it will be useful, but 21b85037dbSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of 22b85037dbSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23b85037dbSmrg# General Public License for more details. 24b85037dbSmrg# 25b85037dbSmrg# You should have received a copy of the GNU General Public License 26b85037dbSmrg# along with GNU Libtool; see the file COPYING. If not, a copy 27b85037dbSmrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 28b85037dbSmrg# or obtained by writing to the Free Software Foundation, Inc., 29b85037dbSmrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30b85037dbSmrg 31b85037dbSmrg# Usage: $progname [OPTION]... [MODE-ARG]... 32b85037dbSmrg# 33b85037dbSmrg# Provide generalized library-building support services. 34b85037dbSmrg# 35b85037dbSmrg# --config show all configuration variables 36b85037dbSmrg# --debug enable verbose shell tracing 37b85037dbSmrg# -n, --dry-run display commands without modifying any files 38b85037dbSmrg# --features display basic configuration information and exit 39b85037dbSmrg# --mode=MODE use operation mode MODE 40b85037dbSmrg# --preserve-dup-deps don't remove duplicate dependency libraries 41b85037dbSmrg# --quiet, --silent don't print informational messages 42b85037dbSmrg# --no-quiet, --no-silent 43b85037dbSmrg# print informational messages (default) 44b85037dbSmrg# --tag=TAG use configuration variables from tag TAG 45b85037dbSmrg# -v, --verbose print more informational messages than default 46b85037dbSmrg# --no-verbose don't print the extra informational messages 47b85037dbSmrg# --version print version information 48b85037dbSmrg# -h, --help, --help-all print short, long, or detailed help message 49b85037dbSmrg# 50b85037dbSmrg# MODE must be one of the following: 51b85037dbSmrg# 52b85037dbSmrg# clean remove files from the build directory 53b85037dbSmrg# compile compile a source file into a libtool object 54b85037dbSmrg# execute automatically set library path, then run a program 55b85037dbSmrg# finish complete the installation of libtool libraries 56b85037dbSmrg# install install libraries or executables 57b85037dbSmrg# link create a library or an executable 58b85037dbSmrg# uninstall remove libraries from an installed directory 59b85037dbSmrg# 60b85037dbSmrg# MODE-ARGS vary depending on the MODE. When passed as first option, 61b85037dbSmrg# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 62b85037dbSmrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 63b85037dbSmrg# 64b85037dbSmrg# When reporting a bug, please describe a test case to reproduce it and 65b85037dbSmrg# include the following information: 66b85037dbSmrg# 67b85037dbSmrg# host-triplet: $host 68b85037dbSmrg# shell: $SHELL 69b85037dbSmrg# compiler: $LTCC 70b85037dbSmrg# compiler flags: $LTCFLAGS 71b85037dbSmrg# linker: $LD (gnu? $with_gnu_ld) 72302b15bdSmrg# $progname: (GNU libtool) 2.4 73b85037dbSmrg# automake: $automake_version 74b85037dbSmrg# autoconf: $autoconf_version 75b85037dbSmrg# 76b85037dbSmrg# Report bugs to <bug-libtool@gnu.org>. 77302b15bdSmrg# GNU libtool home page: <http://www.gnu.org/software/libtool/>. 78302b15bdSmrg# General help using GNU software: <http://www.gnu.org/gethelp/>. 79b85037dbSmrg 80b85037dbSmrgPROGRAM=libtool 81b85037dbSmrgPACKAGE=libtool 82302b15bdSmrgVERSION=2.4 83b85037dbSmrgTIMESTAMP="" 84302b15bdSmrgpackage_revision=1.3293 85b85037dbSmrg 86b85037dbSmrg# Be Bourne compatible 87b85037dbSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 88b85037dbSmrg emulate sh 89b85037dbSmrg NULLCMD=: 90b85037dbSmrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 91b85037dbSmrg # is contrary to our usage. Disable this feature. 92b85037dbSmrg alias -g '${1+"$@"}'='"$@"' 93b85037dbSmrg setopt NO_GLOB_SUBST 94b85037dbSmrgelse 95b85037dbSmrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 96b85037dbSmrgfi 97b85037dbSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 98b85037dbSmrgDUALCASE=1; export DUALCASE # for MKS sh 99b85037dbSmrg 100b85037dbSmrg# A function that is used when there is no print builtin or printf. 101b85037dbSmrgfunc_fallback_echo () 102b85037dbSmrg{ 103b85037dbSmrg eval 'cat <<_LTECHO_EOF 104b85037dbSmrg$1 105b85037dbSmrg_LTECHO_EOF' 106b85037dbSmrg} 107b85037dbSmrg 108b85037dbSmrg# NLS nuisances: We save the old values to restore during execute mode. 109b85037dbSmrglt_user_locale= 110b85037dbSmrglt_safe_locale= 111b85037dbSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 112b85037dbSmrgdo 113b85037dbSmrg eval "if test \"\${$lt_var+set}\" = set; then 114b85037dbSmrg save_$lt_var=\$$lt_var 115b85037dbSmrg $lt_var=C 116b85037dbSmrg export $lt_var 117b85037dbSmrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 118b85037dbSmrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 119b85037dbSmrg fi" 120b85037dbSmrgdone 121b85037dbSmrgLC_ALL=C 122b85037dbSmrgLANGUAGE=C 123b85037dbSmrgexport LANGUAGE LC_ALL 124b85037dbSmrg 125b85037dbSmrg$lt_unset CDPATH 126b85037dbSmrg 127b85037dbSmrg 128b85037dbSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 129b85037dbSmrg# is ksh but when the shell is invoked as "sh" and the current value of 130b85037dbSmrg# the _XPG environment variable is not equal to 1 (one), the special 131b85037dbSmrg# positional parameter $0, within a function call, is the name of the 132b85037dbSmrg# function. 133b85037dbSmrgprogpath="$0" 134b85037dbSmrg 135b85037dbSmrg 136b85037dbSmrg 137b85037dbSmrg: ${CP="cp -f"} 138b85037dbSmrgtest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 139b85037dbSmrg: ${EGREP="/bin/grep -E"} 140b85037dbSmrg: ${FGREP="/bin/grep -F"} 141b85037dbSmrg: ${GREP="/bin/grep"} 142b85037dbSmrg: ${LN_S="ln -s"} 143b85037dbSmrg: ${MAKE="make"} 144b85037dbSmrg: ${MKDIR="mkdir"} 145b85037dbSmrg: ${MV="mv -f"} 146b85037dbSmrg: ${RM="rm -f"} 147b85037dbSmrg: ${SED="/bin/sed"} 148b85037dbSmrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 149b85037dbSmrg: ${Xsed="$SED -e 1s/^X//"} 150b85037dbSmrg 151b85037dbSmrg# Global variables: 152b85037dbSmrgEXIT_SUCCESS=0 153b85037dbSmrgEXIT_FAILURE=1 154b85037dbSmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 155b85037dbSmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 156b85037dbSmrg 157b85037dbSmrgexit_status=$EXIT_SUCCESS 158b85037dbSmrg 159b85037dbSmrg# Make sure IFS has a sensible default 160b85037dbSmrglt_nl=' 161b85037dbSmrg' 162b85037dbSmrgIFS=" $lt_nl" 163b85037dbSmrg 164b85037dbSmrgdirname="s,/[^/]*$,," 165b85037dbSmrgbasename="s,^.*/,," 166b85037dbSmrg 167302b15bdSmrg# func_dirname file append nondir_replacement 168302b15bdSmrg# Compute the dirname of FILE. If nonempty, add APPEND to the result, 169302b15bdSmrg# otherwise set result to NONDIR_REPLACEMENT. 170302b15bdSmrgfunc_dirname () 171302b15bdSmrg{ 172302b15bdSmrg func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` 173302b15bdSmrg if test "X$func_dirname_result" = "X${1}"; then 174302b15bdSmrg func_dirname_result="${3}" 175302b15bdSmrg else 176302b15bdSmrg func_dirname_result="$func_dirname_result${2}" 177302b15bdSmrg fi 178302b15bdSmrg} # func_dirname may be replaced by extended shell implementation 179302b15bdSmrg 180302b15bdSmrg 181302b15bdSmrg# func_basename file 182302b15bdSmrgfunc_basename () 183302b15bdSmrg{ 184302b15bdSmrg func_basename_result=`$ECHO "${1}" | $SED "$basename"` 185302b15bdSmrg} # func_basename may be replaced by extended shell implementation 186302b15bdSmrg 187302b15bdSmrg 188b85037dbSmrg# func_dirname_and_basename file append nondir_replacement 189b85037dbSmrg# perform func_basename and func_dirname in a single function 190b85037dbSmrg# call: 191b85037dbSmrg# dirname: Compute the dirname of FILE. If nonempty, 192b85037dbSmrg# add APPEND to the result, otherwise set result 193b85037dbSmrg# to NONDIR_REPLACEMENT. 194b85037dbSmrg# value returned in "$func_dirname_result" 195b85037dbSmrg# basename: Compute filename of FILE. 196b85037dbSmrg# value retuned in "$func_basename_result" 197b85037dbSmrg# Implementation must be kept synchronized with func_dirname 198b85037dbSmrg# and func_basename. For efficiency, we do not delegate to 199b85037dbSmrg# those functions but instead duplicate the functionality here. 200b85037dbSmrgfunc_dirname_and_basename () 201b85037dbSmrg{ 202302b15bdSmrg # Extract subdirectory from the argument. 203302b15bdSmrg func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 204302b15bdSmrg if test "X$func_dirname_result" = "X${1}"; then 205302b15bdSmrg func_dirname_result="${3}" 206302b15bdSmrg else 207302b15bdSmrg func_dirname_result="$func_dirname_result${2}" 208302b15bdSmrg fi 209302b15bdSmrg func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 210302b15bdSmrg} # func_dirname_and_basename may be replaced by extended shell implementation 211302b15bdSmrg 212302b15bdSmrg 213302b15bdSmrg# func_stripname prefix suffix name 214302b15bdSmrg# strip PREFIX and SUFFIX off of NAME. 215302b15bdSmrg# PREFIX and SUFFIX must not contain globbing or regex special 216302b15bdSmrg# characters, hashes, percent signs, but SUFFIX may contain a leading 217302b15bdSmrg# dot (in which case that matches only a dot). 218302b15bdSmrg# func_strip_suffix prefix name 219302b15bdSmrgfunc_stripname () 220302b15bdSmrg{ 221302b15bdSmrg case ${2} in 222302b15bdSmrg .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; 223302b15bdSmrg *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; 224302b15bdSmrg esac 225302b15bdSmrg} # func_stripname may be replaced by extended shell implementation 226b85037dbSmrg 227b85037dbSmrg 228b85037dbSmrg# These SED scripts presuppose an absolute path with a trailing slash. 229b85037dbSmrgpathcar='s,^/\([^/]*\).*$,\1,' 230b85037dbSmrgpathcdr='s,^/[^/]*,,' 231b85037dbSmrgremovedotparts=':dotsl 232b85037dbSmrg s@/\./@/@g 233b85037dbSmrg t dotsl 234b85037dbSmrg s,/\.$,/,' 235b85037dbSmrgcollapseslashes='s@/\{1,\}@/@g' 236b85037dbSmrgfinalslash='s,/*$,/,' 237b85037dbSmrg 238b85037dbSmrg# func_normal_abspath PATH 239b85037dbSmrg# Remove doubled-up and trailing slashes, "." path components, 240b85037dbSmrg# and cancel out any ".." path components in PATH after making 241b85037dbSmrg# it an absolute path. 242b85037dbSmrg# value returned in "$func_normal_abspath_result" 243b85037dbSmrgfunc_normal_abspath () 244b85037dbSmrg{ 245b85037dbSmrg # Start from root dir and reassemble the path. 246b85037dbSmrg func_normal_abspath_result= 247b85037dbSmrg func_normal_abspath_tpath=$1 248b85037dbSmrg func_normal_abspath_altnamespace= 249b85037dbSmrg case $func_normal_abspath_tpath in 250b85037dbSmrg "") 251b85037dbSmrg # Empty path, that just means $cwd. 252b85037dbSmrg func_stripname '' '/' "`pwd`" 253b85037dbSmrg func_normal_abspath_result=$func_stripname_result 254b85037dbSmrg return 255b85037dbSmrg ;; 256b85037dbSmrg # The next three entries are used to spot a run of precisely 257b85037dbSmrg # two leading slashes without using negated character classes; 258b85037dbSmrg # we take advantage of case's first-match behaviour. 259b85037dbSmrg ///*) 260b85037dbSmrg # Unusual form of absolute path, do nothing. 261b85037dbSmrg ;; 262b85037dbSmrg //*) 263b85037dbSmrg # Not necessarily an ordinary path; POSIX reserves leading '//' 264b85037dbSmrg # and for example Cygwin uses it to access remote file shares 265b85037dbSmrg # over CIFS/SMB, so we conserve a leading double slash if found. 266b85037dbSmrg func_normal_abspath_altnamespace=/ 267b85037dbSmrg ;; 268b85037dbSmrg /*) 269b85037dbSmrg # Absolute path, do nothing. 270b85037dbSmrg ;; 271b85037dbSmrg *) 272b85037dbSmrg # Relative path, prepend $cwd. 273b85037dbSmrg func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 274b85037dbSmrg ;; 275b85037dbSmrg esac 276b85037dbSmrg # Cancel out all the simple stuff to save iterations. We also want 277b85037dbSmrg # the path to end with a slash for ease of parsing, so make sure 278b85037dbSmrg # there is one (and only one) here. 279b85037dbSmrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 280b85037dbSmrg -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 281b85037dbSmrg while :; do 282b85037dbSmrg # Processed it all yet? 283b85037dbSmrg if test "$func_normal_abspath_tpath" = / ; then 284b85037dbSmrg # If we ascended to the root using ".." the result may be empty now. 285b85037dbSmrg if test -z "$func_normal_abspath_result" ; then 286b85037dbSmrg func_normal_abspath_result=/ 287b85037dbSmrg fi 288b85037dbSmrg break 289b85037dbSmrg fi 290b85037dbSmrg func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 291b85037dbSmrg -e "$pathcar"` 292b85037dbSmrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 293b85037dbSmrg -e "$pathcdr"` 294b85037dbSmrg # Figure out what to do with it 295b85037dbSmrg case $func_normal_abspath_tcomponent in 296b85037dbSmrg "") 297b85037dbSmrg # Trailing empty path component, ignore it. 298b85037dbSmrg ;; 299b85037dbSmrg ..) 300b85037dbSmrg # Parent dir; strip last assembled component from result. 301b85037dbSmrg func_dirname "$func_normal_abspath_result" 302b85037dbSmrg func_normal_abspath_result=$func_dirname_result 303b85037dbSmrg ;; 304b85037dbSmrg *) 305b85037dbSmrg # Actual path component, append it. 306b85037dbSmrg func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 307b85037dbSmrg ;; 308b85037dbSmrg esac 309b85037dbSmrg done 310b85037dbSmrg # Restore leading double-slash if one was found on entry. 311b85037dbSmrg func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 312b85037dbSmrg} 313b85037dbSmrg 314b85037dbSmrg# func_relative_path SRCDIR DSTDIR 315b85037dbSmrg# generates a relative path from SRCDIR to DSTDIR, with a trailing 316b85037dbSmrg# slash if non-empty, suitable for immediately appending a filename 317b85037dbSmrg# without needing to append a separator. 318b85037dbSmrg# value returned in "$func_relative_path_result" 319b85037dbSmrgfunc_relative_path () 320b85037dbSmrg{ 321b85037dbSmrg func_relative_path_result= 322b85037dbSmrg func_normal_abspath "$1" 323b85037dbSmrg func_relative_path_tlibdir=$func_normal_abspath_result 324b85037dbSmrg func_normal_abspath "$2" 325b85037dbSmrg func_relative_path_tbindir=$func_normal_abspath_result 326b85037dbSmrg 327b85037dbSmrg # Ascend the tree starting from libdir 328b85037dbSmrg while :; do 329b85037dbSmrg # check if we have found a prefix of bindir 330b85037dbSmrg case $func_relative_path_tbindir in 331b85037dbSmrg $func_relative_path_tlibdir) 332b85037dbSmrg # found an exact match 333b85037dbSmrg func_relative_path_tcancelled= 334b85037dbSmrg break 335b85037dbSmrg ;; 336b85037dbSmrg $func_relative_path_tlibdir*) 337b85037dbSmrg # found a matching prefix 338b85037dbSmrg func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 339b85037dbSmrg func_relative_path_tcancelled=$func_stripname_result 340b85037dbSmrg if test -z "$func_relative_path_result"; then 341b85037dbSmrg func_relative_path_result=. 342b85037dbSmrg fi 343b85037dbSmrg break 344b85037dbSmrg ;; 345b85037dbSmrg *) 346b85037dbSmrg func_dirname $func_relative_path_tlibdir 347b85037dbSmrg func_relative_path_tlibdir=${func_dirname_result} 348b85037dbSmrg if test "x$func_relative_path_tlibdir" = x ; then 349b85037dbSmrg # Have to descend all the way to the root! 350b85037dbSmrg func_relative_path_result=../$func_relative_path_result 351b85037dbSmrg func_relative_path_tcancelled=$func_relative_path_tbindir 352b85037dbSmrg break 353b85037dbSmrg fi 354b85037dbSmrg func_relative_path_result=../$func_relative_path_result 355b85037dbSmrg ;; 356b85037dbSmrg esac 357b85037dbSmrg done 358b85037dbSmrg 359b85037dbSmrg # Now calculate path; take care to avoid doubling-up slashes. 360b85037dbSmrg func_stripname '' '/' "$func_relative_path_result" 361b85037dbSmrg func_relative_path_result=$func_stripname_result 362b85037dbSmrg func_stripname '/' '/' "$func_relative_path_tcancelled" 363b85037dbSmrg if test "x$func_stripname_result" != x ; then 364b85037dbSmrg func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 365b85037dbSmrg fi 366b85037dbSmrg 367b85037dbSmrg # Normalisation. If bindir is libdir, return empty string, 368b85037dbSmrg # else relative path ending with a slash; either way, target 369b85037dbSmrg # file name can be directly appended. 370b85037dbSmrg if test ! -z "$func_relative_path_result"; then 371b85037dbSmrg func_stripname './' '' "$func_relative_path_result/" 372b85037dbSmrg func_relative_path_result=$func_stripname_result 373b85037dbSmrg fi 374b85037dbSmrg} 375b85037dbSmrg 376b85037dbSmrg# The name of this program: 377b85037dbSmrgfunc_dirname_and_basename "$progpath" 378b85037dbSmrgprogname=$func_basename_result 379b85037dbSmrg 380b85037dbSmrg# Make sure we have an absolute path for reexecution: 381b85037dbSmrgcase $progpath in 382b85037dbSmrg [\\/]*|[A-Za-z]:\\*) ;; 383b85037dbSmrg *[\\/]*) 384b85037dbSmrg progdir=$func_dirname_result 385b85037dbSmrg progdir=`cd "$progdir" && pwd` 386b85037dbSmrg progpath="$progdir/$progname" 387b85037dbSmrg ;; 388b85037dbSmrg *) 389b85037dbSmrg save_IFS="$IFS" 390b85037dbSmrg IFS=: 391b85037dbSmrg for progdir in $PATH; do 392b85037dbSmrg IFS="$save_IFS" 393b85037dbSmrg test -x "$progdir/$progname" && break 394b85037dbSmrg done 395b85037dbSmrg IFS="$save_IFS" 396b85037dbSmrg test -n "$progdir" || progdir=`pwd` 397b85037dbSmrg progpath="$progdir/$progname" 398b85037dbSmrg ;; 399b85037dbSmrgesac 400b85037dbSmrg 401b85037dbSmrg# Sed substitution that helps us do robust quoting. It backslashifies 402b85037dbSmrg# metacharacters that are still active within double-quoted strings. 403b85037dbSmrgXsed="${SED}"' -e 1s/^X//' 404b85037dbSmrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 405b85037dbSmrg 406b85037dbSmrg# Same as above, but do not quote variable references. 407b85037dbSmrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 408b85037dbSmrg 409302b15bdSmrg# Sed substitution that turns a string into a regex matching for the 410302b15bdSmrg# string literally. 411302b15bdSmrgsed_make_literal_regex='s,[].[^$\\*\/],\\&,g' 412302b15bdSmrg 413302b15bdSmrg# Sed substitution that converts a w32 file name or path 414302b15bdSmrg# which contains forward slashes, into one that contains 415302b15bdSmrg# (escaped) backslashes. A very naive implementation. 416302b15bdSmrglt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 417302b15bdSmrg 418b85037dbSmrg# Re-`\' parameter expansions in output of double_quote_subst that were 419b85037dbSmrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 420b85037dbSmrg# in input to double_quote_subst, that '$' was protected from expansion. 421b85037dbSmrg# Since each input `\' is now two `\'s, look for any number of runs of 422b85037dbSmrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 423b85037dbSmrgbs='\\' 424b85037dbSmrgbs2='\\\\' 425b85037dbSmrgbs4='\\\\\\\\' 426b85037dbSmrgdollar='\$' 427b85037dbSmrgsed_double_backslash="\ 428b85037dbSmrg s/$bs4/&\\ 429b85037dbSmrg/g 430b85037dbSmrg s/^$bs2$dollar/$bs&/ 431b85037dbSmrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 432b85037dbSmrg s/\n//g" 433b85037dbSmrg 434b85037dbSmrg# Standard options: 435b85037dbSmrgopt_dry_run=false 436b85037dbSmrgopt_help=false 437b85037dbSmrgopt_quiet=false 438b85037dbSmrgopt_verbose=false 439b85037dbSmrgopt_warning=: 440b85037dbSmrg 441b85037dbSmrg# func_echo arg... 442b85037dbSmrg# Echo program name prefixed message, along with the current mode 443b85037dbSmrg# name if it has been set yet. 444b85037dbSmrgfunc_echo () 445b85037dbSmrg{ 446302b15bdSmrg $ECHO "$progname: ${opt_mode+$opt_mode: }$*" 447b85037dbSmrg} 448b85037dbSmrg 449b85037dbSmrg# func_verbose arg... 450b85037dbSmrg# Echo program name prefixed message in verbose mode only. 451b85037dbSmrgfunc_verbose () 452b85037dbSmrg{ 453b85037dbSmrg $opt_verbose && func_echo ${1+"$@"} 454b85037dbSmrg 455b85037dbSmrg # A bug in bash halts the script if the last line of a function 456b85037dbSmrg # fails when set -e is in force, so we need another command to 457b85037dbSmrg # work around that: 458b85037dbSmrg : 459b85037dbSmrg} 460b85037dbSmrg 461b85037dbSmrg# func_echo_all arg... 462b85037dbSmrg# Invoke $ECHO with all args, space-separated. 463b85037dbSmrgfunc_echo_all () 464b85037dbSmrg{ 465b85037dbSmrg $ECHO "$*" 466b85037dbSmrg} 467b85037dbSmrg 468b85037dbSmrg# func_error arg... 469b85037dbSmrg# Echo program name prefixed message to standard error. 470b85037dbSmrgfunc_error () 471b85037dbSmrg{ 472302b15bdSmrg $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 473b85037dbSmrg} 474b85037dbSmrg 475b85037dbSmrg# func_warning arg... 476b85037dbSmrg# Echo program name prefixed warning message to standard error. 477b85037dbSmrgfunc_warning () 478b85037dbSmrg{ 479302b15bdSmrg $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 480b85037dbSmrg 481b85037dbSmrg # bash bug again: 482b85037dbSmrg : 483b85037dbSmrg} 484b85037dbSmrg 485b85037dbSmrg# func_fatal_error arg... 486b85037dbSmrg# Echo program name prefixed message to standard error, and exit. 487b85037dbSmrgfunc_fatal_error () 488b85037dbSmrg{ 489b85037dbSmrg func_error ${1+"$@"} 490b85037dbSmrg exit $EXIT_FAILURE 491b85037dbSmrg} 492b85037dbSmrg 493b85037dbSmrg# func_fatal_help arg... 494b85037dbSmrg# Echo program name prefixed message to standard error, followed by 495b85037dbSmrg# a help hint, and exit. 496b85037dbSmrgfunc_fatal_help () 497b85037dbSmrg{ 498b85037dbSmrg func_error ${1+"$@"} 499b85037dbSmrg func_fatal_error "$help" 500b85037dbSmrg} 501b85037dbSmrghelp="Try \`$progname --help' for more information." ## default 502b85037dbSmrg 503b85037dbSmrg 504b85037dbSmrg# func_grep expression filename 505b85037dbSmrg# Check whether EXPRESSION matches any line of FILENAME, without output. 506b85037dbSmrgfunc_grep () 507b85037dbSmrg{ 508b85037dbSmrg $GREP "$1" "$2" >/dev/null 2>&1 509b85037dbSmrg} 510b85037dbSmrg 511b85037dbSmrg 512b85037dbSmrg# func_mkdir_p directory-path 513b85037dbSmrg# Make sure the entire path to DIRECTORY-PATH is available. 514b85037dbSmrgfunc_mkdir_p () 515b85037dbSmrg{ 516b85037dbSmrg my_directory_path="$1" 517b85037dbSmrg my_dir_list= 518b85037dbSmrg 519b85037dbSmrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 520b85037dbSmrg 521b85037dbSmrg # Protect directory names starting with `-' 522b85037dbSmrg case $my_directory_path in 523b85037dbSmrg -*) my_directory_path="./$my_directory_path" ;; 524b85037dbSmrg esac 525b85037dbSmrg 526b85037dbSmrg # While some portion of DIR does not yet exist... 527b85037dbSmrg while test ! -d "$my_directory_path"; do 528b85037dbSmrg # ...make a list in topmost first order. Use a colon delimited 529b85037dbSmrg # list incase some portion of path contains whitespace. 530b85037dbSmrg my_dir_list="$my_directory_path:$my_dir_list" 531b85037dbSmrg 532b85037dbSmrg # If the last portion added has no slash in it, the list is done 533b85037dbSmrg case $my_directory_path in */*) ;; *) break ;; esac 534b85037dbSmrg 535b85037dbSmrg # ...otherwise throw away the child directory and loop 536b85037dbSmrg my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 537b85037dbSmrg done 538b85037dbSmrg my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 539b85037dbSmrg 540b85037dbSmrg save_mkdir_p_IFS="$IFS"; IFS=':' 541b85037dbSmrg for my_dir in $my_dir_list; do 542b85037dbSmrg IFS="$save_mkdir_p_IFS" 543b85037dbSmrg # mkdir can fail with a `File exist' error if two processes 544b85037dbSmrg # try to create one of the directories concurrently. Don't 545b85037dbSmrg # stop in that case! 546b85037dbSmrg $MKDIR "$my_dir" 2>/dev/null || : 547b85037dbSmrg done 548b85037dbSmrg IFS="$save_mkdir_p_IFS" 549b85037dbSmrg 550b85037dbSmrg # Bail out if we (or some other process) failed to create a directory. 551b85037dbSmrg test -d "$my_directory_path" || \ 552b85037dbSmrg func_fatal_error "Failed to create \`$1'" 553b85037dbSmrg fi 554b85037dbSmrg} 555b85037dbSmrg 556b85037dbSmrg 557b85037dbSmrg# func_mktempdir [string] 558b85037dbSmrg# Make a temporary directory that won't clash with other running 559b85037dbSmrg# libtool processes, and avoids race conditions if possible. If 560b85037dbSmrg# given, STRING is the basename for that directory. 561b85037dbSmrgfunc_mktempdir () 562b85037dbSmrg{ 563b85037dbSmrg my_template="${TMPDIR-/tmp}/${1-$progname}" 564b85037dbSmrg 565b85037dbSmrg if test "$opt_dry_run" = ":"; then 566b85037dbSmrg # Return a directory name, but don't create it in dry-run mode 567b85037dbSmrg my_tmpdir="${my_template}-$$" 568b85037dbSmrg else 569b85037dbSmrg 570b85037dbSmrg # If mktemp works, use that first and foremost 571b85037dbSmrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 572b85037dbSmrg 573b85037dbSmrg if test ! -d "$my_tmpdir"; then 574b85037dbSmrg # Failing that, at least try and use $RANDOM to avoid a race 575b85037dbSmrg my_tmpdir="${my_template}-${RANDOM-0}$$" 576b85037dbSmrg 577b85037dbSmrg save_mktempdir_umask=`umask` 578b85037dbSmrg umask 0077 579b85037dbSmrg $MKDIR "$my_tmpdir" 580b85037dbSmrg umask $save_mktempdir_umask 581b85037dbSmrg fi 582b85037dbSmrg 583b85037dbSmrg # If we're not in dry-run mode, bomb out on failure 584b85037dbSmrg test -d "$my_tmpdir" || \ 585b85037dbSmrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 586b85037dbSmrg fi 587b85037dbSmrg 588b85037dbSmrg $ECHO "$my_tmpdir" 589b85037dbSmrg} 590b85037dbSmrg 591b85037dbSmrg 592b85037dbSmrg# func_quote_for_eval arg 593b85037dbSmrg# Aesthetically quote ARG to be evaled later. 594b85037dbSmrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 595b85037dbSmrg# is double-quoted, suitable for a subsequent eval, whereas 596b85037dbSmrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 597b85037dbSmrg# which are still active within double quotes backslashified. 598b85037dbSmrgfunc_quote_for_eval () 599b85037dbSmrg{ 600b85037dbSmrg case $1 in 601b85037dbSmrg *[\\\`\"\$]*) 602b85037dbSmrg func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 603b85037dbSmrg *) 604b85037dbSmrg func_quote_for_eval_unquoted_result="$1" ;; 605b85037dbSmrg esac 606b85037dbSmrg 607b85037dbSmrg case $func_quote_for_eval_unquoted_result in 608b85037dbSmrg # Double-quote args containing shell metacharacters to delay 609b85037dbSmrg # word splitting, command substitution and and variable 610b85037dbSmrg # expansion for a subsequent eval. 611b85037dbSmrg # Many Bourne shells cannot handle close brackets correctly 612b85037dbSmrg # in scan sets, so we specify it separately. 613b85037dbSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 614b85037dbSmrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 615b85037dbSmrg ;; 616b85037dbSmrg *) 617b85037dbSmrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 618b85037dbSmrg esac 619b85037dbSmrg} 620b85037dbSmrg 621b85037dbSmrg 622b85037dbSmrg# func_quote_for_expand arg 623b85037dbSmrg# Aesthetically quote ARG to be evaled later; same as above, 624b85037dbSmrg# but do not quote variable references. 625b85037dbSmrgfunc_quote_for_expand () 626b85037dbSmrg{ 627b85037dbSmrg case $1 in 628b85037dbSmrg *[\\\`\"]*) 629b85037dbSmrg my_arg=`$ECHO "$1" | $SED \ 630b85037dbSmrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 631b85037dbSmrg *) 632b85037dbSmrg my_arg="$1" ;; 633b85037dbSmrg esac 634b85037dbSmrg 635b85037dbSmrg case $my_arg in 636b85037dbSmrg # Double-quote args containing shell metacharacters to delay 637b85037dbSmrg # word splitting and command substitution for a subsequent eval. 638b85037dbSmrg # Many Bourne shells cannot handle close brackets correctly 639b85037dbSmrg # in scan sets, so we specify it separately. 640b85037dbSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 641b85037dbSmrg my_arg="\"$my_arg\"" 642b85037dbSmrg ;; 643b85037dbSmrg esac 644b85037dbSmrg 645b85037dbSmrg func_quote_for_expand_result="$my_arg" 646b85037dbSmrg} 647b85037dbSmrg 648b85037dbSmrg 649b85037dbSmrg# func_show_eval cmd [fail_exp] 650b85037dbSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 651b85037dbSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 652b85037dbSmrg# is given, then evaluate it. 653b85037dbSmrgfunc_show_eval () 654b85037dbSmrg{ 655b85037dbSmrg my_cmd="$1" 656b85037dbSmrg my_fail_exp="${2-:}" 657b85037dbSmrg 658b85037dbSmrg ${opt_silent-false} || { 659b85037dbSmrg func_quote_for_expand "$my_cmd" 660b85037dbSmrg eval "func_echo $func_quote_for_expand_result" 661b85037dbSmrg } 662b85037dbSmrg 663b85037dbSmrg if ${opt_dry_run-false}; then :; else 664b85037dbSmrg eval "$my_cmd" 665b85037dbSmrg my_status=$? 666b85037dbSmrg if test "$my_status" -eq 0; then :; else 667b85037dbSmrg eval "(exit $my_status); $my_fail_exp" 668b85037dbSmrg fi 669b85037dbSmrg fi 670b85037dbSmrg} 671b85037dbSmrg 672b85037dbSmrg 673b85037dbSmrg# func_show_eval_locale cmd [fail_exp] 674b85037dbSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 675b85037dbSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 676b85037dbSmrg# is given, then evaluate it. Use the saved locale for evaluation. 677b85037dbSmrgfunc_show_eval_locale () 678b85037dbSmrg{ 679b85037dbSmrg my_cmd="$1" 680b85037dbSmrg my_fail_exp="${2-:}" 681b85037dbSmrg 682b85037dbSmrg ${opt_silent-false} || { 683b85037dbSmrg func_quote_for_expand "$my_cmd" 684b85037dbSmrg eval "func_echo $func_quote_for_expand_result" 685b85037dbSmrg } 686b85037dbSmrg 687b85037dbSmrg if ${opt_dry_run-false}; then :; else 688b85037dbSmrg eval "$lt_user_locale 689b85037dbSmrg $my_cmd" 690b85037dbSmrg my_status=$? 691b85037dbSmrg eval "$lt_safe_locale" 692b85037dbSmrg if test "$my_status" -eq 0; then :; else 693b85037dbSmrg eval "(exit $my_status); $my_fail_exp" 694b85037dbSmrg fi 695b85037dbSmrg fi 696b85037dbSmrg} 697b85037dbSmrg 698302b15bdSmrg# func_tr_sh 699302b15bdSmrg# Turn $1 into a string suitable for a shell variable name. 700302b15bdSmrg# Result is stored in $func_tr_sh_result. All characters 701302b15bdSmrg# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 702302b15bdSmrg# if $1 begins with a digit, a '_' is prepended as well. 703302b15bdSmrgfunc_tr_sh () 704302b15bdSmrg{ 705302b15bdSmrg case $1 in 706302b15bdSmrg [0-9]* | *[!a-zA-Z0-9_]*) 707302b15bdSmrg func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` 708302b15bdSmrg ;; 709302b15bdSmrg * ) 710302b15bdSmrg func_tr_sh_result=$1 711302b15bdSmrg ;; 712302b15bdSmrg esac 713302b15bdSmrg} 714302b15bdSmrg 715b85037dbSmrg 716b85037dbSmrg# func_version 717b85037dbSmrg# Echo version message to standard output and exit. 718b85037dbSmrgfunc_version () 719b85037dbSmrg{ 720302b15bdSmrg $opt_debug 721302b15bdSmrg 722b85037dbSmrg $SED -n '/(C)/!b go 723b85037dbSmrg :more 724b85037dbSmrg /\./!{ 725b85037dbSmrg N 726b85037dbSmrg s/\n# / / 727b85037dbSmrg b more 728b85037dbSmrg } 729b85037dbSmrg :go 730b85037dbSmrg /^# '$PROGRAM' (GNU /,/# warranty; / { 731b85037dbSmrg s/^# // 732b85037dbSmrg s/^# *$// 733b85037dbSmrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 734b85037dbSmrg p 735b85037dbSmrg }' < "$progpath" 736b85037dbSmrg exit $? 737b85037dbSmrg} 738b85037dbSmrg 739b85037dbSmrg# func_usage 740b85037dbSmrg# Echo short help message to standard output and exit. 741b85037dbSmrgfunc_usage () 742b85037dbSmrg{ 743302b15bdSmrg $opt_debug 744302b15bdSmrg 745b85037dbSmrg $SED -n '/^# Usage:/,/^# *.*--help/ { 746b85037dbSmrg s/^# // 747b85037dbSmrg s/^# *$// 748b85037dbSmrg s/\$progname/'$progname'/ 749b85037dbSmrg p 750b85037dbSmrg }' < "$progpath" 751b85037dbSmrg echo 752b85037dbSmrg $ECHO "run \`$progname --help | more' for full usage" 753b85037dbSmrg exit $? 754b85037dbSmrg} 755b85037dbSmrg 756b85037dbSmrg# func_help [NOEXIT] 757b85037dbSmrg# Echo long help message to standard output and exit, 758b85037dbSmrg# unless 'noexit' is passed as argument. 759b85037dbSmrgfunc_help () 760b85037dbSmrg{ 761302b15bdSmrg $opt_debug 762302b15bdSmrg 763b85037dbSmrg $SED -n '/^# Usage:/,/# Report bugs to/ { 764302b15bdSmrg :print 765b85037dbSmrg s/^# // 766b85037dbSmrg s/^# *$// 767b85037dbSmrg s*\$progname*'$progname'* 768b85037dbSmrg s*\$host*'"$host"'* 769b85037dbSmrg s*\$SHELL*'"$SHELL"'* 770b85037dbSmrg s*\$LTCC*'"$LTCC"'* 771b85037dbSmrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 772b85037dbSmrg s*\$LD*'"$LD"'* 773b85037dbSmrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 774b85037dbSmrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 775b85037dbSmrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 776b85037dbSmrg p 777302b15bdSmrg d 778302b15bdSmrg } 779302b15bdSmrg /^# .* home page:/b print 780302b15bdSmrg /^# General help using/b print 781302b15bdSmrg ' < "$progpath" 782b85037dbSmrg ret=$? 783b85037dbSmrg if test -z "$1"; then 784b85037dbSmrg exit $ret 785b85037dbSmrg fi 786b85037dbSmrg} 787b85037dbSmrg 788b85037dbSmrg# func_missing_arg argname 789b85037dbSmrg# Echo program name prefixed message to standard error and set global 790b85037dbSmrg# exit_cmd. 791b85037dbSmrgfunc_missing_arg () 792b85037dbSmrg{ 793302b15bdSmrg $opt_debug 794302b15bdSmrg 795b85037dbSmrg func_error "missing argument for $1." 796b85037dbSmrg exit_cmd=exit 797b85037dbSmrg} 798b85037dbSmrg 799b85037dbSmrg 800302b15bdSmrg# func_split_short_opt shortopt 801302b15bdSmrg# Set func_split_short_opt_name and func_split_short_opt_arg shell 802302b15bdSmrg# variables after splitting SHORTOPT after the 2nd character. 803302b15bdSmrgfunc_split_short_opt () 804302b15bdSmrg{ 805302b15bdSmrg my_sed_short_opt='1s/^\(..\).*$/\1/;q' 806302b15bdSmrg my_sed_short_rest='1s/^..\(.*\)$/\1/;q' 807302b15bdSmrg 808302b15bdSmrg func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` 809302b15bdSmrg func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` 810302b15bdSmrg} # func_split_short_opt may be replaced by extended shell implementation 811302b15bdSmrg 812302b15bdSmrg 813302b15bdSmrg# func_split_long_opt longopt 814302b15bdSmrg# Set func_split_long_opt_name and func_split_long_opt_arg shell 815302b15bdSmrg# variables after splitting LONGOPT at the `=' sign. 816302b15bdSmrgfunc_split_long_opt () 817302b15bdSmrg{ 818302b15bdSmrg my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' 819302b15bdSmrg my_sed_long_arg='1s/^--[^=]*=//' 820302b15bdSmrg 821302b15bdSmrg func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` 822302b15bdSmrg func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` 823302b15bdSmrg} # func_split_long_opt may be replaced by extended shell implementation 824302b15bdSmrg 825302b15bdSmrgexit_cmd=: 826b85037dbSmrg 827b85037dbSmrg 828b85037dbSmrg 829b85037dbSmrg 830b85037dbSmrg 831b85037dbSmrgmagic="%%%MAGIC variable%%%" 832b85037dbSmrgmagic_exe="%%%MAGIC EXE variable%%%" 833b85037dbSmrg 834b85037dbSmrg# Global variables. 835b85037dbSmrgnonopt= 836b85037dbSmrgpreserve_args= 837b85037dbSmrglo2o="s/\\.lo\$/.${objext}/" 838b85037dbSmrgo2lo="s/\\.${objext}\$/.lo/" 839b85037dbSmrgextracted_archives= 840b85037dbSmrgextracted_serial=0 841b85037dbSmrg 842b85037dbSmrg# If this variable is set in any of the actions, the command in it 843b85037dbSmrg# will be execed at the end. This prevents here-documents from being 844b85037dbSmrg# left over by shells. 845b85037dbSmrgexec_cmd= 846b85037dbSmrg 847302b15bdSmrg# func_append var value 848302b15bdSmrg# Append VALUE to the end of shell variable VAR. 849302b15bdSmrgfunc_append () 850302b15bdSmrg{ 851302b15bdSmrg eval "${1}=\$${1}\${2}" 852302b15bdSmrg} # func_append may be replaced by extended shell implementation 853302b15bdSmrg 854302b15bdSmrg# func_append_quoted var value 855302b15bdSmrg# Quote VALUE and append to the end of shell variable VAR, separated 856302b15bdSmrg# by a space. 857302b15bdSmrgfunc_append_quoted () 858302b15bdSmrg{ 859302b15bdSmrg func_quote_for_eval "${2}" 860302b15bdSmrg eval "${1}=\$${1}\\ \$func_quote_for_eval_result" 861302b15bdSmrg} # func_append_quoted may be replaced by extended shell implementation 862302b15bdSmrg 863302b15bdSmrg 864302b15bdSmrg# func_arith arithmetic-term... 865302b15bdSmrgfunc_arith () 866302b15bdSmrg{ 867302b15bdSmrg func_arith_result=`expr "${@}"` 868302b15bdSmrg} # func_arith may be replaced by extended shell implementation 869302b15bdSmrg 870302b15bdSmrg 871302b15bdSmrg# func_len string 872302b15bdSmrg# STRING may not start with a hyphen. 873302b15bdSmrgfunc_len () 874302b15bdSmrg{ 875302b15bdSmrg func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` 876302b15bdSmrg} # func_len may be replaced by extended shell implementation 877302b15bdSmrg 878302b15bdSmrg 879302b15bdSmrg# func_lo2o object 880302b15bdSmrgfunc_lo2o () 881302b15bdSmrg{ 882302b15bdSmrg func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` 883302b15bdSmrg} # func_lo2o may be replaced by extended shell implementation 884302b15bdSmrg 885302b15bdSmrg 886302b15bdSmrg# func_xform libobj-or-source 887302b15bdSmrgfunc_xform () 888302b15bdSmrg{ 889302b15bdSmrg func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` 890302b15bdSmrg} # func_xform may be replaced by extended shell implementation 891302b15bdSmrg 892302b15bdSmrg 893b85037dbSmrg# func_fatal_configuration arg... 894b85037dbSmrg# Echo program name prefixed message to standard error, followed by 895b85037dbSmrg# a configuration failure hint, and exit. 896b85037dbSmrgfunc_fatal_configuration () 897b85037dbSmrg{ 898b85037dbSmrg func_error ${1+"$@"} 899b85037dbSmrg func_error "See the $PACKAGE documentation for more information." 900b85037dbSmrg func_fatal_error "Fatal configuration error." 901b85037dbSmrg} 902b85037dbSmrg 903b85037dbSmrg 904b85037dbSmrg# func_config 905b85037dbSmrg# Display the configuration for all the tags in this script. 906b85037dbSmrgfunc_config () 907b85037dbSmrg{ 908b85037dbSmrg re_begincf='^# ### BEGIN LIBTOOL' 909b85037dbSmrg re_endcf='^# ### END LIBTOOL' 910b85037dbSmrg 911b85037dbSmrg # Default configuration. 912b85037dbSmrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 913b85037dbSmrg 914b85037dbSmrg # Now print the configurations for the tags. 915b85037dbSmrg for tagname in $taglist; do 916b85037dbSmrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 917b85037dbSmrg done 918b85037dbSmrg 919b85037dbSmrg exit $? 920b85037dbSmrg} 921b85037dbSmrg 922b85037dbSmrg# func_features 923b85037dbSmrg# Display the features supported by this script. 924b85037dbSmrgfunc_features () 925b85037dbSmrg{ 926b85037dbSmrg echo "host: $host" 927b85037dbSmrg if test "$build_libtool_libs" = yes; then 928b85037dbSmrg echo "enable shared libraries" 929b85037dbSmrg else 930b85037dbSmrg echo "disable shared libraries" 931b85037dbSmrg fi 932b85037dbSmrg if test "$build_old_libs" = yes; then 933b85037dbSmrg echo "enable static libraries" 934b85037dbSmrg else 935b85037dbSmrg echo "disable static libraries" 936b85037dbSmrg fi 937b85037dbSmrg 938b85037dbSmrg exit $? 939b85037dbSmrg} 940b85037dbSmrg 941b85037dbSmrg# func_enable_tag tagname 942b85037dbSmrg# Verify that TAGNAME is valid, and either flag an error and exit, or 943b85037dbSmrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 944b85037dbSmrg# variable here. 945b85037dbSmrgfunc_enable_tag () 946b85037dbSmrg{ 947b85037dbSmrg # Global variable: 948b85037dbSmrg tagname="$1" 949b85037dbSmrg 950b85037dbSmrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 951b85037dbSmrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 952b85037dbSmrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 953b85037dbSmrg 954b85037dbSmrg # Validate tagname. 955b85037dbSmrg case $tagname in 956b85037dbSmrg *[!-_A-Za-z0-9,/]*) 957b85037dbSmrg func_fatal_error "invalid tag name: $tagname" 958b85037dbSmrg ;; 959b85037dbSmrg esac 960b85037dbSmrg 961b85037dbSmrg # Don't test for the "default" C tag, as we know it's 962b85037dbSmrg # there but not specially marked. 963b85037dbSmrg case $tagname in 964b85037dbSmrg CC) ;; 965b85037dbSmrg *) 966b85037dbSmrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 967b85037dbSmrg taglist="$taglist $tagname" 968b85037dbSmrg 969b85037dbSmrg # Evaluate the configuration. Be careful to quote the path 970b85037dbSmrg # and the sed script, to avoid splitting on whitespace, but 971b85037dbSmrg # also don't use non-portable quotes within backquotes within 972b85037dbSmrg # quotes we have to do it in 2 steps: 973b85037dbSmrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 974b85037dbSmrg eval "$extractedcf" 975b85037dbSmrg else 976b85037dbSmrg func_error "ignoring unknown tag $tagname" 977b85037dbSmrg fi 978b85037dbSmrg ;; 979b85037dbSmrg esac 980b85037dbSmrg} 981b85037dbSmrg 982302b15bdSmrg# func_check_version_match 983302b15bdSmrg# Ensure that we are using m4 macros, and libtool script from the same 984302b15bdSmrg# release of libtool. 985302b15bdSmrgfunc_check_version_match () 986b85037dbSmrg{ 987302b15bdSmrg if test "$package_revision" != "$macro_revision"; then 988302b15bdSmrg if test "$VERSION" != "$macro_version"; then 989302b15bdSmrg if test -z "$macro_version"; then 990302b15bdSmrg cat >&2 <<_LT_EOF 991302b15bdSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 992302b15bdSmrg$progname: definition of this LT_INIT comes from an older release. 993302b15bdSmrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 994302b15bdSmrg$progname: and run autoconf again. 995302b15bdSmrg_LT_EOF 996302b15bdSmrg else 997302b15bdSmrg cat >&2 <<_LT_EOF 998302b15bdSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 999302b15bdSmrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 1000302b15bdSmrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 1001302b15bdSmrg$progname: and run autoconf again. 1002302b15bdSmrg_LT_EOF 1003302b15bdSmrg fi 1004302b15bdSmrg else 1005302b15bdSmrg cat >&2 <<_LT_EOF 1006302b15bdSmrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 1007302b15bdSmrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 1008302b15bdSmrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 1009302b15bdSmrg$progname: of $PACKAGE $VERSION and run autoconf again. 1010302b15bdSmrg_LT_EOF 1011302b15bdSmrg fi 1012b85037dbSmrg 1013302b15bdSmrg exit $EXIT_MISMATCH 1014302b15bdSmrg fi 1015302b15bdSmrg} 1016302b15bdSmrg 1017302b15bdSmrg 1018302b15bdSmrg# Shorthand for --mode=foo, only valid as the first argument 1019302b15bdSmrgcase $1 in 1020302b15bdSmrgclean|clea|cle|cl) 1021302b15bdSmrg shift; set dummy --mode clean ${1+"$@"}; shift 1022302b15bdSmrg ;; 1023302b15bdSmrgcompile|compil|compi|comp|com|co|c) 1024302b15bdSmrg shift; set dummy --mode compile ${1+"$@"}; shift 1025302b15bdSmrg ;; 1026302b15bdSmrgexecute|execut|execu|exec|exe|ex|e) 1027302b15bdSmrg shift; set dummy --mode execute ${1+"$@"}; shift 1028302b15bdSmrg ;; 1029302b15bdSmrgfinish|finis|fini|fin|fi|f) 1030302b15bdSmrg shift; set dummy --mode finish ${1+"$@"}; shift 1031302b15bdSmrg ;; 1032302b15bdSmrginstall|instal|insta|inst|ins|in|i) 1033302b15bdSmrg shift; set dummy --mode install ${1+"$@"}; shift 1034302b15bdSmrg ;; 1035302b15bdSmrglink|lin|li|l) 1036302b15bdSmrg shift; set dummy --mode link ${1+"$@"}; shift 1037302b15bdSmrg ;; 1038302b15bdSmrguninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 1039302b15bdSmrg shift; set dummy --mode uninstall ${1+"$@"}; shift 1040302b15bdSmrg ;; 1041302b15bdSmrgesac 1042b85037dbSmrg 1043302b15bdSmrg 1044302b15bdSmrg 1045302b15bdSmrg# Option defaults: 1046302b15bdSmrgopt_debug=: 1047302b15bdSmrgopt_dry_run=false 1048302b15bdSmrgopt_config=false 1049302b15bdSmrgopt_preserve_dup_deps=false 1050302b15bdSmrgopt_features=false 1051302b15bdSmrgopt_finish=false 1052302b15bdSmrgopt_help=false 1053302b15bdSmrgopt_help_all=false 1054302b15bdSmrgopt_silent=: 1055302b15bdSmrgopt_verbose=: 1056302b15bdSmrgopt_silent=false 1057302b15bdSmrgopt_verbose=false 1058302b15bdSmrg 1059302b15bdSmrg 1060302b15bdSmrg# Parse options once, thoroughly. This comes as soon as possible in the 1061302b15bdSmrg# script to make things like `--version' happen as quickly as we can. 1062302b15bdSmrg{ 1063302b15bdSmrg # this just eases exit handling 1064302b15bdSmrg while test $# -gt 0; do 1065b85037dbSmrg opt="$1" 1066b85037dbSmrg shift 1067b85037dbSmrg case $opt in 1068302b15bdSmrg --debug|-x) opt_debug='set -x' 1069b85037dbSmrg func_echo "enabling shell trace mode" 1070b85037dbSmrg $opt_debug 1071b85037dbSmrg ;; 1072302b15bdSmrg --dry-run|--dryrun|-n) 1073302b15bdSmrg opt_dry_run=: 1074b85037dbSmrg ;; 1075302b15bdSmrg --config) 1076302b15bdSmrg opt_config=: 1077302b15bdSmrgfunc_config 1078302b15bdSmrg ;; 1079302b15bdSmrg --dlopen|-dlopen) 1080302b15bdSmrg optarg="$1" 1081302b15bdSmrg opt_dlopen="${opt_dlopen+$opt_dlopen 1082302b15bdSmrg}$optarg" 1083b85037dbSmrg shift 1084b85037dbSmrg ;; 1085b85037dbSmrg --preserve-dup-deps) 1086302b15bdSmrg opt_preserve_dup_deps=: 1087b85037dbSmrg ;; 1088302b15bdSmrg --features) 1089302b15bdSmrg opt_features=: 1090302b15bdSmrgfunc_features 1091b85037dbSmrg ;; 1092302b15bdSmrg --finish) 1093302b15bdSmrg opt_finish=: 1094302b15bdSmrgset dummy --mode finish ${1+"$@"}; shift 1095302b15bdSmrg ;; 1096302b15bdSmrg --help) 1097302b15bdSmrg opt_help=: 1098302b15bdSmrg ;; 1099302b15bdSmrg --help-all) 1100302b15bdSmrg opt_help_all=: 1101302b15bdSmrgopt_help=': help-all' 1102302b15bdSmrg ;; 1103302b15bdSmrg --mode) 1104302b15bdSmrg test $# = 0 && func_missing_arg $opt && break 1105302b15bdSmrg optarg="$1" 1106302b15bdSmrg opt_mode="$optarg" 1107302b15bdSmrgcase $optarg in 1108302b15bdSmrg # Valid mode arguments: 1109302b15bdSmrg clean|compile|execute|finish|install|link|relink|uninstall) ;; 1110302b15bdSmrg 1111302b15bdSmrg # Catch anything else as an error 1112302b15bdSmrg *) func_error "invalid argument for $opt" 1113302b15bdSmrg exit_cmd=exit 1114302b15bdSmrg break 1115302b15bdSmrg ;; 1116302b15bdSmrgesac 1117302b15bdSmrg shift 1118302b15bdSmrg ;; 1119302b15bdSmrg --no-silent|--no-quiet) 1120b85037dbSmrg opt_silent=false 1121302b15bdSmrgfunc_append preserve_args " $opt" 1122b85037dbSmrg ;; 1123302b15bdSmrg --no-verbose) 1124b85037dbSmrg opt_verbose=false 1125302b15bdSmrgfunc_append preserve_args " $opt" 1126b85037dbSmrg ;; 1127302b15bdSmrg --silent|--quiet) 1128302b15bdSmrg opt_silent=: 1129302b15bdSmrgfunc_append preserve_args " $opt" 1130302b15bdSmrg opt_verbose=false 1131302b15bdSmrg ;; 1132302b15bdSmrg --verbose|-v) 1133302b15bdSmrg opt_verbose=: 1134302b15bdSmrgfunc_append preserve_args " $opt" 1135302b15bdSmrgopt_silent=false 1136302b15bdSmrg ;; 1137302b15bdSmrg --tag) 1138302b15bdSmrg test $# = 0 && func_missing_arg $opt && break 1139302b15bdSmrg optarg="$1" 1140302b15bdSmrg opt_tag="$optarg" 1141302b15bdSmrgfunc_append preserve_args " $opt $optarg" 1142302b15bdSmrgfunc_enable_tag "$optarg" 1143b85037dbSmrg shift 1144b85037dbSmrg ;; 1145b85037dbSmrg 1146302b15bdSmrg -\?|-h) func_usage ;; 1147302b15bdSmrg --help) func_help ;; 1148302b15bdSmrg --version) func_version ;; 1149302b15bdSmrg 1150b85037dbSmrg # Separate optargs to long options: 1151302b15bdSmrg --*=*) 1152302b15bdSmrg func_split_long_opt "$opt" 1153302b15bdSmrg set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} 1154b85037dbSmrg shift 1155b85037dbSmrg ;; 1156b85037dbSmrg 1157302b15bdSmrg # Separate non-argument short options: 1158302b15bdSmrg -\?*|-h*|-n*|-v*) 1159302b15bdSmrg func_split_short_opt "$opt" 1160302b15bdSmrg set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} 1161302b15bdSmrg shift 1162b85037dbSmrg ;; 1163302b15bdSmrg 1164302b15bdSmrg --) break ;; 1165302b15bdSmrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 1166302b15bdSmrg *) set dummy "$opt" ${1+"$@"}; shift; break ;; 1167b85037dbSmrg esac 1168b85037dbSmrg done 1169b85037dbSmrg 1170302b15bdSmrg # Validate options: 1171302b15bdSmrg 1172302b15bdSmrg # save first non-option argument 1173302b15bdSmrg if test "$#" -gt 0; then 1174302b15bdSmrg nonopt="$opt" 1175302b15bdSmrg shift 1176302b15bdSmrg fi 1177302b15bdSmrg 1178302b15bdSmrg # preserve --debug 1179302b15bdSmrg test "$opt_debug" = : || func_append preserve_args " --debug" 1180b85037dbSmrg 1181b85037dbSmrg case $host in 1182b85037dbSmrg *cygwin* | *mingw* | *pw32* | *cegcc*) 1183b85037dbSmrg # don't eliminate duplications in $postdeps and $predeps 1184b85037dbSmrg opt_duplicate_compiler_generated_deps=: 1185b85037dbSmrg ;; 1186b85037dbSmrg *) 1187302b15bdSmrg opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 1188b85037dbSmrg ;; 1189b85037dbSmrg esac 1190b85037dbSmrg 1191302b15bdSmrg $opt_help || { 1192302b15bdSmrg # Sanity checks first: 1193302b15bdSmrg func_check_version_match 1194b85037dbSmrg 1195302b15bdSmrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 1196302b15bdSmrg func_fatal_configuration "not configured to build any kind of library" 1197b85037dbSmrg fi 1198b85037dbSmrg 1199302b15bdSmrg # Darwin sucks 1200302b15bdSmrg eval std_shrext=\"$shrext_cmds\" 1201b85037dbSmrg 1202302b15bdSmrg # Only execute mode is allowed to have -dlopen flags. 1203302b15bdSmrg if test -n "$opt_dlopen" && test "$opt_mode" != execute; then 1204302b15bdSmrg func_error "unrecognized option \`-dlopen'" 1205302b15bdSmrg $ECHO "$help" 1>&2 1206302b15bdSmrg exit $EXIT_FAILURE 1207302b15bdSmrg fi 1208b85037dbSmrg 1209302b15bdSmrg # Change the help message to a mode-specific one. 1210302b15bdSmrg generic_help="$help" 1211302b15bdSmrg help="Try \`$progname --help --mode=$opt_mode' for more information." 1212302b15bdSmrg } 1213b85037dbSmrg 1214b85037dbSmrg 1215302b15bdSmrg # Bail if the options were screwed 1216302b15bdSmrg $exit_cmd $EXIT_FAILURE 1217302b15bdSmrg} 1218b85037dbSmrg 1219b85037dbSmrg 1220b85037dbSmrg 1221b85037dbSmrg 1222302b15bdSmrg## ----------- ## 1223302b15bdSmrg## Main. ## 1224302b15bdSmrg## ----------- ## 1225b85037dbSmrg 1226b85037dbSmrg# func_lalib_p file 1227b85037dbSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 1228b85037dbSmrg# This function is only a basic sanity check; it will hardly flush out 1229b85037dbSmrg# determined imposters. 1230b85037dbSmrgfunc_lalib_p () 1231b85037dbSmrg{ 1232b85037dbSmrg test -f "$1" && 1233b85037dbSmrg $SED -e 4q "$1" 2>/dev/null \ 1234b85037dbSmrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 1235b85037dbSmrg} 1236b85037dbSmrg 1237b85037dbSmrg# func_lalib_unsafe_p file 1238b85037dbSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 1239b85037dbSmrg# This function implements the same check as func_lalib_p without 1240b85037dbSmrg# resorting to external programs. To this end, it redirects stdin and 1241b85037dbSmrg# closes it afterwards, without saving the original file descriptor. 1242b85037dbSmrg# As a safety measure, use it only where a negative result would be 1243b85037dbSmrg# fatal anyway. Works if `file' does not exist. 1244b85037dbSmrgfunc_lalib_unsafe_p () 1245b85037dbSmrg{ 1246b85037dbSmrg lalib_p=no 1247b85037dbSmrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 1248b85037dbSmrg for lalib_p_l in 1 2 3 4 1249b85037dbSmrg do 1250b85037dbSmrg read lalib_p_line 1251b85037dbSmrg case "$lalib_p_line" in 1252b85037dbSmrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 1253b85037dbSmrg esac 1254b85037dbSmrg done 1255b85037dbSmrg exec 0<&5 5<&- 1256b85037dbSmrg fi 1257b85037dbSmrg test "$lalib_p" = yes 1258b85037dbSmrg} 1259b85037dbSmrg 1260b85037dbSmrg# func_ltwrapper_script_p file 1261b85037dbSmrg# True iff FILE is a libtool wrapper script 1262b85037dbSmrg# This function is only a basic sanity check; it will hardly flush out 1263b85037dbSmrg# determined imposters. 1264b85037dbSmrgfunc_ltwrapper_script_p () 1265b85037dbSmrg{ 1266b85037dbSmrg func_lalib_p "$1" 1267b85037dbSmrg} 1268b85037dbSmrg 1269b85037dbSmrg# func_ltwrapper_executable_p file 1270b85037dbSmrg# True iff FILE is a libtool wrapper executable 1271b85037dbSmrg# This function is only a basic sanity check; it will hardly flush out 1272b85037dbSmrg# determined imposters. 1273b85037dbSmrgfunc_ltwrapper_executable_p () 1274b85037dbSmrg{ 1275b85037dbSmrg func_ltwrapper_exec_suffix= 1276b85037dbSmrg case $1 in 1277b85037dbSmrg *.exe) ;; 1278b85037dbSmrg *) func_ltwrapper_exec_suffix=.exe ;; 1279b85037dbSmrg esac 1280b85037dbSmrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 1281b85037dbSmrg} 1282b85037dbSmrg 1283b85037dbSmrg# func_ltwrapper_scriptname file 1284b85037dbSmrg# Assumes file is an ltwrapper_executable 1285b85037dbSmrg# uses $file to determine the appropriate filename for a 1286b85037dbSmrg# temporary ltwrapper_script. 1287b85037dbSmrgfunc_ltwrapper_scriptname () 1288b85037dbSmrg{ 1289302b15bdSmrg func_dirname_and_basename "$1" "" "." 1290302b15bdSmrg func_stripname '' '.exe' "$func_basename_result" 1291302b15bdSmrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 1292b85037dbSmrg} 1293b85037dbSmrg 1294b85037dbSmrg# func_ltwrapper_p file 1295b85037dbSmrg# True iff FILE is a libtool wrapper script or wrapper executable 1296b85037dbSmrg# This function is only a basic sanity check; it will hardly flush out 1297b85037dbSmrg# determined imposters. 1298b85037dbSmrgfunc_ltwrapper_p () 1299b85037dbSmrg{ 1300b85037dbSmrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 1301b85037dbSmrg} 1302b85037dbSmrg 1303b85037dbSmrg 1304b85037dbSmrg# func_execute_cmds commands fail_cmd 1305b85037dbSmrg# Execute tilde-delimited COMMANDS. 1306b85037dbSmrg# If FAIL_CMD is given, eval that upon failure. 1307b85037dbSmrg# FAIL_CMD may read-access the current command in variable CMD! 1308b85037dbSmrgfunc_execute_cmds () 1309b85037dbSmrg{ 1310b85037dbSmrg $opt_debug 1311b85037dbSmrg save_ifs=$IFS; IFS='~' 1312b85037dbSmrg for cmd in $1; do 1313b85037dbSmrg IFS=$save_ifs 1314b85037dbSmrg eval cmd=\"$cmd\" 1315b85037dbSmrg func_show_eval "$cmd" "${2-:}" 1316b85037dbSmrg done 1317b85037dbSmrg IFS=$save_ifs 1318b85037dbSmrg} 1319b85037dbSmrg 1320b85037dbSmrg 1321b85037dbSmrg# func_source file 1322b85037dbSmrg# Source FILE, adding directory component if necessary. 1323b85037dbSmrg# Note that it is not necessary on cygwin/mingw to append a dot to 1324b85037dbSmrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 1325b85037dbSmrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 1326b85037dbSmrg# `FILE.' does not work on cygwin managed mounts. 1327b85037dbSmrgfunc_source () 1328b85037dbSmrg{ 1329b85037dbSmrg $opt_debug 1330b85037dbSmrg case $1 in 1331b85037dbSmrg */* | *\\*) . "$1" ;; 1332b85037dbSmrg *) . "./$1" ;; 1333b85037dbSmrg esac 1334b85037dbSmrg} 1335b85037dbSmrg 1336b85037dbSmrg 1337302b15bdSmrg# func_resolve_sysroot PATH 1338302b15bdSmrg# Replace a leading = in PATH with a sysroot. Store the result into 1339302b15bdSmrg# func_resolve_sysroot_result 1340302b15bdSmrgfunc_resolve_sysroot () 1341302b15bdSmrg{ 1342302b15bdSmrg func_resolve_sysroot_result=$1 1343302b15bdSmrg case $func_resolve_sysroot_result in 1344302b15bdSmrg =*) 1345302b15bdSmrg func_stripname '=' '' "$func_resolve_sysroot_result" 1346302b15bdSmrg func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 1347302b15bdSmrg ;; 1348302b15bdSmrg esac 1349302b15bdSmrg} 1350302b15bdSmrg 1351302b15bdSmrg# func_replace_sysroot PATH 1352302b15bdSmrg# If PATH begins with the sysroot, replace it with = and 1353302b15bdSmrg# store the result into func_replace_sysroot_result. 1354302b15bdSmrgfunc_replace_sysroot () 1355302b15bdSmrg{ 1356302b15bdSmrg case "$lt_sysroot:$1" in 1357302b15bdSmrg ?*:"$lt_sysroot"*) 1358302b15bdSmrg func_stripname "$lt_sysroot" '' "$1" 1359302b15bdSmrg func_replace_sysroot_result="=$func_stripname_result" 1360302b15bdSmrg ;; 1361302b15bdSmrg *) 1362302b15bdSmrg # Including no sysroot. 1363302b15bdSmrg func_replace_sysroot_result=$1 1364302b15bdSmrg ;; 1365302b15bdSmrg esac 1366302b15bdSmrg} 1367302b15bdSmrg 1368b85037dbSmrg# func_infer_tag arg 1369b85037dbSmrg# Infer tagged configuration to use if any are available and 1370b85037dbSmrg# if one wasn't chosen via the "--tag" command line option. 1371b85037dbSmrg# Only attempt this if the compiler in the base compile 1372b85037dbSmrg# command doesn't match the default compiler. 1373b85037dbSmrg# arg is usually of the form 'gcc ...' 1374b85037dbSmrgfunc_infer_tag () 1375b85037dbSmrg{ 1376b85037dbSmrg $opt_debug 1377b85037dbSmrg if test -n "$available_tags" && test -z "$tagname"; then 1378b85037dbSmrg CC_quoted= 1379b85037dbSmrg for arg in $CC; do 1380302b15bdSmrg func_append_quoted CC_quoted "$arg" 1381b85037dbSmrg done 1382b85037dbSmrg CC_expanded=`func_echo_all $CC` 1383b85037dbSmrg CC_quoted_expanded=`func_echo_all $CC_quoted` 1384b85037dbSmrg case $@ in 1385b85037dbSmrg # Blanks in the command may have been stripped by the calling shell, 1386b85037dbSmrg # but not from the CC environment variable when configure was run. 1387b85037dbSmrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1388b85037dbSmrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 1389b85037dbSmrg # Blanks at the start of $base_compile will cause this to fail 1390b85037dbSmrg # if we don't check for them as well. 1391b85037dbSmrg *) 1392b85037dbSmrg for z in $available_tags; do 1393b85037dbSmrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 1394b85037dbSmrg # Evaluate the configuration. 1395b85037dbSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 1396b85037dbSmrg CC_quoted= 1397b85037dbSmrg for arg in $CC; do 1398b85037dbSmrg # Double-quote args containing other shell metacharacters. 1399302b15bdSmrg func_append_quoted CC_quoted "$arg" 1400b85037dbSmrg done 1401b85037dbSmrg CC_expanded=`func_echo_all $CC` 1402b85037dbSmrg CC_quoted_expanded=`func_echo_all $CC_quoted` 1403b85037dbSmrg case "$@ " in 1404b85037dbSmrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1405b85037dbSmrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 1406b85037dbSmrg # The compiler in the base compile command matches 1407b85037dbSmrg # the one in the tagged configuration. 1408b85037dbSmrg # Assume this is the tagged configuration we want. 1409b85037dbSmrg tagname=$z 1410b85037dbSmrg break 1411b85037dbSmrg ;; 1412b85037dbSmrg esac 1413b85037dbSmrg fi 1414b85037dbSmrg done 1415b85037dbSmrg # If $tagname still isn't set, then no tagged configuration 1416b85037dbSmrg # was found and let the user know that the "--tag" command 1417b85037dbSmrg # line option must be used. 1418b85037dbSmrg if test -z "$tagname"; then 1419b85037dbSmrg func_echo "unable to infer tagged configuration" 1420b85037dbSmrg func_fatal_error "specify a tag with \`--tag'" 1421b85037dbSmrg# else 1422b85037dbSmrg# func_verbose "using $tagname tagged configuration" 1423b85037dbSmrg fi 1424b85037dbSmrg ;; 1425b85037dbSmrg esac 1426b85037dbSmrg fi 1427b85037dbSmrg} 1428b85037dbSmrg 1429b85037dbSmrg 1430b85037dbSmrg 1431302b15bdSmrg# func_write_libtool_object output_name pic_name nonpic_name 1432302b15bdSmrg# Create a libtool object file (analogous to a ".la" file), 1433302b15bdSmrg# but don't create it if we're doing a dry run. 1434302b15bdSmrgfunc_write_libtool_object () 1435302b15bdSmrg{ 1436302b15bdSmrg write_libobj=${1} 1437302b15bdSmrg if test "$build_libtool_libs" = yes; then 1438302b15bdSmrg write_lobj=\'${2}\' 1439302b15bdSmrg else 1440302b15bdSmrg write_lobj=none 1441302b15bdSmrg fi 1442302b15bdSmrg 1443302b15bdSmrg if test "$build_old_libs" = yes; then 1444302b15bdSmrg write_oldobj=\'${3}\' 1445302b15bdSmrg else 1446302b15bdSmrg write_oldobj=none 1447302b15bdSmrg fi 1448302b15bdSmrg 1449302b15bdSmrg $opt_dry_run || { 1450302b15bdSmrg cat >${write_libobj}T <<EOF 1451302b15bdSmrg# $write_libobj - a libtool object file 1452302b15bdSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1453302b15bdSmrg# 1454302b15bdSmrg# Please DO NOT delete this file! 1455302b15bdSmrg# It is necessary for linking the library. 1456302b15bdSmrg 1457302b15bdSmrg# Name of the PIC object. 1458302b15bdSmrgpic_object=$write_lobj 1459302b15bdSmrg 1460302b15bdSmrg# Name of the non-PIC object 1461302b15bdSmrgnon_pic_object=$write_oldobj 1462302b15bdSmrg 1463302b15bdSmrgEOF 1464302b15bdSmrg $MV "${write_libobj}T" "${write_libobj}" 1465302b15bdSmrg } 1466302b15bdSmrg} 1467302b15bdSmrg 1468302b15bdSmrg 1469302b15bdSmrg################################################## 1470302b15bdSmrg# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 1471302b15bdSmrg################################################## 1472302b15bdSmrg 1473302b15bdSmrg# func_convert_core_file_wine_to_w32 ARG 1474302b15bdSmrg# Helper function used by file name conversion functions when $build is *nix, 1475302b15bdSmrg# and $host is mingw, cygwin, or some other w32 environment. Relies on a 1476302b15bdSmrg# correctly configured wine environment available, with the winepath program 1477302b15bdSmrg# in $build's $PATH. 1478302b15bdSmrg# 1479302b15bdSmrg# ARG is the $build file name to be converted to w32 format. 1480302b15bdSmrg# Result is available in $func_convert_core_file_wine_to_w32_result, and will 1481302b15bdSmrg# be empty on error (or when ARG is empty) 1482302b15bdSmrgfunc_convert_core_file_wine_to_w32 () 1483302b15bdSmrg{ 1484302b15bdSmrg $opt_debug 1485302b15bdSmrg func_convert_core_file_wine_to_w32_result="$1" 1486302b15bdSmrg if test -n "$1"; then 1487302b15bdSmrg # Unfortunately, winepath does not exit with a non-zero error code, so we 1488302b15bdSmrg # are forced to check the contents of stdout. On the other hand, if the 1489302b15bdSmrg # command is not found, the shell will set an exit code of 127 and print 1490302b15bdSmrg # *an error message* to stdout. So we must check for both error code of 1491302b15bdSmrg # zero AND non-empty stdout, which explains the odd construction: 1492302b15bdSmrg func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 1493302b15bdSmrg if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then 1494302b15bdSmrg func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 1495302b15bdSmrg $SED -e "$lt_sed_naive_backslashify"` 1496302b15bdSmrg else 1497302b15bdSmrg func_convert_core_file_wine_to_w32_result= 1498302b15bdSmrg fi 1499302b15bdSmrg fi 1500302b15bdSmrg} 1501302b15bdSmrg# end: func_convert_core_file_wine_to_w32 1502302b15bdSmrg 1503302b15bdSmrg 1504302b15bdSmrg# func_convert_core_path_wine_to_w32 ARG 1505302b15bdSmrg# Helper function used by path conversion functions when $build is *nix, and 1506302b15bdSmrg# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 1507302b15bdSmrg# configured wine environment available, with the winepath program in $build's 1508302b15bdSmrg# $PATH. Assumes ARG has no leading or trailing path separator characters. 1509302b15bdSmrg# 1510302b15bdSmrg# ARG is path to be converted from $build format to win32. 1511302b15bdSmrg# Result is available in $func_convert_core_path_wine_to_w32_result. 1512302b15bdSmrg# Unconvertible file (directory) names in ARG are skipped; if no directory names 1513302b15bdSmrg# are convertible, then the result may be empty. 1514302b15bdSmrgfunc_convert_core_path_wine_to_w32 () 1515302b15bdSmrg{ 1516302b15bdSmrg $opt_debug 1517302b15bdSmrg # unfortunately, winepath doesn't convert paths, only file names 1518302b15bdSmrg func_convert_core_path_wine_to_w32_result="" 1519302b15bdSmrg if test -n "$1"; then 1520302b15bdSmrg oldIFS=$IFS 1521302b15bdSmrg IFS=: 1522302b15bdSmrg for func_convert_core_path_wine_to_w32_f in $1; do 1523302b15bdSmrg IFS=$oldIFS 1524302b15bdSmrg func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 1525302b15bdSmrg if test -n "$func_convert_core_file_wine_to_w32_result" ; then 1526302b15bdSmrg if test -z "$func_convert_core_path_wine_to_w32_result"; then 1527302b15bdSmrg func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" 1528302b15bdSmrg else 1529302b15bdSmrg func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 1530302b15bdSmrg fi 1531302b15bdSmrg fi 1532302b15bdSmrg done 1533302b15bdSmrg IFS=$oldIFS 1534302b15bdSmrg fi 1535302b15bdSmrg} 1536302b15bdSmrg# end: func_convert_core_path_wine_to_w32 1537302b15bdSmrg 1538302b15bdSmrg 1539302b15bdSmrg# func_cygpath ARGS... 1540302b15bdSmrg# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 1541302b15bdSmrg# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 1542302b15bdSmrg# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 1543302b15bdSmrg# (2), returns the Cygwin file name or path in func_cygpath_result (input 1544302b15bdSmrg# file name or path is assumed to be in w32 format, as previously converted 1545302b15bdSmrg# from $build's *nix or MSYS format). In case (3), returns the w32 file name 1546302b15bdSmrg# or path in func_cygpath_result (input file name or path is assumed to be in 1547302b15bdSmrg# Cygwin format). Returns an empty string on error. 1548302b15bdSmrg# 1549302b15bdSmrg# ARGS are passed to cygpath, with the last one being the file name or path to 1550302b15bdSmrg# be converted. 1551302b15bdSmrg# 1552302b15bdSmrg# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 1553302b15bdSmrg# environment variable; do not put it in $PATH. 1554302b15bdSmrgfunc_cygpath () 1555302b15bdSmrg{ 1556302b15bdSmrg $opt_debug 1557302b15bdSmrg if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 1558302b15bdSmrg func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 1559302b15bdSmrg if test "$?" -ne 0; then 1560302b15bdSmrg # on failure, ensure result is empty 1561302b15bdSmrg func_cygpath_result= 1562302b15bdSmrg fi 1563302b15bdSmrg else 1564302b15bdSmrg func_cygpath_result= 1565302b15bdSmrg func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" 1566302b15bdSmrg fi 1567302b15bdSmrg} 1568302b15bdSmrg#end: func_cygpath 1569302b15bdSmrg 1570302b15bdSmrg 1571302b15bdSmrg# func_convert_core_msys_to_w32 ARG 1572302b15bdSmrg# Convert file name or path ARG from MSYS format to w32 format. Return 1573302b15bdSmrg# result in func_convert_core_msys_to_w32_result. 1574302b15bdSmrgfunc_convert_core_msys_to_w32 () 1575302b15bdSmrg{ 1576302b15bdSmrg $opt_debug 1577302b15bdSmrg # awkward: cmd appends spaces to result 1578302b15bdSmrg func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 1579302b15bdSmrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 1580302b15bdSmrg} 1581302b15bdSmrg#end: func_convert_core_msys_to_w32 1582302b15bdSmrg 1583302b15bdSmrg 1584302b15bdSmrg# func_convert_file_check ARG1 ARG2 1585302b15bdSmrg# Verify that ARG1 (a file name in $build format) was converted to $host 1586302b15bdSmrg# format in ARG2. Otherwise, emit an error message, but continue (resetting 1587302b15bdSmrg# func_to_host_file_result to ARG1). 1588302b15bdSmrgfunc_convert_file_check () 1589302b15bdSmrg{ 1590302b15bdSmrg $opt_debug 1591302b15bdSmrg if test -z "$2" && test -n "$1" ; then 1592302b15bdSmrg func_error "Could not determine host file name corresponding to" 1593302b15bdSmrg func_error " \`$1'" 1594302b15bdSmrg func_error "Continuing, but uninstalled executables may not work." 1595302b15bdSmrg # Fallback: 1596302b15bdSmrg func_to_host_file_result="$1" 1597302b15bdSmrg fi 1598302b15bdSmrg} 1599302b15bdSmrg# end func_convert_file_check 1600302b15bdSmrg 1601302b15bdSmrg 1602302b15bdSmrg# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 1603302b15bdSmrg# Verify that FROM_PATH (a path in $build format) was converted to $host 1604302b15bdSmrg# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 1605302b15bdSmrg# func_to_host_file_result to a simplistic fallback value (see below). 1606302b15bdSmrgfunc_convert_path_check () 1607302b15bdSmrg{ 1608302b15bdSmrg $opt_debug 1609302b15bdSmrg if test -z "$4" && test -n "$3"; then 1610302b15bdSmrg func_error "Could not determine the host path corresponding to" 1611302b15bdSmrg func_error " \`$3'" 1612302b15bdSmrg func_error "Continuing, but uninstalled executables may not work." 1613302b15bdSmrg # Fallback. This is a deliberately simplistic "conversion" and 1614302b15bdSmrg # should not be "improved". See libtool.info. 1615302b15bdSmrg if test "x$1" != "x$2"; then 1616302b15bdSmrg lt_replace_pathsep_chars="s|$1|$2|g" 1617302b15bdSmrg func_to_host_path_result=`echo "$3" | 1618302b15bdSmrg $SED -e "$lt_replace_pathsep_chars"` 1619302b15bdSmrg else 1620302b15bdSmrg func_to_host_path_result="$3" 1621302b15bdSmrg fi 1622302b15bdSmrg fi 1623302b15bdSmrg} 1624302b15bdSmrg# end func_convert_path_check 1625302b15bdSmrg 1626302b15bdSmrg 1627302b15bdSmrg# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 1628302b15bdSmrg# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 1629302b15bdSmrg# and appending REPL if ORIG matches BACKPAT. 1630302b15bdSmrgfunc_convert_path_front_back_pathsep () 1631302b15bdSmrg{ 1632302b15bdSmrg $opt_debug 1633302b15bdSmrg case $4 in 1634302b15bdSmrg $1 ) func_to_host_path_result="$3$func_to_host_path_result" 1635302b15bdSmrg ;; 1636302b15bdSmrg esac 1637302b15bdSmrg case $4 in 1638302b15bdSmrg $2 ) func_append func_to_host_path_result "$3" 1639302b15bdSmrg ;; 1640302b15bdSmrg esac 1641302b15bdSmrg} 1642302b15bdSmrg# end func_convert_path_front_back_pathsep 1643302b15bdSmrg 1644302b15bdSmrg 1645302b15bdSmrg################################################## 1646302b15bdSmrg# $build to $host FILE NAME CONVERSION FUNCTIONS # 1647302b15bdSmrg################################################## 1648302b15bdSmrg# invoked via `$to_host_file_cmd ARG' 1649302b15bdSmrg# 1650302b15bdSmrg# In each case, ARG is the path to be converted from $build to $host format. 1651302b15bdSmrg# Result will be available in $func_to_host_file_result. 1652302b15bdSmrg 1653302b15bdSmrg 1654302b15bdSmrg# func_to_host_file ARG 1655302b15bdSmrg# Converts the file name ARG from $build format to $host format. Return result 1656302b15bdSmrg# in func_to_host_file_result. 1657302b15bdSmrgfunc_to_host_file () 1658302b15bdSmrg{ 1659302b15bdSmrg $opt_debug 1660302b15bdSmrg $to_host_file_cmd "$1" 1661302b15bdSmrg} 1662302b15bdSmrg# end func_to_host_file 1663302b15bdSmrg 1664302b15bdSmrg 1665302b15bdSmrg# func_to_tool_file ARG LAZY 1666302b15bdSmrg# converts the file name ARG from $build format to toolchain format. Return 1667302b15bdSmrg# result in func_to_tool_file_result. If the conversion in use is listed 1668302b15bdSmrg# in (the comma separated) LAZY, no conversion takes place. 1669302b15bdSmrgfunc_to_tool_file () 1670302b15bdSmrg{ 1671302b15bdSmrg $opt_debug 1672302b15bdSmrg case ,$2, in 1673302b15bdSmrg *,"$to_tool_file_cmd",*) 1674302b15bdSmrg func_to_tool_file_result=$1 1675302b15bdSmrg ;; 1676302b15bdSmrg *) 1677302b15bdSmrg $to_tool_file_cmd "$1" 1678302b15bdSmrg func_to_tool_file_result=$func_to_host_file_result 1679302b15bdSmrg ;; 1680302b15bdSmrg esac 1681302b15bdSmrg} 1682302b15bdSmrg# end func_to_tool_file 1683302b15bdSmrg 1684302b15bdSmrg 1685302b15bdSmrg# func_convert_file_noop ARG 1686302b15bdSmrg# Copy ARG to func_to_host_file_result. 1687302b15bdSmrgfunc_convert_file_noop () 1688302b15bdSmrg{ 1689302b15bdSmrg func_to_host_file_result="$1" 1690302b15bdSmrg} 1691302b15bdSmrg# end func_convert_file_noop 1692302b15bdSmrg 1693302b15bdSmrg 1694302b15bdSmrg# func_convert_file_msys_to_w32 ARG 1695302b15bdSmrg# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 1696302b15bdSmrg# conversion to w32 is not available inside the cwrapper. Returns result in 1697302b15bdSmrg# func_to_host_file_result. 1698302b15bdSmrgfunc_convert_file_msys_to_w32 () 1699302b15bdSmrg{ 1700302b15bdSmrg $opt_debug 1701302b15bdSmrg func_to_host_file_result="$1" 1702302b15bdSmrg if test -n "$1"; then 1703302b15bdSmrg func_convert_core_msys_to_w32 "$1" 1704302b15bdSmrg func_to_host_file_result="$func_convert_core_msys_to_w32_result" 1705302b15bdSmrg fi 1706302b15bdSmrg func_convert_file_check "$1" "$func_to_host_file_result" 1707302b15bdSmrg} 1708302b15bdSmrg# end func_convert_file_msys_to_w32 1709302b15bdSmrg 1710302b15bdSmrg 1711302b15bdSmrg# func_convert_file_cygwin_to_w32 ARG 1712302b15bdSmrg# Convert file name ARG from Cygwin to w32 format. Returns result in 1713302b15bdSmrg# func_to_host_file_result. 1714302b15bdSmrgfunc_convert_file_cygwin_to_w32 () 1715302b15bdSmrg{ 1716302b15bdSmrg $opt_debug 1717302b15bdSmrg func_to_host_file_result="$1" 1718302b15bdSmrg if test -n "$1"; then 1719302b15bdSmrg # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 1720302b15bdSmrg # LT_CYGPATH in this case. 1721302b15bdSmrg func_to_host_file_result=`cygpath -m "$1"` 1722302b15bdSmrg fi 1723302b15bdSmrg func_convert_file_check "$1" "$func_to_host_file_result" 1724302b15bdSmrg} 1725302b15bdSmrg# end func_convert_file_cygwin_to_w32 1726302b15bdSmrg 1727302b15bdSmrg 1728302b15bdSmrg# func_convert_file_nix_to_w32 ARG 1729302b15bdSmrg# Convert file name ARG from *nix to w32 format. Requires a wine environment 1730302b15bdSmrg# and a working winepath. Returns result in func_to_host_file_result. 1731302b15bdSmrgfunc_convert_file_nix_to_w32 () 1732302b15bdSmrg{ 1733302b15bdSmrg $opt_debug 1734302b15bdSmrg func_to_host_file_result="$1" 1735302b15bdSmrg if test -n "$1"; then 1736302b15bdSmrg func_convert_core_file_wine_to_w32 "$1" 1737302b15bdSmrg func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" 1738302b15bdSmrg fi 1739302b15bdSmrg func_convert_file_check "$1" "$func_to_host_file_result" 1740302b15bdSmrg} 1741302b15bdSmrg# end func_convert_file_nix_to_w32 1742302b15bdSmrg 1743302b15bdSmrg 1744302b15bdSmrg# func_convert_file_msys_to_cygwin ARG 1745302b15bdSmrg# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 1746302b15bdSmrg# Returns result in func_to_host_file_result. 1747302b15bdSmrgfunc_convert_file_msys_to_cygwin () 1748302b15bdSmrg{ 1749302b15bdSmrg $opt_debug 1750302b15bdSmrg func_to_host_file_result="$1" 1751302b15bdSmrg if test -n "$1"; then 1752302b15bdSmrg func_convert_core_msys_to_w32 "$1" 1753302b15bdSmrg func_cygpath -u "$func_convert_core_msys_to_w32_result" 1754302b15bdSmrg func_to_host_file_result="$func_cygpath_result" 1755302b15bdSmrg fi 1756302b15bdSmrg func_convert_file_check "$1" "$func_to_host_file_result" 1757302b15bdSmrg} 1758302b15bdSmrg# end func_convert_file_msys_to_cygwin 1759302b15bdSmrg 1760302b15bdSmrg 1761302b15bdSmrg# func_convert_file_nix_to_cygwin ARG 1762302b15bdSmrg# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 1763302b15bdSmrg# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 1764302b15bdSmrg# in func_to_host_file_result. 1765302b15bdSmrgfunc_convert_file_nix_to_cygwin () 1766302b15bdSmrg{ 1767302b15bdSmrg $opt_debug 1768302b15bdSmrg func_to_host_file_result="$1" 1769302b15bdSmrg if test -n "$1"; then 1770302b15bdSmrg # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 1771302b15bdSmrg func_convert_core_file_wine_to_w32 "$1" 1772302b15bdSmrg func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 1773302b15bdSmrg func_to_host_file_result="$func_cygpath_result" 1774302b15bdSmrg fi 1775302b15bdSmrg func_convert_file_check "$1" "$func_to_host_file_result" 1776302b15bdSmrg} 1777302b15bdSmrg# end func_convert_file_nix_to_cygwin 1778302b15bdSmrg 1779302b15bdSmrg 1780302b15bdSmrg############################################# 1781302b15bdSmrg# $build to $host PATH CONVERSION FUNCTIONS # 1782302b15bdSmrg############################################# 1783302b15bdSmrg# invoked via `$to_host_path_cmd ARG' 1784302b15bdSmrg# 1785302b15bdSmrg# In each case, ARG is the path to be converted from $build to $host format. 1786302b15bdSmrg# The result will be available in $func_to_host_path_result. 1787302b15bdSmrg# 1788302b15bdSmrg# Path separators are also converted from $build format to $host format. If 1789302b15bdSmrg# ARG begins or ends with a path separator character, it is preserved (but 1790302b15bdSmrg# converted to $host format) on output. 1791302b15bdSmrg# 1792302b15bdSmrg# All path conversion functions are named using the following convention: 1793302b15bdSmrg# file name conversion function : func_convert_file_X_to_Y () 1794302b15bdSmrg# path conversion function : func_convert_path_X_to_Y () 1795302b15bdSmrg# where, for any given $build/$host combination the 'X_to_Y' value is the 1796302b15bdSmrg# same. If conversion functions are added for new $build/$host combinations, 1797302b15bdSmrg# the two new functions must follow this pattern, or func_init_to_host_path_cmd 1798302b15bdSmrg# will break. 1799302b15bdSmrg 1800302b15bdSmrg 1801302b15bdSmrg# func_init_to_host_path_cmd 1802302b15bdSmrg# Ensures that function "pointer" variable $to_host_path_cmd is set to the 1803302b15bdSmrg# appropriate value, based on the value of $to_host_file_cmd. 1804302b15bdSmrgto_host_path_cmd= 1805302b15bdSmrgfunc_init_to_host_path_cmd () 1806302b15bdSmrg{ 1807302b15bdSmrg $opt_debug 1808302b15bdSmrg if test -z "$to_host_path_cmd"; then 1809302b15bdSmrg func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 1810302b15bdSmrg to_host_path_cmd="func_convert_path_${func_stripname_result}" 1811302b15bdSmrg fi 1812302b15bdSmrg} 1813302b15bdSmrg 1814302b15bdSmrg 1815302b15bdSmrg# func_to_host_path ARG 1816302b15bdSmrg# Converts the path ARG from $build format to $host format. Return result 1817302b15bdSmrg# in func_to_host_path_result. 1818302b15bdSmrgfunc_to_host_path () 1819302b15bdSmrg{ 1820302b15bdSmrg $opt_debug 1821302b15bdSmrg func_init_to_host_path_cmd 1822302b15bdSmrg $to_host_path_cmd "$1" 1823302b15bdSmrg} 1824302b15bdSmrg# end func_to_host_path 1825302b15bdSmrg 1826302b15bdSmrg 1827302b15bdSmrg# func_convert_path_noop ARG 1828302b15bdSmrg# Copy ARG to func_to_host_path_result. 1829302b15bdSmrgfunc_convert_path_noop () 1830302b15bdSmrg{ 1831302b15bdSmrg func_to_host_path_result="$1" 1832302b15bdSmrg} 1833302b15bdSmrg# end func_convert_path_noop 1834302b15bdSmrg 1835302b15bdSmrg 1836302b15bdSmrg# func_convert_path_msys_to_w32 ARG 1837302b15bdSmrg# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 1838302b15bdSmrg# conversion to w32 is not available inside the cwrapper. Returns result in 1839302b15bdSmrg# func_to_host_path_result. 1840302b15bdSmrgfunc_convert_path_msys_to_w32 () 1841b85037dbSmrg{ 1842302b15bdSmrg $opt_debug 1843302b15bdSmrg func_to_host_path_result="$1" 1844302b15bdSmrg if test -n "$1"; then 1845302b15bdSmrg # Remove leading and trailing path separator characters from ARG. MSYS 1846302b15bdSmrg # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 1847302b15bdSmrg # and winepath ignores them completely. 1848302b15bdSmrg func_stripname : : "$1" 1849302b15bdSmrg func_to_host_path_tmp1=$func_stripname_result 1850302b15bdSmrg func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 1851302b15bdSmrg func_to_host_path_result="$func_convert_core_msys_to_w32_result" 1852302b15bdSmrg func_convert_path_check : ";" \ 1853302b15bdSmrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 1854302b15bdSmrg func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1855302b15bdSmrg fi 1856302b15bdSmrg} 1857302b15bdSmrg# end func_convert_path_msys_to_w32 1858b85037dbSmrg 1859b85037dbSmrg 1860302b15bdSmrg# func_convert_path_cygwin_to_w32 ARG 1861302b15bdSmrg# Convert path ARG from Cygwin to w32 format. Returns result in 1862302b15bdSmrg# func_to_host_file_result. 1863302b15bdSmrgfunc_convert_path_cygwin_to_w32 () 1864302b15bdSmrg{ 1865302b15bdSmrg $opt_debug 1866302b15bdSmrg func_to_host_path_result="$1" 1867302b15bdSmrg if test -n "$1"; then 1868302b15bdSmrg # See func_convert_path_msys_to_w32: 1869302b15bdSmrg func_stripname : : "$1" 1870302b15bdSmrg func_to_host_path_tmp1=$func_stripname_result 1871302b15bdSmrg func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 1872302b15bdSmrg func_convert_path_check : ";" \ 1873302b15bdSmrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 1874302b15bdSmrg func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1875302b15bdSmrg fi 1876302b15bdSmrg} 1877302b15bdSmrg# end func_convert_path_cygwin_to_w32 1878b85037dbSmrg 1879b85037dbSmrg 1880302b15bdSmrg# func_convert_path_nix_to_w32 ARG 1881302b15bdSmrg# Convert path ARG from *nix to w32 format. Requires a wine environment and 1882302b15bdSmrg# a working winepath. Returns result in func_to_host_file_result. 1883302b15bdSmrgfunc_convert_path_nix_to_w32 () 1884302b15bdSmrg{ 1885302b15bdSmrg $opt_debug 1886302b15bdSmrg func_to_host_path_result="$1" 1887302b15bdSmrg if test -n "$1"; then 1888302b15bdSmrg # See func_convert_path_msys_to_w32: 1889302b15bdSmrg func_stripname : : "$1" 1890302b15bdSmrg func_to_host_path_tmp1=$func_stripname_result 1891302b15bdSmrg func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 1892302b15bdSmrg func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" 1893302b15bdSmrg func_convert_path_check : ";" \ 1894302b15bdSmrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 1895302b15bdSmrg func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1896302b15bdSmrg fi 1897302b15bdSmrg} 1898302b15bdSmrg# end func_convert_path_nix_to_w32 1899b85037dbSmrg 1900302b15bdSmrg 1901302b15bdSmrg# func_convert_path_msys_to_cygwin ARG 1902302b15bdSmrg# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 1903302b15bdSmrg# Returns result in func_to_host_file_result. 1904302b15bdSmrgfunc_convert_path_msys_to_cygwin () 1905302b15bdSmrg{ 1906302b15bdSmrg $opt_debug 1907302b15bdSmrg func_to_host_path_result="$1" 1908302b15bdSmrg if test -n "$1"; then 1909302b15bdSmrg # See func_convert_path_msys_to_w32: 1910302b15bdSmrg func_stripname : : "$1" 1911302b15bdSmrg func_to_host_path_tmp1=$func_stripname_result 1912302b15bdSmrg func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 1913302b15bdSmrg func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 1914302b15bdSmrg func_to_host_path_result="$func_cygpath_result" 1915302b15bdSmrg func_convert_path_check : : \ 1916302b15bdSmrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 1917302b15bdSmrg func_convert_path_front_back_pathsep ":*" "*:" : "$1" 1918302b15bdSmrg fi 1919302b15bdSmrg} 1920302b15bdSmrg# end func_convert_path_msys_to_cygwin 1921302b15bdSmrg 1922302b15bdSmrg 1923302b15bdSmrg# func_convert_path_nix_to_cygwin ARG 1924302b15bdSmrg# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 1925302b15bdSmrg# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 1926302b15bdSmrg# func_to_host_file_result. 1927302b15bdSmrgfunc_convert_path_nix_to_cygwin () 1928302b15bdSmrg{ 1929302b15bdSmrg $opt_debug 1930302b15bdSmrg func_to_host_path_result="$1" 1931302b15bdSmrg if test -n "$1"; then 1932302b15bdSmrg # Remove leading and trailing path separator characters from 1933302b15bdSmrg # ARG. msys behavior is inconsistent here, cygpath turns them 1934302b15bdSmrg # into '.;' and ';.', and winepath ignores them completely. 1935302b15bdSmrg func_stripname : : "$1" 1936302b15bdSmrg func_to_host_path_tmp1=$func_stripname_result 1937302b15bdSmrg func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 1938302b15bdSmrg func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 1939302b15bdSmrg func_to_host_path_result="$func_cygpath_result" 1940302b15bdSmrg func_convert_path_check : : \ 1941302b15bdSmrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 1942302b15bdSmrg func_convert_path_front_back_pathsep ":*" "*:" : "$1" 1943302b15bdSmrg fi 1944b85037dbSmrg} 1945302b15bdSmrg# end func_convert_path_nix_to_cygwin 1946302b15bdSmrg 1947b85037dbSmrg 1948b85037dbSmrg# func_mode_compile arg... 1949b85037dbSmrgfunc_mode_compile () 1950b85037dbSmrg{ 1951b85037dbSmrg $opt_debug 1952b85037dbSmrg # Get the compilation command and the source file. 1953b85037dbSmrg base_compile= 1954b85037dbSmrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1955b85037dbSmrg suppress_opt=yes 1956b85037dbSmrg suppress_output= 1957b85037dbSmrg arg_mode=normal 1958b85037dbSmrg libobj= 1959b85037dbSmrg later= 1960b85037dbSmrg pie_flag= 1961b85037dbSmrg 1962b85037dbSmrg for arg 1963b85037dbSmrg do 1964b85037dbSmrg case $arg_mode in 1965b85037dbSmrg arg ) 1966b85037dbSmrg # do not "continue". Instead, add this to base_compile 1967b85037dbSmrg lastarg="$arg" 1968b85037dbSmrg arg_mode=normal 1969b85037dbSmrg ;; 1970b85037dbSmrg 1971b85037dbSmrg target ) 1972b85037dbSmrg libobj="$arg" 1973b85037dbSmrg arg_mode=normal 1974b85037dbSmrg continue 1975b85037dbSmrg ;; 1976b85037dbSmrg 1977b85037dbSmrg normal ) 1978b85037dbSmrg # Accept any command-line options. 1979b85037dbSmrg case $arg in 1980b85037dbSmrg -o) 1981b85037dbSmrg test -n "$libobj" && \ 1982b85037dbSmrg func_fatal_error "you cannot specify \`-o' more than once" 1983b85037dbSmrg arg_mode=target 1984b85037dbSmrg continue 1985b85037dbSmrg ;; 1986b85037dbSmrg 1987b85037dbSmrg -pie | -fpie | -fPIE) 1988302b15bdSmrg func_append pie_flag " $arg" 1989b85037dbSmrg continue 1990b85037dbSmrg ;; 1991b85037dbSmrg 1992b85037dbSmrg -shared | -static | -prefer-pic | -prefer-non-pic) 1993302b15bdSmrg func_append later " $arg" 1994b85037dbSmrg continue 1995b85037dbSmrg ;; 1996b85037dbSmrg 1997b85037dbSmrg -no-suppress) 1998b85037dbSmrg suppress_opt=no 1999b85037dbSmrg continue 2000b85037dbSmrg ;; 2001b85037dbSmrg 2002b85037dbSmrg -Xcompiler) 2003b85037dbSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 2004b85037dbSmrg continue # The current "srcfile" will either be retained or 2005b85037dbSmrg ;; # replaced later. I would guess that would be a bug. 2006b85037dbSmrg 2007b85037dbSmrg -Wc,*) 2008b85037dbSmrg func_stripname '-Wc,' '' "$arg" 2009b85037dbSmrg args=$func_stripname_result 2010b85037dbSmrg lastarg= 2011b85037dbSmrg save_ifs="$IFS"; IFS=',' 2012b85037dbSmrg for arg in $args; do 2013b85037dbSmrg IFS="$save_ifs" 2014302b15bdSmrg func_append_quoted lastarg "$arg" 2015b85037dbSmrg done 2016b85037dbSmrg IFS="$save_ifs" 2017b85037dbSmrg func_stripname ' ' '' "$lastarg" 2018b85037dbSmrg lastarg=$func_stripname_result 2019b85037dbSmrg 2020b85037dbSmrg # Add the arguments to base_compile. 2021302b15bdSmrg func_append base_compile " $lastarg" 2022b85037dbSmrg continue 2023b85037dbSmrg ;; 2024b85037dbSmrg 2025b85037dbSmrg *) 2026b85037dbSmrg # Accept the current argument as the source file. 2027b85037dbSmrg # The previous "srcfile" becomes the current argument. 2028b85037dbSmrg # 2029b85037dbSmrg lastarg="$srcfile" 2030b85037dbSmrg srcfile="$arg" 2031b85037dbSmrg ;; 2032b85037dbSmrg esac # case $arg 2033b85037dbSmrg ;; 2034b85037dbSmrg esac # case $arg_mode 2035b85037dbSmrg 2036b85037dbSmrg # Aesthetically quote the previous argument. 2037302b15bdSmrg func_append_quoted base_compile "$lastarg" 2038b85037dbSmrg done # for arg 2039b85037dbSmrg 2040b85037dbSmrg case $arg_mode in 2041b85037dbSmrg arg) 2042b85037dbSmrg func_fatal_error "you must specify an argument for -Xcompile" 2043b85037dbSmrg ;; 2044b85037dbSmrg target) 2045b85037dbSmrg func_fatal_error "you must specify a target with \`-o'" 2046b85037dbSmrg ;; 2047b85037dbSmrg *) 2048b85037dbSmrg # Get the name of the library object. 2049b85037dbSmrg test -z "$libobj" && { 2050b85037dbSmrg func_basename "$srcfile" 2051b85037dbSmrg libobj="$func_basename_result" 2052b85037dbSmrg } 2053b85037dbSmrg ;; 2054b85037dbSmrg esac 2055b85037dbSmrg 2056b85037dbSmrg # Recognize several different file suffixes. 2057b85037dbSmrg # If the user specifies -o file.o, it is replaced with file.lo 2058b85037dbSmrg case $libobj in 2059b85037dbSmrg *.[cCFSifmso] | \ 2060b85037dbSmrg *.ada | *.adb | *.ads | *.asm | \ 2061b85037dbSmrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 2062b85037dbSmrg *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) 2063b85037dbSmrg func_xform "$libobj" 2064b85037dbSmrg libobj=$func_xform_result 2065b85037dbSmrg ;; 2066b85037dbSmrg esac 2067b85037dbSmrg 2068b85037dbSmrg case $libobj in 2069b85037dbSmrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 2070b85037dbSmrg *) 2071b85037dbSmrg func_fatal_error "cannot determine name of library object from \`$libobj'" 2072b85037dbSmrg ;; 2073b85037dbSmrg esac 2074b85037dbSmrg 2075b85037dbSmrg func_infer_tag $base_compile 2076b85037dbSmrg 2077b85037dbSmrg for arg in $later; do 2078b85037dbSmrg case $arg in 2079b85037dbSmrg -shared) 2080b85037dbSmrg test "$build_libtool_libs" != yes && \ 2081b85037dbSmrg func_fatal_configuration "can not build a shared library" 2082b85037dbSmrg build_old_libs=no 2083b85037dbSmrg continue 2084b85037dbSmrg ;; 2085b85037dbSmrg 2086b85037dbSmrg -static) 2087b85037dbSmrg build_libtool_libs=no 2088b85037dbSmrg build_old_libs=yes 2089b85037dbSmrg continue 2090b85037dbSmrg ;; 2091b85037dbSmrg 2092b85037dbSmrg -prefer-pic) 2093b85037dbSmrg pic_mode=yes 2094b85037dbSmrg continue 2095b85037dbSmrg ;; 2096b85037dbSmrg 2097b85037dbSmrg -prefer-non-pic) 2098b85037dbSmrg pic_mode=no 2099b85037dbSmrg continue 2100b85037dbSmrg ;; 2101b85037dbSmrg esac 2102b85037dbSmrg done 2103b85037dbSmrg 2104b85037dbSmrg func_quote_for_eval "$libobj" 2105b85037dbSmrg test "X$libobj" != "X$func_quote_for_eval_result" \ 2106b85037dbSmrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 2107b85037dbSmrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 2108b85037dbSmrg func_dirname_and_basename "$obj" "/" "" 2109b85037dbSmrg objname="$func_basename_result" 2110b85037dbSmrg xdir="$func_dirname_result" 2111b85037dbSmrg lobj=${xdir}$objdir/$objname 2112b85037dbSmrg 2113b85037dbSmrg test -z "$base_compile" && \ 2114b85037dbSmrg func_fatal_help "you must specify a compilation command" 2115b85037dbSmrg 2116b85037dbSmrg # Delete any leftover library objects. 2117b85037dbSmrg if test "$build_old_libs" = yes; then 2118b85037dbSmrg removelist="$obj $lobj $libobj ${libobj}T" 2119b85037dbSmrg else 2120b85037dbSmrg removelist="$lobj $libobj ${libobj}T" 2121b85037dbSmrg fi 2122b85037dbSmrg 2123b85037dbSmrg # On Cygwin there's no "real" PIC flag so we must build both object types 2124b85037dbSmrg case $host_os in 2125b85037dbSmrg cygwin* | mingw* | pw32* | os2* | cegcc*) 2126b85037dbSmrg pic_mode=default 2127b85037dbSmrg ;; 2128b85037dbSmrg esac 2129b85037dbSmrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 2130b85037dbSmrg # non-PIC code in shared libraries is not supported 2131b85037dbSmrg pic_mode=default 2132b85037dbSmrg fi 2133b85037dbSmrg 2134b85037dbSmrg # Calculate the filename of the output object if compiler does 2135b85037dbSmrg # not support -o with -c 2136b85037dbSmrg if test "$compiler_c_o" = no; then 2137b85037dbSmrg output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 2138b85037dbSmrg lockfile="$output_obj.lock" 2139b85037dbSmrg else 2140b85037dbSmrg output_obj= 2141b85037dbSmrg need_locks=no 2142b85037dbSmrg lockfile= 2143b85037dbSmrg fi 2144b85037dbSmrg 2145b85037dbSmrg # Lock this critical section if it is needed 2146b85037dbSmrg # We use this script file to make the link, it avoids creating a new file 2147b85037dbSmrg if test "$need_locks" = yes; then 2148b85037dbSmrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 2149b85037dbSmrg func_echo "Waiting for $lockfile to be removed" 2150b85037dbSmrg sleep 2 2151b85037dbSmrg done 2152b85037dbSmrg elif test "$need_locks" = warn; then 2153b85037dbSmrg if test -f "$lockfile"; then 2154b85037dbSmrg $ECHO "\ 2155b85037dbSmrg*** ERROR, $lockfile exists and contains: 2156b85037dbSmrg`cat $lockfile 2>/dev/null` 2157b85037dbSmrg 2158b85037dbSmrgThis indicates that another process is trying to use the same 2159b85037dbSmrgtemporary object file, and libtool could not work around it because 2160b85037dbSmrgyour compiler does not support \`-c' and \`-o' together. If you 2161b85037dbSmrgrepeat this compilation, it may succeed, by chance, but you had better 2162b85037dbSmrgavoid parallel builds (make -j) in this platform, or get a better 2163b85037dbSmrgcompiler." 2164b85037dbSmrg 2165b85037dbSmrg $opt_dry_run || $RM $removelist 2166b85037dbSmrg exit $EXIT_FAILURE 2167b85037dbSmrg fi 2168302b15bdSmrg func_append removelist " $output_obj" 2169b85037dbSmrg $ECHO "$srcfile" > "$lockfile" 2170b85037dbSmrg fi 2171b85037dbSmrg 2172b85037dbSmrg $opt_dry_run || $RM $removelist 2173302b15bdSmrg func_append removelist " $lockfile" 2174b85037dbSmrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 2175b85037dbSmrg 2176302b15bdSmrg func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 2177302b15bdSmrg srcfile=$func_to_tool_file_result 2178b85037dbSmrg func_quote_for_eval "$srcfile" 2179b85037dbSmrg qsrcfile=$func_quote_for_eval_result 2180b85037dbSmrg 2181b85037dbSmrg # Only build a PIC object if we are building libtool libraries. 2182b85037dbSmrg if test "$build_libtool_libs" = yes; then 2183b85037dbSmrg # Without this assignment, base_compile gets emptied. 2184b85037dbSmrg fbsd_hideous_sh_bug=$base_compile 2185b85037dbSmrg 2186b85037dbSmrg if test "$pic_mode" != no; then 2187b85037dbSmrg command="$base_compile $qsrcfile $pic_flag" 2188b85037dbSmrg else 2189b85037dbSmrg # Don't build PIC code 2190b85037dbSmrg command="$base_compile $qsrcfile" 2191b85037dbSmrg fi 2192b85037dbSmrg 2193b85037dbSmrg func_mkdir_p "$xdir$objdir" 2194b85037dbSmrg 2195b85037dbSmrg if test -z "$output_obj"; then 2196b85037dbSmrg # Place PIC objects in $objdir 2197302b15bdSmrg func_append command " -o $lobj" 2198b85037dbSmrg fi 2199b85037dbSmrg 2200b85037dbSmrg func_show_eval_locale "$command" \ 2201b85037dbSmrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 2202b85037dbSmrg 2203b85037dbSmrg if test "$need_locks" = warn && 2204b85037dbSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2205b85037dbSmrg $ECHO "\ 2206b85037dbSmrg*** ERROR, $lockfile contains: 2207b85037dbSmrg`cat $lockfile 2>/dev/null` 2208b85037dbSmrg 2209b85037dbSmrgbut it should contain: 2210b85037dbSmrg$srcfile 2211b85037dbSmrg 2212b85037dbSmrgThis indicates that another process is trying to use the same 2213b85037dbSmrgtemporary object file, and libtool could not work around it because 2214b85037dbSmrgyour compiler does not support \`-c' and \`-o' together. If you 2215b85037dbSmrgrepeat this compilation, it may succeed, by chance, but you had better 2216b85037dbSmrgavoid parallel builds (make -j) in this platform, or get a better 2217b85037dbSmrgcompiler." 2218b85037dbSmrg 2219b85037dbSmrg $opt_dry_run || $RM $removelist 2220b85037dbSmrg exit $EXIT_FAILURE 2221b85037dbSmrg fi 2222b85037dbSmrg 2223b85037dbSmrg # Just move the object if needed, then go on to compile the next one 2224b85037dbSmrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 2225b85037dbSmrg func_show_eval '$MV "$output_obj" "$lobj"' \ 2226b85037dbSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2227b85037dbSmrg fi 2228b85037dbSmrg 2229b85037dbSmrg # Allow error messages only from the first compilation. 2230b85037dbSmrg if test "$suppress_opt" = yes; then 2231b85037dbSmrg suppress_output=' >/dev/null 2>&1' 2232b85037dbSmrg fi 2233b85037dbSmrg fi 2234b85037dbSmrg 2235b85037dbSmrg # Only build a position-dependent object if we build old libraries. 2236b85037dbSmrg if test "$build_old_libs" = yes; then 2237b85037dbSmrg if test "$pic_mode" != yes; then 2238b85037dbSmrg # Don't build PIC code 2239b85037dbSmrg command="$base_compile $qsrcfile$pie_flag" 2240b85037dbSmrg else 2241b85037dbSmrg command="$base_compile $qsrcfile $pic_flag" 2242b85037dbSmrg fi 2243b85037dbSmrg if test "$compiler_c_o" = yes; then 2244302b15bdSmrg func_append command " -o $obj" 2245b85037dbSmrg fi 2246b85037dbSmrg 2247b85037dbSmrg # Suppress compiler output if we already did a PIC compilation. 2248302b15bdSmrg func_append command "$suppress_output" 2249b85037dbSmrg func_show_eval_locale "$command" \ 2250b85037dbSmrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 2251b85037dbSmrg 2252b85037dbSmrg if test "$need_locks" = warn && 2253b85037dbSmrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2254b85037dbSmrg $ECHO "\ 2255b85037dbSmrg*** ERROR, $lockfile contains: 2256b85037dbSmrg`cat $lockfile 2>/dev/null` 2257b85037dbSmrg 2258b85037dbSmrgbut it should contain: 2259b85037dbSmrg$srcfile 2260b85037dbSmrg 2261b85037dbSmrgThis indicates that another process is trying to use the same 2262b85037dbSmrgtemporary object file, and libtool could not work around it because 2263b85037dbSmrgyour compiler does not support \`-c' and \`-o' together. If you 2264b85037dbSmrgrepeat this compilation, it may succeed, by chance, but you had better 2265b85037dbSmrgavoid parallel builds (make -j) in this platform, or get a better 2266b85037dbSmrgcompiler." 2267b85037dbSmrg 2268b85037dbSmrg $opt_dry_run || $RM $removelist 2269b85037dbSmrg exit $EXIT_FAILURE 2270b85037dbSmrg fi 2271b85037dbSmrg 2272b85037dbSmrg # Just move the object if needed 2273b85037dbSmrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 2274b85037dbSmrg func_show_eval '$MV "$output_obj" "$obj"' \ 2275b85037dbSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2276b85037dbSmrg fi 2277b85037dbSmrg fi 2278b85037dbSmrg 2279b85037dbSmrg $opt_dry_run || { 2280b85037dbSmrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 2281b85037dbSmrg 2282b85037dbSmrg # Unlock the critical section if it was locked 2283b85037dbSmrg if test "$need_locks" != no; then 2284b85037dbSmrg removelist=$lockfile 2285b85037dbSmrg $RM "$lockfile" 2286b85037dbSmrg fi 2287b85037dbSmrg } 2288b85037dbSmrg 2289b85037dbSmrg exit $EXIT_SUCCESS 2290b85037dbSmrg} 2291b85037dbSmrg 2292b85037dbSmrg$opt_help || { 2293302b15bdSmrg test "$opt_mode" = compile && func_mode_compile ${1+"$@"} 2294b85037dbSmrg} 2295b85037dbSmrg 2296b85037dbSmrgfunc_mode_help () 2297b85037dbSmrg{ 2298b85037dbSmrg # We need to display help for each of the modes. 2299302b15bdSmrg case $opt_mode in 2300b85037dbSmrg "") 2301b85037dbSmrg # Generic help is extracted from the usage comments 2302b85037dbSmrg # at the start of this file. 2303b85037dbSmrg func_help 2304b85037dbSmrg ;; 2305b85037dbSmrg 2306b85037dbSmrg clean) 2307b85037dbSmrg $ECHO \ 2308b85037dbSmrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 2309b85037dbSmrg 2310b85037dbSmrgRemove files from the build directory. 2311b85037dbSmrg 2312b85037dbSmrgRM is the name of the program to use to delete files associated with each FILE 2313b85037dbSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2314b85037dbSmrgto RM. 2315b85037dbSmrg 2316b85037dbSmrgIf FILE is a libtool library, object or program, all the files associated 2317b85037dbSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 2318b85037dbSmrg ;; 2319b85037dbSmrg 2320b85037dbSmrg compile) 2321b85037dbSmrg $ECHO \ 2322b85037dbSmrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 2323b85037dbSmrg 2324b85037dbSmrgCompile a source file into a libtool library object. 2325b85037dbSmrg 2326b85037dbSmrgThis mode accepts the following additional options: 2327b85037dbSmrg 2328b85037dbSmrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 2329b85037dbSmrg -no-suppress do not suppress compiler output for multiple passes 2330b85037dbSmrg -prefer-pic try to build PIC objects only 2331b85037dbSmrg -prefer-non-pic try to build non-PIC objects only 2332b85037dbSmrg -shared do not build a \`.o' file suitable for static linking 2333b85037dbSmrg -static only build a \`.o' file suitable for static linking 2334b85037dbSmrg -Wc,FLAG pass FLAG directly to the compiler 2335b85037dbSmrg 2336b85037dbSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 2337b85037dbSmrgfrom the given SOURCEFILE. 2338b85037dbSmrg 2339b85037dbSmrgThe output file name is determined by removing the directory component from 2340b85037dbSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 2341b85037dbSmrglibrary object suffix, \`.lo'." 2342b85037dbSmrg ;; 2343b85037dbSmrg 2344b85037dbSmrg execute) 2345b85037dbSmrg $ECHO \ 2346b85037dbSmrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 2347b85037dbSmrg 2348b85037dbSmrgAutomatically set library path, then run a program. 2349b85037dbSmrg 2350b85037dbSmrgThis mode accepts the following additional options: 2351b85037dbSmrg 2352b85037dbSmrg -dlopen FILE add the directory containing FILE to the library path 2353b85037dbSmrg 2354b85037dbSmrgThis mode sets the library path environment variable according to \`-dlopen' 2355b85037dbSmrgflags. 2356b85037dbSmrg 2357b85037dbSmrgIf any of the ARGS are libtool executable wrappers, then they are translated 2358b85037dbSmrginto their corresponding uninstalled binary, and any of their required library 2359b85037dbSmrgdirectories are added to the library path. 2360b85037dbSmrg 2361b85037dbSmrgThen, COMMAND is executed, with ARGS as arguments." 2362b85037dbSmrg ;; 2363b85037dbSmrg 2364b85037dbSmrg finish) 2365b85037dbSmrg $ECHO \ 2366b85037dbSmrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 2367b85037dbSmrg 2368b85037dbSmrgComplete the installation of libtool libraries. 2369b85037dbSmrg 2370b85037dbSmrgEach LIBDIR is a directory that contains libtool libraries. 2371b85037dbSmrg 2372b85037dbSmrgThe commands that this mode executes may require superuser privileges. Use 2373b85037dbSmrgthe \`--dry-run' option if you just want to see what would be executed." 2374b85037dbSmrg ;; 2375b85037dbSmrg 2376b85037dbSmrg install) 2377b85037dbSmrg $ECHO \ 2378b85037dbSmrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 2379b85037dbSmrg 2380b85037dbSmrgInstall executables or libraries. 2381b85037dbSmrg 2382b85037dbSmrgINSTALL-COMMAND is the installation command. The first component should be 2383b85037dbSmrgeither the \`install' or \`cp' program. 2384b85037dbSmrg 2385b85037dbSmrgThe following components of INSTALL-COMMAND are treated specially: 2386b85037dbSmrg 2387b85037dbSmrg -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 2388b85037dbSmrg 2389b85037dbSmrgThe rest of the components are interpreted as arguments to that command (only 2390b85037dbSmrgBSD-compatible install options are recognized)." 2391b85037dbSmrg ;; 2392b85037dbSmrg 2393b85037dbSmrg link) 2394b85037dbSmrg $ECHO \ 2395b85037dbSmrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 2396b85037dbSmrg 2397b85037dbSmrgLink object files or libraries together to form another library, or to 2398b85037dbSmrgcreate an executable program. 2399b85037dbSmrg 2400b85037dbSmrgLINK-COMMAND is a command using the C compiler that you would use to create 2401b85037dbSmrga program from several object files. 2402b85037dbSmrg 2403b85037dbSmrgThe following components of LINK-COMMAND are treated specially: 2404b85037dbSmrg 2405b85037dbSmrg -all-static do not do any dynamic linking at all 2406b85037dbSmrg -avoid-version do not add a version suffix if possible 2407b85037dbSmrg -bindir BINDIR specify path to binaries directory (for systems where 2408b85037dbSmrg libraries must be found in the PATH setting at runtime) 2409b85037dbSmrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 2410b85037dbSmrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 2411b85037dbSmrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 2412b85037dbSmrg -export-symbols SYMFILE 2413b85037dbSmrg try to export only the symbols listed in SYMFILE 2414b85037dbSmrg -export-symbols-regex REGEX 2415b85037dbSmrg try to export only the symbols matching REGEX 2416b85037dbSmrg -LLIBDIR search LIBDIR for required installed libraries 2417b85037dbSmrg -lNAME OUTPUT-FILE requires the installed library libNAME 2418b85037dbSmrg -module build a library that can dlopened 2419b85037dbSmrg -no-fast-install disable the fast-install mode 2420b85037dbSmrg -no-install link a not-installable executable 2421b85037dbSmrg -no-undefined declare that a library does not refer to external symbols 2422b85037dbSmrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 2423b85037dbSmrg -objectlist FILE Use a list of object files found in FILE to specify objects 2424b85037dbSmrg -precious-files-regex REGEX 2425b85037dbSmrg don't remove output files matching REGEX 2426b85037dbSmrg -release RELEASE specify package release information 2427b85037dbSmrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 2428b85037dbSmrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 2429b85037dbSmrg -shared only do dynamic linking of libtool libraries 2430b85037dbSmrg -shrext SUFFIX override the standard shared library file extension 2431b85037dbSmrg -static do not do any dynamic linking of uninstalled libtool libraries 2432b85037dbSmrg -static-libtool-libs 2433b85037dbSmrg do not do any dynamic linking of libtool libraries 2434b85037dbSmrg -version-info CURRENT[:REVISION[:AGE]] 2435b85037dbSmrg specify library version info [each variable defaults to 0] 2436b85037dbSmrg -weak LIBNAME declare that the target provides the LIBNAME interface 2437b85037dbSmrg -Wc,FLAG 2438b85037dbSmrg -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 2439b85037dbSmrg -Wl,FLAG 2440b85037dbSmrg -Xlinker FLAG pass linker-specific FLAG directly to the linker 2441b85037dbSmrg -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 2442b85037dbSmrg 2443b85037dbSmrgAll other options (arguments beginning with \`-') are ignored. 2444b85037dbSmrg 2445b85037dbSmrgEvery other argument is treated as a filename. Files ending in \`.la' are 2446b85037dbSmrgtreated as uninstalled libtool libraries, other files are standard or library 2447b85037dbSmrgobject files. 2448b85037dbSmrg 2449b85037dbSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 2450b85037dbSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 2451b85037dbSmrgrequired, except when creating a convenience library. 2452b85037dbSmrg 2453b85037dbSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 2454b85037dbSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 2455b85037dbSmrg 2456b85037dbSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 2457b85037dbSmrgis created, otherwise an executable program is created." 2458b85037dbSmrg ;; 2459b85037dbSmrg 2460b85037dbSmrg uninstall) 2461b85037dbSmrg $ECHO \ 2462b85037dbSmrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 2463b85037dbSmrg 2464b85037dbSmrgRemove libraries from an installation directory. 2465b85037dbSmrg 2466b85037dbSmrgRM is the name of the program to use to delete files associated with each FILE 2467b85037dbSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2468b85037dbSmrgto RM. 2469b85037dbSmrg 2470b85037dbSmrgIf FILE is a libtool library, all the files associated with it are deleted. 2471b85037dbSmrgOtherwise, only FILE itself is deleted using RM." 2472b85037dbSmrg ;; 2473b85037dbSmrg 2474b85037dbSmrg *) 2475302b15bdSmrg func_fatal_help "invalid operation mode \`$opt_mode'" 2476b85037dbSmrg ;; 2477b85037dbSmrg esac 2478b85037dbSmrg 2479b85037dbSmrg echo 2480b85037dbSmrg $ECHO "Try \`$progname --help' for more information about other modes." 2481b85037dbSmrg} 2482b85037dbSmrg 2483b85037dbSmrg# Now that we've collected a possible --mode arg, show help if necessary 2484b85037dbSmrgif $opt_help; then 2485b85037dbSmrg if test "$opt_help" = :; then 2486b85037dbSmrg func_mode_help 2487b85037dbSmrg else 2488b85037dbSmrg { 2489b85037dbSmrg func_help noexit 2490302b15bdSmrg for opt_mode in compile link execute install finish uninstall clean; do 2491b85037dbSmrg func_mode_help 2492b85037dbSmrg done 2493b85037dbSmrg } | sed -n '1p; 2,$s/^Usage:/ or: /p' 2494b85037dbSmrg { 2495b85037dbSmrg func_help noexit 2496302b15bdSmrg for opt_mode in compile link execute install finish uninstall clean; do 2497b85037dbSmrg echo 2498b85037dbSmrg func_mode_help 2499b85037dbSmrg done 2500b85037dbSmrg } | 2501b85037dbSmrg sed '1d 2502b85037dbSmrg /^When reporting/,/^Report/{ 2503b85037dbSmrg H 2504b85037dbSmrg d 2505b85037dbSmrg } 2506b85037dbSmrg $x 2507b85037dbSmrg /information about other modes/d 2508b85037dbSmrg /more detailed .*MODE/d 2509b85037dbSmrg s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 2510b85037dbSmrg fi 2511b85037dbSmrg exit $? 2512b85037dbSmrgfi 2513b85037dbSmrg 2514b85037dbSmrg 2515b85037dbSmrg# func_mode_execute arg... 2516b85037dbSmrgfunc_mode_execute () 2517b85037dbSmrg{ 2518b85037dbSmrg $opt_debug 2519b85037dbSmrg # The first argument is the command name. 2520b85037dbSmrg cmd="$nonopt" 2521b85037dbSmrg test -z "$cmd" && \ 2522b85037dbSmrg func_fatal_help "you must specify a COMMAND" 2523b85037dbSmrg 2524b85037dbSmrg # Handle -dlopen flags immediately. 2525302b15bdSmrg for file in $opt_dlopen; do 2526b85037dbSmrg test -f "$file" \ 2527b85037dbSmrg || func_fatal_help "\`$file' is not a file" 2528b85037dbSmrg 2529b85037dbSmrg dir= 2530b85037dbSmrg case $file in 2531b85037dbSmrg *.la) 2532302b15bdSmrg func_resolve_sysroot "$file" 2533302b15bdSmrg file=$func_resolve_sysroot_result 2534302b15bdSmrg 2535b85037dbSmrg # Check to see that this really is a libtool archive. 2536b85037dbSmrg func_lalib_unsafe_p "$file" \ 2537b85037dbSmrg || func_fatal_help "\`$lib' is not a valid libtool archive" 2538b85037dbSmrg 2539b85037dbSmrg # Read the libtool library. 2540b85037dbSmrg dlname= 2541b85037dbSmrg library_names= 2542b85037dbSmrg func_source "$file" 2543b85037dbSmrg 2544b85037dbSmrg # Skip this library if it cannot be dlopened. 2545b85037dbSmrg if test -z "$dlname"; then 2546b85037dbSmrg # Warn if it was a shared library. 2547b85037dbSmrg test -n "$library_names" && \ 2548b85037dbSmrg func_warning "\`$file' was not linked with \`-export-dynamic'" 2549b85037dbSmrg continue 2550b85037dbSmrg fi 2551b85037dbSmrg 2552b85037dbSmrg func_dirname "$file" "" "." 2553b85037dbSmrg dir="$func_dirname_result" 2554b85037dbSmrg 2555b85037dbSmrg if test -f "$dir/$objdir/$dlname"; then 2556302b15bdSmrg func_append dir "/$objdir" 2557b85037dbSmrg else 2558b85037dbSmrg if test ! -f "$dir/$dlname"; then 2559b85037dbSmrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 2560b85037dbSmrg fi 2561b85037dbSmrg fi 2562b85037dbSmrg ;; 2563b85037dbSmrg 2564b85037dbSmrg *.lo) 2565b85037dbSmrg # Just add the directory containing the .lo file. 2566b85037dbSmrg func_dirname "$file" "" "." 2567b85037dbSmrg dir="$func_dirname_result" 2568b85037dbSmrg ;; 2569b85037dbSmrg 2570b85037dbSmrg *) 2571b85037dbSmrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 2572b85037dbSmrg continue 2573b85037dbSmrg ;; 2574b85037dbSmrg esac 2575b85037dbSmrg 2576b85037dbSmrg # Get the absolute pathname. 2577b85037dbSmrg absdir=`cd "$dir" && pwd` 2578b85037dbSmrg test -n "$absdir" && dir="$absdir" 2579b85037dbSmrg 2580b85037dbSmrg # Now add the directory to shlibpath_var. 2581b85037dbSmrg if eval "test -z \"\$$shlibpath_var\""; then 2582b85037dbSmrg eval "$shlibpath_var=\"\$dir\"" 2583b85037dbSmrg else 2584b85037dbSmrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 2585b85037dbSmrg fi 2586b85037dbSmrg done 2587b85037dbSmrg 2588b85037dbSmrg # This variable tells wrapper scripts just to set shlibpath_var 2589b85037dbSmrg # rather than running their programs. 2590b85037dbSmrg libtool_execute_magic="$magic" 2591b85037dbSmrg 2592b85037dbSmrg # Check if any of the arguments is a wrapper script. 2593b85037dbSmrg args= 2594b85037dbSmrg for file 2595b85037dbSmrg do 2596b85037dbSmrg case $file in 2597b85037dbSmrg -* | *.la | *.lo ) ;; 2598b85037dbSmrg *) 2599b85037dbSmrg # Do a test to see if this is really a libtool program. 2600b85037dbSmrg if func_ltwrapper_script_p "$file"; then 2601b85037dbSmrg func_source "$file" 2602b85037dbSmrg # Transform arg to wrapped name. 2603b85037dbSmrg file="$progdir/$program" 2604b85037dbSmrg elif func_ltwrapper_executable_p "$file"; then 2605b85037dbSmrg func_ltwrapper_scriptname "$file" 2606b85037dbSmrg func_source "$func_ltwrapper_scriptname_result" 2607b85037dbSmrg # Transform arg to wrapped name. 2608b85037dbSmrg file="$progdir/$program" 2609b85037dbSmrg fi 2610b85037dbSmrg ;; 2611b85037dbSmrg esac 2612b85037dbSmrg # Quote arguments (to preserve shell metacharacters). 2613302b15bdSmrg func_append_quoted args "$file" 2614b85037dbSmrg done 2615b85037dbSmrg 2616b85037dbSmrg if test "X$opt_dry_run" = Xfalse; then 2617b85037dbSmrg if test -n "$shlibpath_var"; then 2618b85037dbSmrg # Export the shlibpath_var. 2619b85037dbSmrg eval "export $shlibpath_var" 2620b85037dbSmrg fi 2621b85037dbSmrg 2622b85037dbSmrg # Restore saved environment variables 2623b85037dbSmrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 2624b85037dbSmrg do 2625b85037dbSmrg eval "if test \"\${save_$lt_var+set}\" = set; then 2626b85037dbSmrg $lt_var=\$save_$lt_var; export $lt_var 2627b85037dbSmrg else 2628b85037dbSmrg $lt_unset $lt_var 2629b85037dbSmrg fi" 2630b85037dbSmrg done 2631b85037dbSmrg 2632b85037dbSmrg # Now prepare to actually exec the command. 2633b85037dbSmrg exec_cmd="\$cmd$args" 2634b85037dbSmrg else 2635b85037dbSmrg # Display what would be done. 2636b85037dbSmrg if test -n "$shlibpath_var"; then 2637b85037dbSmrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 2638b85037dbSmrg echo "export $shlibpath_var" 2639b85037dbSmrg fi 2640b85037dbSmrg $ECHO "$cmd$args" 2641b85037dbSmrg exit $EXIT_SUCCESS 2642b85037dbSmrg fi 2643b85037dbSmrg} 2644b85037dbSmrg 2645302b15bdSmrgtest "$opt_mode" = execute && func_mode_execute ${1+"$@"} 2646b85037dbSmrg 2647b85037dbSmrg 2648b85037dbSmrg# func_mode_finish arg... 2649b85037dbSmrgfunc_mode_finish () 2650b85037dbSmrg{ 2651b85037dbSmrg $opt_debug 2652302b15bdSmrg libs= 2653302b15bdSmrg libdirs= 2654b85037dbSmrg admincmds= 2655b85037dbSmrg 2656302b15bdSmrg for opt in "$nonopt" ${1+"$@"} 2657302b15bdSmrg do 2658302b15bdSmrg if test -d "$opt"; then 2659302b15bdSmrg func_append libdirs " $opt" 2660302b15bdSmrg 2661302b15bdSmrg elif test -f "$opt"; then 2662302b15bdSmrg if func_lalib_unsafe_p "$opt"; then 2663302b15bdSmrg func_append libs " $opt" 2664302b15bdSmrg else 2665302b15bdSmrg func_warning "\`$opt' is not a valid libtool archive" 2666302b15bdSmrg fi 2667302b15bdSmrg 2668302b15bdSmrg else 2669302b15bdSmrg func_fatal_error "invalid argument \`$opt'" 2670302b15bdSmrg fi 2671302b15bdSmrg done 2672302b15bdSmrg 2673302b15bdSmrg if test -n "$libs"; then 2674302b15bdSmrg if test -n "$lt_sysroot"; then 2675302b15bdSmrg sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 2676302b15bdSmrg sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 2677302b15bdSmrg else 2678302b15bdSmrg sysroot_cmd= 2679302b15bdSmrg fi 2680302b15bdSmrg 2681302b15bdSmrg # Remove sysroot references 2682302b15bdSmrg if $opt_dry_run; then 2683302b15bdSmrg for lib in $libs; do 2684302b15bdSmrg echo "removing references to $lt_sysroot and \`=' prefixes from $lib" 2685302b15bdSmrg done 2686302b15bdSmrg else 2687302b15bdSmrg tmpdir=`func_mktempdir` 2688302b15bdSmrg for lib in $libs; do 2689302b15bdSmrg sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 2690302b15bdSmrg > $tmpdir/tmp-la 2691302b15bdSmrg mv -f $tmpdir/tmp-la $lib 2692302b15bdSmrg done 2693302b15bdSmrg ${RM}r "$tmpdir" 2694302b15bdSmrg fi 2695302b15bdSmrg fi 2696b85037dbSmrg 2697302b15bdSmrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2698b85037dbSmrg for libdir in $libdirs; do 2699b85037dbSmrg if test -n "$finish_cmds"; then 2700b85037dbSmrg # Do each command in the finish commands. 2701b85037dbSmrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 2702b85037dbSmrg'"$cmd"'"' 2703b85037dbSmrg fi 2704b85037dbSmrg if test -n "$finish_eval"; then 2705b85037dbSmrg # Do the single finish_eval. 2706b85037dbSmrg eval cmds=\"$finish_eval\" 2707302b15bdSmrg $opt_dry_run || eval "$cmds" || func_append admincmds " 2708b85037dbSmrg $cmds" 2709b85037dbSmrg fi 2710b85037dbSmrg done 2711b85037dbSmrg fi 2712b85037dbSmrg 2713b85037dbSmrg # Exit here if they wanted silent mode. 2714b85037dbSmrg $opt_silent && exit $EXIT_SUCCESS 2715b85037dbSmrg 2716302b15bdSmrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2717302b15bdSmrg echo "----------------------------------------------------------------------" 2718302b15bdSmrg echo "Libraries have been installed in:" 2719302b15bdSmrg for libdir in $libdirs; do 2720302b15bdSmrg $ECHO " $libdir" 2721302b15bdSmrg done 2722302b15bdSmrg echo 2723302b15bdSmrg echo "If you ever happen to want to link against installed libraries" 2724302b15bdSmrg echo "in a given directory, LIBDIR, you must either use libtool, and" 2725302b15bdSmrg echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 2726302b15bdSmrg echo "flag during linking and do at least one of the following:" 2727302b15bdSmrg if test -n "$shlibpath_var"; then 2728302b15bdSmrg echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 2729302b15bdSmrg echo " during execution" 2730302b15bdSmrg fi 2731302b15bdSmrg if test -n "$runpath_var"; then 2732302b15bdSmrg echo " - add LIBDIR to the \`$runpath_var' environment variable" 2733302b15bdSmrg echo " during linking" 2734302b15bdSmrg fi 2735302b15bdSmrg if test -n "$hardcode_libdir_flag_spec"; then 2736302b15bdSmrg libdir=LIBDIR 2737302b15bdSmrg eval flag=\"$hardcode_libdir_flag_spec\" 2738b85037dbSmrg 2739302b15bdSmrg $ECHO " - use the \`$flag' linker flag" 2740302b15bdSmrg fi 2741302b15bdSmrg if test -n "$admincmds"; then 2742302b15bdSmrg $ECHO " - have your system administrator run these commands:$admincmds" 2743302b15bdSmrg fi 2744302b15bdSmrg if test -f /etc/ld.so.conf; then 2745302b15bdSmrg echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 2746302b15bdSmrg fi 2747302b15bdSmrg echo 2748b85037dbSmrg 2749302b15bdSmrg echo "See any operating system documentation about shared libraries for" 2750302b15bdSmrg case $host in 2751302b15bdSmrg solaris2.[6789]|solaris2.1[0-9]) 2752302b15bdSmrg echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 2753302b15bdSmrg echo "pages." 2754302b15bdSmrg ;; 2755302b15bdSmrg *) 2756302b15bdSmrg echo "more information, such as the ld(1) and ld.so(8) manual pages." 2757302b15bdSmrg ;; 2758302b15bdSmrg esac 2759302b15bdSmrg echo "----------------------------------------------------------------------" 2760302b15bdSmrg fi 2761b85037dbSmrg exit $EXIT_SUCCESS 2762b85037dbSmrg} 2763b85037dbSmrg 2764302b15bdSmrgtest "$opt_mode" = finish && func_mode_finish ${1+"$@"} 2765b85037dbSmrg 2766b85037dbSmrg 2767b85037dbSmrg# func_mode_install arg... 2768b85037dbSmrgfunc_mode_install () 2769b85037dbSmrg{ 2770b85037dbSmrg $opt_debug 2771b85037dbSmrg # There may be an optional sh(1) argument at the beginning of 2772b85037dbSmrg # install_prog (especially on Windows NT). 2773b85037dbSmrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 2774b85037dbSmrg # Allow the use of GNU shtool's install command. 2775b85037dbSmrg case $nonopt in *shtool*) :;; *) false;; esac; then 2776b85037dbSmrg # Aesthetically quote it. 2777b85037dbSmrg func_quote_for_eval "$nonopt" 2778b85037dbSmrg install_prog="$func_quote_for_eval_result " 2779b85037dbSmrg arg=$1 2780b85037dbSmrg shift 2781b85037dbSmrg else 2782b85037dbSmrg install_prog= 2783b85037dbSmrg arg=$nonopt 2784b85037dbSmrg fi 2785b85037dbSmrg 2786b85037dbSmrg # The real first argument should be the name of the installation program. 2787b85037dbSmrg # Aesthetically quote it. 2788b85037dbSmrg func_quote_for_eval "$arg" 2789302b15bdSmrg func_append install_prog "$func_quote_for_eval_result" 2790b85037dbSmrg install_shared_prog=$install_prog 2791b85037dbSmrg case " $install_prog " in 2792b85037dbSmrg *[\\\ /]cp\ *) install_cp=: ;; 2793b85037dbSmrg *) install_cp=false ;; 2794b85037dbSmrg esac 2795b85037dbSmrg 2796b85037dbSmrg # We need to accept at least all the BSD install flags. 2797b85037dbSmrg dest= 2798b85037dbSmrg files= 2799b85037dbSmrg opts= 2800b85037dbSmrg prev= 2801b85037dbSmrg install_type= 2802b85037dbSmrg isdir=no 2803b85037dbSmrg stripme= 2804b85037dbSmrg no_mode=: 2805b85037dbSmrg for arg 2806b85037dbSmrg do 2807b85037dbSmrg arg2= 2808b85037dbSmrg if test -n "$dest"; then 2809302b15bdSmrg func_append files " $dest" 2810b85037dbSmrg dest=$arg 2811b85037dbSmrg continue 2812b85037dbSmrg fi 2813b85037dbSmrg 2814b85037dbSmrg case $arg in 2815b85037dbSmrg -d) isdir=yes ;; 2816b85037dbSmrg -f) 2817b85037dbSmrg if $install_cp; then :; else 2818b85037dbSmrg prev=$arg 2819b85037dbSmrg fi 2820b85037dbSmrg ;; 2821b85037dbSmrg -g | -m | -o) 2822b85037dbSmrg prev=$arg 2823b85037dbSmrg ;; 2824b85037dbSmrg -s) 2825b85037dbSmrg stripme=" -s" 2826b85037dbSmrg continue 2827b85037dbSmrg ;; 2828b85037dbSmrg -*) 2829b85037dbSmrg ;; 2830b85037dbSmrg *) 2831b85037dbSmrg # If the previous option needed an argument, then skip it. 2832b85037dbSmrg if test -n "$prev"; then 2833b85037dbSmrg if test "x$prev" = x-m && test -n "$install_override_mode"; then 2834b85037dbSmrg arg2=$install_override_mode 2835b85037dbSmrg no_mode=false 2836b85037dbSmrg fi 2837b85037dbSmrg prev= 2838b85037dbSmrg else 2839b85037dbSmrg dest=$arg 2840b85037dbSmrg continue 2841b85037dbSmrg fi 2842b85037dbSmrg ;; 2843b85037dbSmrg esac 2844b85037dbSmrg 2845b85037dbSmrg # Aesthetically quote the argument. 2846b85037dbSmrg func_quote_for_eval "$arg" 2847302b15bdSmrg func_append install_prog " $func_quote_for_eval_result" 2848b85037dbSmrg if test -n "$arg2"; then 2849b85037dbSmrg func_quote_for_eval "$arg2" 2850b85037dbSmrg fi 2851302b15bdSmrg func_append install_shared_prog " $func_quote_for_eval_result" 2852b85037dbSmrg done 2853b85037dbSmrg 2854b85037dbSmrg test -z "$install_prog" && \ 2855b85037dbSmrg func_fatal_help "you must specify an install program" 2856b85037dbSmrg 2857b85037dbSmrg test -n "$prev" && \ 2858b85037dbSmrg func_fatal_help "the \`$prev' option requires an argument" 2859b85037dbSmrg 2860b85037dbSmrg if test -n "$install_override_mode" && $no_mode; then 2861b85037dbSmrg if $install_cp; then :; else 2862b85037dbSmrg func_quote_for_eval "$install_override_mode" 2863302b15bdSmrg func_append install_shared_prog " -m $func_quote_for_eval_result" 2864b85037dbSmrg fi 2865b85037dbSmrg fi 2866b85037dbSmrg 2867b85037dbSmrg if test -z "$files"; then 2868b85037dbSmrg if test -z "$dest"; then 2869b85037dbSmrg func_fatal_help "no file or destination specified" 2870b85037dbSmrg else 2871b85037dbSmrg func_fatal_help "you must specify a destination" 2872b85037dbSmrg fi 2873b85037dbSmrg fi 2874b85037dbSmrg 2875b85037dbSmrg # Strip any trailing slash from the destination. 2876b85037dbSmrg func_stripname '' '/' "$dest" 2877b85037dbSmrg dest=$func_stripname_result 2878b85037dbSmrg 2879b85037dbSmrg # Check to see that the destination is a directory. 2880b85037dbSmrg test -d "$dest" && isdir=yes 2881b85037dbSmrg if test "$isdir" = yes; then 2882b85037dbSmrg destdir="$dest" 2883b85037dbSmrg destname= 2884b85037dbSmrg else 2885b85037dbSmrg func_dirname_and_basename "$dest" "" "." 2886b85037dbSmrg destdir="$func_dirname_result" 2887b85037dbSmrg destname="$func_basename_result" 2888b85037dbSmrg 2889b85037dbSmrg # Not a directory, so check to see that there is only one file specified. 2890b85037dbSmrg set dummy $files; shift 2891b85037dbSmrg test "$#" -gt 1 && \ 2892b85037dbSmrg func_fatal_help "\`$dest' is not a directory" 2893b85037dbSmrg fi 2894b85037dbSmrg case $destdir in 2895b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 2896b85037dbSmrg *) 2897b85037dbSmrg for file in $files; do 2898b85037dbSmrg case $file in 2899b85037dbSmrg *.lo) ;; 2900b85037dbSmrg *) 2901b85037dbSmrg func_fatal_help "\`$destdir' must be an absolute directory name" 2902b85037dbSmrg ;; 2903b85037dbSmrg esac 2904b85037dbSmrg done 2905b85037dbSmrg ;; 2906b85037dbSmrg esac 2907b85037dbSmrg 2908b85037dbSmrg # This variable tells wrapper scripts just to set variables rather 2909b85037dbSmrg # than running their programs. 2910b85037dbSmrg libtool_install_magic="$magic" 2911b85037dbSmrg 2912b85037dbSmrg staticlibs= 2913b85037dbSmrg future_libdirs= 2914b85037dbSmrg current_libdirs= 2915b85037dbSmrg for file in $files; do 2916b85037dbSmrg 2917b85037dbSmrg # Do each installation. 2918b85037dbSmrg case $file in 2919b85037dbSmrg *.$libext) 2920b85037dbSmrg # Do the static libraries later. 2921302b15bdSmrg func_append staticlibs " $file" 2922b85037dbSmrg ;; 2923b85037dbSmrg 2924b85037dbSmrg *.la) 2925302b15bdSmrg func_resolve_sysroot "$file" 2926302b15bdSmrg file=$func_resolve_sysroot_result 2927302b15bdSmrg 2928b85037dbSmrg # Check to see that this really is a libtool archive. 2929b85037dbSmrg func_lalib_unsafe_p "$file" \ 2930b85037dbSmrg || func_fatal_help "\`$file' is not a valid libtool archive" 2931b85037dbSmrg 2932b85037dbSmrg library_names= 2933b85037dbSmrg old_library= 2934b85037dbSmrg relink_command= 2935b85037dbSmrg func_source "$file" 2936b85037dbSmrg 2937b85037dbSmrg # Add the libdir to current_libdirs if it is the destination. 2938b85037dbSmrg if test "X$destdir" = "X$libdir"; then 2939b85037dbSmrg case "$current_libdirs " in 2940b85037dbSmrg *" $libdir "*) ;; 2941302b15bdSmrg *) func_append current_libdirs " $libdir" ;; 2942b85037dbSmrg esac 2943b85037dbSmrg else 2944b85037dbSmrg # Note the libdir as a future libdir. 2945b85037dbSmrg case "$future_libdirs " in 2946b85037dbSmrg *" $libdir "*) ;; 2947302b15bdSmrg *) func_append future_libdirs " $libdir" ;; 2948b85037dbSmrg esac 2949b85037dbSmrg fi 2950b85037dbSmrg 2951b85037dbSmrg func_dirname "$file" "/" "" 2952b85037dbSmrg dir="$func_dirname_result" 2953302b15bdSmrg func_append dir "$objdir" 2954b85037dbSmrg 2955b85037dbSmrg if test -n "$relink_command"; then 2956b85037dbSmrg # Determine the prefix the user has applied to our future dir. 2957b85037dbSmrg inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 2958b85037dbSmrg 2959b85037dbSmrg # Don't allow the user to place us outside of our expected 2960b85037dbSmrg # location b/c this prevents finding dependent libraries that 2961b85037dbSmrg # are installed to the same prefix. 2962b85037dbSmrg # At present, this check doesn't affect windows .dll's that 2963b85037dbSmrg # are installed into $libdir/../bin (currently, that works fine) 2964b85037dbSmrg # but it's something to keep an eye on. 2965b85037dbSmrg test "$inst_prefix_dir" = "$destdir" && \ 2966b85037dbSmrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2967b85037dbSmrg 2968b85037dbSmrg if test -n "$inst_prefix_dir"; then 2969b85037dbSmrg # Stick the inst_prefix_dir data into the link command. 2970b85037dbSmrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2971b85037dbSmrg else 2972b85037dbSmrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 2973b85037dbSmrg fi 2974b85037dbSmrg 2975b85037dbSmrg func_warning "relinking \`$file'" 2976b85037dbSmrg func_show_eval "$relink_command" \ 2977b85037dbSmrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2978b85037dbSmrg fi 2979b85037dbSmrg 2980b85037dbSmrg # See the names of the shared library. 2981b85037dbSmrg set dummy $library_names; shift 2982b85037dbSmrg if test -n "$1"; then 2983b85037dbSmrg realname="$1" 2984b85037dbSmrg shift 2985b85037dbSmrg 2986b85037dbSmrg srcname="$realname" 2987b85037dbSmrg test -n "$relink_command" && srcname="$realname"T 2988b85037dbSmrg 2989b85037dbSmrg # Install the shared library and build the symlinks. 2990b85037dbSmrg func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 2991b85037dbSmrg 'exit $?' 2992b85037dbSmrg tstripme="$stripme" 2993b85037dbSmrg case $host_os in 2994b85037dbSmrg cygwin* | mingw* | pw32* | cegcc*) 2995b85037dbSmrg case $realname in 2996b85037dbSmrg *.dll.a) 2997b85037dbSmrg tstripme="" 2998b85037dbSmrg ;; 2999b85037dbSmrg esac 3000b85037dbSmrg ;; 3001b85037dbSmrg esac 3002b85037dbSmrg if test -n "$tstripme" && test -n "$striplib"; then 3003b85037dbSmrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 3004b85037dbSmrg fi 3005b85037dbSmrg 3006b85037dbSmrg if test "$#" -gt 0; then 3007b85037dbSmrg # Delete the old symlinks, and create new ones. 3008b85037dbSmrg # Try `ln -sf' first, because the `ln' binary might depend on 3009b85037dbSmrg # the symlink we replace! Solaris /bin/ln does not understand -f, 3010b85037dbSmrg # so we also need to try rm && ln -s. 3011b85037dbSmrg for linkname 3012b85037dbSmrg do 3013b85037dbSmrg test "$linkname" != "$realname" \ 3014b85037dbSmrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 3015b85037dbSmrg done 3016b85037dbSmrg fi 3017b85037dbSmrg 3018b85037dbSmrg # Do each command in the postinstall commands. 3019b85037dbSmrg lib="$destdir/$realname" 3020b85037dbSmrg func_execute_cmds "$postinstall_cmds" 'exit $?' 3021b85037dbSmrg fi 3022b85037dbSmrg 3023b85037dbSmrg # Install the pseudo-library for information purposes. 3024b85037dbSmrg func_basename "$file" 3025b85037dbSmrg name="$func_basename_result" 3026b85037dbSmrg instname="$dir/$name"i 3027b85037dbSmrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 3028b85037dbSmrg 3029b85037dbSmrg # Maybe install the static library, too. 3030302b15bdSmrg test -n "$old_library" && func_append staticlibs " $dir/$old_library" 3031b85037dbSmrg ;; 3032b85037dbSmrg 3033b85037dbSmrg *.lo) 3034b85037dbSmrg # Install (i.e. copy) a libtool object. 3035b85037dbSmrg 3036b85037dbSmrg # Figure out destination file name, if it wasn't already specified. 3037b85037dbSmrg if test -n "$destname"; then 3038b85037dbSmrg destfile="$destdir/$destname" 3039b85037dbSmrg else 3040b85037dbSmrg func_basename "$file" 3041b85037dbSmrg destfile="$func_basename_result" 3042b85037dbSmrg destfile="$destdir/$destfile" 3043b85037dbSmrg fi 3044b85037dbSmrg 3045b85037dbSmrg # Deduce the name of the destination old-style object file. 3046b85037dbSmrg case $destfile in 3047b85037dbSmrg *.lo) 3048b85037dbSmrg func_lo2o "$destfile" 3049b85037dbSmrg staticdest=$func_lo2o_result 3050b85037dbSmrg ;; 3051b85037dbSmrg *.$objext) 3052b85037dbSmrg staticdest="$destfile" 3053b85037dbSmrg destfile= 3054b85037dbSmrg ;; 3055b85037dbSmrg *) 3056b85037dbSmrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 3057b85037dbSmrg ;; 3058b85037dbSmrg esac 3059b85037dbSmrg 3060b85037dbSmrg # Install the libtool object if requested. 3061b85037dbSmrg test -n "$destfile" && \ 3062b85037dbSmrg func_show_eval "$install_prog $file $destfile" 'exit $?' 3063b85037dbSmrg 3064b85037dbSmrg # Install the old object if enabled. 3065b85037dbSmrg if test "$build_old_libs" = yes; then 3066b85037dbSmrg # Deduce the name of the old-style object file. 3067b85037dbSmrg func_lo2o "$file" 3068b85037dbSmrg staticobj=$func_lo2o_result 3069b85037dbSmrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 3070b85037dbSmrg fi 3071b85037dbSmrg exit $EXIT_SUCCESS 3072b85037dbSmrg ;; 3073b85037dbSmrg 3074b85037dbSmrg *) 3075b85037dbSmrg # Figure out destination file name, if it wasn't already specified. 3076b85037dbSmrg if test -n "$destname"; then 3077b85037dbSmrg destfile="$destdir/$destname" 3078b85037dbSmrg else 3079b85037dbSmrg func_basename "$file" 3080b85037dbSmrg destfile="$func_basename_result" 3081b85037dbSmrg destfile="$destdir/$destfile" 3082b85037dbSmrg fi 3083b85037dbSmrg 3084b85037dbSmrg # If the file is missing, and there is a .exe on the end, strip it 3085b85037dbSmrg # because it is most likely a libtool script we actually want to 3086b85037dbSmrg # install 3087b85037dbSmrg stripped_ext="" 3088b85037dbSmrg case $file in 3089b85037dbSmrg *.exe) 3090b85037dbSmrg if test ! -f "$file"; then 3091b85037dbSmrg func_stripname '' '.exe' "$file" 3092b85037dbSmrg file=$func_stripname_result 3093b85037dbSmrg stripped_ext=".exe" 3094b85037dbSmrg fi 3095b85037dbSmrg ;; 3096b85037dbSmrg esac 3097b85037dbSmrg 3098b85037dbSmrg # Do a test to see if this is really a libtool program. 3099b85037dbSmrg case $host in 3100b85037dbSmrg *cygwin* | *mingw*) 3101b85037dbSmrg if func_ltwrapper_executable_p "$file"; then 3102b85037dbSmrg func_ltwrapper_scriptname "$file" 3103b85037dbSmrg wrapper=$func_ltwrapper_scriptname_result 3104b85037dbSmrg else 3105b85037dbSmrg func_stripname '' '.exe' "$file" 3106b85037dbSmrg wrapper=$func_stripname_result 3107b85037dbSmrg fi 3108b85037dbSmrg ;; 3109b85037dbSmrg *) 3110b85037dbSmrg wrapper=$file 3111b85037dbSmrg ;; 3112b85037dbSmrg esac 3113b85037dbSmrg if func_ltwrapper_script_p "$wrapper"; then 3114b85037dbSmrg notinst_deplibs= 3115b85037dbSmrg relink_command= 3116b85037dbSmrg 3117b85037dbSmrg func_source "$wrapper" 3118b85037dbSmrg 3119b85037dbSmrg # Check the variables that should have been set. 3120b85037dbSmrg test -z "$generated_by_libtool_version" && \ 3121b85037dbSmrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 3122b85037dbSmrg 3123b85037dbSmrg finalize=yes 3124b85037dbSmrg for lib in $notinst_deplibs; do 3125b85037dbSmrg # Check to see that each library is installed. 3126b85037dbSmrg libdir= 3127b85037dbSmrg if test -f "$lib"; then 3128b85037dbSmrg func_source "$lib" 3129b85037dbSmrg fi 3130b85037dbSmrg libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 3131b85037dbSmrg if test -n "$libdir" && test ! -f "$libfile"; then 3132b85037dbSmrg func_warning "\`$lib' has not been installed in \`$libdir'" 3133b85037dbSmrg finalize=no 3134b85037dbSmrg fi 3135b85037dbSmrg done 3136b85037dbSmrg 3137b85037dbSmrg relink_command= 3138b85037dbSmrg func_source "$wrapper" 3139b85037dbSmrg 3140b85037dbSmrg outputname= 3141b85037dbSmrg if test "$fast_install" = no && test -n "$relink_command"; then 3142b85037dbSmrg $opt_dry_run || { 3143b85037dbSmrg if test "$finalize" = yes; then 3144b85037dbSmrg tmpdir=`func_mktempdir` 3145b85037dbSmrg func_basename "$file$stripped_ext" 3146b85037dbSmrg file="$func_basename_result" 3147b85037dbSmrg outputname="$tmpdir/$file" 3148b85037dbSmrg # Replace the output file specification. 3149b85037dbSmrg relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 3150b85037dbSmrg 3151b85037dbSmrg $opt_silent || { 3152b85037dbSmrg func_quote_for_expand "$relink_command" 3153b85037dbSmrg eval "func_echo $func_quote_for_expand_result" 3154b85037dbSmrg } 3155b85037dbSmrg if eval "$relink_command"; then : 3156b85037dbSmrg else 3157b85037dbSmrg func_error "error: relink \`$file' with the above command before installing it" 3158b85037dbSmrg $opt_dry_run || ${RM}r "$tmpdir" 3159b85037dbSmrg continue 3160b85037dbSmrg fi 3161b85037dbSmrg file="$outputname" 3162b85037dbSmrg else 3163b85037dbSmrg func_warning "cannot relink \`$file'" 3164b85037dbSmrg fi 3165b85037dbSmrg } 3166b85037dbSmrg else 3167b85037dbSmrg # Install the binary that we compiled earlier. 3168b85037dbSmrg file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 3169b85037dbSmrg fi 3170b85037dbSmrg fi 3171b85037dbSmrg 3172b85037dbSmrg # remove .exe since cygwin /usr/bin/install will append another 3173b85037dbSmrg # one anyway 3174b85037dbSmrg case $install_prog,$host in 3175b85037dbSmrg */usr/bin/install*,*cygwin*) 3176b85037dbSmrg case $file:$destfile in 3177b85037dbSmrg *.exe:*.exe) 3178b85037dbSmrg # this is ok 3179b85037dbSmrg ;; 3180b85037dbSmrg *.exe:*) 3181b85037dbSmrg destfile=$destfile.exe 3182b85037dbSmrg ;; 3183b85037dbSmrg *:*.exe) 3184b85037dbSmrg func_stripname '' '.exe' "$destfile" 3185b85037dbSmrg destfile=$func_stripname_result 3186b85037dbSmrg ;; 3187b85037dbSmrg esac 3188b85037dbSmrg ;; 3189b85037dbSmrg esac 3190b85037dbSmrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 3191b85037dbSmrg $opt_dry_run || if test -n "$outputname"; then 3192b85037dbSmrg ${RM}r "$tmpdir" 3193b85037dbSmrg fi 3194b85037dbSmrg ;; 3195b85037dbSmrg esac 3196b85037dbSmrg done 3197b85037dbSmrg 3198b85037dbSmrg for file in $staticlibs; do 3199b85037dbSmrg func_basename "$file" 3200b85037dbSmrg name="$func_basename_result" 3201b85037dbSmrg 3202b85037dbSmrg # Set up the ranlib parameters. 3203b85037dbSmrg oldlib="$destdir/$name" 3204b85037dbSmrg 3205b85037dbSmrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 3206b85037dbSmrg 3207b85037dbSmrg if test -n "$stripme" && test -n "$old_striplib"; then 3208b85037dbSmrg func_show_eval "$old_striplib $oldlib" 'exit $?' 3209b85037dbSmrg fi 3210b85037dbSmrg 3211b85037dbSmrg # Do each command in the postinstall commands. 3212b85037dbSmrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 3213b85037dbSmrg done 3214b85037dbSmrg 3215b85037dbSmrg test -n "$future_libdirs" && \ 3216b85037dbSmrg func_warning "remember to run \`$progname --finish$future_libdirs'" 3217b85037dbSmrg 3218b85037dbSmrg if test -n "$current_libdirs"; then 3219b85037dbSmrg # Maybe just do a dry run. 3220b85037dbSmrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 3221b85037dbSmrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 3222b85037dbSmrg else 3223b85037dbSmrg exit $EXIT_SUCCESS 3224b85037dbSmrg fi 3225b85037dbSmrg} 3226b85037dbSmrg 3227302b15bdSmrgtest "$opt_mode" = install && func_mode_install ${1+"$@"} 3228b85037dbSmrg 3229b85037dbSmrg 3230b85037dbSmrg# func_generate_dlsyms outputname originator pic_p 3231b85037dbSmrg# Extract symbols from dlprefiles and create ${outputname}S.o with 3232b85037dbSmrg# a dlpreopen symbol table. 3233b85037dbSmrgfunc_generate_dlsyms () 3234b85037dbSmrg{ 3235b85037dbSmrg $opt_debug 3236b85037dbSmrg my_outputname="$1" 3237b85037dbSmrg my_originator="$2" 3238b85037dbSmrg my_pic_p="${3-no}" 3239b85037dbSmrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 3240b85037dbSmrg my_dlsyms= 3241b85037dbSmrg 3242b85037dbSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3243b85037dbSmrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 3244b85037dbSmrg my_dlsyms="${my_outputname}S.c" 3245b85037dbSmrg else 3246b85037dbSmrg func_error "not configured to extract global symbols from dlpreopened files" 3247b85037dbSmrg fi 3248b85037dbSmrg fi 3249b85037dbSmrg 3250b85037dbSmrg if test -n "$my_dlsyms"; then 3251b85037dbSmrg case $my_dlsyms in 3252b85037dbSmrg "") ;; 3253b85037dbSmrg *.c) 3254b85037dbSmrg # Discover the nlist of each of the dlfiles. 3255b85037dbSmrg nlist="$output_objdir/${my_outputname}.nm" 3256b85037dbSmrg 3257b85037dbSmrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 3258b85037dbSmrg 3259b85037dbSmrg # Parse the name list into a source file. 3260b85037dbSmrg func_verbose "creating $output_objdir/$my_dlsyms" 3261b85037dbSmrg 3262b85037dbSmrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 3263b85037dbSmrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 3264b85037dbSmrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 3265b85037dbSmrg 3266b85037dbSmrg#ifdef __cplusplus 3267b85037dbSmrgextern \"C\" { 3268b85037dbSmrg#endif 3269b85037dbSmrg 3270b85037dbSmrg#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 3271b85037dbSmrg#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 3272b85037dbSmrg#endif 3273b85037dbSmrg 3274302b15bdSmrg/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 3275302b15bdSmrg#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 3276302b15bdSmrg/* DATA imports from DLLs on WIN32 con't be const, because runtime 3277302b15bdSmrg relocations are performed -- see ld's documentation on pseudo-relocs. */ 3278302b15bdSmrg# define LT_DLSYM_CONST 3279302b15bdSmrg#elif defined(__osf__) 3280302b15bdSmrg/* This system does not cope well with relocations in const data. */ 3281302b15bdSmrg# define LT_DLSYM_CONST 3282302b15bdSmrg#else 3283302b15bdSmrg# define LT_DLSYM_CONST const 3284302b15bdSmrg#endif 3285302b15bdSmrg 3286b85037dbSmrg/* External symbol declarations for the compiler. */\ 3287b85037dbSmrg" 3288b85037dbSmrg 3289b85037dbSmrg if test "$dlself" = yes; then 3290b85037dbSmrg func_verbose "generating symbol list for \`$output'" 3291b85037dbSmrg 3292b85037dbSmrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 3293b85037dbSmrg 3294b85037dbSmrg # Add our own program objects to the symbol list. 3295b85037dbSmrg progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 3296b85037dbSmrg for progfile in $progfiles; do 3297302b15bdSmrg func_to_tool_file "$progfile" func_convert_file_msys_to_w32 3298302b15bdSmrg func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" 3299302b15bdSmrg $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 3300b85037dbSmrg done 3301b85037dbSmrg 3302b85037dbSmrg if test -n "$exclude_expsyms"; then 3303b85037dbSmrg $opt_dry_run || { 3304b85037dbSmrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 3305b85037dbSmrg eval '$MV "$nlist"T "$nlist"' 3306b85037dbSmrg } 3307b85037dbSmrg fi 3308b85037dbSmrg 3309b85037dbSmrg if test -n "$export_symbols_regex"; then 3310b85037dbSmrg $opt_dry_run || { 3311b85037dbSmrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 3312b85037dbSmrg eval '$MV "$nlist"T "$nlist"' 3313b85037dbSmrg } 3314b85037dbSmrg fi 3315b85037dbSmrg 3316b85037dbSmrg # Prepare the list of exported symbols 3317b85037dbSmrg if test -z "$export_symbols"; then 3318b85037dbSmrg export_symbols="$output_objdir/$outputname.exp" 3319b85037dbSmrg $opt_dry_run || { 3320b85037dbSmrg $RM $export_symbols 3321b85037dbSmrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 3322b85037dbSmrg case $host in 3323b85037dbSmrg *cygwin* | *mingw* | *cegcc* ) 3324b85037dbSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3325b85037dbSmrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 3326b85037dbSmrg ;; 3327b85037dbSmrg esac 3328b85037dbSmrg } 3329b85037dbSmrg else 3330b85037dbSmrg $opt_dry_run || { 3331b85037dbSmrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 3332b85037dbSmrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 3333b85037dbSmrg eval '$MV "$nlist"T "$nlist"' 3334b85037dbSmrg case $host in 3335b85037dbSmrg *cygwin* | *mingw* | *cegcc* ) 3336b85037dbSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3337b85037dbSmrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 3338b85037dbSmrg ;; 3339b85037dbSmrg esac 3340b85037dbSmrg } 3341b85037dbSmrg fi 3342b85037dbSmrg fi 3343b85037dbSmrg 3344b85037dbSmrg for dlprefile in $dlprefiles; do 3345b85037dbSmrg func_verbose "extracting global C symbols from \`$dlprefile'" 3346b85037dbSmrg func_basename "$dlprefile" 3347b85037dbSmrg name="$func_basename_result" 3348302b15bdSmrg case $host in 3349302b15bdSmrg *cygwin* | *mingw* | *cegcc* ) 3350302b15bdSmrg # if an import library, we need to obtain dlname 3351302b15bdSmrg if func_win32_import_lib_p "$dlprefile"; then 3352302b15bdSmrg func_tr_sh "$dlprefile" 3353302b15bdSmrg eval "curr_lafile=\$libfile_$func_tr_sh_result" 3354302b15bdSmrg dlprefile_dlbasename="" 3355302b15bdSmrg if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 3356302b15bdSmrg # Use subshell, to avoid clobbering current variable values 3357302b15bdSmrg dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 3358302b15bdSmrg if test -n "$dlprefile_dlname" ; then 3359302b15bdSmrg func_basename "$dlprefile_dlname" 3360302b15bdSmrg dlprefile_dlbasename="$func_basename_result" 3361302b15bdSmrg else 3362302b15bdSmrg # no lafile. user explicitly requested -dlpreopen <import library>. 3363302b15bdSmrg $sharedlib_from_linklib_cmd "$dlprefile" 3364302b15bdSmrg dlprefile_dlbasename=$sharedlib_from_linklib_result 3365302b15bdSmrg fi 3366302b15bdSmrg fi 3367302b15bdSmrg $opt_dry_run || { 3368302b15bdSmrg if test -n "$dlprefile_dlbasename" ; then 3369302b15bdSmrg eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 3370302b15bdSmrg else 3371302b15bdSmrg func_warning "Could not compute DLL name from $name" 3372302b15bdSmrg eval '$ECHO ": $name " >> "$nlist"' 3373302b15bdSmrg fi 3374302b15bdSmrg func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3375302b15bdSmrg eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 3376302b15bdSmrg $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 3377302b15bdSmrg } 3378302b15bdSmrg else # not an import lib 3379302b15bdSmrg $opt_dry_run || { 3380302b15bdSmrg eval '$ECHO ": $name " >> "$nlist"' 3381302b15bdSmrg func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3382302b15bdSmrg eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 3383302b15bdSmrg } 3384302b15bdSmrg fi 3385302b15bdSmrg ;; 3386302b15bdSmrg *) 3387302b15bdSmrg $opt_dry_run || { 3388302b15bdSmrg eval '$ECHO ": $name " >> "$nlist"' 3389302b15bdSmrg func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3390302b15bdSmrg eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 3391302b15bdSmrg } 3392302b15bdSmrg ;; 3393302b15bdSmrg esac 3394b85037dbSmrg done 3395b85037dbSmrg 3396b85037dbSmrg $opt_dry_run || { 3397b85037dbSmrg # Make sure we have at least an empty file. 3398b85037dbSmrg test -f "$nlist" || : > "$nlist" 3399b85037dbSmrg 3400b85037dbSmrg if test -n "$exclude_expsyms"; then 3401b85037dbSmrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 3402b85037dbSmrg $MV "$nlist"T "$nlist" 3403b85037dbSmrg fi 3404b85037dbSmrg 3405b85037dbSmrg # Try sorting and uniquifying the output. 3406b85037dbSmrg if $GREP -v "^: " < "$nlist" | 3407b85037dbSmrg if sort -k 3 </dev/null >/dev/null 2>&1; then 3408b85037dbSmrg sort -k 3 3409b85037dbSmrg else 3410b85037dbSmrg sort +2 3411b85037dbSmrg fi | 3412b85037dbSmrg uniq > "$nlist"S; then 3413b85037dbSmrg : 3414b85037dbSmrg else 3415b85037dbSmrg $GREP -v "^: " < "$nlist" > "$nlist"S 3416b85037dbSmrg fi 3417b85037dbSmrg 3418b85037dbSmrg if test -f "$nlist"S; then 3419b85037dbSmrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 3420b85037dbSmrg else 3421b85037dbSmrg echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 3422b85037dbSmrg fi 3423b85037dbSmrg 3424b85037dbSmrg echo >> "$output_objdir/$my_dlsyms" "\ 3425b85037dbSmrg 3426b85037dbSmrg/* The mapping between symbol names and symbols. */ 3427b85037dbSmrgtypedef struct { 3428b85037dbSmrg const char *name; 3429b85037dbSmrg void *address; 3430b85037dbSmrg} lt_dlsymlist; 3431302b15bdSmrgextern LT_DLSYM_CONST lt_dlsymlist 3432b85037dbSmrglt_${my_prefix}_LTX_preloaded_symbols[]; 3433302b15bdSmrgLT_DLSYM_CONST lt_dlsymlist 3434b85037dbSmrglt_${my_prefix}_LTX_preloaded_symbols[] = 3435b85037dbSmrg{\ 3436b85037dbSmrg { \"$my_originator\", (void *) 0 }," 3437b85037dbSmrg 3438b85037dbSmrg case $need_lib_prefix in 3439b85037dbSmrg no) 3440b85037dbSmrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 3441b85037dbSmrg ;; 3442b85037dbSmrg *) 3443b85037dbSmrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 3444b85037dbSmrg ;; 3445b85037dbSmrg esac 3446b85037dbSmrg echo >> "$output_objdir/$my_dlsyms" "\ 3447b85037dbSmrg {0, (void *) 0} 3448b85037dbSmrg}; 3449b85037dbSmrg 3450b85037dbSmrg/* This works around a problem in FreeBSD linker */ 3451b85037dbSmrg#ifdef FREEBSD_WORKAROUND 3452b85037dbSmrgstatic const void *lt_preloaded_setup() { 3453b85037dbSmrg return lt_${my_prefix}_LTX_preloaded_symbols; 3454b85037dbSmrg} 3455b85037dbSmrg#endif 3456b85037dbSmrg 3457b85037dbSmrg#ifdef __cplusplus 3458b85037dbSmrg} 3459b85037dbSmrg#endif\ 3460b85037dbSmrg" 3461b85037dbSmrg } # !$opt_dry_run 3462b85037dbSmrg 3463b85037dbSmrg pic_flag_for_symtable= 3464b85037dbSmrg case "$compile_command " in 3465b85037dbSmrg *" -static "*) ;; 3466b85037dbSmrg *) 3467b85037dbSmrg case $host in 3468b85037dbSmrg # compiling the symbol table file with pic_flag works around 3469b85037dbSmrg # a FreeBSD bug that causes programs to crash when -lm is 3470b85037dbSmrg # linked before any other PIC object. But we must not use 3471b85037dbSmrg # pic_flag when linking with -static. The problem exists in 3472b85037dbSmrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 3473b85037dbSmrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 3474b85037dbSmrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 3475b85037dbSmrg *-*-hpux*) 3476b85037dbSmrg pic_flag_for_symtable=" $pic_flag" ;; 3477b85037dbSmrg *) 3478b85037dbSmrg if test "X$my_pic_p" != Xno; then 3479b85037dbSmrg pic_flag_for_symtable=" $pic_flag" 3480b85037dbSmrg fi 3481b85037dbSmrg ;; 3482b85037dbSmrg esac 3483b85037dbSmrg ;; 3484b85037dbSmrg esac 3485b85037dbSmrg symtab_cflags= 3486b85037dbSmrg for arg in $LTCFLAGS; do 3487b85037dbSmrg case $arg in 3488b85037dbSmrg -pie | -fpie | -fPIE) ;; 3489302b15bdSmrg *) func_append symtab_cflags " $arg" ;; 3490b85037dbSmrg esac 3491b85037dbSmrg done 3492b85037dbSmrg 3493b85037dbSmrg # Now compile the dynamic symbol file. 3494b85037dbSmrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 3495b85037dbSmrg 3496b85037dbSmrg # Clean up the generated files. 3497b85037dbSmrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 3498b85037dbSmrg 3499b85037dbSmrg # Transform the symbol file into the correct name. 3500b85037dbSmrg symfileobj="$output_objdir/${my_outputname}S.$objext" 3501b85037dbSmrg case $host in 3502b85037dbSmrg *cygwin* | *mingw* | *cegcc* ) 3503b85037dbSmrg if test -f "$output_objdir/$my_outputname.def"; then 3504b85037dbSmrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3505b85037dbSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3506b85037dbSmrg else 3507b85037dbSmrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3508b85037dbSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3509b85037dbSmrg fi 3510b85037dbSmrg ;; 3511b85037dbSmrg *) 3512b85037dbSmrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3513b85037dbSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3514b85037dbSmrg ;; 3515b85037dbSmrg esac 3516b85037dbSmrg ;; 3517b85037dbSmrg *) 3518b85037dbSmrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 3519b85037dbSmrg ;; 3520b85037dbSmrg esac 3521b85037dbSmrg else 3522b85037dbSmrg # We keep going just in case the user didn't refer to 3523b85037dbSmrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 3524b85037dbSmrg # really was required. 3525b85037dbSmrg 3526b85037dbSmrg # Nullify the symbol file. 3527b85037dbSmrg compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 3528b85037dbSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 3529b85037dbSmrg fi 3530b85037dbSmrg} 3531b85037dbSmrg 3532b85037dbSmrg# func_win32_libid arg 3533b85037dbSmrg# return the library type of file 'arg' 3534b85037dbSmrg# 3535b85037dbSmrg# Need a lot of goo to handle *both* DLLs and import libs 3536b85037dbSmrg# Has to be a shell function in order to 'eat' the argument 3537b85037dbSmrg# that is supplied when $file_magic_command is called. 3538b85037dbSmrg# Despite the name, also deal with 64 bit binaries. 3539b85037dbSmrgfunc_win32_libid () 3540b85037dbSmrg{ 3541b85037dbSmrg $opt_debug 3542b85037dbSmrg win32_libid_type="unknown" 3543b85037dbSmrg win32_fileres=`file -L $1 2>/dev/null` 3544b85037dbSmrg case $win32_fileres in 3545b85037dbSmrg *ar\ archive\ import\ library*) # definitely import 3546b85037dbSmrg win32_libid_type="x86 archive import" 3547b85037dbSmrg ;; 3548b85037dbSmrg *ar\ archive*) # could be an import, or static 3549b85037dbSmrg # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 3550b85037dbSmrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 3551b85037dbSmrg $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 3552302b15bdSmrg func_to_tool_file "$1" func_convert_file_msys_to_w32 3553302b15bdSmrg win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 3554b85037dbSmrg $SED -n -e ' 3555b85037dbSmrg 1,100{ 3556b85037dbSmrg / I /{ 3557b85037dbSmrg s,.*,import, 3558b85037dbSmrg p 3559b85037dbSmrg q 3560b85037dbSmrg } 3561b85037dbSmrg }'` 3562b85037dbSmrg case $win32_nmres in 3563b85037dbSmrg import*) win32_libid_type="x86 archive import";; 3564b85037dbSmrg *) win32_libid_type="x86 archive static";; 3565b85037dbSmrg esac 3566b85037dbSmrg fi 3567b85037dbSmrg ;; 3568b85037dbSmrg *DLL*) 3569b85037dbSmrg win32_libid_type="x86 DLL" 3570b85037dbSmrg ;; 3571b85037dbSmrg *executable*) # but shell scripts are "executable" too... 3572b85037dbSmrg case $win32_fileres in 3573b85037dbSmrg *MS\ Windows\ PE\ Intel*) 3574b85037dbSmrg win32_libid_type="x86 DLL" 3575b85037dbSmrg ;; 3576b85037dbSmrg esac 3577b85037dbSmrg ;; 3578b85037dbSmrg esac 3579b85037dbSmrg $ECHO "$win32_libid_type" 3580b85037dbSmrg} 3581b85037dbSmrg 3582302b15bdSmrg# func_cygming_dll_for_implib ARG 3583302b15bdSmrg# 3584302b15bdSmrg# Platform-specific function to extract the 3585302b15bdSmrg# name of the DLL associated with the specified 3586302b15bdSmrg# import library ARG. 3587302b15bdSmrg# Invoked by eval'ing the libtool variable 3588302b15bdSmrg# $sharedlib_from_linklib_cmd 3589302b15bdSmrg# Result is available in the variable 3590302b15bdSmrg# $sharedlib_from_linklib_result 3591302b15bdSmrgfunc_cygming_dll_for_implib () 3592302b15bdSmrg{ 3593302b15bdSmrg $opt_debug 3594302b15bdSmrg sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 3595302b15bdSmrg} 3596302b15bdSmrg 3597302b15bdSmrg# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 3598302b15bdSmrg# 3599302b15bdSmrg# The is the core of a fallback implementation of a 3600302b15bdSmrg# platform-specific function to extract the name of the 3601302b15bdSmrg# DLL associated with the specified import library LIBNAME. 3602302b15bdSmrg# 3603302b15bdSmrg# SECTION_NAME is either .idata$6 or .idata$7, depending 3604302b15bdSmrg# on the platform and compiler that created the implib. 3605302b15bdSmrg# 3606302b15bdSmrg# Echos the name of the DLL associated with the 3607302b15bdSmrg# specified import library. 3608302b15bdSmrgfunc_cygming_dll_for_implib_fallback_core () 3609302b15bdSmrg{ 3610302b15bdSmrg $opt_debug 3611302b15bdSmrg match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 3612302b15bdSmrg $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 3613302b15bdSmrg $SED '/^Contents of section '"$match_literal"':/{ 3614302b15bdSmrg # Place marker at beginning of archive member dllname section 3615302b15bdSmrg s/.*/====MARK====/ 3616302b15bdSmrg p 3617302b15bdSmrg d 3618302b15bdSmrg } 3619302b15bdSmrg # These lines can sometimes be longer than 43 characters, but 3620302b15bdSmrg # are always uninteresting 3621302b15bdSmrg /:[ ]*file format pe[i]\{,1\}-/d 3622302b15bdSmrg /^In archive [^:]*:/d 3623302b15bdSmrg # Ensure marker is printed 3624302b15bdSmrg /^====MARK====/p 3625302b15bdSmrg # Remove all lines with less than 43 characters 3626302b15bdSmrg /^.\{43\}/!d 3627302b15bdSmrg # From remaining lines, remove first 43 characters 3628302b15bdSmrg s/^.\{43\}//' | 3629302b15bdSmrg $SED -n ' 3630302b15bdSmrg # Join marker and all lines until next marker into a single line 3631302b15bdSmrg /^====MARK====/ b para 3632302b15bdSmrg H 3633302b15bdSmrg $ b para 3634302b15bdSmrg b 3635302b15bdSmrg :para 3636302b15bdSmrg x 3637302b15bdSmrg s/\n//g 3638302b15bdSmrg # Remove the marker 3639302b15bdSmrg s/^====MARK====// 3640302b15bdSmrg # Remove trailing dots and whitespace 3641302b15bdSmrg s/[\. \t]*$// 3642302b15bdSmrg # Print 3643302b15bdSmrg /./p' | 3644302b15bdSmrg # we now have a list, one entry per line, of the stringified 3645302b15bdSmrg # contents of the appropriate section of all members of the 3646302b15bdSmrg # archive which possess that section. Heuristic: eliminate 3647302b15bdSmrg # all those which have a first or second character that is 3648302b15bdSmrg # a '.' (that is, objdump's representation of an unprintable 3649302b15bdSmrg # character.) This should work for all archives with less than 3650302b15bdSmrg # 0x302f exports -- but will fail for DLLs whose name actually 3651302b15bdSmrg # begins with a literal '.' or a single character followed by 3652302b15bdSmrg # a '.'. 3653302b15bdSmrg # 3654302b15bdSmrg # Of those that remain, print the first one. 3655302b15bdSmrg $SED -e '/^\./d;/^.\./d;q' 3656302b15bdSmrg} 3657302b15bdSmrg 3658302b15bdSmrg# func_cygming_gnu_implib_p ARG 3659302b15bdSmrg# This predicate returns with zero status (TRUE) if 3660302b15bdSmrg# ARG is a GNU/binutils-style import library. Returns 3661302b15bdSmrg# with nonzero status (FALSE) otherwise. 3662302b15bdSmrgfunc_cygming_gnu_implib_p () 3663302b15bdSmrg{ 3664302b15bdSmrg $opt_debug 3665302b15bdSmrg func_to_tool_file "$1" func_convert_file_msys_to_w32 3666302b15bdSmrg func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` 3667302b15bdSmrg test -n "$func_cygming_gnu_implib_tmp" 3668302b15bdSmrg} 3669302b15bdSmrg 3670302b15bdSmrg# func_cygming_ms_implib_p ARG 3671302b15bdSmrg# This predicate returns with zero status (TRUE) if 3672302b15bdSmrg# ARG is an MS-style import library. Returns 3673302b15bdSmrg# with nonzero status (FALSE) otherwise. 3674302b15bdSmrgfunc_cygming_ms_implib_p () 3675302b15bdSmrg{ 3676302b15bdSmrg $opt_debug 3677302b15bdSmrg func_to_tool_file "$1" func_convert_file_msys_to_w32 3678302b15bdSmrg func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 3679302b15bdSmrg test -n "$func_cygming_ms_implib_tmp" 3680302b15bdSmrg} 3681302b15bdSmrg 3682302b15bdSmrg# func_cygming_dll_for_implib_fallback ARG 3683302b15bdSmrg# Platform-specific function to extract the 3684302b15bdSmrg# name of the DLL associated with the specified 3685302b15bdSmrg# import library ARG. 3686302b15bdSmrg# 3687302b15bdSmrg# This fallback implementation is for use when $DLLTOOL 3688302b15bdSmrg# does not support the --identify-strict option. 3689302b15bdSmrg# Invoked by eval'ing the libtool variable 3690302b15bdSmrg# $sharedlib_from_linklib_cmd 3691302b15bdSmrg# Result is available in the variable 3692302b15bdSmrg# $sharedlib_from_linklib_result 3693302b15bdSmrgfunc_cygming_dll_for_implib_fallback () 3694302b15bdSmrg{ 3695302b15bdSmrg $opt_debug 3696302b15bdSmrg if func_cygming_gnu_implib_p "$1" ; then 3697302b15bdSmrg # binutils import library 3698302b15bdSmrg sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 3699302b15bdSmrg elif func_cygming_ms_implib_p "$1" ; then 3700302b15bdSmrg # ms-generated import library 3701302b15bdSmrg sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 3702302b15bdSmrg else 3703302b15bdSmrg # unknown 3704302b15bdSmrg sharedlib_from_linklib_result="" 3705302b15bdSmrg fi 3706302b15bdSmrg} 3707b85037dbSmrg 3708b85037dbSmrg 3709b85037dbSmrg# func_extract_an_archive dir oldlib 3710b85037dbSmrgfunc_extract_an_archive () 3711b85037dbSmrg{ 3712b85037dbSmrg $opt_debug 3713b85037dbSmrg f_ex_an_ar_dir="$1"; shift 3714b85037dbSmrg f_ex_an_ar_oldlib="$1" 3715b85037dbSmrg if test "$lock_old_archive_extraction" = yes; then 3716b85037dbSmrg lockfile=$f_ex_an_ar_oldlib.lock 3717b85037dbSmrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 3718b85037dbSmrg func_echo "Waiting for $lockfile to be removed" 3719b85037dbSmrg sleep 2 3720b85037dbSmrg done 3721b85037dbSmrg fi 3722b85037dbSmrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 3723b85037dbSmrg 'stat=$?; rm -f "$lockfile"; exit $stat' 3724b85037dbSmrg if test "$lock_old_archive_extraction" = yes; then 3725b85037dbSmrg $opt_dry_run || rm -f "$lockfile" 3726b85037dbSmrg fi 3727b85037dbSmrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3728b85037dbSmrg : 3729b85037dbSmrg else 3730b85037dbSmrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 3731b85037dbSmrg fi 3732b85037dbSmrg} 3733b85037dbSmrg 3734b85037dbSmrg 3735b85037dbSmrg# func_extract_archives gentop oldlib ... 3736b85037dbSmrgfunc_extract_archives () 3737b85037dbSmrg{ 3738b85037dbSmrg $opt_debug 3739b85037dbSmrg my_gentop="$1"; shift 3740b85037dbSmrg my_oldlibs=${1+"$@"} 3741b85037dbSmrg my_oldobjs="" 3742b85037dbSmrg my_xlib="" 3743b85037dbSmrg my_xabs="" 3744b85037dbSmrg my_xdir="" 3745b85037dbSmrg 3746b85037dbSmrg for my_xlib in $my_oldlibs; do 3747b85037dbSmrg # Extract the objects. 3748b85037dbSmrg case $my_xlib in 3749b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3750b85037dbSmrg *) my_xabs=`pwd`"/$my_xlib" ;; 3751b85037dbSmrg esac 3752b85037dbSmrg func_basename "$my_xlib" 3753b85037dbSmrg my_xlib="$func_basename_result" 3754b85037dbSmrg my_xlib_u=$my_xlib 3755b85037dbSmrg while :; do 3756b85037dbSmrg case " $extracted_archives " in 3757b85037dbSmrg *" $my_xlib_u "*) 3758b85037dbSmrg func_arith $extracted_serial + 1 3759b85037dbSmrg extracted_serial=$func_arith_result 3760b85037dbSmrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 3761b85037dbSmrg *) break ;; 3762b85037dbSmrg esac 3763b85037dbSmrg done 3764b85037dbSmrg extracted_archives="$extracted_archives $my_xlib_u" 3765b85037dbSmrg my_xdir="$my_gentop/$my_xlib_u" 3766b85037dbSmrg 3767b85037dbSmrg func_mkdir_p "$my_xdir" 3768b85037dbSmrg 3769b85037dbSmrg case $host in 3770b85037dbSmrg *-darwin*) 3771b85037dbSmrg func_verbose "Extracting $my_xabs" 3772b85037dbSmrg # Do not bother doing anything if just a dry run 3773b85037dbSmrg $opt_dry_run || { 3774b85037dbSmrg darwin_orig_dir=`pwd` 3775b85037dbSmrg cd $my_xdir || exit $? 3776b85037dbSmrg darwin_archive=$my_xabs 3777b85037dbSmrg darwin_curdir=`pwd` 3778b85037dbSmrg darwin_base_archive=`basename "$darwin_archive"` 3779b85037dbSmrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 3780b85037dbSmrg if test -n "$darwin_arches"; then 3781b85037dbSmrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 3782b85037dbSmrg darwin_arch= 3783b85037dbSmrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 3784b85037dbSmrg for darwin_arch in $darwin_arches ; do 3785b85037dbSmrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3786b85037dbSmrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3787b85037dbSmrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3788b85037dbSmrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3789b85037dbSmrg cd "$darwin_curdir" 3790b85037dbSmrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3791b85037dbSmrg done # $darwin_arches 3792b85037dbSmrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 3793b85037dbSmrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 3794b85037dbSmrg darwin_file= 3795b85037dbSmrg darwin_files= 3796b85037dbSmrg for darwin_file in $darwin_filelist; do 3797b85037dbSmrg darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 3798b85037dbSmrg $LIPO -create -output "$darwin_file" $darwin_files 3799b85037dbSmrg done # $darwin_filelist 3800b85037dbSmrg $RM -rf unfat-$$ 3801b85037dbSmrg cd "$darwin_orig_dir" 3802b85037dbSmrg else 3803b85037dbSmrg cd $darwin_orig_dir 3804b85037dbSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 3805b85037dbSmrg fi # $darwin_arches 3806b85037dbSmrg } # !$opt_dry_run 3807b85037dbSmrg ;; 3808b85037dbSmrg *) 3809b85037dbSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 3810b85037dbSmrg ;; 3811b85037dbSmrg esac 3812b85037dbSmrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 3813b85037dbSmrg done 3814b85037dbSmrg 3815b85037dbSmrg func_extract_archives_result="$my_oldobjs" 3816b85037dbSmrg} 3817b85037dbSmrg 3818b85037dbSmrg 3819b85037dbSmrg# func_emit_wrapper [arg=no] 3820b85037dbSmrg# 3821b85037dbSmrg# Emit a libtool wrapper script on stdout. 3822b85037dbSmrg# Don't directly open a file because we may want to 3823b85037dbSmrg# incorporate the script contents within a cygwin/mingw 3824b85037dbSmrg# wrapper executable. Must ONLY be called from within 3825b85037dbSmrg# func_mode_link because it depends on a number of variables 3826b85037dbSmrg# set therein. 3827b85037dbSmrg# 3828b85037dbSmrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 3829b85037dbSmrg# variable will take. If 'yes', then the emitted script 3830b85037dbSmrg# will assume that the directory in which it is stored is 3831b85037dbSmrg# the $objdir directory. This is a cygwin/mingw-specific 3832b85037dbSmrg# behavior. 3833b85037dbSmrgfunc_emit_wrapper () 3834b85037dbSmrg{ 3835b85037dbSmrg func_emit_wrapper_arg1=${1-no} 3836b85037dbSmrg 3837b85037dbSmrg $ECHO "\ 3838b85037dbSmrg#! $SHELL 3839b85037dbSmrg 3840b85037dbSmrg# $output - temporary wrapper script for $objdir/$outputname 3841b85037dbSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3842b85037dbSmrg# 3843b85037dbSmrg# The $output program cannot be directly executed until all the libtool 3844b85037dbSmrg# libraries that it depends on are installed. 3845b85037dbSmrg# 3846b85037dbSmrg# This wrapper script should never be moved out of the build directory. 3847b85037dbSmrg# If it is, it will not operate correctly. 3848b85037dbSmrg 3849b85037dbSmrg# Sed substitution that helps us do robust quoting. It backslashifies 3850b85037dbSmrg# metacharacters that are still active within double-quoted strings. 3851b85037dbSmrgsed_quote_subst='$sed_quote_subst' 3852b85037dbSmrg 3853b85037dbSmrg# Be Bourne compatible 3854b85037dbSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 3855b85037dbSmrg emulate sh 3856b85037dbSmrg NULLCMD=: 3857b85037dbSmrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 3858b85037dbSmrg # is contrary to our usage. Disable this feature. 3859b85037dbSmrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 3860b85037dbSmrg setopt NO_GLOB_SUBST 3861b85037dbSmrgelse 3862b85037dbSmrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 3863b85037dbSmrgfi 3864b85037dbSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 3865b85037dbSmrgDUALCASE=1; export DUALCASE # for MKS sh 3866b85037dbSmrg 3867b85037dbSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout 3868b85037dbSmrg# if CDPATH is set. 3869b85037dbSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 3870b85037dbSmrg 3871b85037dbSmrgrelink_command=\"$relink_command\" 3872b85037dbSmrg 3873b85037dbSmrg# This environment variable determines our operation mode. 3874b85037dbSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then 3875b85037dbSmrg # install mode needs the following variables: 3876b85037dbSmrg generated_by_libtool_version='$macro_version' 3877b85037dbSmrg notinst_deplibs='$notinst_deplibs' 3878b85037dbSmrgelse 3879b85037dbSmrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 3880b85037dbSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 3881b85037dbSmrg file=\"\$0\"" 3882b85037dbSmrg 3883b85037dbSmrg qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 3884b85037dbSmrg $ECHO "\ 3885b85037dbSmrg 3886b85037dbSmrg# A function that is used when there is no print builtin or printf. 3887b85037dbSmrgfunc_fallback_echo () 3888b85037dbSmrg{ 3889b85037dbSmrg eval 'cat <<_LTECHO_EOF 3890b85037dbSmrg\$1 3891b85037dbSmrg_LTECHO_EOF' 3892b85037dbSmrg} 3893b85037dbSmrg ECHO=\"$qECHO\" 3894b85037dbSmrg fi 3895b85037dbSmrg 3896b85037dbSmrg# Very basic option parsing. These options are (a) specific to 3897b85037dbSmrg# the libtool wrapper, (b) are identical between the wrapper 3898b85037dbSmrg# /script/ and the wrapper /executable/ which is used only on 3899b85037dbSmrg# windows platforms, and (c) all begin with the string "--lt-" 3900b85037dbSmrg# (application programs are unlikely to have options which match 3901b85037dbSmrg# this pattern). 3902b85037dbSmrg# 3903b85037dbSmrg# There are only two supported options: --lt-debug and 3904b85037dbSmrg# --lt-dump-script. There is, deliberately, no --lt-help. 3905b85037dbSmrg# 3906b85037dbSmrg# The first argument to this parsing function should be the 3907b85037dbSmrg# script's $0 value, followed by "$@". 3908b85037dbSmrglt_option_debug= 3909b85037dbSmrgfunc_parse_lt_options () 3910b85037dbSmrg{ 3911b85037dbSmrg lt_script_arg0=\$0 3912b85037dbSmrg shift 3913b85037dbSmrg for lt_opt 3914b85037dbSmrg do 3915b85037dbSmrg case \"\$lt_opt\" in 3916b85037dbSmrg --lt-debug) lt_option_debug=1 ;; 3917b85037dbSmrg --lt-dump-script) 3918b85037dbSmrg lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 3919b85037dbSmrg test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 3920b85037dbSmrg lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 3921b85037dbSmrg cat \"\$lt_dump_D/\$lt_dump_F\" 3922b85037dbSmrg exit 0 3923b85037dbSmrg ;; 3924b85037dbSmrg --lt-*) 3925b85037dbSmrg \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 3926b85037dbSmrg exit 1 3927b85037dbSmrg ;; 3928b85037dbSmrg esac 3929b85037dbSmrg done 3930b85037dbSmrg 3931b85037dbSmrg # Print the debug banner immediately: 3932b85037dbSmrg if test -n \"\$lt_option_debug\"; then 3933b85037dbSmrg echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 3934b85037dbSmrg fi 3935b85037dbSmrg} 3936b85037dbSmrg 3937b85037dbSmrg# Used when --lt-debug. Prints its arguments to stdout 3938b85037dbSmrg# (redirection is the responsibility of the caller) 3939b85037dbSmrgfunc_lt_dump_args () 3940b85037dbSmrg{ 3941b85037dbSmrg lt_dump_args_N=1; 3942b85037dbSmrg for lt_arg 3943b85037dbSmrg do 3944b85037dbSmrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 3945b85037dbSmrg lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 3946b85037dbSmrg done 3947b85037dbSmrg} 3948b85037dbSmrg 3949b85037dbSmrg# Core function for launching the target application 3950b85037dbSmrgfunc_exec_program_core () 3951b85037dbSmrg{ 3952b85037dbSmrg" 3953b85037dbSmrg case $host in 3954b85037dbSmrg # Backslashes separate directories on plain windows 3955b85037dbSmrg *-*-mingw | *-*-os2* | *-cegcc*) 3956b85037dbSmrg $ECHO "\ 3957b85037dbSmrg if test -n \"\$lt_option_debug\"; then 3958b85037dbSmrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 3959b85037dbSmrg func_lt_dump_args \${1+\"\$@\"} 1>&2 3960b85037dbSmrg fi 3961b85037dbSmrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 3962b85037dbSmrg" 3963b85037dbSmrg ;; 3964b85037dbSmrg 3965b85037dbSmrg *) 3966b85037dbSmrg $ECHO "\ 3967b85037dbSmrg if test -n \"\$lt_option_debug\"; then 3968b85037dbSmrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 3969b85037dbSmrg func_lt_dump_args \${1+\"\$@\"} 1>&2 3970b85037dbSmrg fi 3971b85037dbSmrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 3972b85037dbSmrg" 3973b85037dbSmrg ;; 3974b85037dbSmrg esac 3975b85037dbSmrg $ECHO "\ 3976b85037dbSmrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 3977b85037dbSmrg exit 1 3978b85037dbSmrg} 3979b85037dbSmrg 3980b85037dbSmrg# A function to encapsulate launching the target application 3981b85037dbSmrg# Strips options in the --lt-* namespace from \$@ and 3982b85037dbSmrg# launches target application with the remaining arguments. 3983b85037dbSmrgfunc_exec_program () 3984b85037dbSmrg{ 3985b85037dbSmrg for lt_wr_arg 3986b85037dbSmrg do 3987b85037dbSmrg case \$lt_wr_arg in 3988b85037dbSmrg --lt-*) ;; 3989b85037dbSmrg *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 3990b85037dbSmrg esac 3991b85037dbSmrg shift 3992b85037dbSmrg done 3993b85037dbSmrg func_exec_program_core \${1+\"\$@\"} 3994b85037dbSmrg} 3995b85037dbSmrg 3996b85037dbSmrg # Parse options 3997b85037dbSmrg func_parse_lt_options \"\$0\" \${1+\"\$@\"} 3998b85037dbSmrg 3999b85037dbSmrg # Find the directory that this script lives in. 4000b85037dbSmrg thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 4001b85037dbSmrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 4002b85037dbSmrg 4003b85037dbSmrg # Follow symbolic links until we get to the real thisdir. 4004b85037dbSmrg file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 4005b85037dbSmrg while test -n \"\$file\"; do 4006b85037dbSmrg destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 4007b85037dbSmrg 4008b85037dbSmrg # If there was a directory component, then change thisdir. 4009b85037dbSmrg if test \"x\$destdir\" != \"x\$file\"; then 4010b85037dbSmrg case \"\$destdir\" in 4011b85037dbSmrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 4012b85037dbSmrg *) thisdir=\"\$thisdir/\$destdir\" ;; 4013b85037dbSmrg esac 4014b85037dbSmrg fi 4015b85037dbSmrg 4016b85037dbSmrg file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 4017b85037dbSmrg file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 4018b85037dbSmrg done 4019b85037dbSmrg 4020b85037dbSmrg # Usually 'no', except on cygwin/mingw when embedded into 4021b85037dbSmrg # the cwrapper. 4022b85037dbSmrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 4023b85037dbSmrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 4024b85037dbSmrg # special case for '.' 4025b85037dbSmrg if test \"\$thisdir\" = \".\"; then 4026b85037dbSmrg thisdir=\`pwd\` 4027b85037dbSmrg fi 4028b85037dbSmrg # remove .libs from thisdir 4029b85037dbSmrg case \"\$thisdir\" in 4030b85037dbSmrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 4031b85037dbSmrg $objdir ) thisdir=. ;; 4032b85037dbSmrg esac 4033b85037dbSmrg fi 4034b85037dbSmrg 4035b85037dbSmrg # Try to get the absolute directory name. 4036b85037dbSmrg absdir=\`cd \"\$thisdir\" && pwd\` 4037b85037dbSmrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 4038b85037dbSmrg" 4039b85037dbSmrg 4040b85037dbSmrg if test "$fast_install" = yes; then 4041b85037dbSmrg $ECHO "\ 4042b85037dbSmrg program=lt-'$outputname'$exeext 4043b85037dbSmrg progdir=\"\$thisdir/$objdir\" 4044b85037dbSmrg 4045b85037dbSmrg if test ! -f \"\$progdir/\$program\" || 4046b85037dbSmrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 4047b85037dbSmrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 4048b85037dbSmrg 4049b85037dbSmrg file=\"\$\$-\$program\" 4050b85037dbSmrg 4051b85037dbSmrg if test ! -d \"\$progdir\"; then 4052b85037dbSmrg $MKDIR \"\$progdir\" 4053b85037dbSmrg else 4054b85037dbSmrg $RM \"\$progdir/\$file\" 4055b85037dbSmrg fi" 4056b85037dbSmrg 4057b85037dbSmrg $ECHO "\ 4058b85037dbSmrg 4059b85037dbSmrg # relink executable if necessary 4060b85037dbSmrg if test -n \"\$relink_command\"; then 4061b85037dbSmrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 4062b85037dbSmrg else 4063b85037dbSmrg $ECHO \"\$relink_command_output\" >&2 4064b85037dbSmrg $RM \"\$progdir/\$file\" 4065b85037dbSmrg exit 1 4066b85037dbSmrg fi 4067b85037dbSmrg fi 4068b85037dbSmrg 4069b85037dbSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 4070b85037dbSmrg { $RM \"\$progdir/\$program\"; 4071b85037dbSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 4072b85037dbSmrg $RM \"\$progdir/\$file\" 4073b85037dbSmrg fi" 4074b85037dbSmrg else 4075b85037dbSmrg $ECHO "\ 4076b85037dbSmrg program='$outputname' 4077b85037dbSmrg progdir=\"\$thisdir/$objdir\" 4078b85037dbSmrg" 4079b85037dbSmrg fi 4080b85037dbSmrg 4081b85037dbSmrg $ECHO "\ 4082b85037dbSmrg 4083b85037dbSmrg if test -f \"\$progdir/\$program\"; then" 4084b85037dbSmrg 4085302b15bdSmrg # fixup the dll searchpath if we need to. 4086302b15bdSmrg # 4087302b15bdSmrg # Fix the DLL searchpath if we need to. Do this before prepending 4088302b15bdSmrg # to shlibpath, because on Windows, both are PATH and uninstalled 4089302b15bdSmrg # libraries must come first. 4090302b15bdSmrg if test -n "$dllsearchpath"; then 4091302b15bdSmrg $ECHO "\ 4092302b15bdSmrg # Add the dll search path components to the executable PATH 4093302b15bdSmrg PATH=$dllsearchpath:\$PATH 4094302b15bdSmrg" 4095302b15bdSmrg fi 4096302b15bdSmrg 4097b85037dbSmrg # Export our shlibpath_var if we have one. 4098b85037dbSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4099b85037dbSmrg $ECHO "\ 4100b85037dbSmrg # Add our own library path to $shlibpath_var 4101b85037dbSmrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 4102b85037dbSmrg 4103b85037dbSmrg # Some systems cannot cope with colon-terminated $shlibpath_var 4104b85037dbSmrg # The second colon is a workaround for a bug in BeOS R4 sed 4105b85037dbSmrg $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 4106b85037dbSmrg 4107b85037dbSmrg export $shlibpath_var 4108b85037dbSmrg" 4109b85037dbSmrg fi 4110b85037dbSmrg 4111b85037dbSmrg $ECHO "\ 4112b85037dbSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 4113b85037dbSmrg # Run the actual program with our arguments. 4114b85037dbSmrg func_exec_program \${1+\"\$@\"} 4115b85037dbSmrg fi 4116b85037dbSmrg else 4117b85037dbSmrg # The program doesn't exist. 4118b85037dbSmrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 4119b85037dbSmrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 4120b85037dbSmrg \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 4121b85037dbSmrg exit 1 4122b85037dbSmrg fi 4123b85037dbSmrgfi\ 4124b85037dbSmrg" 4125b85037dbSmrg} 4126b85037dbSmrg 4127b85037dbSmrg 4128b85037dbSmrg# func_emit_cwrapperexe_src 4129b85037dbSmrg# emit the source code for a wrapper executable on stdout 4130b85037dbSmrg# Must ONLY be called from within func_mode_link because 4131b85037dbSmrg# it depends on a number of variable set therein. 4132b85037dbSmrgfunc_emit_cwrapperexe_src () 4133b85037dbSmrg{ 4134b85037dbSmrg cat <<EOF 4135b85037dbSmrg 4136b85037dbSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4137b85037dbSmrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 4138b85037dbSmrg 4139b85037dbSmrg The $output program cannot be directly executed until all the libtool 4140b85037dbSmrg libraries that it depends on are installed. 4141b85037dbSmrg 4142b85037dbSmrg This wrapper executable should never be moved out of the build directory. 4143b85037dbSmrg If it is, it will not operate correctly. 4144b85037dbSmrg*/ 4145b85037dbSmrgEOF 4146b85037dbSmrg cat <<"EOF" 4147b85037dbSmrg#ifdef _MSC_VER 4148b85037dbSmrg# define _CRT_SECURE_NO_DEPRECATE 1 4149b85037dbSmrg#endif 4150b85037dbSmrg#include <stdio.h> 4151b85037dbSmrg#include <stdlib.h> 4152b85037dbSmrg#ifdef _MSC_VER 4153b85037dbSmrg# include <direct.h> 4154b85037dbSmrg# include <process.h> 4155b85037dbSmrg# include <io.h> 4156b85037dbSmrg#else 4157b85037dbSmrg# include <unistd.h> 4158b85037dbSmrg# include <stdint.h> 4159b85037dbSmrg# ifdef __CYGWIN__ 4160b85037dbSmrg# include <io.h> 4161b85037dbSmrg# endif 4162b85037dbSmrg#endif 4163b85037dbSmrg#include <malloc.h> 4164b85037dbSmrg#include <stdarg.h> 4165b85037dbSmrg#include <assert.h> 4166b85037dbSmrg#include <string.h> 4167b85037dbSmrg#include <ctype.h> 4168b85037dbSmrg#include <errno.h> 4169b85037dbSmrg#include <fcntl.h> 4170b85037dbSmrg#include <sys/stat.h> 4171b85037dbSmrg 4172b85037dbSmrg/* declarations of non-ANSI functions */ 4173b85037dbSmrg#if defined(__MINGW32__) 4174b85037dbSmrg# ifdef __STRICT_ANSI__ 4175b85037dbSmrgint _putenv (const char *); 4176b85037dbSmrg# endif 4177b85037dbSmrg#elif defined(__CYGWIN__) 4178b85037dbSmrg# ifdef __STRICT_ANSI__ 4179b85037dbSmrgchar *realpath (const char *, char *); 4180b85037dbSmrgint putenv (char *); 4181b85037dbSmrgint setenv (const char *, const char *, int); 4182b85037dbSmrg# endif 4183b85037dbSmrg/* #elif defined (other platforms) ... */ 4184b85037dbSmrg#endif 4185b85037dbSmrg 4186b85037dbSmrg/* portability defines, excluding path handling macros */ 4187b85037dbSmrg#if defined(_MSC_VER) 4188b85037dbSmrg# define setmode _setmode 4189b85037dbSmrg# define stat _stat 4190b85037dbSmrg# define chmod _chmod 4191b85037dbSmrg# define getcwd _getcwd 4192b85037dbSmrg# define putenv _putenv 4193b85037dbSmrg# define S_IXUSR _S_IEXEC 4194b85037dbSmrg# ifndef _INTPTR_T_DEFINED 4195b85037dbSmrg# define _INTPTR_T_DEFINED 4196b85037dbSmrg# define intptr_t int 4197b85037dbSmrg# endif 4198b85037dbSmrg#elif defined(__MINGW32__) 4199b85037dbSmrg# define setmode _setmode 4200b85037dbSmrg# define stat _stat 4201b85037dbSmrg# define chmod _chmod 4202b85037dbSmrg# define getcwd _getcwd 4203b85037dbSmrg# define putenv _putenv 4204b85037dbSmrg#elif defined(__CYGWIN__) 4205b85037dbSmrg# define HAVE_SETENV 4206b85037dbSmrg# define FOPEN_WB "wb" 4207b85037dbSmrg/* #elif defined (other platforms) ... */ 4208b85037dbSmrg#endif 4209b85037dbSmrg 4210b85037dbSmrg#if defined(PATH_MAX) 4211b85037dbSmrg# define LT_PATHMAX PATH_MAX 4212b85037dbSmrg#elif defined(MAXPATHLEN) 4213b85037dbSmrg# define LT_PATHMAX MAXPATHLEN 4214b85037dbSmrg#else 4215b85037dbSmrg# define LT_PATHMAX 1024 4216b85037dbSmrg#endif 4217b85037dbSmrg 4218b85037dbSmrg#ifndef S_IXOTH 4219b85037dbSmrg# define S_IXOTH 0 4220b85037dbSmrg#endif 4221b85037dbSmrg#ifndef S_IXGRP 4222b85037dbSmrg# define S_IXGRP 0 4223b85037dbSmrg#endif 4224b85037dbSmrg 4225b85037dbSmrg/* path handling portability macros */ 4226b85037dbSmrg#ifndef DIR_SEPARATOR 4227b85037dbSmrg# define DIR_SEPARATOR '/' 4228b85037dbSmrg# define PATH_SEPARATOR ':' 4229b85037dbSmrg#endif 4230b85037dbSmrg 4231b85037dbSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4232b85037dbSmrg defined (__OS2__) 4233b85037dbSmrg# define HAVE_DOS_BASED_FILE_SYSTEM 4234b85037dbSmrg# define FOPEN_WB "wb" 4235b85037dbSmrg# ifndef DIR_SEPARATOR_2 4236b85037dbSmrg# define DIR_SEPARATOR_2 '\\' 4237b85037dbSmrg# endif 4238b85037dbSmrg# ifndef PATH_SEPARATOR_2 4239b85037dbSmrg# define PATH_SEPARATOR_2 ';' 4240b85037dbSmrg# endif 4241b85037dbSmrg#endif 4242b85037dbSmrg 4243b85037dbSmrg#ifndef DIR_SEPARATOR_2 4244b85037dbSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4245b85037dbSmrg#else /* DIR_SEPARATOR_2 */ 4246b85037dbSmrg# define IS_DIR_SEPARATOR(ch) \ 4247b85037dbSmrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4248b85037dbSmrg#endif /* DIR_SEPARATOR_2 */ 4249b85037dbSmrg 4250b85037dbSmrg#ifndef PATH_SEPARATOR_2 4251b85037dbSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 4252b85037dbSmrg#else /* PATH_SEPARATOR_2 */ 4253b85037dbSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 4254b85037dbSmrg#endif /* PATH_SEPARATOR_2 */ 4255b85037dbSmrg 4256b85037dbSmrg#ifndef FOPEN_WB 4257b85037dbSmrg# define FOPEN_WB "w" 4258b85037dbSmrg#endif 4259b85037dbSmrg#ifndef _O_BINARY 4260b85037dbSmrg# define _O_BINARY 0 4261b85037dbSmrg#endif 4262b85037dbSmrg 4263b85037dbSmrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4264b85037dbSmrg#define XFREE(stale) do { \ 4265b85037dbSmrg if (stale) { free ((void *) stale); stale = 0; } \ 4266b85037dbSmrg} while (0) 4267b85037dbSmrg 4268b85037dbSmrg#if defined(LT_DEBUGWRAPPER) 4269b85037dbSmrgstatic int lt_debug = 1; 4270b85037dbSmrg#else 4271b85037dbSmrgstatic int lt_debug = 0; 4272b85037dbSmrg#endif 4273b85037dbSmrg 4274b85037dbSmrgconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 4275b85037dbSmrg 4276b85037dbSmrgvoid *xmalloc (size_t num); 4277b85037dbSmrgchar *xstrdup (const char *string); 4278b85037dbSmrgconst char *base_name (const char *name); 4279b85037dbSmrgchar *find_executable (const char *wrapper); 4280b85037dbSmrgchar *chase_symlinks (const char *pathspec); 4281b85037dbSmrgint make_executable (const char *path); 4282b85037dbSmrgint check_executable (const char *path); 4283b85037dbSmrgchar *strendzap (char *str, const char *pat); 4284b85037dbSmrgvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 4285b85037dbSmrgvoid lt_fatal (const char *file, int line, const char *message, ...); 4286b85037dbSmrgstatic const char *nonnull (const char *s); 4287b85037dbSmrgstatic const char *nonempty (const char *s); 4288b85037dbSmrgvoid lt_setenv (const char *name, const char *value); 4289b85037dbSmrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 4290b85037dbSmrgvoid lt_update_exe_path (const char *name, const char *value); 4291b85037dbSmrgvoid lt_update_lib_path (const char *name, const char *value); 4292b85037dbSmrgchar **prepare_spawn (char **argv); 4293b85037dbSmrgvoid lt_dump_script (FILE *f); 4294b85037dbSmrgEOF 4295b85037dbSmrg 4296b85037dbSmrg cat <<EOF 4297302b15bdSmrgvolatile const char * MAGIC_EXE = "$magic_exe"; 4298b85037dbSmrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 4299b85037dbSmrgEOF 4300b85037dbSmrg 4301b85037dbSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4302302b15bdSmrg func_to_host_path "$temp_rpath" 4303b85037dbSmrg cat <<EOF 4304302b15bdSmrgconst char * LIB_PATH_VALUE = "$func_to_host_path_result"; 4305b85037dbSmrgEOF 4306b85037dbSmrg else 4307b85037dbSmrg cat <<"EOF" 4308b85037dbSmrgconst char * LIB_PATH_VALUE = ""; 4309b85037dbSmrgEOF 4310b85037dbSmrg fi 4311b85037dbSmrg 4312b85037dbSmrg if test -n "$dllsearchpath"; then 4313302b15bdSmrg func_to_host_path "$dllsearchpath:" 4314b85037dbSmrg cat <<EOF 4315b85037dbSmrgconst char * EXE_PATH_VARNAME = "PATH"; 4316302b15bdSmrgconst char * EXE_PATH_VALUE = "$func_to_host_path_result"; 4317b85037dbSmrgEOF 4318b85037dbSmrg else 4319b85037dbSmrg cat <<"EOF" 4320b85037dbSmrgconst char * EXE_PATH_VARNAME = ""; 4321b85037dbSmrgconst char * EXE_PATH_VALUE = ""; 4322b85037dbSmrgEOF 4323b85037dbSmrg fi 4324b85037dbSmrg 4325b85037dbSmrg if test "$fast_install" = yes; then 4326b85037dbSmrg cat <<EOF 4327b85037dbSmrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 4328b85037dbSmrgEOF 4329b85037dbSmrg else 4330b85037dbSmrg cat <<EOF 4331b85037dbSmrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 4332b85037dbSmrgEOF 4333b85037dbSmrg fi 4334b85037dbSmrg 4335b85037dbSmrg 4336b85037dbSmrg cat <<"EOF" 4337b85037dbSmrg 4338b85037dbSmrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 4339b85037dbSmrg 4340b85037dbSmrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 4341b85037dbSmrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 4342b85037dbSmrgstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 4343b85037dbSmrg 4344b85037dbSmrgint 4345b85037dbSmrgmain (int argc, char *argv[]) 4346b85037dbSmrg{ 4347b85037dbSmrg char **newargz; 4348b85037dbSmrg int newargc; 4349b85037dbSmrg char *tmp_pathspec; 4350b85037dbSmrg char *actual_cwrapper_path; 4351b85037dbSmrg char *actual_cwrapper_name; 4352b85037dbSmrg char *target_name; 4353b85037dbSmrg char *lt_argv_zero; 4354b85037dbSmrg intptr_t rval = 127; 4355b85037dbSmrg 4356b85037dbSmrg int i; 4357b85037dbSmrg 4358b85037dbSmrg program_name = (char *) xstrdup (base_name (argv[0])); 4359b85037dbSmrg newargz = XMALLOC (char *, argc + 1); 4360b85037dbSmrg 4361b85037dbSmrg /* very simple arg parsing; don't want to rely on getopt 4362b85037dbSmrg * also, copy all non cwrapper options to newargz, except 4363b85037dbSmrg * argz[0], which is handled differently 4364b85037dbSmrg */ 4365b85037dbSmrg newargc=0; 4366b85037dbSmrg for (i = 1; i < argc; i++) 4367b85037dbSmrg { 4368b85037dbSmrg if (strcmp (argv[i], dumpscript_opt) == 0) 4369b85037dbSmrg { 4370b85037dbSmrgEOF 4371b85037dbSmrg case "$host" in 4372b85037dbSmrg *mingw* | *cygwin* ) 4373b85037dbSmrg # make stdout use "unix" line endings 4374b85037dbSmrg echo " setmode(1,_O_BINARY);" 4375b85037dbSmrg ;; 4376b85037dbSmrg esac 4377b85037dbSmrg 4378b85037dbSmrg cat <<"EOF" 4379b85037dbSmrg lt_dump_script (stdout); 4380b85037dbSmrg return 0; 4381b85037dbSmrg } 4382b85037dbSmrg if (strcmp (argv[i], debug_opt) == 0) 4383b85037dbSmrg { 4384b85037dbSmrg lt_debug = 1; 4385b85037dbSmrg continue; 4386b85037dbSmrg } 4387b85037dbSmrg if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 4388b85037dbSmrg { 4389b85037dbSmrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 4390b85037dbSmrg namespace, but it is not one of the ones we know about and 4391b85037dbSmrg have already dealt with, above (inluding dump-script), then 4392b85037dbSmrg report an error. Otherwise, targets might begin to believe 4393b85037dbSmrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 4394b85037dbSmrg namespace. The first time any user complains about this, we'll 4395b85037dbSmrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 4396b85037dbSmrg or a configure.ac-settable value. 4397b85037dbSmrg */ 4398b85037dbSmrg lt_fatal (__FILE__, __LINE__, 4399b85037dbSmrg "unrecognized %s option: '%s'", 4400b85037dbSmrg ltwrapper_option_prefix, argv[i]); 4401b85037dbSmrg } 4402b85037dbSmrg /* otherwise ... */ 4403b85037dbSmrg newargz[++newargc] = xstrdup (argv[i]); 4404b85037dbSmrg } 4405b85037dbSmrg newargz[++newargc] = NULL; 4406b85037dbSmrg 4407b85037dbSmrgEOF 4408b85037dbSmrg cat <<EOF 4409b85037dbSmrg /* The GNU banner must be the first non-error debug message */ 4410b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 4411b85037dbSmrgEOF 4412b85037dbSmrg cat <<"EOF" 4413b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 4414b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 4415b85037dbSmrg 4416b85037dbSmrg tmp_pathspec = find_executable (argv[0]); 4417b85037dbSmrg if (tmp_pathspec == NULL) 4418b85037dbSmrg lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 4419b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, 4420b85037dbSmrg "(main) found exe (before symlink chase) at: %s\n", 4421b85037dbSmrg tmp_pathspec); 4422b85037dbSmrg 4423b85037dbSmrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 4424b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, 4425b85037dbSmrg "(main) found exe (after symlink chase) at: %s\n", 4426b85037dbSmrg actual_cwrapper_path); 4427b85037dbSmrg XFREE (tmp_pathspec); 4428b85037dbSmrg 4429b85037dbSmrg actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 4430b85037dbSmrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 4431b85037dbSmrg 4432b85037dbSmrg /* wrapper name transforms */ 4433b85037dbSmrg strendzap (actual_cwrapper_name, ".exe"); 4434b85037dbSmrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 4435b85037dbSmrg XFREE (actual_cwrapper_name); 4436b85037dbSmrg actual_cwrapper_name = tmp_pathspec; 4437b85037dbSmrg tmp_pathspec = 0; 4438b85037dbSmrg 4439b85037dbSmrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 4440b85037dbSmrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 4441b85037dbSmrg strendzap (target_name, ".exe"); 4442b85037dbSmrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 4443b85037dbSmrg XFREE (target_name); 4444b85037dbSmrg target_name = tmp_pathspec; 4445b85037dbSmrg tmp_pathspec = 0; 4446b85037dbSmrg 4447b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, 4448b85037dbSmrg "(main) libtool target name: %s\n", 4449b85037dbSmrg target_name); 4450b85037dbSmrgEOF 4451b85037dbSmrg 4452b85037dbSmrg cat <<EOF 4453b85037dbSmrg newargz[0] = 4454b85037dbSmrg XMALLOC (char, (strlen (actual_cwrapper_path) + 4455b85037dbSmrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 4456b85037dbSmrg strcpy (newargz[0], actual_cwrapper_path); 4457b85037dbSmrg strcat (newargz[0], "$objdir"); 4458b85037dbSmrg strcat (newargz[0], "/"); 4459b85037dbSmrgEOF 4460b85037dbSmrg 4461b85037dbSmrg cat <<"EOF" 4462b85037dbSmrg /* stop here, and copy so we don't have to do this twice */ 4463b85037dbSmrg tmp_pathspec = xstrdup (newargz[0]); 4464b85037dbSmrg 4465b85037dbSmrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 4466b85037dbSmrg strcat (newargz[0], actual_cwrapper_name); 4467b85037dbSmrg 4468b85037dbSmrg /* DO want the lt- prefix here if it exists, so use target_name */ 4469b85037dbSmrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 4470b85037dbSmrg XFREE (tmp_pathspec); 4471b85037dbSmrg tmp_pathspec = NULL; 4472b85037dbSmrgEOF 4473b85037dbSmrg 4474b85037dbSmrg case $host_os in 4475b85037dbSmrg mingw*) 4476b85037dbSmrg cat <<"EOF" 4477b85037dbSmrg { 4478b85037dbSmrg char* p; 4479b85037dbSmrg while ((p = strchr (newargz[0], '\\')) != NULL) 4480b85037dbSmrg { 4481b85037dbSmrg *p = '/'; 4482b85037dbSmrg } 4483b85037dbSmrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 4484b85037dbSmrg { 4485b85037dbSmrg *p = '/'; 4486b85037dbSmrg } 4487b85037dbSmrg } 4488b85037dbSmrgEOF 4489b85037dbSmrg ;; 4490b85037dbSmrg esac 4491b85037dbSmrg 4492b85037dbSmrg cat <<"EOF" 4493b85037dbSmrg XFREE (target_name); 4494b85037dbSmrg XFREE (actual_cwrapper_path); 4495b85037dbSmrg XFREE (actual_cwrapper_name); 4496b85037dbSmrg 4497b85037dbSmrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 4498b85037dbSmrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 4499302b15bdSmrg /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 4500302b15bdSmrg be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 4501302b15bdSmrg because on Windows, both *_VARNAMEs are PATH but uninstalled 4502302b15bdSmrg libraries must come first. */ 4503b85037dbSmrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 4504302b15bdSmrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 4505b85037dbSmrg 4506b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 4507b85037dbSmrg nonnull (lt_argv_zero)); 4508b85037dbSmrg for (i = 0; i < newargc; i++) 4509b85037dbSmrg { 4510b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 4511b85037dbSmrg i, nonnull (newargz[i])); 4512b85037dbSmrg } 4513b85037dbSmrg 4514b85037dbSmrgEOF 4515b85037dbSmrg 4516b85037dbSmrg case $host_os in 4517b85037dbSmrg mingw*) 4518b85037dbSmrg cat <<"EOF" 4519b85037dbSmrg /* execv doesn't actually work on mingw as expected on unix */ 4520b85037dbSmrg newargz = prepare_spawn (newargz); 4521b85037dbSmrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 4522b85037dbSmrg if (rval == -1) 4523b85037dbSmrg { 4524b85037dbSmrg /* failed to start process */ 4525b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, 4526b85037dbSmrg "(main) failed to launch target \"%s\": %s\n", 4527b85037dbSmrg lt_argv_zero, nonnull (strerror (errno))); 4528b85037dbSmrg return 127; 4529b85037dbSmrg } 4530b85037dbSmrg return rval; 4531b85037dbSmrgEOF 4532b85037dbSmrg ;; 4533b85037dbSmrg *) 4534b85037dbSmrg cat <<"EOF" 4535b85037dbSmrg execv (lt_argv_zero, newargz); 4536b85037dbSmrg return rval; /* =127, but avoids unused variable warning */ 4537b85037dbSmrgEOF 4538b85037dbSmrg ;; 4539b85037dbSmrg esac 4540b85037dbSmrg 4541b85037dbSmrg cat <<"EOF" 4542b85037dbSmrg} 4543b85037dbSmrg 4544b85037dbSmrgvoid * 4545b85037dbSmrgxmalloc (size_t num) 4546b85037dbSmrg{ 4547b85037dbSmrg void *p = (void *) malloc (num); 4548b85037dbSmrg if (!p) 4549b85037dbSmrg lt_fatal (__FILE__, __LINE__, "memory exhausted"); 4550b85037dbSmrg 4551b85037dbSmrg return p; 4552b85037dbSmrg} 4553b85037dbSmrg 4554b85037dbSmrgchar * 4555b85037dbSmrgxstrdup (const char *string) 4556b85037dbSmrg{ 4557b85037dbSmrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 4558b85037dbSmrg string) : NULL; 4559b85037dbSmrg} 4560b85037dbSmrg 4561b85037dbSmrgconst char * 4562b85037dbSmrgbase_name (const char *name) 4563b85037dbSmrg{ 4564b85037dbSmrg const char *base; 4565b85037dbSmrg 4566b85037dbSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4567b85037dbSmrg /* Skip over the disk name in MSDOS pathnames. */ 4568b85037dbSmrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 4569b85037dbSmrg name += 2; 4570b85037dbSmrg#endif 4571b85037dbSmrg 4572b85037dbSmrg for (base = name; *name; name++) 4573b85037dbSmrg if (IS_DIR_SEPARATOR (*name)) 4574b85037dbSmrg base = name + 1; 4575b85037dbSmrg return base; 4576b85037dbSmrg} 4577b85037dbSmrg 4578b85037dbSmrgint 4579b85037dbSmrgcheck_executable (const char *path) 4580b85037dbSmrg{ 4581b85037dbSmrg struct stat st; 4582b85037dbSmrg 4583b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 4584b85037dbSmrg nonempty (path)); 4585b85037dbSmrg if ((!path) || (!*path)) 4586b85037dbSmrg return 0; 4587b85037dbSmrg 4588b85037dbSmrg if ((stat (path, &st) >= 0) 4589b85037dbSmrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 4590b85037dbSmrg return 1; 4591b85037dbSmrg else 4592b85037dbSmrg return 0; 4593b85037dbSmrg} 4594b85037dbSmrg 4595b85037dbSmrgint 4596b85037dbSmrgmake_executable (const char *path) 4597b85037dbSmrg{ 4598b85037dbSmrg int rval = 0; 4599b85037dbSmrg struct stat st; 4600b85037dbSmrg 4601b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 4602b85037dbSmrg nonempty (path)); 4603b85037dbSmrg if ((!path) || (!*path)) 4604b85037dbSmrg return 0; 4605b85037dbSmrg 4606b85037dbSmrg if (stat (path, &st) >= 0) 4607b85037dbSmrg { 4608b85037dbSmrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 4609b85037dbSmrg } 4610b85037dbSmrg return rval; 4611b85037dbSmrg} 4612b85037dbSmrg 4613b85037dbSmrg/* Searches for the full path of the wrapper. Returns 4614b85037dbSmrg newly allocated full path name if found, NULL otherwise 4615b85037dbSmrg Does not chase symlinks, even on platforms that support them. 4616b85037dbSmrg*/ 4617b85037dbSmrgchar * 4618b85037dbSmrgfind_executable (const char *wrapper) 4619b85037dbSmrg{ 4620b85037dbSmrg int has_slash = 0; 4621b85037dbSmrg const char *p; 4622b85037dbSmrg const char *p_next; 4623b85037dbSmrg /* static buffer for getcwd */ 4624b85037dbSmrg char tmp[LT_PATHMAX + 1]; 4625b85037dbSmrg int tmp_len; 4626b85037dbSmrg char *concat_name; 4627b85037dbSmrg 4628b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 4629b85037dbSmrg nonempty (wrapper)); 4630b85037dbSmrg 4631b85037dbSmrg if ((wrapper == NULL) || (*wrapper == '\0')) 4632b85037dbSmrg return NULL; 4633b85037dbSmrg 4634b85037dbSmrg /* Absolute path? */ 4635b85037dbSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4636b85037dbSmrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 4637b85037dbSmrg { 4638b85037dbSmrg concat_name = xstrdup (wrapper); 4639b85037dbSmrg if (check_executable (concat_name)) 4640b85037dbSmrg return concat_name; 4641b85037dbSmrg XFREE (concat_name); 4642b85037dbSmrg } 4643b85037dbSmrg else 4644b85037dbSmrg { 4645b85037dbSmrg#endif 4646b85037dbSmrg if (IS_DIR_SEPARATOR (wrapper[0])) 4647b85037dbSmrg { 4648b85037dbSmrg concat_name = xstrdup (wrapper); 4649b85037dbSmrg if (check_executable (concat_name)) 4650b85037dbSmrg return concat_name; 4651b85037dbSmrg XFREE (concat_name); 4652b85037dbSmrg } 4653b85037dbSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4654b85037dbSmrg } 4655b85037dbSmrg#endif 4656b85037dbSmrg 4657b85037dbSmrg for (p = wrapper; *p; p++) 4658b85037dbSmrg if (*p == '/') 4659b85037dbSmrg { 4660b85037dbSmrg has_slash = 1; 4661b85037dbSmrg break; 4662b85037dbSmrg } 4663b85037dbSmrg if (!has_slash) 4664b85037dbSmrg { 4665b85037dbSmrg /* no slashes; search PATH */ 4666b85037dbSmrg const char *path = getenv ("PATH"); 4667b85037dbSmrg if (path != NULL) 4668b85037dbSmrg { 4669b85037dbSmrg for (p = path; *p; p = p_next) 4670b85037dbSmrg { 4671b85037dbSmrg const char *q; 4672b85037dbSmrg size_t p_len; 4673b85037dbSmrg for (q = p; *q; q++) 4674b85037dbSmrg if (IS_PATH_SEPARATOR (*q)) 4675b85037dbSmrg break; 4676b85037dbSmrg p_len = q - p; 4677b85037dbSmrg p_next = (*q == '\0' ? q : q + 1); 4678b85037dbSmrg if (p_len == 0) 4679b85037dbSmrg { 4680b85037dbSmrg /* empty path: current directory */ 4681b85037dbSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 4682b85037dbSmrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4683b85037dbSmrg nonnull (strerror (errno))); 4684b85037dbSmrg tmp_len = strlen (tmp); 4685b85037dbSmrg concat_name = 4686b85037dbSmrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4687b85037dbSmrg memcpy (concat_name, tmp, tmp_len); 4688b85037dbSmrg concat_name[tmp_len] = '/'; 4689b85037dbSmrg strcpy (concat_name + tmp_len + 1, wrapper); 4690b85037dbSmrg } 4691b85037dbSmrg else 4692b85037dbSmrg { 4693b85037dbSmrg concat_name = 4694b85037dbSmrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 4695b85037dbSmrg memcpy (concat_name, p, p_len); 4696b85037dbSmrg concat_name[p_len] = '/'; 4697b85037dbSmrg strcpy (concat_name + p_len + 1, wrapper); 4698b85037dbSmrg } 4699b85037dbSmrg if (check_executable (concat_name)) 4700b85037dbSmrg return concat_name; 4701b85037dbSmrg XFREE (concat_name); 4702b85037dbSmrg } 4703b85037dbSmrg } 4704b85037dbSmrg /* not found in PATH; assume curdir */ 4705b85037dbSmrg } 4706b85037dbSmrg /* Relative path | not found in path: prepend cwd */ 4707b85037dbSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 4708b85037dbSmrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4709b85037dbSmrg nonnull (strerror (errno))); 4710b85037dbSmrg tmp_len = strlen (tmp); 4711b85037dbSmrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4712b85037dbSmrg memcpy (concat_name, tmp, tmp_len); 4713b85037dbSmrg concat_name[tmp_len] = '/'; 4714b85037dbSmrg strcpy (concat_name + tmp_len + 1, wrapper); 4715b85037dbSmrg 4716b85037dbSmrg if (check_executable (concat_name)) 4717b85037dbSmrg return concat_name; 4718b85037dbSmrg XFREE (concat_name); 4719b85037dbSmrg return NULL; 4720b85037dbSmrg} 4721b85037dbSmrg 4722b85037dbSmrgchar * 4723b85037dbSmrgchase_symlinks (const char *pathspec) 4724b85037dbSmrg{ 4725b85037dbSmrg#ifndef S_ISLNK 4726b85037dbSmrg return xstrdup (pathspec); 4727b85037dbSmrg#else 4728b85037dbSmrg char buf[LT_PATHMAX]; 4729b85037dbSmrg struct stat s; 4730b85037dbSmrg char *tmp_pathspec = xstrdup (pathspec); 4731b85037dbSmrg char *p; 4732b85037dbSmrg int has_symlinks = 0; 4733b85037dbSmrg while (strlen (tmp_pathspec) && !has_symlinks) 4734b85037dbSmrg { 4735b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, 4736b85037dbSmrg "checking path component for symlinks: %s\n", 4737b85037dbSmrg tmp_pathspec); 4738b85037dbSmrg if (lstat (tmp_pathspec, &s) == 0) 4739b85037dbSmrg { 4740b85037dbSmrg if (S_ISLNK (s.st_mode) != 0) 4741b85037dbSmrg { 4742b85037dbSmrg has_symlinks = 1; 4743b85037dbSmrg break; 4744b85037dbSmrg } 4745b85037dbSmrg 4746b85037dbSmrg /* search backwards for last DIR_SEPARATOR */ 4747b85037dbSmrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 4748b85037dbSmrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4749b85037dbSmrg p--; 4750b85037dbSmrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4751b85037dbSmrg { 4752b85037dbSmrg /* no more DIR_SEPARATORS left */ 4753b85037dbSmrg break; 4754b85037dbSmrg } 4755b85037dbSmrg *p = '\0'; 4756b85037dbSmrg } 4757b85037dbSmrg else 4758b85037dbSmrg { 4759b85037dbSmrg lt_fatal (__FILE__, __LINE__, 4760b85037dbSmrg "error accessing file \"%s\": %s", 4761b85037dbSmrg tmp_pathspec, nonnull (strerror (errno))); 4762b85037dbSmrg } 4763b85037dbSmrg } 4764b85037dbSmrg XFREE (tmp_pathspec); 4765b85037dbSmrg 4766b85037dbSmrg if (!has_symlinks) 4767b85037dbSmrg { 4768b85037dbSmrg return xstrdup (pathspec); 4769b85037dbSmrg } 4770b85037dbSmrg 4771b85037dbSmrg tmp_pathspec = realpath (pathspec, buf); 4772b85037dbSmrg if (tmp_pathspec == 0) 4773b85037dbSmrg { 4774b85037dbSmrg lt_fatal (__FILE__, __LINE__, 4775b85037dbSmrg "could not follow symlinks for %s", pathspec); 4776b85037dbSmrg } 4777b85037dbSmrg return xstrdup (tmp_pathspec); 4778b85037dbSmrg#endif 4779b85037dbSmrg} 4780b85037dbSmrg 4781b85037dbSmrgchar * 4782b85037dbSmrgstrendzap (char *str, const char *pat) 4783b85037dbSmrg{ 4784b85037dbSmrg size_t len, patlen; 4785b85037dbSmrg 4786b85037dbSmrg assert (str != NULL); 4787b85037dbSmrg assert (pat != NULL); 4788b85037dbSmrg 4789b85037dbSmrg len = strlen (str); 4790b85037dbSmrg patlen = strlen (pat); 4791b85037dbSmrg 4792b85037dbSmrg if (patlen <= len) 4793b85037dbSmrg { 4794b85037dbSmrg str += len - patlen; 4795b85037dbSmrg if (strcmp (str, pat) == 0) 4796b85037dbSmrg *str = '\0'; 4797b85037dbSmrg } 4798b85037dbSmrg return str; 4799b85037dbSmrg} 4800b85037dbSmrg 4801b85037dbSmrgvoid 4802b85037dbSmrglt_debugprintf (const char *file, int line, const char *fmt, ...) 4803b85037dbSmrg{ 4804b85037dbSmrg va_list args; 4805b85037dbSmrg if (lt_debug) 4806b85037dbSmrg { 4807b85037dbSmrg (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 4808b85037dbSmrg va_start (args, fmt); 4809b85037dbSmrg (void) vfprintf (stderr, fmt, args); 4810b85037dbSmrg va_end (args); 4811b85037dbSmrg } 4812b85037dbSmrg} 4813b85037dbSmrg 4814b85037dbSmrgstatic void 4815b85037dbSmrglt_error_core (int exit_status, const char *file, 4816b85037dbSmrg int line, const char *mode, 4817b85037dbSmrg const char *message, va_list ap) 4818b85037dbSmrg{ 4819b85037dbSmrg fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 4820b85037dbSmrg vfprintf (stderr, message, ap); 4821b85037dbSmrg fprintf (stderr, ".\n"); 4822b85037dbSmrg 4823b85037dbSmrg if (exit_status >= 0) 4824b85037dbSmrg exit (exit_status); 4825b85037dbSmrg} 4826b85037dbSmrg 4827b85037dbSmrgvoid 4828b85037dbSmrglt_fatal (const char *file, int line, const char *message, ...) 4829b85037dbSmrg{ 4830b85037dbSmrg va_list ap; 4831b85037dbSmrg va_start (ap, message); 4832b85037dbSmrg lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 4833b85037dbSmrg va_end (ap); 4834b85037dbSmrg} 4835b85037dbSmrg 4836b85037dbSmrgstatic const char * 4837b85037dbSmrgnonnull (const char *s) 4838b85037dbSmrg{ 4839b85037dbSmrg return s ? s : "(null)"; 4840b85037dbSmrg} 4841b85037dbSmrg 4842b85037dbSmrgstatic const char * 4843b85037dbSmrgnonempty (const char *s) 4844b85037dbSmrg{ 4845b85037dbSmrg return (s && !*s) ? "(empty)" : nonnull (s); 4846b85037dbSmrg} 4847b85037dbSmrg 4848b85037dbSmrgvoid 4849b85037dbSmrglt_setenv (const char *name, const char *value) 4850b85037dbSmrg{ 4851b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, 4852b85037dbSmrg "(lt_setenv) setting '%s' to '%s'\n", 4853b85037dbSmrg nonnull (name), nonnull (value)); 4854b85037dbSmrg { 4855b85037dbSmrg#ifdef HAVE_SETENV 4856b85037dbSmrg /* always make a copy, for consistency with !HAVE_SETENV */ 4857b85037dbSmrg char *str = xstrdup (value); 4858b85037dbSmrg setenv (name, str, 1); 4859b85037dbSmrg#else 4860b85037dbSmrg int len = strlen (name) + 1 + strlen (value) + 1; 4861b85037dbSmrg char *str = XMALLOC (char, len); 4862b85037dbSmrg sprintf (str, "%s=%s", name, value); 4863b85037dbSmrg if (putenv (str) != EXIT_SUCCESS) 4864b85037dbSmrg { 4865b85037dbSmrg XFREE (str); 4866b85037dbSmrg } 4867b85037dbSmrg#endif 4868b85037dbSmrg } 4869b85037dbSmrg} 4870b85037dbSmrg 4871b85037dbSmrgchar * 4872b85037dbSmrglt_extend_str (const char *orig_value, const char *add, int to_end) 4873b85037dbSmrg{ 4874b85037dbSmrg char *new_value; 4875b85037dbSmrg if (orig_value && *orig_value) 4876b85037dbSmrg { 4877b85037dbSmrg int orig_value_len = strlen (orig_value); 4878b85037dbSmrg int add_len = strlen (add); 4879b85037dbSmrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 4880b85037dbSmrg if (to_end) 4881b85037dbSmrg { 4882b85037dbSmrg strcpy (new_value, orig_value); 4883b85037dbSmrg strcpy (new_value + orig_value_len, add); 4884b85037dbSmrg } 4885b85037dbSmrg else 4886b85037dbSmrg { 4887b85037dbSmrg strcpy (new_value, add); 4888b85037dbSmrg strcpy (new_value + add_len, orig_value); 4889b85037dbSmrg } 4890b85037dbSmrg } 4891b85037dbSmrg else 4892b85037dbSmrg { 4893b85037dbSmrg new_value = xstrdup (add); 4894b85037dbSmrg } 4895b85037dbSmrg return new_value; 4896b85037dbSmrg} 4897b85037dbSmrg 4898b85037dbSmrgvoid 4899b85037dbSmrglt_update_exe_path (const char *name, const char *value) 4900b85037dbSmrg{ 4901b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, 4902b85037dbSmrg "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 4903b85037dbSmrg nonnull (name), nonnull (value)); 4904b85037dbSmrg 4905b85037dbSmrg if (name && *name && value && *value) 4906b85037dbSmrg { 4907b85037dbSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 4908b85037dbSmrg /* some systems can't cope with a ':'-terminated path #' */ 4909b85037dbSmrg int len = strlen (new_value); 4910b85037dbSmrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 4911b85037dbSmrg { 4912b85037dbSmrg new_value[len-1] = '\0'; 4913b85037dbSmrg } 4914b85037dbSmrg lt_setenv (name, new_value); 4915b85037dbSmrg XFREE (new_value); 4916b85037dbSmrg } 4917b85037dbSmrg} 4918b85037dbSmrg 4919b85037dbSmrgvoid 4920b85037dbSmrglt_update_lib_path (const char *name, const char *value) 4921b85037dbSmrg{ 4922b85037dbSmrg lt_debugprintf (__FILE__, __LINE__, 4923b85037dbSmrg "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 4924b85037dbSmrg nonnull (name), nonnull (value)); 4925b85037dbSmrg 4926b85037dbSmrg if (name && *name && value && *value) 4927b85037dbSmrg { 4928b85037dbSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 4929b85037dbSmrg lt_setenv (name, new_value); 4930b85037dbSmrg XFREE (new_value); 4931b85037dbSmrg } 4932b85037dbSmrg} 4933b85037dbSmrg 4934b85037dbSmrgEOF 4935b85037dbSmrg case $host_os in 4936b85037dbSmrg mingw*) 4937b85037dbSmrg cat <<"EOF" 4938b85037dbSmrg 4939b85037dbSmrg/* Prepares an argument vector before calling spawn(). 4940b85037dbSmrg Note that spawn() does not by itself call the command interpreter 4941b85037dbSmrg (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 4942b85037dbSmrg ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 4943b85037dbSmrg GetVersionEx(&v); 4944b85037dbSmrg v.dwPlatformId == VER_PLATFORM_WIN32_NT; 4945b85037dbSmrg }) ? "cmd.exe" : "command.com"). 4946b85037dbSmrg Instead it simply concatenates the arguments, separated by ' ', and calls 4947b85037dbSmrg CreateProcess(). We must quote the arguments since Win32 CreateProcess() 4948b85037dbSmrg interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 4949b85037dbSmrg special way: 4950b85037dbSmrg - Space and tab are interpreted as delimiters. They are not treated as 4951b85037dbSmrg delimiters if they are surrounded by double quotes: "...". 4952b85037dbSmrg - Unescaped double quotes are removed from the input. Their only effect is 4953b85037dbSmrg that within double quotes, space and tab are treated like normal 4954b85037dbSmrg characters. 4955b85037dbSmrg - Backslashes not followed by double quotes are not special. 4956b85037dbSmrg - But 2*n+1 backslashes followed by a double quote become 4957b85037dbSmrg n backslashes followed by a double quote (n >= 0): 4958b85037dbSmrg \" -> " 4959b85037dbSmrg \\\" -> \" 4960b85037dbSmrg \\\\\" -> \\" 4961b85037dbSmrg */ 4962b85037dbSmrg#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" 4963b85037dbSmrg#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" 4964b85037dbSmrgchar ** 4965b85037dbSmrgprepare_spawn (char **argv) 4966b85037dbSmrg{ 4967b85037dbSmrg size_t argc; 4968b85037dbSmrg char **new_argv; 4969b85037dbSmrg size_t i; 4970b85037dbSmrg 4971b85037dbSmrg /* Count number of arguments. */ 4972b85037dbSmrg for (argc = 0; argv[argc] != NULL; argc++) 4973b85037dbSmrg ; 4974b85037dbSmrg 4975b85037dbSmrg /* Allocate new argument vector. */ 4976b85037dbSmrg new_argv = XMALLOC (char *, argc + 1); 4977b85037dbSmrg 4978b85037dbSmrg /* Put quoted arguments into the new argument vector. */ 4979b85037dbSmrg for (i = 0; i < argc; i++) 4980b85037dbSmrg { 4981b85037dbSmrg const char *string = argv[i]; 4982b85037dbSmrg 4983b85037dbSmrg if (string[0] == '\0') 4984b85037dbSmrg new_argv[i] = xstrdup ("\"\""); 4985b85037dbSmrg else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 4986b85037dbSmrg { 4987b85037dbSmrg int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 4988b85037dbSmrg size_t length; 4989b85037dbSmrg unsigned int backslashes; 4990b85037dbSmrg const char *s; 4991b85037dbSmrg char *quoted_string; 4992b85037dbSmrg char *p; 4993b85037dbSmrg 4994b85037dbSmrg length = 0; 4995b85037dbSmrg backslashes = 0; 4996b85037dbSmrg if (quote_around) 4997b85037dbSmrg length++; 4998b85037dbSmrg for (s = string; *s != '\0'; s++) 4999b85037dbSmrg { 5000b85037dbSmrg char c = *s; 5001b85037dbSmrg if (c == '"') 5002b85037dbSmrg length += backslashes + 1; 5003b85037dbSmrg length++; 5004b85037dbSmrg if (c == '\\') 5005b85037dbSmrg backslashes++; 5006b85037dbSmrg else 5007b85037dbSmrg backslashes = 0; 5008b85037dbSmrg } 5009b85037dbSmrg if (quote_around) 5010b85037dbSmrg length += backslashes + 1; 5011b85037dbSmrg 5012b85037dbSmrg quoted_string = XMALLOC (char, length + 1); 5013b85037dbSmrg 5014b85037dbSmrg p = quoted_string; 5015b85037dbSmrg backslashes = 0; 5016b85037dbSmrg if (quote_around) 5017b85037dbSmrg *p++ = '"'; 5018b85037dbSmrg for (s = string; *s != '\0'; s++) 5019b85037dbSmrg { 5020b85037dbSmrg char c = *s; 5021b85037dbSmrg if (c == '"') 5022b85037dbSmrg { 5023b85037dbSmrg unsigned int j; 5024b85037dbSmrg for (j = backslashes + 1; j > 0; j--) 5025b85037dbSmrg *p++ = '\\'; 5026b85037dbSmrg } 5027b85037dbSmrg *p++ = c; 5028b85037dbSmrg if (c == '\\') 5029b85037dbSmrg backslashes++; 5030b85037dbSmrg else 5031b85037dbSmrg backslashes = 0; 5032b85037dbSmrg } 5033b85037dbSmrg if (quote_around) 5034b85037dbSmrg { 5035b85037dbSmrg unsigned int j; 5036b85037dbSmrg for (j = backslashes; j > 0; j--) 5037b85037dbSmrg *p++ = '\\'; 5038b85037dbSmrg *p++ = '"'; 5039b85037dbSmrg } 5040b85037dbSmrg *p = '\0'; 5041b85037dbSmrg 5042b85037dbSmrg new_argv[i] = quoted_string; 5043b85037dbSmrg } 5044b85037dbSmrg else 5045b85037dbSmrg new_argv[i] = (char *) string; 5046b85037dbSmrg } 5047b85037dbSmrg new_argv[argc] = NULL; 5048b85037dbSmrg 5049b85037dbSmrg return new_argv; 5050b85037dbSmrg} 5051b85037dbSmrgEOF 5052b85037dbSmrg ;; 5053b85037dbSmrg esac 5054b85037dbSmrg 5055b85037dbSmrg cat <<"EOF" 5056b85037dbSmrgvoid lt_dump_script (FILE* f) 5057b85037dbSmrg{ 5058b85037dbSmrgEOF 5059b85037dbSmrg func_emit_wrapper yes | 5060b85037dbSmrg $SED -e 's/\([\\"]\)/\\\1/g' \ 5061b85037dbSmrg -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' 5062b85037dbSmrg 5063b85037dbSmrg cat <<"EOF" 5064b85037dbSmrg} 5065b85037dbSmrgEOF 5066b85037dbSmrg} 5067b85037dbSmrg# end: func_emit_cwrapperexe_src 5068b85037dbSmrg 5069b85037dbSmrg# func_win32_import_lib_p ARG 5070b85037dbSmrg# True if ARG is an import lib, as indicated by $file_magic_cmd 5071b85037dbSmrgfunc_win32_import_lib_p () 5072b85037dbSmrg{ 5073b85037dbSmrg $opt_debug 5074b85037dbSmrg case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 5075b85037dbSmrg *import*) : ;; 5076b85037dbSmrg *) false ;; 5077b85037dbSmrg esac 5078b85037dbSmrg} 5079b85037dbSmrg 5080b85037dbSmrg# func_mode_link arg... 5081b85037dbSmrgfunc_mode_link () 5082b85037dbSmrg{ 5083b85037dbSmrg $opt_debug 5084b85037dbSmrg case $host in 5085b85037dbSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5086b85037dbSmrg # It is impossible to link a dll without this setting, and 5087b85037dbSmrg # we shouldn't force the makefile maintainer to figure out 5088b85037dbSmrg # which system we are compiling for in order to pass an extra 5089b85037dbSmrg # flag for every libtool invocation. 5090b85037dbSmrg # allow_undefined=no 5091b85037dbSmrg 5092b85037dbSmrg # FIXME: Unfortunately, there are problems with the above when trying 5093b85037dbSmrg # to make a dll which has undefined symbols, in which case not 5094b85037dbSmrg # even a static library is built. For now, we need to specify 5095b85037dbSmrg # -no-undefined on the libtool link line when we can be certain 5096b85037dbSmrg # that all symbols are satisfied, otherwise we get a static library. 5097b85037dbSmrg allow_undefined=yes 5098b85037dbSmrg ;; 5099b85037dbSmrg *) 5100b85037dbSmrg allow_undefined=yes 5101b85037dbSmrg ;; 5102b85037dbSmrg esac 5103b85037dbSmrg libtool_args=$nonopt 5104b85037dbSmrg base_compile="$nonopt $@" 5105b85037dbSmrg compile_command=$nonopt 5106b85037dbSmrg finalize_command=$nonopt 5107b85037dbSmrg 5108b85037dbSmrg compile_rpath= 5109b85037dbSmrg finalize_rpath= 5110b85037dbSmrg compile_shlibpath= 5111b85037dbSmrg finalize_shlibpath= 5112b85037dbSmrg convenience= 5113b85037dbSmrg old_convenience= 5114b85037dbSmrg deplibs= 5115b85037dbSmrg old_deplibs= 5116b85037dbSmrg compiler_flags= 5117b85037dbSmrg linker_flags= 5118b85037dbSmrg dllsearchpath= 5119b85037dbSmrg lib_search_path=`pwd` 5120b85037dbSmrg inst_prefix_dir= 5121b85037dbSmrg new_inherited_linker_flags= 5122b85037dbSmrg 5123b85037dbSmrg avoid_version=no 5124b85037dbSmrg bindir= 5125b85037dbSmrg dlfiles= 5126b85037dbSmrg dlprefiles= 5127b85037dbSmrg dlself=no 5128b85037dbSmrg export_dynamic=no 5129b85037dbSmrg export_symbols= 5130b85037dbSmrg export_symbols_regex= 5131b85037dbSmrg generated= 5132b85037dbSmrg libobjs= 5133b85037dbSmrg ltlibs= 5134b85037dbSmrg module=no 5135b85037dbSmrg no_install=no 5136b85037dbSmrg objs= 5137b85037dbSmrg non_pic_objects= 5138b85037dbSmrg precious_files_regex= 5139b85037dbSmrg prefer_static_libs=no 5140b85037dbSmrg preload=no 5141b85037dbSmrg prev= 5142b85037dbSmrg prevarg= 5143b85037dbSmrg release= 5144b85037dbSmrg rpath= 5145b85037dbSmrg xrpath= 5146b85037dbSmrg perm_rpath= 5147b85037dbSmrg temp_rpath= 5148b85037dbSmrg thread_safe=no 5149b85037dbSmrg vinfo= 5150b85037dbSmrg vinfo_number=no 5151b85037dbSmrg weak_libs= 5152b85037dbSmrg single_module="${wl}-single_module" 5153b85037dbSmrg func_infer_tag $base_compile 5154b85037dbSmrg 5155b85037dbSmrg # We need to know -static, to get the right output filenames. 5156b85037dbSmrg for arg 5157b85037dbSmrg do 5158b85037dbSmrg case $arg in 5159b85037dbSmrg -shared) 5160b85037dbSmrg test "$build_libtool_libs" != yes && \ 5161b85037dbSmrg func_fatal_configuration "can not build a shared library" 5162b85037dbSmrg build_old_libs=no 5163b85037dbSmrg break 5164b85037dbSmrg ;; 5165b85037dbSmrg -all-static | -static | -static-libtool-libs) 5166b85037dbSmrg case $arg in 5167b85037dbSmrg -all-static) 5168b85037dbSmrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 5169b85037dbSmrg func_warning "complete static linking is impossible in this configuration" 5170b85037dbSmrg fi 5171b85037dbSmrg if test -n "$link_static_flag"; then 5172b85037dbSmrg dlopen_self=$dlopen_self_static 5173b85037dbSmrg fi 5174b85037dbSmrg prefer_static_libs=yes 5175b85037dbSmrg ;; 5176b85037dbSmrg -static) 5177b85037dbSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 5178b85037dbSmrg dlopen_self=$dlopen_self_static 5179b85037dbSmrg fi 5180b85037dbSmrg prefer_static_libs=built 5181b85037dbSmrg ;; 5182b85037dbSmrg -static-libtool-libs) 5183b85037dbSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 5184b85037dbSmrg dlopen_self=$dlopen_self_static 5185b85037dbSmrg fi 5186b85037dbSmrg prefer_static_libs=yes 5187b85037dbSmrg ;; 5188b85037dbSmrg esac 5189b85037dbSmrg build_libtool_libs=no 5190b85037dbSmrg build_old_libs=yes 5191b85037dbSmrg break 5192b85037dbSmrg ;; 5193b85037dbSmrg esac 5194b85037dbSmrg done 5195b85037dbSmrg 5196b85037dbSmrg # See if our shared archives depend on static archives. 5197b85037dbSmrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 5198b85037dbSmrg 5199b85037dbSmrg # Go through the arguments, transforming them on the way. 5200b85037dbSmrg while test "$#" -gt 0; do 5201b85037dbSmrg arg="$1" 5202b85037dbSmrg shift 5203b85037dbSmrg func_quote_for_eval "$arg" 5204b85037dbSmrg qarg=$func_quote_for_eval_unquoted_result 5205b85037dbSmrg func_append libtool_args " $func_quote_for_eval_result" 5206b85037dbSmrg 5207b85037dbSmrg # If the previous option needs an argument, assign it. 5208b85037dbSmrg if test -n "$prev"; then 5209b85037dbSmrg case $prev in 5210b85037dbSmrg output) 5211b85037dbSmrg func_append compile_command " @OUTPUT@" 5212b85037dbSmrg func_append finalize_command " @OUTPUT@" 5213b85037dbSmrg ;; 5214b85037dbSmrg esac 5215b85037dbSmrg 5216b85037dbSmrg case $prev in 5217b85037dbSmrg bindir) 5218b85037dbSmrg bindir="$arg" 5219b85037dbSmrg prev= 5220b85037dbSmrg continue 5221b85037dbSmrg ;; 5222b85037dbSmrg dlfiles|dlprefiles) 5223b85037dbSmrg if test "$preload" = no; then 5224b85037dbSmrg # Add the symbol object into the linking commands. 5225b85037dbSmrg func_append compile_command " @SYMFILE@" 5226b85037dbSmrg func_append finalize_command " @SYMFILE@" 5227b85037dbSmrg preload=yes 5228b85037dbSmrg fi 5229b85037dbSmrg case $arg in 5230b85037dbSmrg *.la | *.lo) ;; # We handle these cases below. 5231b85037dbSmrg force) 5232b85037dbSmrg if test "$dlself" = no; then 5233b85037dbSmrg dlself=needless 5234b85037dbSmrg export_dynamic=yes 5235b85037dbSmrg fi 5236b85037dbSmrg prev= 5237b85037dbSmrg continue 5238b85037dbSmrg ;; 5239b85037dbSmrg self) 5240b85037dbSmrg if test "$prev" = dlprefiles; then 5241b85037dbSmrg dlself=yes 5242b85037dbSmrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 5243b85037dbSmrg dlself=yes 5244b85037dbSmrg else 5245b85037dbSmrg dlself=needless 5246b85037dbSmrg export_dynamic=yes 5247b85037dbSmrg fi 5248b85037dbSmrg prev= 5249b85037dbSmrg continue 5250b85037dbSmrg ;; 5251b85037dbSmrg *) 5252b85037dbSmrg if test "$prev" = dlfiles; then 5253302b15bdSmrg func_append dlfiles " $arg" 5254b85037dbSmrg else 5255302b15bdSmrg func_append dlprefiles " $arg" 5256b85037dbSmrg fi 5257b85037dbSmrg prev= 5258b85037dbSmrg continue 5259b85037dbSmrg ;; 5260b85037dbSmrg esac 5261b85037dbSmrg ;; 5262b85037dbSmrg expsyms) 5263b85037dbSmrg export_symbols="$arg" 5264b85037dbSmrg test -f "$arg" \ 5265b85037dbSmrg || func_fatal_error "symbol file \`$arg' does not exist" 5266b85037dbSmrg prev= 5267b85037dbSmrg continue 5268b85037dbSmrg ;; 5269b85037dbSmrg expsyms_regex) 5270b85037dbSmrg export_symbols_regex="$arg" 5271b85037dbSmrg prev= 5272b85037dbSmrg continue 5273b85037dbSmrg ;; 5274b85037dbSmrg framework) 5275b85037dbSmrg case $host in 5276b85037dbSmrg *-*-darwin*) 5277b85037dbSmrg case "$deplibs " in 5278b85037dbSmrg *" $qarg.ltframework "*) ;; 5279302b15bdSmrg *) func_append deplibs " $qarg.ltframework" # this is fixed later 5280b85037dbSmrg ;; 5281b85037dbSmrg esac 5282b85037dbSmrg ;; 5283b85037dbSmrg esac 5284b85037dbSmrg prev= 5285b85037dbSmrg continue 5286b85037dbSmrg ;; 5287b85037dbSmrg inst_prefix) 5288b85037dbSmrg inst_prefix_dir="$arg" 5289b85037dbSmrg prev= 5290b85037dbSmrg continue 5291b85037dbSmrg ;; 5292b85037dbSmrg objectlist) 5293b85037dbSmrg if test -f "$arg"; then 5294b85037dbSmrg save_arg=$arg 5295b85037dbSmrg moreargs= 5296b85037dbSmrg for fil in `cat "$save_arg"` 5297b85037dbSmrg do 5298302b15bdSmrg# func_append moreargs " $fil" 5299b85037dbSmrg arg=$fil 5300b85037dbSmrg # A libtool-controlled object. 5301b85037dbSmrg 5302b85037dbSmrg # Check to see that this really is a libtool object. 5303b85037dbSmrg if func_lalib_unsafe_p "$arg"; then 5304b85037dbSmrg pic_object= 5305b85037dbSmrg non_pic_object= 5306b85037dbSmrg 5307b85037dbSmrg # Read the .lo file 5308b85037dbSmrg func_source "$arg" 5309b85037dbSmrg 5310b85037dbSmrg if test -z "$pic_object" || 5311b85037dbSmrg test -z "$non_pic_object" || 5312b85037dbSmrg test "$pic_object" = none && 5313b85037dbSmrg test "$non_pic_object" = none; then 5314b85037dbSmrg func_fatal_error "cannot find name of object for \`$arg'" 5315b85037dbSmrg fi 5316b85037dbSmrg 5317b85037dbSmrg # Extract subdirectory from the argument. 5318b85037dbSmrg func_dirname "$arg" "/" "" 5319b85037dbSmrg xdir="$func_dirname_result" 5320b85037dbSmrg 5321b85037dbSmrg if test "$pic_object" != none; then 5322b85037dbSmrg # Prepend the subdirectory the object is found in. 5323b85037dbSmrg pic_object="$xdir$pic_object" 5324b85037dbSmrg 5325b85037dbSmrg if test "$prev" = dlfiles; then 5326b85037dbSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 5327302b15bdSmrg func_append dlfiles " $pic_object" 5328b85037dbSmrg prev= 5329b85037dbSmrg continue 5330b85037dbSmrg else 5331b85037dbSmrg # If libtool objects are unsupported, then we need to preload. 5332b85037dbSmrg prev=dlprefiles 5333b85037dbSmrg fi 5334b85037dbSmrg fi 5335b85037dbSmrg 5336b85037dbSmrg # CHECK ME: I think I busted this. -Ossama 5337b85037dbSmrg if test "$prev" = dlprefiles; then 5338b85037dbSmrg # Preload the old-style object. 5339302b15bdSmrg func_append dlprefiles " $pic_object" 5340b85037dbSmrg prev= 5341b85037dbSmrg fi 5342b85037dbSmrg 5343b85037dbSmrg # A PIC object. 5344b85037dbSmrg func_append libobjs " $pic_object" 5345b85037dbSmrg arg="$pic_object" 5346b85037dbSmrg fi 5347b85037dbSmrg 5348b85037dbSmrg # Non-PIC object. 5349b85037dbSmrg if test "$non_pic_object" != none; then 5350b85037dbSmrg # Prepend the subdirectory the object is found in. 5351b85037dbSmrg non_pic_object="$xdir$non_pic_object" 5352b85037dbSmrg 5353b85037dbSmrg # A standard non-PIC object 5354b85037dbSmrg func_append non_pic_objects " $non_pic_object" 5355b85037dbSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 5356b85037dbSmrg arg="$non_pic_object" 5357b85037dbSmrg fi 5358b85037dbSmrg else 5359b85037dbSmrg # If the PIC object exists, use it instead. 5360b85037dbSmrg # $xdir was prepended to $pic_object above. 5361b85037dbSmrg non_pic_object="$pic_object" 5362b85037dbSmrg func_append non_pic_objects " $non_pic_object" 5363b85037dbSmrg fi 5364b85037dbSmrg else 5365b85037dbSmrg # Only an error if not doing a dry-run. 5366b85037dbSmrg if $opt_dry_run; then 5367b85037dbSmrg # Extract subdirectory from the argument. 5368b85037dbSmrg func_dirname "$arg" "/" "" 5369b85037dbSmrg xdir="$func_dirname_result" 5370b85037dbSmrg 5371b85037dbSmrg func_lo2o "$arg" 5372b85037dbSmrg pic_object=$xdir$objdir/$func_lo2o_result 5373b85037dbSmrg non_pic_object=$xdir$func_lo2o_result 5374b85037dbSmrg func_append libobjs " $pic_object" 5375b85037dbSmrg func_append non_pic_objects " $non_pic_object" 5376b85037dbSmrg else 5377b85037dbSmrg func_fatal_error "\`$arg' is not a valid libtool object" 5378b85037dbSmrg fi 5379b85037dbSmrg fi 5380b85037dbSmrg done 5381b85037dbSmrg else 5382b85037dbSmrg func_fatal_error "link input file \`$arg' does not exist" 5383b85037dbSmrg fi 5384b85037dbSmrg arg=$save_arg 5385b85037dbSmrg prev= 5386b85037dbSmrg continue 5387b85037dbSmrg ;; 5388b85037dbSmrg precious_regex) 5389b85037dbSmrg precious_files_regex="$arg" 5390b85037dbSmrg prev= 5391b85037dbSmrg continue 5392b85037dbSmrg ;; 5393b85037dbSmrg release) 5394b85037dbSmrg release="-$arg" 5395b85037dbSmrg prev= 5396b85037dbSmrg continue 5397b85037dbSmrg ;; 5398b85037dbSmrg rpath | xrpath) 5399b85037dbSmrg # We need an absolute path. 5400b85037dbSmrg case $arg in 5401b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 5402b85037dbSmrg *) 5403b85037dbSmrg func_fatal_error "only absolute run-paths are allowed" 5404b85037dbSmrg ;; 5405b85037dbSmrg esac 5406b85037dbSmrg if test "$prev" = rpath; then 5407b85037dbSmrg case "$rpath " in 5408b85037dbSmrg *" $arg "*) ;; 5409302b15bdSmrg *) func_append rpath " $arg" ;; 5410b85037dbSmrg esac 5411b85037dbSmrg else 5412b85037dbSmrg case "$xrpath " in 5413b85037dbSmrg *" $arg "*) ;; 5414302b15bdSmrg *) func_append xrpath " $arg" ;; 5415b85037dbSmrg esac 5416b85037dbSmrg fi 5417b85037dbSmrg prev= 5418b85037dbSmrg continue 5419b85037dbSmrg ;; 5420b85037dbSmrg shrext) 5421b85037dbSmrg shrext_cmds="$arg" 5422b85037dbSmrg prev= 5423b85037dbSmrg continue 5424b85037dbSmrg ;; 5425b85037dbSmrg weak) 5426302b15bdSmrg func_append weak_libs " $arg" 5427b85037dbSmrg prev= 5428b85037dbSmrg continue 5429b85037dbSmrg ;; 5430b85037dbSmrg xcclinker) 5431302b15bdSmrg func_append linker_flags " $qarg" 5432302b15bdSmrg func_append compiler_flags " $qarg" 5433b85037dbSmrg prev= 5434b85037dbSmrg func_append compile_command " $qarg" 5435b85037dbSmrg func_append finalize_command " $qarg" 5436b85037dbSmrg continue 5437b85037dbSmrg ;; 5438b85037dbSmrg xcompiler) 5439302b15bdSmrg func_append compiler_flags " $qarg" 5440b85037dbSmrg prev= 5441b85037dbSmrg func_append compile_command " $qarg" 5442b85037dbSmrg func_append finalize_command " $qarg" 5443b85037dbSmrg continue 5444b85037dbSmrg ;; 5445b85037dbSmrg xlinker) 5446302b15bdSmrg func_append linker_flags " $qarg" 5447302b15bdSmrg func_append compiler_flags " $wl$qarg" 5448b85037dbSmrg prev= 5449b85037dbSmrg func_append compile_command " $wl$qarg" 5450b85037dbSmrg func_append finalize_command " $wl$qarg" 5451b85037dbSmrg continue 5452b85037dbSmrg ;; 5453b85037dbSmrg *) 5454b85037dbSmrg eval "$prev=\"\$arg\"" 5455b85037dbSmrg prev= 5456b85037dbSmrg continue 5457b85037dbSmrg ;; 5458b85037dbSmrg esac 5459b85037dbSmrg fi # test -n "$prev" 5460b85037dbSmrg 5461b85037dbSmrg prevarg="$arg" 5462b85037dbSmrg 5463b85037dbSmrg case $arg in 5464b85037dbSmrg -all-static) 5465b85037dbSmrg if test -n "$link_static_flag"; then 5466b85037dbSmrg # See comment for -static flag below, for more details. 5467b85037dbSmrg func_append compile_command " $link_static_flag" 5468b85037dbSmrg func_append finalize_command " $link_static_flag" 5469b85037dbSmrg fi 5470b85037dbSmrg continue 5471b85037dbSmrg ;; 5472b85037dbSmrg 5473b85037dbSmrg -allow-undefined) 5474b85037dbSmrg # FIXME: remove this flag sometime in the future. 5475b85037dbSmrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 5476b85037dbSmrg ;; 5477b85037dbSmrg 5478b85037dbSmrg -avoid-version) 5479b85037dbSmrg avoid_version=yes 5480b85037dbSmrg continue 5481b85037dbSmrg ;; 5482b85037dbSmrg 5483b85037dbSmrg -bindir) 5484b85037dbSmrg prev=bindir 5485b85037dbSmrg continue 5486b85037dbSmrg ;; 5487b85037dbSmrg 5488b85037dbSmrg -dlopen) 5489b85037dbSmrg prev=dlfiles 5490b85037dbSmrg continue 5491b85037dbSmrg ;; 5492b85037dbSmrg 5493b85037dbSmrg -dlpreopen) 5494b85037dbSmrg prev=dlprefiles 5495b85037dbSmrg continue 5496b85037dbSmrg ;; 5497b85037dbSmrg 5498b85037dbSmrg -export-dynamic) 5499b85037dbSmrg export_dynamic=yes 5500b85037dbSmrg continue 5501b85037dbSmrg ;; 5502b85037dbSmrg 5503b85037dbSmrg -export-symbols | -export-symbols-regex) 5504b85037dbSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 5505b85037dbSmrg func_fatal_error "more than one -exported-symbols argument is not allowed" 5506b85037dbSmrg fi 5507b85037dbSmrg if test "X$arg" = "X-export-symbols"; then 5508b85037dbSmrg prev=expsyms 5509b85037dbSmrg else 5510b85037dbSmrg prev=expsyms_regex 5511b85037dbSmrg fi 5512b85037dbSmrg continue 5513b85037dbSmrg ;; 5514b85037dbSmrg 5515b85037dbSmrg -framework) 5516b85037dbSmrg prev=framework 5517b85037dbSmrg continue 5518b85037dbSmrg ;; 5519b85037dbSmrg 5520b85037dbSmrg -inst-prefix-dir) 5521b85037dbSmrg prev=inst_prefix 5522b85037dbSmrg continue 5523b85037dbSmrg ;; 5524b85037dbSmrg 5525b85037dbSmrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 5526b85037dbSmrg # so, if we see these flags be careful not to treat them like -L 5527b85037dbSmrg -L[A-Z][A-Z]*:*) 5528b85037dbSmrg case $with_gcc/$host in 5529b85037dbSmrg no/*-*-irix* | /*-*-irix*) 5530b85037dbSmrg func_append compile_command " $arg" 5531b85037dbSmrg func_append finalize_command " $arg" 5532b85037dbSmrg ;; 5533b85037dbSmrg esac 5534b85037dbSmrg continue 5535b85037dbSmrg ;; 5536b85037dbSmrg 5537b85037dbSmrg -L*) 5538302b15bdSmrg func_stripname "-L" '' "$arg" 5539302b15bdSmrg if test -z "$func_stripname_result"; then 5540b85037dbSmrg if test "$#" -gt 0; then 5541b85037dbSmrg func_fatal_error "require no space between \`-L' and \`$1'" 5542b85037dbSmrg else 5543b85037dbSmrg func_fatal_error "need path for \`-L' option" 5544b85037dbSmrg fi 5545b85037dbSmrg fi 5546302b15bdSmrg func_resolve_sysroot "$func_stripname_result" 5547302b15bdSmrg dir=$func_resolve_sysroot_result 5548b85037dbSmrg # We need an absolute path. 5549b85037dbSmrg case $dir in 5550b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 5551b85037dbSmrg *) 5552b85037dbSmrg absdir=`cd "$dir" && pwd` 5553b85037dbSmrg test -z "$absdir" && \ 5554b85037dbSmrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 5555b85037dbSmrg dir="$absdir" 5556b85037dbSmrg ;; 5557b85037dbSmrg esac 5558b85037dbSmrg case "$deplibs " in 5559302b15bdSmrg *" -L$dir "* | *" $arg "*) 5560302b15bdSmrg # Will only happen for absolute or sysroot arguments 5561302b15bdSmrg ;; 5562b85037dbSmrg *) 5563302b15bdSmrg # Preserve sysroot, but never include relative directories 5564302b15bdSmrg case $dir in 5565302b15bdSmrg [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 5566302b15bdSmrg *) func_append deplibs " -L$dir" ;; 5567302b15bdSmrg esac 5568302b15bdSmrg func_append lib_search_path " $dir" 5569b85037dbSmrg ;; 5570b85037dbSmrg esac 5571b85037dbSmrg case $host in 5572b85037dbSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5573b85037dbSmrg testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 5574b85037dbSmrg case :$dllsearchpath: in 5575b85037dbSmrg *":$dir:"*) ;; 5576b85037dbSmrg ::) dllsearchpath=$dir;; 5577302b15bdSmrg *) func_append dllsearchpath ":$dir";; 5578b85037dbSmrg esac 5579b85037dbSmrg case :$dllsearchpath: in 5580b85037dbSmrg *":$testbindir:"*) ;; 5581b85037dbSmrg ::) dllsearchpath=$testbindir;; 5582302b15bdSmrg *) func_append dllsearchpath ":$testbindir";; 5583b85037dbSmrg esac 5584b85037dbSmrg ;; 5585b85037dbSmrg esac 5586b85037dbSmrg continue 5587b85037dbSmrg ;; 5588b85037dbSmrg 5589b85037dbSmrg -l*) 5590b85037dbSmrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 5591b85037dbSmrg case $host in 5592b85037dbSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 5593b85037dbSmrg # These systems don't actually have a C or math library (as such) 5594b85037dbSmrg continue 5595b85037dbSmrg ;; 5596b85037dbSmrg *-*-os2*) 5597b85037dbSmrg # These systems don't actually have a C library (as such) 5598b85037dbSmrg test "X$arg" = "X-lc" && continue 5599b85037dbSmrg ;; 5600b85037dbSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5601b85037dbSmrg # Do not include libc due to us having libc/libc_r. 5602b85037dbSmrg test "X$arg" = "X-lc" && continue 5603b85037dbSmrg ;; 5604b85037dbSmrg *-*-rhapsody* | *-*-darwin1.[012]) 5605b85037dbSmrg # Rhapsody C and math libraries are in the System framework 5606302b15bdSmrg func_append deplibs " System.ltframework" 5607b85037dbSmrg continue 5608b85037dbSmrg ;; 5609b85037dbSmrg *-*-sco3.2v5* | *-*-sco5v6*) 5610b85037dbSmrg # Causes problems with __ctype 5611b85037dbSmrg test "X$arg" = "X-lc" && continue 5612b85037dbSmrg ;; 5613b85037dbSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 5614b85037dbSmrg # Compiler inserts libc in the correct place for threads to work 5615b85037dbSmrg test "X$arg" = "X-lc" && continue 5616b85037dbSmrg ;; 5617b85037dbSmrg esac 5618b85037dbSmrg elif test "X$arg" = "X-lc_r"; then 5619b85037dbSmrg case $host in 5620b85037dbSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5621b85037dbSmrg # Do not include libc_r directly, use -pthread flag. 5622b85037dbSmrg continue 5623b85037dbSmrg ;; 5624b85037dbSmrg esac 5625b85037dbSmrg fi 5626302b15bdSmrg func_append deplibs " $arg" 5627b85037dbSmrg continue 5628b85037dbSmrg ;; 5629b85037dbSmrg 5630b85037dbSmrg -module) 5631b85037dbSmrg module=yes 5632b85037dbSmrg continue 5633b85037dbSmrg ;; 5634b85037dbSmrg 5635b85037dbSmrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 5636b85037dbSmrg # classes, name mangling, and exception handling. 5637b85037dbSmrg # Darwin uses the -arch flag to determine output architecture. 5638302b15bdSmrg -model|-arch|-isysroot|--sysroot) 5639302b15bdSmrg func_append compiler_flags " $arg" 5640b85037dbSmrg func_append compile_command " $arg" 5641b85037dbSmrg func_append finalize_command " $arg" 5642b85037dbSmrg prev=xcompiler 5643b85037dbSmrg continue 5644b85037dbSmrg ;; 5645b85037dbSmrg 5646b85037dbSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 5647302b15bdSmrg func_append compiler_flags " $arg" 5648b85037dbSmrg func_append compile_command " $arg" 5649b85037dbSmrg func_append finalize_command " $arg" 5650b85037dbSmrg case "$new_inherited_linker_flags " in 5651b85037dbSmrg *" $arg "*) ;; 5652302b15bdSmrg * ) func_append new_inherited_linker_flags " $arg" ;; 5653b85037dbSmrg esac 5654b85037dbSmrg continue 5655b85037dbSmrg ;; 5656b85037dbSmrg 5657b85037dbSmrg -multi_module) 5658b85037dbSmrg single_module="${wl}-multi_module" 5659b85037dbSmrg continue 5660b85037dbSmrg ;; 5661b85037dbSmrg 5662b85037dbSmrg -no-fast-install) 5663b85037dbSmrg fast_install=no 5664b85037dbSmrg continue 5665b85037dbSmrg ;; 5666b85037dbSmrg 5667b85037dbSmrg -no-install) 5668b85037dbSmrg case $host in 5669b85037dbSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 5670b85037dbSmrg # The PATH hackery in wrapper scripts is required on Windows 5671b85037dbSmrg # and Darwin in order for the loader to find any dlls it needs. 5672b85037dbSmrg func_warning "\`-no-install' is ignored for $host" 5673b85037dbSmrg func_warning "assuming \`-no-fast-install' instead" 5674b85037dbSmrg fast_install=no 5675b85037dbSmrg ;; 5676b85037dbSmrg *) no_install=yes ;; 5677b85037dbSmrg esac 5678b85037dbSmrg continue 5679b85037dbSmrg ;; 5680b85037dbSmrg 5681b85037dbSmrg -no-undefined) 5682b85037dbSmrg allow_undefined=no 5683b85037dbSmrg continue 5684b85037dbSmrg ;; 5685b85037dbSmrg 5686b85037dbSmrg -objectlist) 5687b85037dbSmrg prev=objectlist 5688b85037dbSmrg continue 5689b85037dbSmrg ;; 5690b85037dbSmrg 5691b85037dbSmrg -o) prev=output ;; 5692b85037dbSmrg 5693b85037dbSmrg -precious-files-regex) 5694b85037dbSmrg prev=precious_regex 5695b85037dbSmrg continue 5696b85037dbSmrg ;; 5697b85037dbSmrg 5698b85037dbSmrg -release) 5699b85037dbSmrg prev=release 5700b85037dbSmrg continue 5701b85037dbSmrg ;; 5702b85037dbSmrg 5703b85037dbSmrg -rpath) 5704b85037dbSmrg prev=rpath 5705b85037dbSmrg continue 5706b85037dbSmrg ;; 5707b85037dbSmrg 5708b85037dbSmrg -R) 5709b85037dbSmrg prev=xrpath 5710b85037dbSmrg continue 5711b85037dbSmrg ;; 5712b85037dbSmrg 5713b85037dbSmrg -R*) 5714b85037dbSmrg func_stripname '-R' '' "$arg" 5715b85037dbSmrg dir=$func_stripname_result 5716b85037dbSmrg # We need an absolute path. 5717b85037dbSmrg case $dir in 5718b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 5719302b15bdSmrg =*) 5720302b15bdSmrg func_stripname '=' '' "$dir" 5721302b15bdSmrg dir=$lt_sysroot$func_stripname_result 5722302b15bdSmrg ;; 5723b85037dbSmrg *) 5724b85037dbSmrg func_fatal_error "only absolute run-paths are allowed" 5725b85037dbSmrg ;; 5726b85037dbSmrg esac 5727b85037dbSmrg case "$xrpath " in 5728b85037dbSmrg *" $dir "*) ;; 5729302b15bdSmrg *) func_append xrpath " $dir" ;; 5730b85037dbSmrg esac 5731b85037dbSmrg continue 5732b85037dbSmrg ;; 5733b85037dbSmrg 5734b85037dbSmrg -shared) 5735b85037dbSmrg # The effects of -shared are defined in a previous loop. 5736b85037dbSmrg continue 5737b85037dbSmrg ;; 5738b85037dbSmrg 5739b85037dbSmrg -shrext) 5740b85037dbSmrg prev=shrext 5741b85037dbSmrg continue 5742b85037dbSmrg ;; 5743b85037dbSmrg 5744b85037dbSmrg -static | -static-libtool-libs) 5745b85037dbSmrg # The effects of -static are defined in a previous loop. 5746b85037dbSmrg # We used to do the same as -all-static on platforms that 5747b85037dbSmrg # didn't have a PIC flag, but the assumption that the effects 5748b85037dbSmrg # would be equivalent was wrong. It would break on at least 5749b85037dbSmrg # Digital Unix and AIX. 5750b85037dbSmrg continue 5751b85037dbSmrg ;; 5752b85037dbSmrg 5753b85037dbSmrg -thread-safe) 5754b85037dbSmrg thread_safe=yes 5755b85037dbSmrg continue 5756b85037dbSmrg ;; 5757b85037dbSmrg 5758b85037dbSmrg -version-info) 5759b85037dbSmrg prev=vinfo 5760b85037dbSmrg continue 5761b85037dbSmrg ;; 5762b85037dbSmrg 5763b85037dbSmrg -version-number) 5764b85037dbSmrg prev=vinfo 5765b85037dbSmrg vinfo_number=yes 5766b85037dbSmrg continue 5767b85037dbSmrg ;; 5768b85037dbSmrg 5769b85037dbSmrg -weak) 5770b85037dbSmrg prev=weak 5771b85037dbSmrg continue 5772b85037dbSmrg ;; 5773b85037dbSmrg 5774b85037dbSmrg -Wc,*) 5775b85037dbSmrg func_stripname '-Wc,' '' "$arg" 5776b85037dbSmrg args=$func_stripname_result 5777b85037dbSmrg arg= 5778b85037dbSmrg save_ifs="$IFS"; IFS=',' 5779b85037dbSmrg for flag in $args; do 5780b85037dbSmrg IFS="$save_ifs" 5781b85037dbSmrg func_quote_for_eval "$flag" 5782302b15bdSmrg func_append arg " $func_quote_for_eval_result" 5783302b15bdSmrg func_append compiler_flags " $func_quote_for_eval_result" 5784b85037dbSmrg done 5785b85037dbSmrg IFS="$save_ifs" 5786b85037dbSmrg func_stripname ' ' '' "$arg" 5787b85037dbSmrg arg=$func_stripname_result 5788b85037dbSmrg ;; 5789b85037dbSmrg 5790b85037dbSmrg -Wl,*) 5791b85037dbSmrg func_stripname '-Wl,' '' "$arg" 5792b85037dbSmrg args=$func_stripname_result 5793b85037dbSmrg arg= 5794b85037dbSmrg save_ifs="$IFS"; IFS=',' 5795b85037dbSmrg for flag in $args; do 5796b85037dbSmrg IFS="$save_ifs" 5797b85037dbSmrg func_quote_for_eval "$flag" 5798302b15bdSmrg func_append arg " $wl$func_quote_for_eval_result" 5799302b15bdSmrg func_append compiler_flags " $wl$func_quote_for_eval_result" 5800302b15bdSmrg func_append linker_flags " $func_quote_for_eval_result" 5801b85037dbSmrg done 5802b85037dbSmrg IFS="$save_ifs" 5803b85037dbSmrg func_stripname ' ' '' "$arg" 5804b85037dbSmrg arg=$func_stripname_result 5805b85037dbSmrg ;; 5806b85037dbSmrg 5807b85037dbSmrg -Xcompiler) 5808b85037dbSmrg prev=xcompiler 5809b85037dbSmrg continue 5810b85037dbSmrg ;; 5811b85037dbSmrg 5812b85037dbSmrg -Xlinker) 5813b85037dbSmrg prev=xlinker 5814b85037dbSmrg continue 5815b85037dbSmrg ;; 5816b85037dbSmrg 5817b85037dbSmrg -XCClinker) 5818b85037dbSmrg prev=xcclinker 5819b85037dbSmrg continue 5820b85037dbSmrg ;; 5821b85037dbSmrg 5822b85037dbSmrg # -msg_* for osf cc 5823b85037dbSmrg -msg_*) 5824b85037dbSmrg func_quote_for_eval "$arg" 5825b85037dbSmrg arg="$func_quote_for_eval_result" 5826b85037dbSmrg ;; 5827b85037dbSmrg 5828b85037dbSmrg # Flags to be passed through unchanged, with rationale: 5829b85037dbSmrg # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 5830b85037dbSmrg # -r[0-9][0-9]* specify processor for the SGI compiler 5831b85037dbSmrg # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 5832b85037dbSmrg # +DA*, +DD* enable 64-bit mode for the HP compiler 5833b85037dbSmrg # -q* compiler args for the IBM compiler 5834b85037dbSmrg # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 5835b85037dbSmrg # -F/path path to uninstalled frameworks, gcc on darwin 5836b85037dbSmrg # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 5837b85037dbSmrg # @file GCC response files 5838b85037dbSmrg # -tp=* Portland pgcc target processor selection 5839302b15bdSmrg # --sysroot=* for sysroot support 5840302b15bdSmrg # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 5841b85037dbSmrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 5842302b15bdSmrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 5843302b15bdSmrg -O*|-flto*|-fwhopr*|-fuse-linker-plugin) 5844b85037dbSmrg func_quote_for_eval "$arg" 5845b85037dbSmrg arg="$func_quote_for_eval_result" 5846b85037dbSmrg func_append compile_command " $arg" 5847b85037dbSmrg func_append finalize_command " $arg" 5848302b15bdSmrg func_append compiler_flags " $arg" 5849b85037dbSmrg continue 5850b85037dbSmrg ;; 5851b85037dbSmrg 5852b85037dbSmrg # Some other compiler flag. 5853b85037dbSmrg -* | +*) 5854b85037dbSmrg func_quote_for_eval "$arg" 5855b85037dbSmrg arg="$func_quote_for_eval_result" 5856b85037dbSmrg ;; 5857b85037dbSmrg 5858b85037dbSmrg *.$objext) 5859b85037dbSmrg # A standard object. 5860302b15bdSmrg func_append objs " $arg" 5861b85037dbSmrg ;; 5862b85037dbSmrg 5863b85037dbSmrg *.lo) 5864b85037dbSmrg # A libtool-controlled object. 5865b85037dbSmrg 5866b85037dbSmrg # Check to see that this really is a libtool object. 5867b85037dbSmrg if func_lalib_unsafe_p "$arg"; then 5868b85037dbSmrg pic_object= 5869b85037dbSmrg non_pic_object= 5870b85037dbSmrg 5871b85037dbSmrg # Read the .lo file 5872b85037dbSmrg func_source "$arg" 5873b85037dbSmrg 5874b85037dbSmrg if test -z "$pic_object" || 5875b85037dbSmrg test -z "$non_pic_object" || 5876b85037dbSmrg test "$pic_object" = none && 5877b85037dbSmrg test "$non_pic_object" = none; then 5878b85037dbSmrg func_fatal_error "cannot find name of object for \`$arg'" 5879b85037dbSmrg fi 5880b85037dbSmrg 5881b85037dbSmrg # Extract subdirectory from the argument. 5882b85037dbSmrg func_dirname "$arg" "/" "" 5883b85037dbSmrg xdir="$func_dirname_result" 5884b85037dbSmrg 5885b85037dbSmrg if test "$pic_object" != none; then 5886b85037dbSmrg # Prepend the subdirectory the object is found in. 5887b85037dbSmrg pic_object="$xdir$pic_object" 5888b85037dbSmrg 5889b85037dbSmrg if test "$prev" = dlfiles; then 5890b85037dbSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 5891302b15bdSmrg func_append dlfiles " $pic_object" 5892b85037dbSmrg prev= 5893b85037dbSmrg continue 5894b85037dbSmrg else 5895b85037dbSmrg # If libtool objects are unsupported, then we need to preload. 5896b85037dbSmrg prev=dlprefiles 5897b85037dbSmrg fi 5898b85037dbSmrg fi 5899b85037dbSmrg 5900b85037dbSmrg # CHECK ME: I think I busted this. -Ossama 5901b85037dbSmrg if test "$prev" = dlprefiles; then 5902b85037dbSmrg # Preload the old-style object. 5903302b15bdSmrg func_append dlprefiles " $pic_object" 5904b85037dbSmrg prev= 5905b85037dbSmrg fi 5906b85037dbSmrg 5907b85037dbSmrg # A PIC object. 5908b85037dbSmrg func_append libobjs " $pic_object" 5909b85037dbSmrg arg="$pic_object" 5910b85037dbSmrg fi 5911b85037dbSmrg 5912b85037dbSmrg # Non-PIC object. 5913b85037dbSmrg if test "$non_pic_object" != none; then 5914b85037dbSmrg # Prepend the subdirectory the object is found in. 5915b85037dbSmrg non_pic_object="$xdir$non_pic_object" 5916b85037dbSmrg 5917b85037dbSmrg # A standard non-PIC object 5918b85037dbSmrg func_append non_pic_objects " $non_pic_object" 5919b85037dbSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 5920b85037dbSmrg arg="$non_pic_object" 5921b85037dbSmrg fi 5922b85037dbSmrg else 5923b85037dbSmrg # If the PIC object exists, use it instead. 5924b85037dbSmrg # $xdir was prepended to $pic_object above. 5925b85037dbSmrg non_pic_object="$pic_object" 5926b85037dbSmrg func_append non_pic_objects " $non_pic_object" 5927b85037dbSmrg fi 5928b85037dbSmrg else 5929b85037dbSmrg # Only an error if not doing a dry-run. 5930b85037dbSmrg if $opt_dry_run; then 5931b85037dbSmrg # Extract subdirectory from the argument. 5932b85037dbSmrg func_dirname "$arg" "/" "" 5933b85037dbSmrg xdir="$func_dirname_result" 5934b85037dbSmrg 5935b85037dbSmrg func_lo2o "$arg" 5936b85037dbSmrg pic_object=$xdir$objdir/$func_lo2o_result 5937b85037dbSmrg non_pic_object=$xdir$func_lo2o_result 5938b85037dbSmrg func_append libobjs " $pic_object" 5939b85037dbSmrg func_append non_pic_objects " $non_pic_object" 5940b85037dbSmrg else 5941b85037dbSmrg func_fatal_error "\`$arg' is not a valid libtool object" 5942b85037dbSmrg fi 5943b85037dbSmrg fi 5944b85037dbSmrg ;; 5945b85037dbSmrg 5946b85037dbSmrg *.$libext) 5947b85037dbSmrg # An archive. 5948302b15bdSmrg func_append deplibs " $arg" 5949302b15bdSmrg func_append old_deplibs " $arg" 5950b85037dbSmrg continue 5951b85037dbSmrg ;; 5952b85037dbSmrg 5953b85037dbSmrg *.la) 5954b85037dbSmrg # A libtool-controlled library. 5955b85037dbSmrg 5956302b15bdSmrg func_resolve_sysroot "$arg" 5957b85037dbSmrg if test "$prev" = dlfiles; then 5958b85037dbSmrg # This library was specified with -dlopen. 5959302b15bdSmrg func_append dlfiles " $func_resolve_sysroot_result" 5960b85037dbSmrg prev= 5961b85037dbSmrg elif test "$prev" = dlprefiles; then 5962b85037dbSmrg # The library was specified with -dlpreopen. 5963302b15bdSmrg func_append dlprefiles " $func_resolve_sysroot_result" 5964b85037dbSmrg prev= 5965b85037dbSmrg else 5966302b15bdSmrg func_append deplibs " $func_resolve_sysroot_result" 5967b85037dbSmrg fi 5968b85037dbSmrg continue 5969b85037dbSmrg ;; 5970b85037dbSmrg 5971b85037dbSmrg # Some other compiler argument. 5972b85037dbSmrg *) 5973b85037dbSmrg # Unknown arguments in both finalize_command and compile_command need 5974b85037dbSmrg # to be aesthetically quoted because they are evaled later. 5975b85037dbSmrg func_quote_for_eval "$arg" 5976b85037dbSmrg arg="$func_quote_for_eval_result" 5977b85037dbSmrg ;; 5978b85037dbSmrg esac # arg 5979b85037dbSmrg 5980b85037dbSmrg # Now actually substitute the argument into the commands. 5981b85037dbSmrg if test -n "$arg"; then 5982b85037dbSmrg func_append compile_command " $arg" 5983b85037dbSmrg func_append finalize_command " $arg" 5984b85037dbSmrg fi 5985b85037dbSmrg done # argument parsing loop 5986b85037dbSmrg 5987b85037dbSmrg test -n "$prev" && \ 5988b85037dbSmrg func_fatal_help "the \`$prevarg' option requires an argument" 5989b85037dbSmrg 5990b85037dbSmrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 5991b85037dbSmrg eval arg=\"$export_dynamic_flag_spec\" 5992b85037dbSmrg func_append compile_command " $arg" 5993b85037dbSmrg func_append finalize_command " $arg" 5994b85037dbSmrg fi 5995b85037dbSmrg 5996b85037dbSmrg oldlibs= 5997b85037dbSmrg # calculate the name of the file, without its directory 5998b85037dbSmrg func_basename "$output" 5999b85037dbSmrg outputname="$func_basename_result" 6000b85037dbSmrg libobjs_save="$libobjs" 6001b85037dbSmrg 6002b85037dbSmrg if test -n "$shlibpath_var"; then 6003b85037dbSmrg # get the directories listed in $shlibpath_var 6004b85037dbSmrg eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 6005b85037dbSmrg else 6006b85037dbSmrg shlib_search_path= 6007b85037dbSmrg fi 6008b85037dbSmrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 6009b85037dbSmrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 6010b85037dbSmrg 6011b85037dbSmrg func_dirname "$output" "/" "" 6012b85037dbSmrg output_objdir="$func_dirname_result$objdir" 6013302b15bdSmrg func_to_tool_file "$output_objdir/" 6014302b15bdSmrg tool_output_objdir=$func_to_tool_file_result 6015b85037dbSmrg # Create the object directory. 6016b85037dbSmrg func_mkdir_p "$output_objdir" 6017b85037dbSmrg 6018b85037dbSmrg # Determine the type of output 6019b85037dbSmrg case $output in 6020b85037dbSmrg "") 6021b85037dbSmrg func_fatal_help "you must specify an output file" 6022b85037dbSmrg ;; 6023b85037dbSmrg *.$libext) linkmode=oldlib ;; 6024b85037dbSmrg *.lo | *.$objext) linkmode=obj ;; 6025b85037dbSmrg *.la) linkmode=lib ;; 6026b85037dbSmrg *) linkmode=prog ;; # Anything else should be a program. 6027b85037dbSmrg esac 6028b85037dbSmrg 6029b85037dbSmrg specialdeplibs= 6030b85037dbSmrg 6031b85037dbSmrg libs= 6032b85037dbSmrg # Find all interdependent deplibs by searching for libraries 6033b85037dbSmrg # that are linked more than once (e.g. -la -lb -la) 6034b85037dbSmrg for deplib in $deplibs; do 6035302b15bdSmrg if $opt_preserve_dup_deps ; then 6036b85037dbSmrg case "$libs " in 6037302b15bdSmrg *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6038b85037dbSmrg esac 6039b85037dbSmrg fi 6040302b15bdSmrg func_append libs " $deplib" 6041b85037dbSmrg done 6042b85037dbSmrg 6043b85037dbSmrg if test "$linkmode" = lib; then 6044b85037dbSmrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 6045b85037dbSmrg 6046b85037dbSmrg # Compute libraries that are listed more than once in $predeps 6047b85037dbSmrg # $postdeps and mark them as special (i.e., whose duplicates are 6048b85037dbSmrg # not to be eliminated). 6049b85037dbSmrg pre_post_deps= 6050b85037dbSmrg if $opt_duplicate_compiler_generated_deps; then 6051b85037dbSmrg for pre_post_dep in $predeps $postdeps; do 6052b85037dbSmrg case "$pre_post_deps " in 6053302b15bdSmrg *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 6054b85037dbSmrg esac 6055302b15bdSmrg func_append pre_post_deps " $pre_post_dep" 6056b85037dbSmrg done 6057b85037dbSmrg fi 6058b85037dbSmrg pre_post_deps= 6059b85037dbSmrg fi 6060b85037dbSmrg 6061b85037dbSmrg deplibs= 6062b85037dbSmrg newdependency_libs= 6063b85037dbSmrg newlib_search_path= 6064b85037dbSmrg need_relink=no # whether we're linking any uninstalled libtool libraries 6065b85037dbSmrg notinst_deplibs= # not-installed libtool libraries 6066b85037dbSmrg notinst_path= # paths that contain not-installed libtool libraries 6067b85037dbSmrg 6068b85037dbSmrg case $linkmode in 6069b85037dbSmrg lib) 6070b85037dbSmrg passes="conv dlpreopen link" 6071b85037dbSmrg for file in $dlfiles $dlprefiles; do 6072b85037dbSmrg case $file in 6073b85037dbSmrg *.la) ;; 6074b85037dbSmrg *) 6075b85037dbSmrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 6076b85037dbSmrg ;; 6077b85037dbSmrg esac 6078b85037dbSmrg done 6079b85037dbSmrg ;; 6080b85037dbSmrg prog) 6081b85037dbSmrg compile_deplibs= 6082b85037dbSmrg finalize_deplibs= 6083b85037dbSmrg alldeplibs=no 6084b85037dbSmrg newdlfiles= 6085b85037dbSmrg newdlprefiles= 6086b85037dbSmrg passes="conv scan dlopen dlpreopen link" 6087b85037dbSmrg ;; 6088b85037dbSmrg *) passes="conv" 6089b85037dbSmrg ;; 6090b85037dbSmrg esac 6091b85037dbSmrg 6092b85037dbSmrg for pass in $passes; do 6093b85037dbSmrg # The preopen pass in lib mode reverses $deplibs; put it back here 6094b85037dbSmrg # so that -L comes before libs that need it for instance... 6095b85037dbSmrg if test "$linkmode,$pass" = "lib,link"; then 6096b85037dbSmrg ## FIXME: Find the place where the list is rebuilt in the wrong 6097b85037dbSmrg ## order, and fix it there properly 6098b85037dbSmrg tmp_deplibs= 6099b85037dbSmrg for deplib in $deplibs; do 6100b85037dbSmrg tmp_deplibs="$deplib $tmp_deplibs" 6101b85037dbSmrg done 6102b85037dbSmrg deplibs="$tmp_deplibs" 6103b85037dbSmrg fi 6104b85037dbSmrg 6105b85037dbSmrg if test "$linkmode,$pass" = "lib,link" || 6106b85037dbSmrg test "$linkmode,$pass" = "prog,scan"; then 6107b85037dbSmrg libs="$deplibs" 6108b85037dbSmrg deplibs= 6109b85037dbSmrg fi 6110b85037dbSmrg if test "$linkmode" = prog; then 6111b85037dbSmrg case $pass in 6112b85037dbSmrg dlopen) libs="$dlfiles" ;; 6113b85037dbSmrg dlpreopen) libs="$dlprefiles" ;; 6114b85037dbSmrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 6115b85037dbSmrg esac 6116b85037dbSmrg fi 6117b85037dbSmrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 6118b85037dbSmrg # Collect and forward deplibs of preopened libtool libs 6119b85037dbSmrg for lib in $dlprefiles; do 6120b85037dbSmrg # Ignore non-libtool-libs 6121b85037dbSmrg dependency_libs= 6122302b15bdSmrg func_resolve_sysroot "$lib" 6123b85037dbSmrg case $lib in 6124302b15bdSmrg *.la) func_source "$func_resolve_sysroot_result" ;; 6125b85037dbSmrg esac 6126b85037dbSmrg 6127b85037dbSmrg # Collect preopened libtool deplibs, except any this library 6128b85037dbSmrg # has declared as weak libs 6129b85037dbSmrg for deplib in $dependency_libs; do 6130b85037dbSmrg func_basename "$deplib" 6131b85037dbSmrg deplib_base=$func_basename_result 6132b85037dbSmrg case " $weak_libs " in 6133b85037dbSmrg *" $deplib_base "*) ;; 6134302b15bdSmrg *) func_append deplibs " $deplib" ;; 6135b85037dbSmrg esac 6136b85037dbSmrg done 6137b85037dbSmrg done 6138b85037dbSmrg libs="$dlprefiles" 6139b85037dbSmrg fi 6140b85037dbSmrg if test "$pass" = dlopen; then 6141b85037dbSmrg # Collect dlpreopened libraries 6142b85037dbSmrg save_deplibs="$deplibs" 6143b85037dbSmrg deplibs= 6144b85037dbSmrg fi 6145b85037dbSmrg 6146b85037dbSmrg for deplib in $libs; do 6147b85037dbSmrg lib= 6148b85037dbSmrg found=no 6149b85037dbSmrg case $deplib in 6150b85037dbSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 6151b85037dbSmrg if test "$linkmode,$pass" = "prog,link"; then 6152b85037dbSmrg compile_deplibs="$deplib $compile_deplibs" 6153b85037dbSmrg finalize_deplibs="$deplib $finalize_deplibs" 6154b85037dbSmrg else 6155302b15bdSmrg func_append compiler_flags " $deplib" 6156b85037dbSmrg if test "$linkmode" = lib ; then 6157b85037dbSmrg case "$new_inherited_linker_flags " in 6158b85037dbSmrg *" $deplib "*) ;; 6159302b15bdSmrg * ) func_append new_inherited_linker_flags " $deplib" ;; 6160b85037dbSmrg esac 6161b85037dbSmrg fi 6162b85037dbSmrg fi 6163b85037dbSmrg continue 6164b85037dbSmrg ;; 6165b85037dbSmrg -l*) 6166b85037dbSmrg if test "$linkmode" != lib && test "$linkmode" != prog; then 6167b85037dbSmrg func_warning "\`-l' is ignored for archives/objects" 6168b85037dbSmrg continue 6169b85037dbSmrg fi 6170b85037dbSmrg func_stripname '-l' '' "$deplib" 6171b85037dbSmrg name=$func_stripname_result 6172b85037dbSmrg if test "$linkmode" = lib; then 6173b85037dbSmrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 6174b85037dbSmrg else 6175b85037dbSmrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 6176b85037dbSmrg fi 6177b85037dbSmrg for searchdir in $searchdirs; do 6178b85037dbSmrg for search_ext in .la $std_shrext .so .a; do 6179b85037dbSmrg # Search the libtool library 6180b85037dbSmrg lib="$searchdir/lib${name}${search_ext}" 6181b85037dbSmrg if test -f "$lib"; then 6182b85037dbSmrg if test "$search_ext" = ".la"; then 6183b85037dbSmrg found=yes 6184b85037dbSmrg else 6185b85037dbSmrg found=no 6186b85037dbSmrg fi 6187b85037dbSmrg break 2 6188b85037dbSmrg fi 6189b85037dbSmrg done 6190b85037dbSmrg done 6191b85037dbSmrg if test "$found" != yes; then 6192b85037dbSmrg # deplib doesn't seem to be a libtool library 6193b85037dbSmrg if test "$linkmode,$pass" = "prog,link"; then 6194b85037dbSmrg compile_deplibs="$deplib $compile_deplibs" 6195b85037dbSmrg finalize_deplibs="$deplib $finalize_deplibs" 6196b85037dbSmrg else 6197b85037dbSmrg deplibs="$deplib $deplibs" 6198b85037dbSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6199b85037dbSmrg fi 6200b85037dbSmrg continue 6201b85037dbSmrg else # deplib is a libtool library 6202b85037dbSmrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 6203b85037dbSmrg # We need to do some special things here, and not later. 6204b85037dbSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6205b85037dbSmrg case " $predeps $postdeps " in 6206b85037dbSmrg *" $deplib "*) 6207b85037dbSmrg if func_lalib_p "$lib"; then 6208b85037dbSmrg library_names= 6209b85037dbSmrg old_library= 6210b85037dbSmrg func_source "$lib" 6211b85037dbSmrg for l in $old_library $library_names; do 6212b85037dbSmrg ll="$l" 6213b85037dbSmrg done 6214b85037dbSmrg if test "X$ll" = "X$old_library" ; then # only static version available 6215b85037dbSmrg found=no 6216b85037dbSmrg func_dirname "$lib" "" "." 6217b85037dbSmrg ladir="$func_dirname_result" 6218b85037dbSmrg lib=$ladir/$old_library 6219b85037dbSmrg if test "$linkmode,$pass" = "prog,link"; then 6220b85037dbSmrg compile_deplibs="$deplib $compile_deplibs" 6221b85037dbSmrg finalize_deplibs="$deplib $finalize_deplibs" 6222b85037dbSmrg else 6223b85037dbSmrg deplibs="$deplib $deplibs" 6224b85037dbSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6225b85037dbSmrg fi 6226b85037dbSmrg continue 6227b85037dbSmrg fi 6228b85037dbSmrg fi 6229b85037dbSmrg ;; 6230b85037dbSmrg *) ;; 6231b85037dbSmrg esac 6232b85037dbSmrg fi 6233b85037dbSmrg fi 6234b85037dbSmrg ;; # -l 6235b85037dbSmrg *.ltframework) 6236b85037dbSmrg if test "$linkmode,$pass" = "prog,link"; then 6237b85037dbSmrg compile_deplibs="$deplib $compile_deplibs" 6238b85037dbSmrg finalize_deplibs="$deplib $finalize_deplibs" 6239b85037dbSmrg else 6240b85037dbSmrg deplibs="$deplib $deplibs" 6241b85037dbSmrg if test "$linkmode" = lib ; then 6242b85037dbSmrg case "$new_inherited_linker_flags " in 6243b85037dbSmrg *" $deplib "*) ;; 6244302b15bdSmrg * ) func_append new_inherited_linker_flags " $deplib" ;; 6245b85037dbSmrg esac 6246b85037dbSmrg fi 6247b85037dbSmrg fi 6248b85037dbSmrg continue 6249b85037dbSmrg ;; 6250b85037dbSmrg -L*) 6251b85037dbSmrg case $linkmode in 6252b85037dbSmrg lib) 6253b85037dbSmrg deplibs="$deplib $deplibs" 6254b85037dbSmrg test "$pass" = conv && continue 6255b85037dbSmrg newdependency_libs="$deplib $newdependency_libs" 6256b85037dbSmrg func_stripname '-L' '' "$deplib" 6257302b15bdSmrg func_resolve_sysroot "$func_stripname_result" 6258302b15bdSmrg func_append newlib_search_path " $func_resolve_sysroot_result" 6259b85037dbSmrg ;; 6260b85037dbSmrg prog) 6261b85037dbSmrg if test "$pass" = conv; then 6262b85037dbSmrg deplibs="$deplib $deplibs" 6263b85037dbSmrg continue 6264b85037dbSmrg fi 6265b85037dbSmrg if test "$pass" = scan; then 6266b85037dbSmrg deplibs="$deplib $deplibs" 6267b85037dbSmrg else 6268b85037dbSmrg compile_deplibs="$deplib $compile_deplibs" 6269b85037dbSmrg finalize_deplibs="$deplib $finalize_deplibs" 6270b85037dbSmrg fi 6271b85037dbSmrg func_stripname '-L' '' "$deplib" 6272302b15bdSmrg func_resolve_sysroot "$func_stripname_result" 6273302b15bdSmrg func_append newlib_search_path " $func_resolve_sysroot_result" 6274b85037dbSmrg ;; 6275b85037dbSmrg *) 6276b85037dbSmrg func_warning "\`-L' is ignored for archives/objects" 6277b85037dbSmrg ;; 6278b85037dbSmrg esac # linkmode 6279b85037dbSmrg continue 6280b85037dbSmrg ;; # -L 6281b85037dbSmrg -R*) 6282b85037dbSmrg if test "$pass" = link; then 6283b85037dbSmrg func_stripname '-R' '' "$deplib" 6284302b15bdSmrg func_resolve_sysroot "$func_stripname_result" 6285302b15bdSmrg dir=$func_resolve_sysroot_result 6286b85037dbSmrg # Make sure the xrpath contains only unique directories. 6287b85037dbSmrg case "$xrpath " in 6288b85037dbSmrg *" $dir "*) ;; 6289302b15bdSmrg *) func_append xrpath " $dir" ;; 6290b85037dbSmrg esac 6291b85037dbSmrg fi 6292b85037dbSmrg deplibs="$deplib $deplibs" 6293b85037dbSmrg continue 6294b85037dbSmrg ;; 6295302b15bdSmrg *.la) 6296302b15bdSmrg func_resolve_sysroot "$deplib" 6297302b15bdSmrg lib=$func_resolve_sysroot_result 6298302b15bdSmrg ;; 6299b85037dbSmrg *.$libext) 6300b85037dbSmrg if test "$pass" = conv; then 6301b85037dbSmrg deplibs="$deplib $deplibs" 6302b85037dbSmrg continue 6303b85037dbSmrg fi 6304b85037dbSmrg case $linkmode in 6305b85037dbSmrg lib) 6306b85037dbSmrg # Linking convenience modules into shared libraries is allowed, 6307b85037dbSmrg # but linking other static libraries is non-portable. 6308b85037dbSmrg case " $dlpreconveniencelibs " in 6309b85037dbSmrg *" $deplib "*) ;; 6310b85037dbSmrg *) 6311b85037dbSmrg valid_a_lib=no 6312b85037dbSmrg case $deplibs_check_method in 6313b85037dbSmrg match_pattern*) 6314b85037dbSmrg set dummy $deplibs_check_method; shift 6315b85037dbSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 6316b85037dbSmrg if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 6317b85037dbSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 6318b85037dbSmrg valid_a_lib=yes 6319b85037dbSmrg fi 6320b85037dbSmrg ;; 6321b85037dbSmrg pass_all) 6322b85037dbSmrg valid_a_lib=yes 6323b85037dbSmrg ;; 6324b85037dbSmrg esac 6325b85037dbSmrg if test "$valid_a_lib" != yes; then 6326b85037dbSmrg echo 6327b85037dbSmrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 6328b85037dbSmrg echo "*** I have the capability to make that library automatically link in when" 6329b85037dbSmrg echo "*** you link to this library. But I can only do this if you have a" 6330b85037dbSmrg echo "*** shared version of the library, which you do not appear to have" 6331b85037dbSmrg echo "*** because the file extensions .$libext of this argument makes me believe" 6332b85037dbSmrg echo "*** that it is just a static archive that I should not use here." 6333b85037dbSmrg else 6334b85037dbSmrg echo 6335b85037dbSmrg $ECHO "*** Warning: Linking the shared library $output against the" 6336b85037dbSmrg $ECHO "*** static library $deplib is not portable!" 6337b85037dbSmrg deplibs="$deplib $deplibs" 6338b85037dbSmrg fi 6339b85037dbSmrg ;; 6340b85037dbSmrg esac 6341b85037dbSmrg continue 6342b85037dbSmrg ;; 6343b85037dbSmrg prog) 6344b85037dbSmrg if test "$pass" != link; then 6345b85037dbSmrg deplibs="$deplib $deplibs" 6346b85037dbSmrg else 6347b85037dbSmrg compile_deplibs="$deplib $compile_deplibs" 6348b85037dbSmrg finalize_deplibs="$deplib $finalize_deplibs" 6349b85037dbSmrg fi 6350b85037dbSmrg continue 6351b85037dbSmrg ;; 6352b85037dbSmrg esac # linkmode 6353b85037dbSmrg ;; # *.$libext 6354b85037dbSmrg *.lo | *.$objext) 6355b85037dbSmrg if test "$pass" = conv; then 6356b85037dbSmrg deplibs="$deplib $deplibs" 6357b85037dbSmrg elif test "$linkmode" = prog; then 6358b85037dbSmrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 6359b85037dbSmrg # If there is no dlopen support or we're linking statically, 6360b85037dbSmrg # we need to preload. 6361302b15bdSmrg func_append newdlprefiles " $deplib" 6362b85037dbSmrg compile_deplibs="$deplib $compile_deplibs" 6363b85037dbSmrg finalize_deplibs="$deplib $finalize_deplibs" 6364b85037dbSmrg else 6365302b15bdSmrg func_append newdlfiles " $deplib" 6366b85037dbSmrg fi 6367b85037dbSmrg fi 6368b85037dbSmrg continue 6369b85037dbSmrg ;; 6370b85037dbSmrg %DEPLIBS%) 6371b85037dbSmrg alldeplibs=yes 6372b85037dbSmrg continue 6373b85037dbSmrg ;; 6374b85037dbSmrg esac # case $deplib 6375b85037dbSmrg 6376b85037dbSmrg if test "$found" = yes || test -f "$lib"; then : 6377b85037dbSmrg else 6378b85037dbSmrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 6379b85037dbSmrg fi 6380b85037dbSmrg 6381b85037dbSmrg # Check to see that this really is a libtool archive. 6382b85037dbSmrg func_lalib_unsafe_p "$lib" \ 6383b85037dbSmrg || func_fatal_error "\`$lib' is not a valid libtool archive" 6384b85037dbSmrg 6385b85037dbSmrg func_dirname "$lib" "" "." 6386b85037dbSmrg ladir="$func_dirname_result" 6387b85037dbSmrg 6388b85037dbSmrg dlname= 6389b85037dbSmrg dlopen= 6390b85037dbSmrg dlpreopen= 6391b85037dbSmrg libdir= 6392b85037dbSmrg library_names= 6393b85037dbSmrg old_library= 6394b85037dbSmrg inherited_linker_flags= 6395b85037dbSmrg # If the library was installed with an old release of libtool, 6396b85037dbSmrg # it will not redefine variables installed, or shouldnotlink 6397b85037dbSmrg installed=yes 6398b85037dbSmrg shouldnotlink=no 6399b85037dbSmrg avoidtemprpath= 6400b85037dbSmrg 6401b85037dbSmrg 6402b85037dbSmrg # Read the .la file 6403b85037dbSmrg func_source "$lib" 6404b85037dbSmrg 6405b85037dbSmrg # Convert "-framework foo" to "foo.ltframework" 6406b85037dbSmrg if test -n "$inherited_linker_flags"; then 6407b85037dbSmrg tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 6408b85037dbSmrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 6409b85037dbSmrg case " $new_inherited_linker_flags " in 6410b85037dbSmrg *" $tmp_inherited_linker_flag "*) ;; 6411302b15bdSmrg *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 6412b85037dbSmrg esac 6413b85037dbSmrg done 6414b85037dbSmrg fi 6415b85037dbSmrg dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 6416b85037dbSmrg if test "$linkmode,$pass" = "lib,link" || 6417b85037dbSmrg test "$linkmode,$pass" = "prog,scan" || 6418b85037dbSmrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 6419302b15bdSmrg test -n "$dlopen" && func_append dlfiles " $dlopen" 6420302b15bdSmrg test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 6421b85037dbSmrg fi 6422b85037dbSmrg 6423b85037dbSmrg if test "$pass" = conv; then 6424b85037dbSmrg # Only check for convenience libraries 6425b85037dbSmrg deplibs="$lib $deplibs" 6426b85037dbSmrg if test -z "$libdir"; then 6427b85037dbSmrg if test -z "$old_library"; then 6428b85037dbSmrg func_fatal_error "cannot find name of link library for \`$lib'" 6429b85037dbSmrg fi 6430b85037dbSmrg # It is a libtool convenience library, so add in its objects. 6431302b15bdSmrg func_append convenience " $ladir/$objdir/$old_library" 6432302b15bdSmrg func_append old_convenience " $ladir/$objdir/$old_library" 6433b85037dbSmrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 6434b85037dbSmrg func_fatal_error "\`$lib' is not a convenience library" 6435b85037dbSmrg fi 6436b85037dbSmrg tmp_libs= 6437b85037dbSmrg for deplib in $dependency_libs; do 6438b85037dbSmrg deplibs="$deplib $deplibs" 6439302b15bdSmrg if $opt_preserve_dup_deps ; then 6440b85037dbSmrg case "$tmp_libs " in 6441302b15bdSmrg *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6442b85037dbSmrg esac 6443b85037dbSmrg fi 6444302b15bdSmrg func_append tmp_libs " $deplib" 6445b85037dbSmrg done 6446b85037dbSmrg continue 6447b85037dbSmrg fi # $pass = conv 6448b85037dbSmrg 6449b85037dbSmrg 6450b85037dbSmrg # Get the name of the library we link against. 6451b85037dbSmrg linklib= 6452302b15bdSmrg if test -n "$old_library" && 6453302b15bdSmrg { test "$prefer_static_libs" = yes || 6454302b15bdSmrg test "$prefer_static_libs,$installed" = "built,no"; }; then 6455302b15bdSmrg linklib=$old_library 6456302b15bdSmrg else 6457302b15bdSmrg for l in $old_library $library_names; do 6458302b15bdSmrg linklib="$l" 6459302b15bdSmrg done 6460302b15bdSmrg fi 6461b85037dbSmrg if test -z "$linklib"; then 6462b85037dbSmrg func_fatal_error "cannot find name of link library for \`$lib'" 6463b85037dbSmrg fi 6464b85037dbSmrg 6465b85037dbSmrg # This library was specified with -dlopen. 6466b85037dbSmrg if test "$pass" = dlopen; then 6467b85037dbSmrg if test -z "$libdir"; then 6468b85037dbSmrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 6469b85037dbSmrg fi 6470b85037dbSmrg if test -z "$dlname" || 6471b85037dbSmrg test "$dlopen_support" != yes || 6472b85037dbSmrg test "$build_libtool_libs" = no; then 6473b85037dbSmrg # If there is no dlname, no dlopen support or we're linking 6474b85037dbSmrg # statically, we need to preload. We also need to preload any 6475b85037dbSmrg # dependent libraries so libltdl's deplib preloader doesn't 6476b85037dbSmrg # bomb out in the load deplibs phase. 6477302b15bdSmrg func_append dlprefiles " $lib $dependency_libs" 6478b85037dbSmrg else 6479302b15bdSmrg func_append newdlfiles " $lib" 6480b85037dbSmrg fi 6481b85037dbSmrg continue 6482b85037dbSmrg fi # $pass = dlopen 6483b85037dbSmrg 6484b85037dbSmrg # We need an absolute path. 6485b85037dbSmrg case $ladir in 6486b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 6487b85037dbSmrg *) 6488b85037dbSmrg abs_ladir=`cd "$ladir" && pwd` 6489b85037dbSmrg if test -z "$abs_ladir"; then 6490b85037dbSmrg func_warning "cannot determine absolute directory name of \`$ladir'" 6491b85037dbSmrg func_warning "passing it literally to the linker, although it might fail" 6492b85037dbSmrg abs_ladir="$ladir" 6493b85037dbSmrg fi 6494b85037dbSmrg ;; 6495b85037dbSmrg esac 6496b85037dbSmrg func_basename "$lib" 6497b85037dbSmrg laname="$func_basename_result" 6498b85037dbSmrg 6499b85037dbSmrg # Find the relevant object directory and library name. 6500b85037dbSmrg if test "X$installed" = Xyes; then 6501302b15bdSmrg if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6502b85037dbSmrg func_warning "library \`$lib' was moved." 6503b85037dbSmrg dir="$ladir" 6504b85037dbSmrg absdir="$abs_ladir" 6505b85037dbSmrg libdir="$abs_ladir" 6506b85037dbSmrg else 6507302b15bdSmrg dir="$lt_sysroot$libdir" 6508302b15bdSmrg absdir="$lt_sysroot$libdir" 6509b85037dbSmrg fi 6510b85037dbSmrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 6511b85037dbSmrg else 6512b85037dbSmrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6513b85037dbSmrg dir="$ladir" 6514b85037dbSmrg absdir="$abs_ladir" 6515b85037dbSmrg # Remove this search path later 6516302b15bdSmrg func_append notinst_path " $abs_ladir" 6517b85037dbSmrg else 6518b85037dbSmrg dir="$ladir/$objdir" 6519b85037dbSmrg absdir="$abs_ladir/$objdir" 6520b85037dbSmrg # Remove this search path later 6521302b15bdSmrg func_append notinst_path " $abs_ladir" 6522b85037dbSmrg fi 6523b85037dbSmrg fi # $installed = yes 6524b85037dbSmrg func_stripname 'lib' '.la' "$laname" 6525b85037dbSmrg name=$func_stripname_result 6526b85037dbSmrg 6527b85037dbSmrg # This library was specified with -dlpreopen. 6528b85037dbSmrg if test "$pass" = dlpreopen; then 6529b85037dbSmrg if test -z "$libdir" && test "$linkmode" = prog; then 6530b85037dbSmrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 6531b85037dbSmrg fi 6532302b15bdSmrg case "$host" in 6533302b15bdSmrg # special handling for platforms with PE-DLLs. 6534302b15bdSmrg *cygwin* | *mingw* | *cegcc* ) 6535302b15bdSmrg # Linker will automatically link against shared library if both 6536302b15bdSmrg # static and shared are present. Therefore, ensure we extract 6537302b15bdSmrg # symbols from the import library if a shared library is present 6538302b15bdSmrg # (otherwise, the dlopen module name will be incorrect). We do 6539302b15bdSmrg # this by putting the import library name into $newdlprefiles. 6540302b15bdSmrg # We recover the dlopen module name by 'saving' the la file 6541302b15bdSmrg # name in a special purpose variable, and (later) extracting the 6542302b15bdSmrg # dlname from the la file. 6543302b15bdSmrg if test -n "$dlname"; then 6544302b15bdSmrg func_tr_sh "$dir/$linklib" 6545302b15bdSmrg eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 6546302b15bdSmrg func_append newdlprefiles " $dir/$linklib" 6547302b15bdSmrg else 6548302b15bdSmrg func_append newdlprefiles " $dir/$old_library" 6549302b15bdSmrg # Keep a list of preopened convenience libraries to check 6550302b15bdSmrg # that they are being used correctly in the link pass. 6551302b15bdSmrg test -z "$libdir" && \ 6552302b15bdSmrg func_append dlpreconveniencelibs " $dir/$old_library" 6553302b15bdSmrg fi 6554302b15bdSmrg ;; 6555302b15bdSmrg * ) 6556302b15bdSmrg # Prefer using a static library (so that no silly _DYNAMIC symbols 6557302b15bdSmrg # are required to link). 6558302b15bdSmrg if test -n "$old_library"; then 6559302b15bdSmrg func_append newdlprefiles " $dir/$old_library" 6560302b15bdSmrg # Keep a list of preopened convenience libraries to check 6561302b15bdSmrg # that they are being used correctly in the link pass. 6562302b15bdSmrg test -z "$libdir" && \ 6563302b15bdSmrg func_append dlpreconveniencelibs " $dir/$old_library" 6564302b15bdSmrg # Otherwise, use the dlname, so that lt_dlopen finds it. 6565302b15bdSmrg elif test -n "$dlname"; then 6566302b15bdSmrg func_append newdlprefiles " $dir/$dlname" 6567302b15bdSmrg else 6568302b15bdSmrg func_append newdlprefiles " $dir/$linklib" 6569302b15bdSmrg fi 6570302b15bdSmrg ;; 6571302b15bdSmrg esac 6572b85037dbSmrg fi # $pass = dlpreopen 6573b85037dbSmrg 6574b85037dbSmrg if test -z "$libdir"; then 6575b85037dbSmrg # Link the convenience library 6576b85037dbSmrg if test "$linkmode" = lib; then 6577b85037dbSmrg deplibs="$dir/$old_library $deplibs" 6578b85037dbSmrg elif test "$linkmode,$pass" = "prog,link"; then 6579b85037dbSmrg compile_deplibs="$dir/$old_library $compile_deplibs" 6580b85037dbSmrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 6581b85037dbSmrg else 6582b85037dbSmrg deplibs="$lib $deplibs" # used for prog,scan pass 6583b85037dbSmrg fi 6584b85037dbSmrg continue 6585b85037dbSmrg fi 6586b85037dbSmrg 6587b85037dbSmrg 6588b85037dbSmrg if test "$linkmode" = prog && test "$pass" != link; then 6589302b15bdSmrg func_append newlib_search_path " $ladir" 6590b85037dbSmrg deplibs="$lib $deplibs" 6591b85037dbSmrg 6592b85037dbSmrg linkalldeplibs=no 6593b85037dbSmrg if test "$link_all_deplibs" != no || test -z "$library_names" || 6594b85037dbSmrg test "$build_libtool_libs" = no; then 6595b85037dbSmrg linkalldeplibs=yes 6596b85037dbSmrg fi 6597b85037dbSmrg 6598b85037dbSmrg tmp_libs= 6599b85037dbSmrg for deplib in $dependency_libs; do 6600b85037dbSmrg case $deplib in 6601b85037dbSmrg -L*) func_stripname '-L' '' "$deplib" 6602302b15bdSmrg func_resolve_sysroot "$func_stripname_result" 6603302b15bdSmrg func_append newlib_search_path " $func_resolve_sysroot_result" 6604b85037dbSmrg ;; 6605b85037dbSmrg esac 6606b85037dbSmrg # Need to link against all dependency_libs? 6607b85037dbSmrg if test "$linkalldeplibs" = yes; then 6608b85037dbSmrg deplibs="$deplib $deplibs" 6609b85037dbSmrg else 6610b85037dbSmrg # Need to hardcode shared library paths 6611b85037dbSmrg # or/and link against static libraries 6612b85037dbSmrg newdependency_libs="$deplib $newdependency_libs" 6613b85037dbSmrg fi 6614302b15bdSmrg if $opt_preserve_dup_deps ; then 6615b85037dbSmrg case "$tmp_libs " in 6616302b15bdSmrg *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6617b85037dbSmrg esac 6618b85037dbSmrg fi 6619302b15bdSmrg func_append tmp_libs " $deplib" 6620b85037dbSmrg done # for deplib 6621b85037dbSmrg continue 6622b85037dbSmrg fi # $linkmode = prog... 6623b85037dbSmrg 6624b85037dbSmrg if test "$linkmode,$pass" = "prog,link"; then 6625b85037dbSmrg if test -n "$library_names" && 6626b85037dbSmrg { { test "$prefer_static_libs" = no || 6627b85037dbSmrg test "$prefer_static_libs,$installed" = "built,yes"; } || 6628b85037dbSmrg test -z "$old_library"; }; then 6629b85037dbSmrg # We need to hardcode the library path 6630b85037dbSmrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 6631b85037dbSmrg # Make sure the rpath contains only unique directories. 6632b85037dbSmrg case "$temp_rpath:" in 6633b85037dbSmrg *"$absdir:"*) ;; 6634302b15bdSmrg *) func_append temp_rpath "$absdir:" ;; 6635b85037dbSmrg esac 6636b85037dbSmrg fi 6637b85037dbSmrg 6638b85037dbSmrg # Hardcode the library path. 6639b85037dbSmrg # Skip directories that are in the system default run-time 6640b85037dbSmrg # search path. 6641b85037dbSmrg case " $sys_lib_dlsearch_path " in 6642b85037dbSmrg *" $absdir "*) ;; 6643b85037dbSmrg *) 6644b85037dbSmrg case "$compile_rpath " in 6645b85037dbSmrg *" $absdir "*) ;; 6646302b15bdSmrg *) func_append compile_rpath " $absdir" ;; 6647b85037dbSmrg esac 6648b85037dbSmrg ;; 6649b85037dbSmrg esac 6650b85037dbSmrg case " $sys_lib_dlsearch_path " in 6651b85037dbSmrg *" $libdir "*) ;; 6652b85037dbSmrg *) 6653b85037dbSmrg case "$finalize_rpath " in 6654b85037dbSmrg *" $libdir "*) ;; 6655302b15bdSmrg *) func_append finalize_rpath " $libdir" ;; 6656b85037dbSmrg esac 6657b85037dbSmrg ;; 6658b85037dbSmrg esac 6659b85037dbSmrg fi # $linkmode,$pass = prog,link... 6660b85037dbSmrg 6661b85037dbSmrg if test "$alldeplibs" = yes && 6662b85037dbSmrg { test "$deplibs_check_method" = pass_all || 6663b85037dbSmrg { test "$build_libtool_libs" = yes && 6664b85037dbSmrg test -n "$library_names"; }; }; then 6665b85037dbSmrg # We only need to search for static libraries 6666b85037dbSmrg continue 6667b85037dbSmrg fi 6668b85037dbSmrg fi 6669b85037dbSmrg 6670b85037dbSmrg link_static=no # Whether the deplib will be linked statically 6671b85037dbSmrg use_static_libs=$prefer_static_libs 6672b85037dbSmrg if test "$use_static_libs" = built && test "$installed" = yes; then 6673b85037dbSmrg use_static_libs=no 6674b85037dbSmrg fi 6675b85037dbSmrg if test -n "$library_names" && 6676b85037dbSmrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 6677b85037dbSmrg case $host in 6678b85037dbSmrg *cygwin* | *mingw* | *cegcc*) 6679b85037dbSmrg # No point in relinking DLLs because paths are not encoded 6680302b15bdSmrg func_append notinst_deplibs " $lib" 6681b85037dbSmrg need_relink=no 6682b85037dbSmrg ;; 6683b85037dbSmrg *) 6684b85037dbSmrg if test "$installed" = no; then 6685302b15bdSmrg func_append notinst_deplibs " $lib" 6686b85037dbSmrg need_relink=yes 6687b85037dbSmrg fi 6688b85037dbSmrg ;; 6689b85037dbSmrg esac 6690b85037dbSmrg # This is a shared library 6691b85037dbSmrg 6692b85037dbSmrg # Warn about portability, can't link against -module's on some 6693b85037dbSmrg # systems (darwin). Don't bleat about dlopened modules though! 6694b85037dbSmrg dlopenmodule="" 6695b85037dbSmrg for dlpremoduletest in $dlprefiles; do 6696b85037dbSmrg if test "X$dlpremoduletest" = "X$lib"; then 6697b85037dbSmrg dlopenmodule="$dlpremoduletest" 6698b85037dbSmrg break 6699b85037dbSmrg fi 6700b85037dbSmrg done 6701b85037dbSmrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 6702b85037dbSmrg echo 6703b85037dbSmrg if test "$linkmode" = prog; then 6704b85037dbSmrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 6705b85037dbSmrg else 6706b85037dbSmrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 6707b85037dbSmrg fi 6708b85037dbSmrg $ECHO "*** $linklib is not portable!" 6709b85037dbSmrg fi 6710b85037dbSmrg if test "$linkmode" = lib && 6711b85037dbSmrg test "$hardcode_into_libs" = yes; then 6712b85037dbSmrg # Hardcode the library path. 6713b85037dbSmrg # Skip directories that are in the system default run-time 6714b85037dbSmrg # search path. 6715b85037dbSmrg case " $sys_lib_dlsearch_path " in 6716b85037dbSmrg *" $absdir "*) ;; 6717b85037dbSmrg *) 6718b85037dbSmrg case "$compile_rpath " in 6719b85037dbSmrg *" $absdir "*) ;; 6720302b15bdSmrg *) func_append compile_rpath " $absdir" ;; 6721b85037dbSmrg esac 6722b85037dbSmrg ;; 6723b85037dbSmrg esac 6724b85037dbSmrg case " $sys_lib_dlsearch_path " in 6725b85037dbSmrg *" $libdir "*) ;; 6726b85037dbSmrg *) 6727b85037dbSmrg case "$finalize_rpath " in 6728b85037dbSmrg *" $libdir "*) ;; 6729302b15bdSmrg *) func_append finalize_rpath " $libdir" ;; 6730b85037dbSmrg esac 6731b85037dbSmrg ;; 6732b85037dbSmrg esac 6733b85037dbSmrg fi 6734b85037dbSmrg 6735b85037dbSmrg if test -n "$old_archive_from_expsyms_cmds"; then 6736b85037dbSmrg # figure out the soname 6737b85037dbSmrg set dummy $library_names 6738b85037dbSmrg shift 6739b85037dbSmrg realname="$1" 6740b85037dbSmrg shift 6741b85037dbSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 6742b85037dbSmrg # use dlname if we got it. it's perfectly good, no? 6743b85037dbSmrg if test -n "$dlname"; then 6744b85037dbSmrg soname="$dlname" 6745b85037dbSmrg elif test -n "$soname_spec"; then 6746b85037dbSmrg # bleh windows 6747b85037dbSmrg case $host in 6748b85037dbSmrg *cygwin* | mingw* | *cegcc*) 6749b85037dbSmrg func_arith $current - $age 6750b85037dbSmrg major=$func_arith_result 6751b85037dbSmrg versuffix="-$major" 6752b85037dbSmrg ;; 6753b85037dbSmrg esac 6754b85037dbSmrg eval soname=\"$soname_spec\" 6755b85037dbSmrg else 6756b85037dbSmrg soname="$realname" 6757b85037dbSmrg fi 6758b85037dbSmrg 6759b85037dbSmrg # Make a new name for the extract_expsyms_cmds to use 6760b85037dbSmrg soroot="$soname" 6761b85037dbSmrg func_basename "$soroot" 6762b85037dbSmrg soname="$func_basename_result" 6763b85037dbSmrg func_stripname 'lib' '.dll' "$soname" 6764b85037dbSmrg newlib=libimp-$func_stripname_result.a 6765b85037dbSmrg 6766b85037dbSmrg # If the library has no export list, then create one now 6767b85037dbSmrg if test -f "$output_objdir/$soname-def"; then : 6768b85037dbSmrg else 6769b85037dbSmrg func_verbose "extracting exported symbol list from \`$soname'" 6770b85037dbSmrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 6771b85037dbSmrg fi 6772b85037dbSmrg 6773b85037dbSmrg # Create $newlib 6774b85037dbSmrg if test -f "$output_objdir/$newlib"; then :; else 6775b85037dbSmrg func_verbose "generating import library for \`$soname'" 6776b85037dbSmrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 6777b85037dbSmrg fi 6778b85037dbSmrg # make sure the library variables are pointing to the new library 6779b85037dbSmrg dir=$output_objdir 6780b85037dbSmrg linklib=$newlib 6781b85037dbSmrg fi # test -n "$old_archive_from_expsyms_cmds" 6782b85037dbSmrg 6783302b15bdSmrg if test "$linkmode" = prog || test "$opt_mode" != relink; then 6784b85037dbSmrg add_shlibpath= 6785b85037dbSmrg add_dir= 6786b85037dbSmrg add= 6787b85037dbSmrg lib_linked=yes 6788b85037dbSmrg case $hardcode_action in 6789b85037dbSmrg immediate | unsupported) 6790b85037dbSmrg if test "$hardcode_direct" = no; then 6791b85037dbSmrg add="$dir/$linklib" 6792b85037dbSmrg case $host in 6793b85037dbSmrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 6794b85037dbSmrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 6795b85037dbSmrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 6796b85037dbSmrg *-*-unixware7*) add_dir="-L$dir" ;; 6797b85037dbSmrg *-*-darwin* ) 6798b85037dbSmrg # if the lib is a (non-dlopened) module then we can not 6799b85037dbSmrg # link against it, someone is ignoring the earlier warnings 6800b85037dbSmrg if /usr/bin/file -L $add 2> /dev/null | 6801b85037dbSmrg $GREP ": [^:]* bundle" >/dev/null ; then 6802b85037dbSmrg if test "X$dlopenmodule" != "X$lib"; then 6803b85037dbSmrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 6804b85037dbSmrg if test -z "$old_library" ; then 6805b85037dbSmrg echo 6806b85037dbSmrg echo "*** And there doesn't seem to be a static archive available" 6807b85037dbSmrg echo "*** The link will probably fail, sorry" 6808b85037dbSmrg else 6809b85037dbSmrg add="$dir/$old_library" 6810b85037dbSmrg fi 6811b85037dbSmrg elif test -n "$old_library"; then 6812b85037dbSmrg add="$dir/$old_library" 6813b85037dbSmrg fi 6814b85037dbSmrg fi 6815b85037dbSmrg esac 6816b85037dbSmrg elif test "$hardcode_minus_L" = no; then 6817b85037dbSmrg case $host in 6818b85037dbSmrg *-*-sunos*) add_shlibpath="$dir" ;; 6819b85037dbSmrg esac 6820b85037dbSmrg add_dir="-L$dir" 6821b85037dbSmrg add="-l$name" 6822b85037dbSmrg elif test "$hardcode_shlibpath_var" = no; then 6823b85037dbSmrg add_shlibpath="$dir" 6824b85037dbSmrg add="-l$name" 6825b85037dbSmrg else 6826b85037dbSmrg lib_linked=no 6827b85037dbSmrg fi 6828b85037dbSmrg ;; 6829b85037dbSmrg relink) 6830b85037dbSmrg if test "$hardcode_direct" = yes && 6831b85037dbSmrg test "$hardcode_direct_absolute" = no; then 6832b85037dbSmrg add="$dir/$linklib" 6833b85037dbSmrg elif test "$hardcode_minus_L" = yes; then 6834b85037dbSmrg add_dir="-L$dir" 6835b85037dbSmrg # Try looking first in the location we're being installed to. 6836b85037dbSmrg if test -n "$inst_prefix_dir"; then 6837b85037dbSmrg case $libdir in 6838b85037dbSmrg [\\/]*) 6839302b15bdSmrg func_append add_dir " -L$inst_prefix_dir$libdir" 6840b85037dbSmrg ;; 6841b85037dbSmrg esac 6842b85037dbSmrg fi 6843b85037dbSmrg add="-l$name" 6844b85037dbSmrg elif test "$hardcode_shlibpath_var" = yes; then 6845b85037dbSmrg add_shlibpath="$dir" 6846b85037dbSmrg add="-l$name" 6847b85037dbSmrg else 6848b85037dbSmrg lib_linked=no 6849b85037dbSmrg fi 6850b85037dbSmrg ;; 6851b85037dbSmrg *) lib_linked=no ;; 6852b85037dbSmrg esac 6853b85037dbSmrg 6854b85037dbSmrg if test "$lib_linked" != yes; then 6855b85037dbSmrg func_fatal_configuration "unsupported hardcode properties" 6856b85037dbSmrg fi 6857b85037dbSmrg 6858b85037dbSmrg if test -n "$add_shlibpath"; then 6859b85037dbSmrg case :$compile_shlibpath: in 6860b85037dbSmrg *":$add_shlibpath:"*) ;; 6861302b15bdSmrg *) func_append compile_shlibpath "$add_shlibpath:" ;; 6862b85037dbSmrg esac 6863b85037dbSmrg fi 6864b85037dbSmrg if test "$linkmode" = prog; then 6865b85037dbSmrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 6866b85037dbSmrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 6867b85037dbSmrg else 6868b85037dbSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 6869b85037dbSmrg test -n "$add" && deplibs="$add $deplibs" 6870b85037dbSmrg if test "$hardcode_direct" != yes && 6871b85037dbSmrg test "$hardcode_minus_L" != yes && 6872b85037dbSmrg test "$hardcode_shlibpath_var" = yes; then 6873b85037dbSmrg case :$finalize_shlibpath: in 6874b85037dbSmrg *":$libdir:"*) ;; 6875302b15bdSmrg *) func_append finalize_shlibpath "$libdir:" ;; 6876b85037dbSmrg esac 6877b85037dbSmrg fi 6878b85037dbSmrg fi 6879b85037dbSmrg fi 6880b85037dbSmrg 6881302b15bdSmrg if test "$linkmode" = prog || test "$opt_mode" = relink; then 6882b85037dbSmrg add_shlibpath= 6883b85037dbSmrg add_dir= 6884b85037dbSmrg add= 6885b85037dbSmrg # Finalize command for both is simple: just hardcode it. 6886b85037dbSmrg if test "$hardcode_direct" = yes && 6887b85037dbSmrg test "$hardcode_direct_absolute" = no; then 6888b85037dbSmrg add="$libdir/$linklib" 6889b85037dbSmrg elif test "$hardcode_minus_L" = yes; then 6890b85037dbSmrg add_dir="-L$libdir" 6891b85037dbSmrg add="-l$name" 6892b85037dbSmrg elif test "$hardcode_shlibpath_var" = yes; then 6893b85037dbSmrg case :$finalize_shlibpath: in 6894b85037dbSmrg *":$libdir:"*) ;; 6895302b15bdSmrg *) func_append finalize_shlibpath "$libdir:" ;; 6896b85037dbSmrg esac 6897b85037dbSmrg add="-l$name" 6898b85037dbSmrg elif test "$hardcode_automatic" = yes; then 6899b85037dbSmrg if test -n "$inst_prefix_dir" && 6900b85037dbSmrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 6901b85037dbSmrg add="$inst_prefix_dir$libdir/$linklib" 6902b85037dbSmrg else 6903b85037dbSmrg add="$libdir/$linklib" 6904b85037dbSmrg fi 6905b85037dbSmrg else 6906b85037dbSmrg # We cannot seem to hardcode it, guess we'll fake it. 6907b85037dbSmrg add_dir="-L$libdir" 6908b85037dbSmrg # Try looking first in the location we're being installed to. 6909b85037dbSmrg if test -n "$inst_prefix_dir"; then 6910b85037dbSmrg case $libdir in 6911b85037dbSmrg [\\/]*) 6912302b15bdSmrg func_append add_dir " -L$inst_prefix_dir$libdir" 6913b85037dbSmrg ;; 6914b85037dbSmrg esac 6915b85037dbSmrg fi 6916b85037dbSmrg add="-l$name" 6917b85037dbSmrg fi 6918b85037dbSmrg 6919b85037dbSmrg if test "$linkmode" = prog; then 6920b85037dbSmrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 6921b85037dbSmrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 6922b85037dbSmrg else 6923b85037dbSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 6924b85037dbSmrg test -n "$add" && deplibs="$add $deplibs" 6925b85037dbSmrg fi 6926b85037dbSmrg fi 6927b85037dbSmrg elif test "$linkmode" = prog; then 6928b85037dbSmrg # Here we assume that one of hardcode_direct or hardcode_minus_L 6929b85037dbSmrg # is not unsupported. This is valid on all known static and 6930b85037dbSmrg # shared platforms. 6931b85037dbSmrg if test "$hardcode_direct" != unsupported; then 6932b85037dbSmrg test -n "$old_library" && linklib="$old_library" 6933b85037dbSmrg compile_deplibs="$dir/$linklib $compile_deplibs" 6934b85037dbSmrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 6935b85037dbSmrg else 6936b85037dbSmrg compile_deplibs="-l$name -L$dir $compile_deplibs" 6937b85037dbSmrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 6938b85037dbSmrg fi 6939b85037dbSmrg elif test "$build_libtool_libs" = yes; then 6940b85037dbSmrg # Not a shared library 6941b85037dbSmrg if test "$deplibs_check_method" != pass_all; then 6942b85037dbSmrg # We're trying link a shared library against a static one 6943b85037dbSmrg # but the system doesn't support it. 6944b85037dbSmrg 6945b85037dbSmrg # Just print a warning and add the library to dependency_libs so 6946b85037dbSmrg # that the program can be linked against the static library. 6947b85037dbSmrg echo 6948b85037dbSmrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 6949b85037dbSmrg echo "*** I have the capability to make that library automatically link in when" 6950b85037dbSmrg echo "*** you link to this library. But I can only do this if you have a" 6951b85037dbSmrg echo "*** shared version of the library, which you do not appear to have." 6952b85037dbSmrg if test "$module" = yes; then 6953b85037dbSmrg echo "*** But as you try to build a module library, libtool will still create " 6954b85037dbSmrg echo "*** a static module, that should work as long as the dlopening application" 6955b85037dbSmrg echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 6956b85037dbSmrg if test -z "$global_symbol_pipe"; then 6957b85037dbSmrg echo 6958b85037dbSmrg echo "*** However, this would only work if libtool was able to extract symbol" 6959b85037dbSmrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 6960b85037dbSmrg echo "*** not find such a program. So, this module is probably useless." 6961b85037dbSmrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 6962b85037dbSmrg fi 6963b85037dbSmrg if test "$build_old_libs" = no; then 6964b85037dbSmrg build_libtool_libs=module 6965b85037dbSmrg build_old_libs=yes 6966b85037dbSmrg else 6967b85037dbSmrg build_libtool_libs=no 6968b85037dbSmrg fi 6969b85037dbSmrg fi 6970b85037dbSmrg else 6971b85037dbSmrg deplibs="$dir/$old_library $deplibs" 6972b85037dbSmrg link_static=yes 6973b85037dbSmrg fi 6974b85037dbSmrg fi # link shared/static library? 6975b85037dbSmrg 6976b85037dbSmrg if test "$linkmode" = lib; then 6977b85037dbSmrg if test -n "$dependency_libs" && 6978b85037dbSmrg { test "$hardcode_into_libs" != yes || 6979b85037dbSmrg test "$build_old_libs" = yes || 6980b85037dbSmrg test "$link_static" = yes; }; then 6981b85037dbSmrg # Extract -R from dependency_libs 6982b85037dbSmrg temp_deplibs= 6983b85037dbSmrg for libdir in $dependency_libs; do 6984b85037dbSmrg case $libdir in 6985b85037dbSmrg -R*) func_stripname '-R' '' "$libdir" 6986b85037dbSmrg temp_xrpath=$func_stripname_result 6987b85037dbSmrg case " $xrpath " in 6988b85037dbSmrg *" $temp_xrpath "*) ;; 6989302b15bdSmrg *) func_append xrpath " $temp_xrpath";; 6990b85037dbSmrg esac;; 6991302b15bdSmrg *) func_append temp_deplibs " $libdir";; 6992b85037dbSmrg esac 6993b85037dbSmrg done 6994b85037dbSmrg dependency_libs="$temp_deplibs" 6995b85037dbSmrg fi 6996b85037dbSmrg 6997302b15bdSmrg func_append newlib_search_path " $absdir" 6998b85037dbSmrg # Link against this library 6999b85037dbSmrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 7000b85037dbSmrg # ... and its dependency_libs 7001b85037dbSmrg tmp_libs= 7002b85037dbSmrg for deplib in $dependency_libs; do 7003b85037dbSmrg newdependency_libs="$deplib $newdependency_libs" 7004302b15bdSmrg case $deplib in 7005302b15bdSmrg -L*) func_stripname '-L' '' "$deplib" 7006302b15bdSmrg func_resolve_sysroot "$func_stripname_result";; 7007302b15bdSmrg *) func_resolve_sysroot "$deplib" ;; 7008302b15bdSmrg esac 7009302b15bdSmrg if $opt_preserve_dup_deps ; then 7010b85037dbSmrg case "$tmp_libs " in 7011302b15bdSmrg *" $func_resolve_sysroot_result "*) 7012302b15bdSmrg func_append specialdeplibs " $func_resolve_sysroot_result" ;; 7013b85037dbSmrg esac 7014b85037dbSmrg fi 7015302b15bdSmrg func_append tmp_libs " $func_resolve_sysroot_result" 7016b85037dbSmrg done 7017b85037dbSmrg 7018b85037dbSmrg if test "$link_all_deplibs" != no; then 7019b85037dbSmrg # Add the search paths of all dependency libraries 7020b85037dbSmrg for deplib in $dependency_libs; do 7021b85037dbSmrg path= 7022b85037dbSmrg case $deplib in 7023b85037dbSmrg -L*) path="$deplib" ;; 7024b85037dbSmrg *.la) 7025302b15bdSmrg func_resolve_sysroot "$deplib" 7026302b15bdSmrg deplib=$func_resolve_sysroot_result 7027b85037dbSmrg func_dirname "$deplib" "" "." 7028302b15bdSmrg dir=$func_dirname_result 7029b85037dbSmrg # We need an absolute path. 7030b85037dbSmrg case $dir in 7031b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 7032b85037dbSmrg *) 7033b85037dbSmrg absdir=`cd "$dir" && pwd` 7034b85037dbSmrg if test -z "$absdir"; then 7035b85037dbSmrg func_warning "cannot determine absolute directory name of \`$dir'" 7036b85037dbSmrg absdir="$dir" 7037b85037dbSmrg fi 7038b85037dbSmrg ;; 7039b85037dbSmrg esac 7040b85037dbSmrg if $GREP "^installed=no" $deplib > /dev/null; then 7041b85037dbSmrg case $host in 7042b85037dbSmrg *-*-darwin*) 7043b85037dbSmrg depdepl= 7044b85037dbSmrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 7045b85037dbSmrg if test -n "$deplibrary_names" ; then 7046b85037dbSmrg for tmp in $deplibrary_names ; do 7047b85037dbSmrg depdepl=$tmp 7048b85037dbSmrg done 7049b85037dbSmrg if test -f "$absdir/$objdir/$depdepl" ; then 7050b85037dbSmrg depdepl="$absdir/$objdir/$depdepl" 7051b85037dbSmrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7052b85037dbSmrg if test -z "$darwin_install_name"; then 7053b85037dbSmrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7054b85037dbSmrg fi 7055302b15bdSmrg func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 7056302b15bdSmrg func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" 7057b85037dbSmrg path= 7058b85037dbSmrg fi 7059b85037dbSmrg fi 7060b85037dbSmrg ;; 7061b85037dbSmrg *) 7062b85037dbSmrg path="-L$absdir/$objdir" 7063b85037dbSmrg ;; 7064b85037dbSmrg esac 7065b85037dbSmrg else 7066b85037dbSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 7067b85037dbSmrg test -z "$libdir" && \ 7068b85037dbSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 7069b85037dbSmrg test "$absdir" != "$libdir" && \ 7070b85037dbSmrg func_warning "\`$deplib' seems to be moved" 7071b85037dbSmrg 7072b85037dbSmrg path="-L$absdir" 7073b85037dbSmrg fi 7074b85037dbSmrg ;; 7075b85037dbSmrg esac 7076b85037dbSmrg case " $deplibs " in 7077b85037dbSmrg *" $path "*) ;; 7078b85037dbSmrg *) deplibs="$path $deplibs" ;; 7079b85037dbSmrg esac 7080b85037dbSmrg done 7081b85037dbSmrg fi # link_all_deplibs != no 7082b85037dbSmrg fi # linkmode = lib 7083b85037dbSmrg done # for deplib in $libs 7084b85037dbSmrg if test "$pass" = link; then 7085b85037dbSmrg if test "$linkmode" = "prog"; then 7086b85037dbSmrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 7087b85037dbSmrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 7088b85037dbSmrg else 7089b85037dbSmrg compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7090b85037dbSmrg fi 7091b85037dbSmrg fi 7092b85037dbSmrg dependency_libs="$newdependency_libs" 7093b85037dbSmrg if test "$pass" = dlpreopen; then 7094b85037dbSmrg # Link the dlpreopened libraries before other libraries 7095b85037dbSmrg for deplib in $save_deplibs; do 7096b85037dbSmrg deplibs="$deplib $deplibs" 7097b85037dbSmrg done 7098b85037dbSmrg fi 7099b85037dbSmrg if test "$pass" != dlopen; then 7100b85037dbSmrg if test "$pass" != conv; then 7101b85037dbSmrg # Make sure lib_search_path contains only unique directories. 7102b85037dbSmrg lib_search_path= 7103b85037dbSmrg for dir in $newlib_search_path; do 7104b85037dbSmrg case "$lib_search_path " in 7105b85037dbSmrg *" $dir "*) ;; 7106302b15bdSmrg *) func_append lib_search_path " $dir" ;; 7107b85037dbSmrg esac 7108b85037dbSmrg done 7109b85037dbSmrg newlib_search_path= 7110b85037dbSmrg fi 7111b85037dbSmrg 7112b85037dbSmrg if test "$linkmode,$pass" != "prog,link"; then 7113b85037dbSmrg vars="deplibs" 7114b85037dbSmrg else 7115b85037dbSmrg vars="compile_deplibs finalize_deplibs" 7116b85037dbSmrg fi 7117b85037dbSmrg for var in $vars dependency_libs; do 7118b85037dbSmrg # Add libraries to $var in reverse order 7119b85037dbSmrg eval tmp_libs=\"\$$var\" 7120b85037dbSmrg new_libs= 7121b85037dbSmrg for deplib in $tmp_libs; do 7122b85037dbSmrg # FIXME: Pedantically, this is the right thing to do, so 7123b85037dbSmrg # that some nasty dependency loop isn't accidentally 7124b85037dbSmrg # broken: 7125b85037dbSmrg #new_libs="$deplib $new_libs" 7126b85037dbSmrg # Pragmatically, this seems to cause very few problems in 7127b85037dbSmrg # practice: 7128b85037dbSmrg case $deplib in 7129b85037dbSmrg -L*) new_libs="$deplib $new_libs" ;; 7130b85037dbSmrg -R*) ;; 7131b85037dbSmrg *) 7132b85037dbSmrg # And here is the reason: when a library appears more 7133b85037dbSmrg # than once as an explicit dependence of a library, or 7134b85037dbSmrg # is implicitly linked in more than once by the 7135b85037dbSmrg # compiler, it is considered special, and multiple 7136b85037dbSmrg # occurrences thereof are not removed. Compare this 7137b85037dbSmrg # with having the same library being listed as a 7138b85037dbSmrg # dependency of multiple other libraries: in this case, 7139b85037dbSmrg # we know (pedantically, we assume) the library does not 7140b85037dbSmrg # need to be listed more than once, so we keep only the 7141b85037dbSmrg # last copy. This is not always right, but it is rare 7142b85037dbSmrg # enough that we require users that really mean to play 7143b85037dbSmrg # such unportable linking tricks to link the library 7144b85037dbSmrg # using -Wl,-lname, so that libtool does not consider it 7145b85037dbSmrg # for duplicate removal. 7146b85037dbSmrg case " $specialdeplibs " in 7147b85037dbSmrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 7148b85037dbSmrg *) 7149b85037dbSmrg case " $new_libs " in 7150b85037dbSmrg *" $deplib "*) ;; 7151b85037dbSmrg *) new_libs="$deplib $new_libs" ;; 7152b85037dbSmrg esac 7153b85037dbSmrg ;; 7154b85037dbSmrg esac 7155b85037dbSmrg ;; 7156b85037dbSmrg esac 7157b85037dbSmrg done 7158b85037dbSmrg tmp_libs= 7159b85037dbSmrg for deplib in $new_libs; do 7160b85037dbSmrg case $deplib in 7161b85037dbSmrg -L*) 7162b85037dbSmrg case " $tmp_libs " in 7163b85037dbSmrg *" $deplib "*) ;; 7164302b15bdSmrg *) func_append tmp_libs " $deplib" ;; 7165b85037dbSmrg esac 7166b85037dbSmrg ;; 7167302b15bdSmrg *) func_append tmp_libs " $deplib" ;; 7168b85037dbSmrg esac 7169b85037dbSmrg done 7170b85037dbSmrg eval $var=\"$tmp_libs\" 7171b85037dbSmrg done # for var 7172b85037dbSmrg fi 7173b85037dbSmrg # Last step: remove runtime libs from dependency_libs 7174b85037dbSmrg # (they stay in deplibs) 7175b85037dbSmrg tmp_libs= 7176b85037dbSmrg for i in $dependency_libs ; do 7177b85037dbSmrg case " $predeps $postdeps $compiler_lib_search_path " in 7178b85037dbSmrg *" $i "*) 7179b85037dbSmrg i="" 7180b85037dbSmrg ;; 7181b85037dbSmrg esac 7182b85037dbSmrg if test -n "$i" ; then 7183302b15bdSmrg func_append tmp_libs " $i" 7184b85037dbSmrg fi 7185b85037dbSmrg done 7186b85037dbSmrg dependency_libs=$tmp_libs 7187b85037dbSmrg done # for pass 7188b85037dbSmrg if test "$linkmode" = prog; then 7189b85037dbSmrg dlfiles="$newdlfiles" 7190b85037dbSmrg fi 7191b85037dbSmrg if test "$linkmode" = prog || test "$linkmode" = lib; then 7192b85037dbSmrg dlprefiles="$newdlprefiles" 7193b85037dbSmrg fi 7194b85037dbSmrg 7195b85037dbSmrg case $linkmode in 7196b85037dbSmrg oldlib) 7197b85037dbSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7198b85037dbSmrg func_warning "\`-dlopen' is ignored for archives" 7199b85037dbSmrg fi 7200b85037dbSmrg 7201b85037dbSmrg case " $deplibs" in 7202b85037dbSmrg *\ -l* | *\ -L*) 7203b85037dbSmrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 7204b85037dbSmrg esac 7205b85037dbSmrg 7206b85037dbSmrg test -n "$rpath" && \ 7207b85037dbSmrg func_warning "\`-rpath' is ignored for archives" 7208b85037dbSmrg 7209b85037dbSmrg test -n "$xrpath" && \ 7210b85037dbSmrg func_warning "\`-R' is ignored for archives" 7211b85037dbSmrg 7212b85037dbSmrg test -n "$vinfo" && \ 7213b85037dbSmrg func_warning "\`-version-info/-version-number' is ignored for archives" 7214b85037dbSmrg 7215b85037dbSmrg test -n "$release" && \ 7216b85037dbSmrg func_warning "\`-release' is ignored for archives" 7217b85037dbSmrg 7218b85037dbSmrg test -n "$export_symbols$export_symbols_regex" && \ 7219b85037dbSmrg func_warning "\`-export-symbols' is ignored for archives" 7220b85037dbSmrg 7221b85037dbSmrg # Now set the variables for building old libraries. 7222b85037dbSmrg build_libtool_libs=no 7223b85037dbSmrg oldlibs="$output" 7224302b15bdSmrg func_append objs "$old_deplibs" 7225b85037dbSmrg ;; 7226b85037dbSmrg 7227b85037dbSmrg lib) 7228b85037dbSmrg # Make sure we only generate libraries of the form `libNAME.la'. 7229b85037dbSmrg case $outputname in 7230b85037dbSmrg lib*) 7231b85037dbSmrg func_stripname 'lib' '.la' "$outputname" 7232b85037dbSmrg name=$func_stripname_result 7233b85037dbSmrg eval shared_ext=\"$shrext_cmds\" 7234b85037dbSmrg eval libname=\"$libname_spec\" 7235b85037dbSmrg ;; 7236b85037dbSmrg *) 7237b85037dbSmrg test "$module" = no && \ 7238b85037dbSmrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 7239b85037dbSmrg 7240b85037dbSmrg if test "$need_lib_prefix" != no; then 7241b85037dbSmrg # Add the "lib" prefix for modules if required 7242b85037dbSmrg func_stripname '' '.la' "$outputname" 7243b85037dbSmrg name=$func_stripname_result 7244b85037dbSmrg eval shared_ext=\"$shrext_cmds\" 7245b85037dbSmrg eval libname=\"$libname_spec\" 7246b85037dbSmrg else 7247b85037dbSmrg func_stripname '' '.la' "$outputname" 7248b85037dbSmrg libname=$func_stripname_result 7249b85037dbSmrg fi 7250b85037dbSmrg ;; 7251b85037dbSmrg esac 7252b85037dbSmrg 7253b85037dbSmrg if test -n "$objs"; then 7254b85037dbSmrg if test "$deplibs_check_method" != pass_all; then 7255b85037dbSmrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 7256b85037dbSmrg else 7257b85037dbSmrg echo 7258b85037dbSmrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 7259b85037dbSmrg $ECHO "*** objects $objs is not portable!" 7260302b15bdSmrg func_append libobjs " $objs" 7261b85037dbSmrg fi 7262b85037dbSmrg fi 7263b85037dbSmrg 7264b85037dbSmrg test "$dlself" != no && \ 7265b85037dbSmrg func_warning "\`-dlopen self' is ignored for libtool libraries" 7266b85037dbSmrg 7267b85037dbSmrg set dummy $rpath 7268b85037dbSmrg shift 7269b85037dbSmrg test "$#" -gt 1 && \ 7270b85037dbSmrg func_warning "ignoring multiple \`-rpath's for a libtool library" 7271b85037dbSmrg 7272b85037dbSmrg install_libdir="$1" 7273b85037dbSmrg 7274b85037dbSmrg oldlibs= 7275b85037dbSmrg if test -z "$rpath"; then 7276b85037dbSmrg if test "$build_libtool_libs" = yes; then 7277b85037dbSmrg # Building a libtool convenience library. 7278b85037dbSmrg # Some compilers have problems with a `.al' extension so 7279b85037dbSmrg # convenience libraries should have the same extension an 7280b85037dbSmrg # archive normally would. 7281b85037dbSmrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 7282b85037dbSmrg build_libtool_libs=convenience 7283b85037dbSmrg build_old_libs=yes 7284b85037dbSmrg fi 7285b85037dbSmrg 7286b85037dbSmrg test -n "$vinfo" && \ 7287b85037dbSmrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 7288b85037dbSmrg 7289b85037dbSmrg test -n "$release" && \ 7290b85037dbSmrg func_warning "\`-release' is ignored for convenience libraries" 7291b85037dbSmrg else 7292b85037dbSmrg 7293b85037dbSmrg # Parse the version information argument. 7294b85037dbSmrg save_ifs="$IFS"; IFS=':' 7295b85037dbSmrg set dummy $vinfo 0 0 0 7296b85037dbSmrg shift 7297b85037dbSmrg IFS="$save_ifs" 7298b85037dbSmrg 7299b85037dbSmrg test -n "$7" && \ 7300b85037dbSmrg func_fatal_help "too many parameters to \`-version-info'" 7301b85037dbSmrg 7302b85037dbSmrg # convert absolute version numbers to libtool ages 7303b85037dbSmrg # this retains compatibility with .la files and attempts 7304b85037dbSmrg # to make the code below a bit more comprehensible 7305b85037dbSmrg 7306b85037dbSmrg case $vinfo_number in 7307b85037dbSmrg yes) 7308b85037dbSmrg number_major="$1" 7309b85037dbSmrg number_minor="$2" 7310b85037dbSmrg number_revision="$3" 7311b85037dbSmrg # 7312b85037dbSmrg # There are really only two kinds -- those that 7313b85037dbSmrg # use the current revision as the major version 7314b85037dbSmrg # and those that subtract age and use age as 7315b85037dbSmrg # a minor version. But, then there is irix 7316b85037dbSmrg # which has an extra 1 added just for fun 7317b85037dbSmrg # 7318b85037dbSmrg case $version_type in 7319b85037dbSmrg darwin|linux|osf|windows|none) 7320b85037dbSmrg func_arith $number_major + $number_minor 7321b85037dbSmrg current=$func_arith_result 7322b85037dbSmrg age="$number_minor" 7323b85037dbSmrg revision="$number_revision" 7324b85037dbSmrg ;; 7325b85037dbSmrg freebsd-aout|freebsd-elf|qnx|sunos) 7326b85037dbSmrg current="$number_major" 7327b85037dbSmrg revision="$number_minor" 7328b85037dbSmrg age="0" 7329b85037dbSmrg ;; 7330b85037dbSmrg irix|nonstopux) 7331b85037dbSmrg func_arith $number_major + $number_minor 7332b85037dbSmrg current=$func_arith_result 7333b85037dbSmrg age="$number_minor" 7334b85037dbSmrg revision="$number_minor" 7335b85037dbSmrg lt_irix_increment=no 7336b85037dbSmrg ;; 7337b85037dbSmrg esac 7338b85037dbSmrg ;; 7339b85037dbSmrg no) 7340b85037dbSmrg current="$1" 7341b85037dbSmrg revision="$2" 7342b85037dbSmrg age="$3" 7343b85037dbSmrg ;; 7344b85037dbSmrg esac 7345b85037dbSmrg 7346b85037dbSmrg # Check that each of the things are valid numbers. 7347b85037dbSmrg case $current in 7348b85037dbSmrg 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]) ;; 7349b85037dbSmrg *) 7350b85037dbSmrg func_error "CURRENT \`$current' must be a nonnegative integer" 7351b85037dbSmrg func_fatal_error "\`$vinfo' is not valid version information" 7352b85037dbSmrg ;; 7353b85037dbSmrg esac 7354b85037dbSmrg 7355b85037dbSmrg case $revision in 7356b85037dbSmrg 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]) ;; 7357b85037dbSmrg *) 7358b85037dbSmrg func_error "REVISION \`$revision' must be a nonnegative integer" 7359b85037dbSmrg func_fatal_error "\`$vinfo' is not valid version information" 7360b85037dbSmrg ;; 7361b85037dbSmrg esac 7362b85037dbSmrg 7363b85037dbSmrg case $age in 7364b85037dbSmrg 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]) ;; 7365b85037dbSmrg *) 7366b85037dbSmrg func_error "AGE \`$age' must be a nonnegative integer" 7367b85037dbSmrg func_fatal_error "\`$vinfo' is not valid version information" 7368b85037dbSmrg ;; 7369b85037dbSmrg esac 7370b85037dbSmrg 7371b85037dbSmrg if test "$age" -gt "$current"; then 7372b85037dbSmrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 7373b85037dbSmrg func_fatal_error "\`$vinfo' is not valid version information" 7374b85037dbSmrg fi 7375b85037dbSmrg 7376b85037dbSmrg # Calculate the version variables. 7377b85037dbSmrg major= 7378b85037dbSmrg versuffix= 7379b85037dbSmrg verstring= 7380b85037dbSmrg case $version_type in 7381b85037dbSmrg none) ;; 7382b85037dbSmrg 7383b85037dbSmrg darwin) 7384b85037dbSmrg # Like Linux, but with the current version available in 7385b85037dbSmrg # verstring for coding it into the library header 7386b85037dbSmrg func_arith $current - $age 7387b85037dbSmrg major=.$func_arith_result 7388b85037dbSmrg versuffix="$major.$age.$revision" 7389b85037dbSmrg # Darwin ld doesn't like 0 for these options... 7390b85037dbSmrg func_arith $current + 1 7391b85037dbSmrg minor_current=$func_arith_result 7392b85037dbSmrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 7393b85037dbSmrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 7394b85037dbSmrg ;; 7395b85037dbSmrg 7396b85037dbSmrg freebsd-aout) 7397b85037dbSmrg major=".$current" 7398b85037dbSmrg versuffix=".$current.$revision"; 7399b85037dbSmrg ;; 7400b85037dbSmrg 7401b85037dbSmrg freebsd-elf) 7402b85037dbSmrg major=".$current" 7403b85037dbSmrg versuffix=".$current" 7404b85037dbSmrg ;; 7405b85037dbSmrg 7406b85037dbSmrg irix | nonstopux) 7407b85037dbSmrg if test "X$lt_irix_increment" = "Xno"; then 7408b85037dbSmrg func_arith $current - $age 7409b85037dbSmrg else 7410b85037dbSmrg func_arith $current - $age + 1 7411b85037dbSmrg fi 7412b85037dbSmrg major=$func_arith_result 7413b85037dbSmrg 7414b85037dbSmrg case $version_type in 7415b85037dbSmrg nonstopux) verstring_prefix=nonstopux ;; 7416b85037dbSmrg *) verstring_prefix=sgi ;; 7417b85037dbSmrg esac 7418b85037dbSmrg verstring="$verstring_prefix$major.$revision" 7419b85037dbSmrg 7420b85037dbSmrg # Add in all the interfaces that we are compatible with. 7421b85037dbSmrg loop=$revision 7422b85037dbSmrg while test "$loop" -ne 0; do 7423b85037dbSmrg func_arith $revision - $loop 7424b85037dbSmrg iface=$func_arith_result 7425b85037dbSmrg func_arith $loop - 1 7426b85037dbSmrg loop=$func_arith_result 7427b85037dbSmrg verstring="$verstring_prefix$major.$iface:$verstring" 7428b85037dbSmrg done 7429b85037dbSmrg 7430b85037dbSmrg # Before this point, $major must not contain `.'. 7431b85037dbSmrg major=.$major 7432b85037dbSmrg versuffix="$major.$revision" 7433b85037dbSmrg ;; 7434b85037dbSmrg 7435b85037dbSmrg linux) 7436b85037dbSmrg func_arith $current - $age 7437b85037dbSmrg major=.$func_arith_result 7438b85037dbSmrg versuffix="$major.$age.$revision" 7439b85037dbSmrg ;; 7440b85037dbSmrg 7441b85037dbSmrg osf) 7442b85037dbSmrg func_arith $current - $age 7443b85037dbSmrg major=.$func_arith_result 7444b85037dbSmrg versuffix=".$current.$age.$revision" 7445b85037dbSmrg verstring="$current.$age.$revision" 7446b85037dbSmrg 7447b85037dbSmrg # Add in all the interfaces that we are compatible with. 7448b85037dbSmrg loop=$age 7449b85037dbSmrg while test "$loop" -ne 0; do 7450b85037dbSmrg func_arith $current - $loop 7451b85037dbSmrg iface=$func_arith_result 7452b85037dbSmrg func_arith $loop - 1 7453b85037dbSmrg loop=$func_arith_result 7454b85037dbSmrg verstring="$verstring:${iface}.0" 7455b85037dbSmrg done 7456b85037dbSmrg 7457b85037dbSmrg # Make executables depend on our current version. 7458302b15bdSmrg func_append verstring ":${current}.0" 7459b85037dbSmrg ;; 7460b85037dbSmrg 7461b85037dbSmrg qnx) 7462b85037dbSmrg major=".$current" 7463b85037dbSmrg versuffix=".$current" 7464b85037dbSmrg ;; 7465b85037dbSmrg 7466b85037dbSmrg sunos) 7467b85037dbSmrg major=".$current" 7468b85037dbSmrg versuffix=".$current.$revision" 7469b85037dbSmrg ;; 7470b85037dbSmrg 7471b85037dbSmrg windows) 7472b85037dbSmrg # Use '-' rather than '.', since we only want one 7473b85037dbSmrg # extension on DOS 8.3 filesystems. 7474b85037dbSmrg func_arith $current - $age 7475b85037dbSmrg major=$func_arith_result 7476b85037dbSmrg versuffix="-$major" 7477b85037dbSmrg ;; 7478b85037dbSmrg 7479b85037dbSmrg *) 7480b85037dbSmrg func_fatal_configuration "unknown library version type \`$version_type'" 7481b85037dbSmrg ;; 7482b85037dbSmrg esac 7483b85037dbSmrg 7484b85037dbSmrg # Clear the version info if we defaulted, and they specified a release. 7485b85037dbSmrg if test -z "$vinfo" && test -n "$release"; then 7486b85037dbSmrg major= 7487b85037dbSmrg case $version_type in 7488b85037dbSmrg darwin) 7489b85037dbSmrg # we can't check for "0.0" in archive_cmds due to quoting 7490b85037dbSmrg # problems, so we reset it completely 7491b85037dbSmrg verstring= 7492b85037dbSmrg ;; 7493b85037dbSmrg *) 7494b85037dbSmrg verstring="0.0" 7495b85037dbSmrg ;; 7496b85037dbSmrg esac 7497b85037dbSmrg if test "$need_version" = no; then 7498b85037dbSmrg versuffix= 7499b85037dbSmrg else 7500b85037dbSmrg versuffix=".0.0" 7501b85037dbSmrg fi 7502b85037dbSmrg fi 7503b85037dbSmrg 7504b85037dbSmrg # Remove version info from name if versioning should be avoided 7505b85037dbSmrg if test "$avoid_version" = yes && test "$need_version" = no; then 7506b85037dbSmrg major= 7507b85037dbSmrg versuffix= 7508b85037dbSmrg verstring="" 7509b85037dbSmrg fi 7510b85037dbSmrg 7511b85037dbSmrg # Check to see if the archive will have undefined symbols. 7512b85037dbSmrg if test "$allow_undefined" = yes; then 7513b85037dbSmrg if test "$allow_undefined_flag" = unsupported; then 7514b85037dbSmrg func_warning "undefined symbols not allowed in $host shared libraries" 7515b85037dbSmrg build_libtool_libs=no 7516b85037dbSmrg build_old_libs=yes 7517b85037dbSmrg fi 7518b85037dbSmrg else 7519b85037dbSmrg # Don't allow undefined symbols. 7520b85037dbSmrg allow_undefined_flag="$no_undefined_flag" 7521b85037dbSmrg fi 7522b85037dbSmrg 7523b85037dbSmrg fi 7524b85037dbSmrg 7525b85037dbSmrg func_generate_dlsyms "$libname" "$libname" "yes" 7526302b15bdSmrg func_append libobjs " $symfileobj" 7527b85037dbSmrg test "X$libobjs" = "X " && libobjs= 7528b85037dbSmrg 7529302b15bdSmrg if test "$opt_mode" != relink; then 7530b85037dbSmrg # Remove our outputs, but don't remove object files since they 7531b85037dbSmrg # may have been created when compiling PIC objects. 7532b85037dbSmrg removelist= 7533b85037dbSmrg tempremovelist=`$ECHO "$output_objdir/*"` 7534b85037dbSmrg for p in $tempremovelist; do 7535b85037dbSmrg case $p in 7536b85037dbSmrg *.$objext | *.gcno) 7537b85037dbSmrg ;; 7538b85037dbSmrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 7539b85037dbSmrg if test "X$precious_files_regex" != "X"; then 7540b85037dbSmrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 7541b85037dbSmrg then 7542b85037dbSmrg continue 7543b85037dbSmrg fi 7544b85037dbSmrg fi 7545302b15bdSmrg func_append removelist " $p" 7546b85037dbSmrg ;; 7547b85037dbSmrg *) ;; 7548b85037dbSmrg esac 7549b85037dbSmrg done 7550b85037dbSmrg test -n "$removelist" && \ 7551b85037dbSmrg func_show_eval "${RM}r \$removelist" 7552b85037dbSmrg fi 7553b85037dbSmrg 7554b85037dbSmrg # Now set the variables for building old libraries. 7555b85037dbSmrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 7556302b15bdSmrg func_append oldlibs " $output_objdir/$libname.$libext" 7557b85037dbSmrg 7558b85037dbSmrg # Transform .lo files to .o files. 7559b85037dbSmrg oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 7560b85037dbSmrg fi 7561b85037dbSmrg 7562b85037dbSmrg # Eliminate all temporary directories. 7563b85037dbSmrg #for path in $notinst_path; do 7564b85037dbSmrg # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 7565b85037dbSmrg # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 7566b85037dbSmrg # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 7567b85037dbSmrg #done 7568b85037dbSmrg 7569b85037dbSmrg if test -n "$xrpath"; then 7570b85037dbSmrg # If the user specified any rpath flags, then add them. 7571b85037dbSmrg temp_xrpath= 7572b85037dbSmrg for libdir in $xrpath; do 7573302b15bdSmrg func_replace_sysroot "$libdir" 7574302b15bdSmrg func_append temp_xrpath " -R$func_replace_sysroot_result" 7575b85037dbSmrg case "$finalize_rpath " in 7576b85037dbSmrg *" $libdir "*) ;; 7577302b15bdSmrg *) func_append finalize_rpath " $libdir" ;; 7578b85037dbSmrg esac 7579b85037dbSmrg done 7580b85037dbSmrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 7581b85037dbSmrg dependency_libs="$temp_xrpath $dependency_libs" 7582b85037dbSmrg fi 7583b85037dbSmrg fi 7584b85037dbSmrg 7585b85037dbSmrg # Make sure dlfiles contains only unique files that won't be dlpreopened 7586b85037dbSmrg old_dlfiles="$dlfiles" 7587b85037dbSmrg dlfiles= 7588b85037dbSmrg for lib in $old_dlfiles; do 7589b85037dbSmrg case " $dlprefiles $dlfiles " in 7590b85037dbSmrg *" $lib "*) ;; 7591302b15bdSmrg *) func_append dlfiles " $lib" ;; 7592b85037dbSmrg esac 7593b85037dbSmrg done 7594b85037dbSmrg 7595b85037dbSmrg # Make sure dlprefiles contains only unique files 7596b85037dbSmrg old_dlprefiles="$dlprefiles" 7597b85037dbSmrg dlprefiles= 7598b85037dbSmrg for lib in $old_dlprefiles; do 7599b85037dbSmrg case "$dlprefiles " in 7600b85037dbSmrg *" $lib "*) ;; 7601302b15bdSmrg *) func_append dlprefiles " $lib" ;; 7602b85037dbSmrg esac 7603b85037dbSmrg done 7604b85037dbSmrg 7605b85037dbSmrg if test "$build_libtool_libs" = yes; then 7606b85037dbSmrg if test -n "$rpath"; then 7607b85037dbSmrg case $host in 7608b85037dbSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 7609b85037dbSmrg # these systems don't actually have a c library (as such)! 7610b85037dbSmrg ;; 7611b85037dbSmrg *-*-rhapsody* | *-*-darwin1.[012]) 7612b85037dbSmrg # Rhapsody C library is in the System framework 7613302b15bdSmrg func_append deplibs " System.ltframework" 7614b85037dbSmrg ;; 7615b85037dbSmrg *-*-netbsd*) 7616b85037dbSmrg # Don't link with libc until the a.out ld.so is fixed. 7617b85037dbSmrg ;; 7618b85037dbSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 7619b85037dbSmrg # Do not include libc due to us having libc/libc_r. 7620b85037dbSmrg ;; 7621b85037dbSmrg *-*-sco3.2v5* | *-*-sco5v6*) 7622b85037dbSmrg # Causes problems with __ctype 7623b85037dbSmrg ;; 7624b85037dbSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 7625b85037dbSmrg # Compiler inserts libc in the correct place for threads to work 7626b85037dbSmrg ;; 7627b85037dbSmrg *) 7628b85037dbSmrg # Add libc to deplibs on all other systems if necessary. 7629b85037dbSmrg if test "$build_libtool_need_lc" = "yes"; then 7630302b15bdSmrg func_append deplibs " -lc" 7631b85037dbSmrg fi 7632b85037dbSmrg ;; 7633b85037dbSmrg esac 7634b85037dbSmrg fi 7635b85037dbSmrg 7636b85037dbSmrg # Transform deplibs into only deplibs that can be linked in shared. 7637b85037dbSmrg name_save=$name 7638b85037dbSmrg libname_save=$libname 7639b85037dbSmrg release_save=$release 7640b85037dbSmrg versuffix_save=$versuffix 7641b85037dbSmrg major_save=$major 7642b85037dbSmrg # I'm not sure if I'm treating the release correctly. I think 7643b85037dbSmrg # release should show up in the -l (ie -lgmp5) so we don't want to 7644b85037dbSmrg # add it in twice. Is that correct? 7645b85037dbSmrg release="" 7646b85037dbSmrg versuffix="" 7647b85037dbSmrg major="" 7648b85037dbSmrg newdeplibs= 7649b85037dbSmrg droppeddeps=no 7650b85037dbSmrg case $deplibs_check_method in 7651b85037dbSmrg pass_all) 7652b85037dbSmrg # Don't check for shared/static. Everything works. 7653b85037dbSmrg # This might be a little naive. We might want to check 7654b85037dbSmrg # whether the library exists or not. But this is on 7655b85037dbSmrg # osf3 & osf4 and I'm not really sure... Just 7656b85037dbSmrg # implementing what was already the behavior. 7657b85037dbSmrg newdeplibs=$deplibs 7658b85037dbSmrg ;; 7659b85037dbSmrg test_compile) 7660b85037dbSmrg # This code stresses the "libraries are programs" paradigm to its 7661b85037dbSmrg # limits. Maybe even breaks it. We compile a program, linking it 7662b85037dbSmrg # against the deplibs as a proxy for the library. Then we can check 7663b85037dbSmrg # whether they linked in statically or dynamically with ldd. 7664b85037dbSmrg $opt_dry_run || $RM conftest.c 7665b85037dbSmrg cat > conftest.c <<EOF 7666b85037dbSmrg int main() { return 0; } 7667b85037dbSmrgEOF 7668b85037dbSmrg $opt_dry_run || $RM conftest 7669b85037dbSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 7670b85037dbSmrg ldd_output=`ldd conftest` 7671b85037dbSmrg for i in $deplibs; do 7672b85037dbSmrg case $i in 7673b85037dbSmrg -l*) 7674b85037dbSmrg func_stripname -l '' "$i" 7675b85037dbSmrg name=$func_stripname_result 7676b85037dbSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7677b85037dbSmrg case " $predeps $postdeps " in 7678b85037dbSmrg *" $i "*) 7679302b15bdSmrg func_append newdeplibs " $i" 7680b85037dbSmrg i="" 7681b85037dbSmrg ;; 7682b85037dbSmrg esac 7683b85037dbSmrg fi 7684b85037dbSmrg if test -n "$i" ; then 7685b85037dbSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 7686b85037dbSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7687b85037dbSmrg set dummy $deplib_matches; shift 7688b85037dbSmrg deplib_match=$1 7689b85037dbSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7690302b15bdSmrg func_append newdeplibs " $i" 7691b85037dbSmrg else 7692b85037dbSmrg droppeddeps=yes 7693b85037dbSmrg echo 7694b85037dbSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7695b85037dbSmrg echo "*** I have the capability to make that library automatically link in when" 7696b85037dbSmrg echo "*** you link to this library. But I can only do this if you have a" 7697b85037dbSmrg echo "*** shared version of the library, which I believe you do not have" 7698b85037dbSmrg echo "*** because a test_compile did reveal that the linker did not use it for" 7699b85037dbSmrg echo "*** its dynamic dependency list that programs get resolved with at runtime." 7700b85037dbSmrg fi 7701b85037dbSmrg fi 7702b85037dbSmrg ;; 7703b85037dbSmrg *) 7704302b15bdSmrg func_append newdeplibs " $i" 7705b85037dbSmrg ;; 7706b85037dbSmrg esac 7707b85037dbSmrg done 7708b85037dbSmrg else 7709b85037dbSmrg # Error occurred in the first compile. Let's try to salvage 7710b85037dbSmrg # the situation: Compile a separate program for each library. 7711b85037dbSmrg for i in $deplibs; do 7712b85037dbSmrg case $i in 7713b85037dbSmrg -l*) 7714b85037dbSmrg func_stripname -l '' "$i" 7715b85037dbSmrg name=$func_stripname_result 7716b85037dbSmrg $opt_dry_run || $RM conftest 7717b85037dbSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 7718b85037dbSmrg ldd_output=`ldd conftest` 7719b85037dbSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7720b85037dbSmrg case " $predeps $postdeps " in 7721b85037dbSmrg *" $i "*) 7722302b15bdSmrg func_append newdeplibs " $i" 7723b85037dbSmrg i="" 7724b85037dbSmrg ;; 7725b85037dbSmrg esac 7726b85037dbSmrg fi 7727b85037dbSmrg if test -n "$i" ; then 7728b85037dbSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 7729b85037dbSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7730b85037dbSmrg set dummy $deplib_matches; shift 7731b85037dbSmrg deplib_match=$1 7732b85037dbSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7733302b15bdSmrg func_append newdeplibs " $i" 7734b85037dbSmrg else 7735b85037dbSmrg droppeddeps=yes 7736b85037dbSmrg echo 7737b85037dbSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7738b85037dbSmrg echo "*** I have the capability to make that library automatically link in when" 7739b85037dbSmrg echo "*** you link to this library. But I can only do this if you have a" 7740b85037dbSmrg echo "*** shared version of the library, which you do not appear to have" 7741b85037dbSmrg echo "*** because a test_compile did reveal that the linker did not use this one" 7742b85037dbSmrg echo "*** as a dynamic dependency that programs can get resolved with at runtime." 7743b85037dbSmrg fi 7744b85037dbSmrg fi 7745b85037dbSmrg else 7746b85037dbSmrg droppeddeps=yes 7747b85037dbSmrg echo 7748b85037dbSmrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 7749b85037dbSmrg echo "*** make it link in! You will probably need to install it or some" 7750b85037dbSmrg echo "*** library that it depends on before this library will be fully" 7751b85037dbSmrg echo "*** functional. Installing it before continuing would be even better." 7752b85037dbSmrg fi 7753b85037dbSmrg ;; 7754b85037dbSmrg *) 7755302b15bdSmrg func_append newdeplibs " $i" 7756b85037dbSmrg ;; 7757b85037dbSmrg esac 7758b85037dbSmrg done 7759b85037dbSmrg fi 7760b85037dbSmrg ;; 7761b85037dbSmrg file_magic*) 7762b85037dbSmrg set dummy $deplibs_check_method; shift 7763b85037dbSmrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7764b85037dbSmrg for a_deplib in $deplibs; do 7765b85037dbSmrg case $a_deplib in 7766b85037dbSmrg -l*) 7767b85037dbSmrg func_stripname -l '' "$a_deplib" 7768b85037dbSmrg name=$func_stripname_result 7769b85037dbSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7770b85037dbSmrg case " $predeps $postdeps " in 7771b85037dbSmrg *" $a_deplib "*) 7772302b15bdSmrg func_append newdeplibs " $a_deplib" 7773b85037dbSmrg a_deplib="" 7774b85037dbSmrg ;; 7775b85037dbSmrg esac 7776b85037dbSmrg fi 7777b85037dbSmrg if test -n "$a_deplib" ; then 7778b85037dbSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 7779302b15bdSmrg if test -n "$file_magic_glob"; then 7780302b15bdSmrg libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 7781302b15bdSmrg else 7782302b15bdSmrg libnameglob=$libname 7783302b15bdSmrg fi 7784302b15bdSmrg test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` 7785b85037dbSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7786302b15bdSmrg if test "$want_nocaseglob" = yes; then 7787302b15bdSmrg shopt -s nocaseglob 7788302b15bdSmrg potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7789302b15bdSmrg $nocaseglob 7790302b15bdSmrg else 7791302b15bdSmrg potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7792302b15bdSmrg fi 7793b85037dbSmrg for potent_lib in $potential_libs; do 7794b85037dbSmrg # Follow soft links. 7795b85037dbSmrg if ls -lLd "$potent_lib" 2>/dev/null | 7796b85037dbSmrg $GREP " -> " >/dev/null; then 7797b85037dbSmrg continue 7798b85037dbSmrg fi 7799b85037dbSmrg # The statement above tries to avoid entering an 7800b85037dbSmrg # endless loop below, in case of cyclic links. 7801b85037dbSmrg # We might still enter an endless loop, since a link 7802b85037dbSmrg # loop can be closed while we follow links, 7803b85037dbSmrg # but so what? 7804b85037dbSmrg potlib="$potent_lib" 7805b85037dbSmrg while test -h "$potlib" 2>/dev/null; do 7806b85037dbSmrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 7807b85037dbSmrg case $potliblink in 7808b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 7809b85037dbSmrg *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 7810b85037dbSmrg esac 7811b85037dbSmrg done 7812b85037dbSmrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 7813b85037dbSmrg $SED -e 10q | 7814b85037dbSmrg $EGREP "$file_magic_regex" > /dev/null; then 7815302b15bdSmrg func_append newdeplibs " $a_deplib" 7816b85037dbSmrg a_deplib="" 7817b85037dbSmrg break 2 7818b85037dbSmrg fi 7819b85037dbSmrg done 7820b85037dbSmrg done 7821b85037dbSmrg fi 7822b85037dbSmrg if test -n "$a_deplib" ; then 7823b85037dbSmrg droppeddeps=yes 7824b85037dbSmrg echo 7825b85037dbSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7826b85037dbSmrg echo "*** I have the capability to make that library automatically link in when" 7827b85037dbSmrg echo "*** you link to this library. But I can only do this if you have a" 7828b85037dbSmrg echo "*** shared version of the library, which you do not appear to have" 7829b85037dbSmrg echo "*** because I did check the linker path looking for a file starting" 7830b85037dbSmrg if test -z "$potlib" ; then 7831b85037dbSmrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 7832b85037dbSmrg else 7833b85037dbSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 7834b85037dbSmrg $ECHO "*** using a file magic. Last file checked: $potlib" 7835b85037dbSmrg fi 7836b85037dbSmrg fi 7837b85037dbSmrg ;; 7838b85037dbSmrg *) 7839b85037dbSmrg # Add a -L argument. 7840302b15bdSmrg func_append newdeplibs " $a_deplib" 7841b85037dbSmrg ;; 7842b85037dbSmrg esac 7843b85037dbSmrg done # Gone through all deplibs. 7844b85037dbSmrg ;; 7845b85037dbSmrg match_pattern*) 7846b85037dbSmrg set dummy $deplibs_check_method; shift 7847b85037dbSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7848b85037dbSmrg for a_deplib in $deplibs; do 7849b85037dbSmrg case $a_deplib in 7850b85037dbSmrg -l*) 7851b85037dbSmrg func_stripname -l '' "$a_deplib" 7852b85037dbSmrg name=$func_stripname_result 7853b85037dbSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7854b85037dbSmrg case " $predeps $postdeps " in 7855b85037dbSmrg *" $a_deplib "*) 7856302b15bdSmrg func_append newdeplibs " $a_deplib" 7857b85037dbSmrg a_deplib="" 7858b85037dbSmrg ;; 7859b85037dbSmrg esac 7860b85037dbSmrg fi 7861b85037dbSmrg if test -n "$a_deplib" ; then 7862b85037dbSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 7863b85037dbSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7864b85037dbSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 7865b85037dbSmrg for potent_lib in $potential_libs; do 7866b85037dbSmrg potlib="$potent_lib" # see symlink-check above in file_magic test 7867b85037dbSmrg if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 7868b85037dbSmrg $EGREP "$match_pattern_regex" > /dev/null; then 7869302b15bdSmrg func_append newdeplibs " $a_deplib" 7870b85037dbSmrg a_deplib="" 7871b85037dbSmrg break 2 7872b85037dbSmrg fi 7873b85037dbSmrg done 7874b85037dbSmrg done 7875b85037dbSmrg fi 7876b85037dbSmrg if test -n "$a_deplib" ; then 7877b85037dbSmrg droppeddeps=yes 7878b85037dbSmrg echo 7879b85037dbSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7880b85037dbSmrg echo "*** I have the capability to make that library automatically link in when" 7881b85037dbSmrg echo "*** you link to this library. But I can only do this if you have a" 7882b85037dbSmrg echo "*** shared version of the library, which you do not appear to have" 7883b85037dbSmrg echo "*** because I did check the linker path looking for a file starting" 7884b85037dbSmrg if test -z "$potlib" ; then 7885b85037dbSmrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 7886b85037dbSmrg else 7887b85037dbSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 7888b85037dbSmrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 7889b85037dbSmrg fi 7890b85037dbSmrg fi 7891b85037dbSmrg ;; 7892b85037dbSmrg *) 7893b85037dbSmrg # Add a -L argument. 7894302b15bdSmrg func_append newdeplibs " $a_deplib" 7895b85037dbSmrg ;; 7896b85037dbSmrg esac 7897b85037dbSmrg done # Gone through all deplibs. 7898b85037dbSmrg ;; 7899b85037dbSmrg none | unknown | *) 7900b85037dbSmrg newdeplibs="" 7901b85037dbSmrg tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 7902b85037dbSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7903b85037dbSmrg for i in $predeps $postdeps ; do 7904b85037dbSmrg # can't use Xsed below, because $i might contain '/' 7905b85037dbSmrg tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 7906b85037dbSmrg done 7907b85037dbSmrg fi 7908b85037dbSmrg case $tmp_deplibs in 7909b85037dbSmrg *[!\ \ ]*) 7910b85037dbSmrg echo 7911b85037dbSmrg if test "X$deplibs_check_method" = "Xnone"; then 7912b85037dbSmrg echo "*** Warning: inter-library dependencies are not supported in this platform." 7913b85037dbSmrg else 7914b85037dbSmrg echo "*** Warning: inter-library dependencies are not known to be supported." 7915b85037dbSmrg fi 7916b85037dbSmrg echo "*** All declared inter-library dependencies are being dropped." 7917b85037dbSmrg droppeddeps=yes 7918b85037dbSmrg ;; 7919b85037dbSmrg esac 7920b85037dbSmrg ;; 7921b85037dbSmrg esac 7922b85037dbSmrg versuffix=$versuffix_save 7923b85037dbSmrg major=$major_save 7924b85037dbSmrg release=$release_save 7925b85037dbSmrg libname=$libname_save 7926b85037dbSmrg name=$name_save 7927b85037dbSmrg 7928b85037dbSmrg case $host in 7929b85037dbSmrg *-*-rhapsody* | *-*-darwin1.[012]) 7930b85037dbSmrg # On Rhapsody replace the C library with the System framework 7931b85037dbSmrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 7932b85037dbSmrg ;; 7933b85037dbSmrg esac 7934b85037dbSmrg 7935b85037dbSmrg if test "$droppeddeps" = yes; then 7936b85037dbSmrg if test "$module" = yes; then 7937b85037dbSmrg echo 7938b85037dbSmrg echo "*** Warning: libtool could not satisfy all declared inter-library" 7939b85037dbSmrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 7940b85037dbSmrg echo "*** a static module, that should work as long as the dlopening" 7941b85037dbSmrg echo "*** application is linked with the -dlopen flag." 7942b85037dbSmrg if test -z "$global_symbol_pipe"; then 7943b85037dbSmrg echo 7944b85037dbSmrg echo "*** However, this would only work if libtool was able to extract symbol" 7945b85037dbSmrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 7946b85037dbSmrg echo "*** not find such a program. So, this module is probably useless." 7947b85037dbSmrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 7948b85037dbSmrg fi 7949b85037dbSmrg if test "$build_old_libs" = no; then 7950b85037dbSmrg oldlibs="$output_objdir/$libname.$libext" 7951b85037dbSmrg build_libtool_libs=module 7952b85037dbSmrg build_old_libs=yes 7953b85037dbSmrg else 7954b85037dbSmrg build_libtool_libs=no 7955b85037dbSmrg fi 7956b85037dbSmrg else 7957b85037dbSmrg echo "*** The inter-library dependencies that have been dropped here will be" 7958b85037dbSmrg echo "*** automatically added whenever a program is linked with this library" 7959b85037dbSmrg echo "*** or is declared to -dlopen it." 7960b85037dbSmrg 7961b85037dbSmrg if test "$allow_undefined" = no; then 7962b85037dbSmrg echo 7963b85037dbSmrg echo "*** Since this library must not contain undefined symbols," 7964b85037dbSmrg echo "*** because either the platform does not support them or" 7965b85037dbSmrg echo "*** it was explicitly requested with -no-undefined," 7966b85037dbSmrg echo "*** libtool will only create a static version of it." 7967b85037dbSmrg if test "$build_old_libs" = no; then 7968b85037dbSmrg oldlibs="$output_objdir/$libname.$libext" 7969b85037dbSmrg build_libtool_libs=module 7970b85037dbSmrg build_old_libs=yes 7971b85037dbSmrg else 7972b85037dbSmrg build_libtool_libs=no 7973b85037dbSmrg fi 7974b85037dbSmrg fi 7975b85037dbSmrg fi 7976b85037dbSmrg fi 7977b85037dbSmrg # Done checking deplibs! 7978b85037dbSmrg deplibs=$newdeplibs 7979b85037dbSmrg fi 7980b85037dbSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 7981b85037dbSmrg case $host in 7982b85037dbSmrg *-*-darwin*) 7983b85037dbSmrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7984b85037dbSmrg new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7985b85037dbSmrg deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7986b85037dbSmrg ;; 7987b85037dbSmrg esac 7988b85037dbSmrg 7989b85037dbSmrg # move library search paths that coincide with paths to not yet 7990b85037dbSmrg # installed libraries to the beginning of the library search list 7991b85037dbSmrg new_libs= 7992b85037dbSmrg for path in $notinst_path; do 7993b85037dbSmrg case " $new_libs " in 7994b85037dbSmrg *" -L$path/$objdir "*) ;; 7995b85037dbSmrg *) 7996b85037dbSmrg case " $deplibs " in 7997b85037dbSmrg *" -L$path/$objdir "*) 7998302b15bdSmrg func_append new_libs " -L$path/$objdir" ;; 7999b85037dbSmrg esac 8000b85037dbSmrg ;; 8001b85037dbSmrg esac 8002b85037dbSmrg done 8003b85037dbSmrg for deplib in $deplibs; do 8004b85037dbSmrg case $deplib in 8005b85037dbSmrg -L*) 8006b85037dbSmrg case " $new_libs " in 8007b85037dbSmrg *" $deplib "*) ;; 8008302b15bdSmrg *) func_append new_libs " $deplib" ;; 8009b85037dbSmrg esac 8010b85037dbSmrg ;; 8011302b15bdSmrg *) func_append new_libs " $deplib" ;; 8012b85037dbSmrg esac 8013b85037dbSmrg done 8014b85037dbSmrg deplibs="$new_libs" 8015b85037dbSmrg 8016b85037dbSmrg # All the library-specific variables (install_libdir is set above). 8017b85037dbSmrg library_names= 8018b85037dbSmrg old_library= 8019b85037dbSmrg dlname= 8020b85037dbSmrg 8021b85037dbSmrg # Test again, we may have decided not to build it any more 8022b85037dbSmrg if test "$build_libtool_libs" = yes; then 8023b85037dbSmrg if test "$hardcode_into_libs" = yes; then 8024b85037dbSmrg # Hardcode the library paths 8025b85037dbSmrg hardcode_libdirs= 8026b85037dbSmrg dep_rpath= 8027b85037dbSmrg rpath="$finalize_rpath" 8028302b15bdSmrg test "$opt_mode" != relink && rpath="$compile_rpath$rpath" 8029b85037dbSmrg for libdir in $rpath; do 8030b85037dbSmrg if test -n "$hardcode_libdir_flag_spec"; then 8031b85037dbSmrg if test -n "$hardcode_libdir_separator"; then 8032302b15bdSmrg func_replace_sysroot "$libdir" 8033302b15bdSmrg libdir=$func_replace_sysroot_result 8034b85037dbSmrg if test -z "$hardcode_libdirs"; then 8035b85037dbSmrg hardcode_libdirs="$libdir" 8036b85037dbSmrg else 8037b85037dbSmrg # Just accumulate the unique libdirs. 8038b85037dbSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8039b85037dbSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8040b85037dbSmrg ;; 8041b85037dbSmrg *) 8042302b15bdSmrg func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8043b85037dbSmrg ;; 8044b85037dbSmrg esac 8045b85037dbSmrg fi 8046b85037dbSmrg else 8047b85037dbSmrg eval flag=\"$hardcode_libdir_flag_spec\" 8048302b15bdSmrg func_append dep_rpath " $flag" 8049b85037dbSmrg fi 8050b85037dbSmrg elif test -n "$runpath_var"; then 8051b85037dbSmrg case "$perm_rpath " in 8052b85037dbSmrg *" $libdir "*) ;; 8053302b15bdSmrg *) func_apped perm_rpath " $libdir" ;; 8054b85037dbSmrg esac 8055b85037dbSmrg fi 8056b85037dbSmrg done 8057b85037dbSmrg # Substitute the hardcoded libdirs into the rpath. 8058b85037dbSmrg if test -n "$hardcode_libdir_separator" && 8059b85037dbSmrg test -n "$hardcode_libdirs"; then 8060b85037dbSmrg libdir="$hardcode_libdirs" 8061b85037dbSmrg if test -n "$hardcode_libdir_flag_spec_ld"; then 8062b85037dbSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 8063b85037dbSmrg else 8064b85037dbSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 8065b85037dbSmrg fi 8066b85037dbSmrg fi 8067b85037dbSmrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 8068b85037dbSmrg # We should set the runpath_var. 8069b85037dbSmrg rpath= 8070b85037dbSmrg for dir in $perm_rpath; do 8071302b15bdSmrg func_append rpath "$dir:" 8072b85037dbSmrg done 8073b85037dbSmrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 8074b85037dbSmrg fi 8075b85037dbSmrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 8076b85037dbSmrg fi 8077b85037dbSmrg 8078b85037dbSmrg shlibpath="$finalize_shlibpath" 8079302b15bdSmrg test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 8080b85037dbSmrg if test -n "$shlibpath"; then 8081b85037dbSmrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 8082b85037dbSmrg fi 8083b85037dbSmrg 8084b85037dbSmrg # Get the real and link names of the library. 8085b85037dbSmrg eval shared_ext=\"$shrext_cmds\" 8086b85037dbSmrg eval library_names=\"$library_names_spec\" 8087b85037dbSmrg set dummy $library_names 8088b85037dbSmrg shift 8089b85037dbSmrg realname="$1" 8090b85037dbSmrg shift 8091b85037dbSmrg 8092b85037dbSmrg if test -n "$soname_spec"; then 8093b85037dbSmrg eval soname=\"$soname_spec\" 8094b85037dbSmrg else 8095b85037dbSmrg soname="$realname" 8096b85037dbSmrg fi 8097b85037dbSmrg if test -z "$dlname"; then 8098b85037dbSmrg dlname=$soname 8099b85037dbSmrg fi 8100b85037dbSmrg 8101b85037dbSmrg lib="$output_objdir/$realname" 8102b85037dbSmrg linknames= 8103b85037dbSmrg for link 8104b85037dbSmrg do 8105302b15bdSmrg func_append linknames " $link" 8106b85037dbSmrg done 8107b85037dbSmrg 8108b85037dbSmrg # Use standard objects if they are pic 8109b85037dbSmrg test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 8110b85037dbSmrg test "X$libobjs" = "X " && libobjs= 8111b85037dbSmrg 8112b85037dbSmrg delfiles= 8113b85037dbSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 8114b85037dbSmrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 8115b85037dbSmrg export_symbols="$output_objdir/$libname.uexp" 8116302b15bdSmrg func_append delfiles " $export_symbols" 8117b85037dbSmrg fi 8118b85037dbSmrg 8119b85037dbSmrg orig_export_symbols= 8120b85037dbSmrg case $host_os in 8121b85037dbSmrg cygwin* | mingw* | cegcc*) 8122b85037dbSmrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 8123b85037dbSmrg # exporting using user supplied symfile 8124b85037dbSmrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 8125b85037dbSmrg # and it's NOT already a .def file. Must figure out 8126b85037dbSmrg # which of the given symbols are data symbols and tag 8127b85037dbSmrg # them as such. So, trigger use of export_symbols_cmds. 8128b85037dbSmrg # export_symbols gets reassigned inside the "prepare 8129b85037dbSmrg # the list of exported symbols" if statement, so the 8130b85037dbSmrg # include_expsyms logic still works. 8131b85037dbSmrg orig_export_symbols="$export_symbols" 8132b85037dbSmrg export_symbols= 8133b85037dbSmrg always_export_symbols=yes 8134b85037dbSmrg fi 8135b85037dbSmrg fi 8136b85037dbSmrg ;; 8137b85037dbSmrg esac 8138b85037dbSmrg 8139b85037dbSmrg # Prepare the list of exported symbols 8140b85037dbSmrg if test -z "$export_symbols"; then 8141b85037dbSmrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 8142b85037dbSmrg func_verbose "generating symbol list for \`$libname.la'" 8143b85037dbSmrg export_symbols="$output_objdir/$libname.exp" 8144b85037dbSmrg $opt_dry_run || $RM $export_symbols 8145b85037dbSmrg cmds=$export_symbols_cmds 8146b85037dbSmrg save_ifs="$IFS"; IFS='~' 8147302b15bdSmrg for cmd1 in $cmds; do 8148b85037dbSmrg IFS="$save_ifs" 8149302b15bdSmrg # Take the normal branch if the nm_file_list_spec branch 8150302b15bdSmrg # doesn't work or if tool conversion is not needed. 8151302b15bdSmrg case $nm_file_list_spec~$to_tool_file_cmd in 8152302b15bdSmrg *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 8153302b15bdSmrg try_normal_branch=yes 8154302b15bdSmrg eval cmd=\"$cmd1\" 8155302b15bdSmrg func_len " $cmd" 8156302b15bdSmrg len=$func_len_result 8157302b15bdSmrg ;; 8158302b15bdSmrg *) 8159302b15bdSmrg try_normal_branch=no 8160302b15bdSmrg ;; 8161302b15bdSmrg esac 8162302b15bdSmrg if test "$try_normal_branch" = yes \ 8163302b15bdSmrg && { test "$len" -lt "$max_cmd_len" \ 8164302b15bdSmrg || test "$max_cmd_len" -le -1; } 8165302b15bdSmrg then 8166302b15bdSmrg func_show_eval "$cmd" 'exit $?' 8167302b15bdSmrg skipped_export=false 8168302b15bdSmrg elif test -n "$nm_file_list_spec"; then 8169302b15bdSmrg func_basename "$output" 8170302b15bdSmrg output_la=$func_basename_result 8171302b15bdSmrg save_libobjs=$libobjs 8172302b15bdSmrg save_output=$output 8173302b15bdSmrg output=${output_objdir}/${output_la}.nm 8174302b15bdSmrg func_to_tool_file "$output" 8175302b15bdSmrg libobjs=$nm_file_list_spec$func_to_tool_file_result 8176302b15bdSmrg func_append delfiles " $output" 8177302b15bdSmrg func_verbose "creating $NM input file list: $output" 8178302b15bdSmrg for obj in $save_libobjs; do 8179302b15bdSmrg func_to_tool_file "$obj" 8180302b15bdSmrg $ECHO "$func_to_tool_file_result" 8181302b15bdSmrg done > "$output" 8182302b15bdSmrg eval cmd=\"$cmd1\" 8183b85037dbSmrg func_show_eval "$cmd" 'exit $?' 8184302b15bdSmrg output=$save_output 8185302b15bdSmrg libobjs=$save_libobjs 8186b85037dbSmrg skipped_export=false 8187b85037dbSmrg else 8188b85037dbSmrg # The command line is too long to execute in one step. 8189b85037dbSmrg func_verbose "using reloadable object file for export list..." 8190b85037dbSmrg skipped_export=: 8191b85037dbSmrg # Break out early, otherwise skipped_export may be 8192b85037dbSmrg # set to false by a later but shorter cmd. 8193b85037dbSmrg break 8194b85037dbSmrg fi 8195b85037dbSmrg done 8196b85037dbSmrg IFS="$save_ifs" 8197b85037dbSmrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 8198b85037dbSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8199b85037dbSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8200b85037dbSmrg fi 8201b85037dbSmrg fi 8202b85037dbSmrg fi 8203b85037dbSmrg 8204b85037dbSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 8205b85037dbSmrg tmp_export_symbols="$export_symbols" 8206b85037dbSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8207b85037dbSmrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8208b85037dbSmrg fi 8209b85037dbSmrg 8210b85037dbSmrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 8211b85037dbSmrg # The given exports_symbols file has to be filtered, so filter it. 8212b85037dbSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8213b85037dbSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 8214b85037dbSmrg # 's' commands which not all seds can handle. GNU sed should be fine 8215b85037dbSmrg # though. Also, the filter scales superlinearly with the number of 8216b85037dbSmrg # global variables. join(1) would be nice here, but unfortunately 8217b85037dbSmrg # isn't a blessed tool. 8218b85037dbSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8219302b15bdSmrg func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8220b85037dbSmrg export_symbols=$output_objdir/$libname.def 8221b85037dbSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8222b85037dbSmrg fi 8223b85037dbSmrg 8224b85037dbSmrg tmp_deplibs= 8225b85037dbSmrg for test_deplib in $deplibs; do 8226b85037dbSmrg case " $convenience " in 8227b85037dbSmrg *" $test_deplib "*) ;; 8228b85037dbSmrg *) 8229302b15bdSmrg func_append tmp_deplibs " $test_deplib" 8230b85037dbSmrg ;; 8231b85037dbSmrg esac 8232b85037dbSmrg done 8233b85037dbSmrg deplibs="$tmp_deplibs" 8234b85037dbSmrg 8235b85037dbSmrg if test -n "$convenience"; then 8236b85037dbSmrg if test -n "$whole_archive_flag_spec" && 8237b85037dbSmrg test "$compiler_needs_object" = yes && 8238b85037dbSmrg test -z "$libobjs"; then 8239b85037dbSmrg # extract the archives, so we have objects to list. 8240b85037dbSmrg # TODO: could optimize this to just extract one archive. 8241b85037dbSmrg whole_archive_flag_spec= 8242b85037dbSmrg fi 8243b85037dbSmrg if test -n "$whole_archive_flag_spec"; then 8244b85037dbSmrg save_libobjs=$libobjs 8245b85037dbSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8246b85037dbSmrg test "X$libobjs" = "X " && libobjs= 8247b85037dbSmrg else 8248b85037dbSmrg gentop="$output_objdir/${outputname}x" 8249302b15bdSmrg func_append generated " $gentop" 8250b85037dbSmrg 8251b85037dbSmrg func_extract_archives $gentop $convenience 8252302b15bdSmrg func_append libobjs " $func_extract_archives_result" 8253b85037dbSmrg test "X$libobjs" = "X " && libobjs= 8254b85037dbSmrg fi 8255b85037dbSmrg fi 8256b85037dbSmrg 8257b85037dbSmrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 8258b85037dbSmrg eval flag=\"$thread_safe_flag_spec\" 8259302b15bdSmrg func_append linker_flags " $flag" 8260b85037dbSmrg fi 8261b85037dbSmrg 8262b85037dbSmrg # Make a backup of the uninstalled library when relinking 8263302b15bdSmrg if test "$opt_mode" = relink; then 8264b85037dbSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 8265b85037dbSmrg fi 8266b85037dbSmrg 8267b85037dbSmrg # Do each of the archive commands. 8268b85037dbSmrg if test "$module" = yes && test -n "$module_cmds" ; then 8269b85037dbSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8270b85037dbSmrg eval test_cmds=\"$module_expsym_cmds\" 8271b85037dbSmrg cmds=$module_expsym_cmds 8272b85037dbSmrg else 8273b85037dbSmrg eval test_cmds=\"$module_cmds\" 8274b85037dbSmrg cmds=$module_cmds 8275b85037dbSmrg fi 8276b85037dbSmrg else 8277b85037dbSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8278b85037dbSmrg eval test_cmds=\"$archive_expsym_cmds\" 8279b85037dbSmrg cmds=$archive_expsym_cmds 8280b85037dbSmrg else 8281b85037dbSmrg eval test_cmds=\"$archive_cmds\" 8282b85037dbSmrg cmds=$archive_cmds 8283b85037dbSmrg fi 8284b85037dbSmrg fi 8285b85037dbSmrg 8286b85037dbSmrg if test "X$skipped_export" != "X:" && 8287b85037dbSmrg func_len " $test_cmds" && 8288b85037dbSmrg len=$func_len_result && 8289b85037dbSmrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 8290b85037dbSmrg : 8291b85037dbSmrg else 8292b85037dbSmrg # The command line is too long to link in one step, link piecewise 8293b85037dbSmrg # or, if using GNU ld and skipped_export is not :, use a linker 8294b85037dbSmrg # script. 8295b85037dbSmrg 8296b85037dbSmrg # Save the value of $output and $libobjs because we want to 8297b85037dbSmrg # use them later. If we have whole_archive_flag_spec, we 8298b85037dbSmrg # want to use save_libobjs as it was before 8299b85037dbSmrg # whole_archive_flag_spec was expanded, because we can't 8300b85037dbSmrg # assume the linker understands whole_archive_flag_spec. 8301b85037dbSmrg # This may have to be revisited, in case too many 8302b85037dbSmrg # convenience libraries get linked in and end up exceeding 8303b85037dbSmrg # the spec. 8304b85037dbSmrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 8305b85037dbSmrg save_libobjs=$libobjs 8306b85037dbSmrg fi 8307b85037dbSmrg save_output=$output 8308b85037dbSmrg func_basename "$output" 8309b85037dbSmrg output_la=$func_basename_result 8310b85037dbSmrg 8311b85037dbSmrg # Clear the reloadable object creation command queue and 8312b85037dbSmrg # initialize k to one. 8313b85037dbSmrg test_cmds= 8314b85037dbSmrg concat_cmds= 8315b85037dbSmrg objlist= 8316b85037dbSmrg last_robj= 8317b85037dbSmrg k=1 8318b85037dbSmrg 8319b85037dbSmrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 8320b85037dbSmrg output=${output_objdir}/${output_la}.lnkscript 8321b85037dbSmrg func_verbose "creating GNU ld script: $output" 8322b85037dbSmrg echo 'INPUT (' > $output 8323b85037dbSmrg for obj in $save_libobjs 8324b85037dbSmrg do 8325302b15bdSmrg func_to_tool_file "$obj" 8326302b15bdSmrg $ECHO "$func_to_tool_file_result" >> $output 8327b85037dbSmrg done 8328b85037dbSmrg echo ')' >> $output 8329302b15bdSmrg func_append delfiles " $output" 8330302b15bdSmrg func_to_tool_file "$output" 8331302b15bdSmrg output=$func_to_tool_file_result 8332b85037dbSmrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 8333b85037dbSmrg output=${output_objdir}/${output_la}.lnk 8334b85037dbSmrg func_verbose "creating linker input file list: $output" 8335b85037dbSmrg : > $output 8336b85037dbSmrg set x $save_libobjs 8337b85037dbSmrg shift 8338b85037dbSmrg firstobj= 8339b85037dbSmrg if test "$compiler_needs_object" = yes; then 8340b85037dbSmrg firstobj="$1 " 8341b85037dbSmrg shift 8342b85037dbSmrg fi 8343b85037dbSmrg for obj 8344b85037dbSmrg do 8345302b15bdSmrg func_to_tool_file "$obj" 8346302b15bdSmrg $ECHO "$func_to_tool_file_result" >> $output 8347b85037dbSmrg done 8348302b15bdSmrg func_append delfiles " $output" 8349302b15bdSmrg func_to_tool_file "$output" 8350302b15bdSmrg output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 8351b85037dbSmrg else 8352b85037dbSmrg if test -n "$save_libobjs"; then 8353b85037dbSmrg func_verbose "creating reloadable object files..." 8354b85037dbSmrg output=$output_objdir/$output_la-${k}.$objext 8355b85037dbSmrg eval test_cmds=\"$reload_cmds\" 8356b85037dbSmrg func_len " $test_cmds" 8357b85037dbSmrg len0=$func_len_result 8358b85037dbSmrg len=$len0 8359b85037dbSmrg 8360b85037dbSmrg # Loop over the list of objects to be linked. 8361b85037dbSmrg for obj in $save_libobjs 8362b85037dbSmrg do 8363b85037dbSmrg func_len " $obj" 8364b85037dbSmrg func_arith $len + $func_len_result 8365b85037dbSmrg len=$func_arith_result 8366b85037dbSmrg if test "X$objlist" = X || 8367b85037dbSmrg test "$len" -lt "$max_cmd_len"; then 8368b85037dbSmrg func_append objlist " $obj" 8369b85037dbSmrg else 8370b85037dbSmrg # The command $test_cmds is almost too long, add a 8371b85037dbSmrg # command to the queue. 8372b85037dbSmrg if test "$k" -eq 1 ; then 8373b85037dbSmrg # The first file doesn't have a previous command to add. 8374b85037dbSmrg reload_objs=$objlist 8375b85037dbSmrg eval concat_cmds=\"$reload_cmds\" 8376b85037dbSmrg else 8377b85037dbSmrg # All subsequent reloadable object files will link in 8378b85037dbSmrg # the last one created. 8379b85037dbSmrg reload_objs="$objlist $last_robj" 8380b85037dbSmrg eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 8381b85037dbSmrg fi 8382b85037dbSmrg last_robj=$output_objdir/$output_la-${k}.$objext 8383b85037dbSmrg func_arith $k + 1 8384b85037dbSmrg k=$func_arith_result 8385b85037dbSmrg output=$output_objdir/$output_la-${k}.$objext 8386b85037dbSmrg objlist=" $obj" 8387b85037dbSmrg func_len " $last_robj" 8388b85037dbSmrg func_arith $len0 + $func_len_result 8389b85037dbSmrg len=$func_arith_result 8390b85037dbSmrg fi 8391b85037dbSmrg done 8392b85037dbSmrg # Handle the remaining objects by creating one last 8393b85037dbSmrg # reloadable object file. All subsequent reloadable object 8394b85037dbSmrg # files will link in the last one created. 8395b85037dbSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8396b85037dbSmrg reload_objs="$objlist $last_robj" 8397b85037dbSmrg eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 8398b85037dbSmrg if test -n "$last_robj"; then 8399b85037dbSmrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 8400b85037dbSmrg fi 8401302b15bdSmrg func_append delfiles " $output" 8402b85037dbSmrg 8403b85037dbSmrg else 8404b85037dbSmrg output= 8405b85037dbSmrg fi 8406b85037dbSmrg 8407b85037dbSmrg if ${skipped_export-false}; then 8408b85037dbSmrg func_verbose "generating symbol list for \`$libname.la'" 8409b85037dbSmrg export_symbols="$output_objdir/$libname.exp" 8410b85037dbSmrg $opt_dry_run || $RM $export_symbols 8411b85037dbSmrg libobjs=$output 8412b85037dbSmrg # Append the command to create the export file. 8413b85037dbSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8414b85037dbSmrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 8415b85037dbSmrg if test -n "$last_robj"; then 8416b85037dbSmrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 8417b85037dbSmrg fi 8418b85037dbSmrg fi 8419b85037dbSmrg 8420b85037dbSmrg test -n "$save_libobjs" && 8421b85037dbSmrg func_verbose "creating a temporary reloadable object file: $output" 8422b85037dbSmrg 8423b85037dbSmrg # Loop through the commands generated above and execute them. 8424b85037dbSmrg save_ifs="$IFS"; IFS='~' 8425b85037dbSmrg for cmd in $concat_cmds; do 8426b85037dbSmrg IFS="$save_ifs" 8427b85037dbSmrg $opt_silent || { 8428b85037dbSmrg func_quote_for_expand "$cmd" 8429b85037dbSmrg eval "func_echo $func_quote_for_expand_result" 8430b85037dbSmrg } 8431b85037dbSmrg $opt_dry_run || eval "$cmd" || { 8432b85037dbSmrg lt_exit=$? 8433b85037dbSmrg 8434b85037dbSmrg # Restore the uninstalled library and exit 8435302b15bdSmrg if test "$opt_mode" = relink; then 8436b85037dbSmrg ( cd "$output_objdir" && \ 8437b85037dbSmrg $RM "${realname}T" && \ 8438b85037dbSmrg $MV "${realname}U" "$realname" ) 8439b85037dbSmrg fi 8440b85037dbSmrg 8441b85037dbSmrg exit $lt_exit 8442b85037dbSmrg } 8443b85037dbSmrg done 8444b85037dbSmrg IFS="$save_ifs" 8445b85037dbSmrg 8446b85037dbSmrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 8447b85037dbSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8448b85037dbSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8449b85037dbSmrg fi 8450b85037dbSmrg fi 8451b85037dbSmrg 8452b85037dbSmrg if ${skipped_export-false}; then 8453b85037dbSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 8454b85037dbSmrg tmp_export_symbols="$export_symbols" 8455b85037dbSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8456b85037dbSmrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8457b85037dbSmrg fi 8458b85037dbSmrg 8459b85037dbSmrg if test -n "$orig_export_symbols"; then 8460b85037dbSmrg # The given exports_symbols file has to be filtered, so filter it. 8461b85037dbSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8462b85037dbSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 8463b85037dbSmrg # 's' commands which not all seds can handle. GNU sed should be fine 8464b85037dbSmrg # though. Also, the filter scales superlinearly with the number of 8465b85037dbSmrg # global variables. join(1) would be nice here, but unfortunately 8466b85037dbSmrg # isn't a blessed tool. 8467b85037dbSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8468302b15bdSmrg func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8469b85037dbSmrg export_symbols=$output_objdir/$libname.def 8470b85037dbSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8471b85037dbSmrg fi 8472b85037dbSmrg fi 8473b85037dbSmrg 8474b85037dbSmrg libobjs=$output 8475b85037dbSmrg # Restore the value of output. 8476b85037dbSmrg output=$save_output 8477b85037dbSmrg 8478b85037dbSmrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 8479b85037dbSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8480b85037dbSmrg test "X$libobjs" = "X " && libobjs= 8481b85037dbSmrg fi 8482b85037dbSmrg # Expand the library linking commands again to reset the 8483b85037dbSmrg # value of $libobjs for piecewise linking. 8484b85037dbSmrg 8485b85037dbSmrg # Do each of the archive commands. 8486b85037dbSmrg if test "$module" = yes && test -n "$module_cmds" ; then 8487b85037dbSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8488b85037dbSmrg cmds=$module_expsym_cmds 8489b85037dbSmrg else 8490b85037dbSmrg cmds=$module_cmds 8491b85037dbSmrg fi 8492b85037dbSmrg else 8493b85037dbSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8494b85037dbSmrg cmds=$archive_expsym_cmds 8495b85037dbSmrg else 8496b85037dbSmrg cmds=$archive_cmds 8497b85037dbSmrg fi 8498b85037dbSmrg fi 8499b85037dbSmrg fi 8500b85037dbSmrg 8501b85037dbSmrg if test -n "$delfiles"; then 8502b85037dbSmrg # Append the command to remove temporary files to $cmds. 8503b85037dbSmrg eval cmds=\"\$cmds~\$RM $delfiles\" 8504b85037dbSmrg fi 8505b85037dbSmrg 8506b85037dbSmrg # Add any objects from preloaded convenience libraries 8507b85037dbSmrg if test -n "$dlprefiles"; then 8508b85037dbSmrg gentop="$output_objdir/${outputname}x" 8509302b15bdSmrg func_append generated " $gentop" 8510b85037dbSmrg 8511b85037dbSmrg func_extract_archives $gentop $dlprefiles 8512302b15bdSmrg func_append libobjs " $func_extract_archives_result" 8513b85037dbSmrg test "X$libobjs" = "X " && libobjs= 8514b85037dbSmrg fi 8515b85037dbSmrg 8516b85037dbSmrg save_ifs="$IFS"; IFS='~' 8517b85037dbSmrg for cmd in $cmds; do 8518b85037dbSmrg IFS="$save_ifs" 8519b85037dbSmrg eval cmd=\"$cmd\" 8520b85037dbSmrg $opt_silent || { 8521b85037dbSmrg func_quote_for_expand "$cmd" 8522b85037dbSmrg eval "func_echo $func_quote_for_expand_result" 8523b85037dbSmrg } 8524b85037dbSmrg $opt_dry_run || eval "$cmd" || { 8525b85037dbSmrg lt_exit=$? 8526b85037dbSmrg 8527b85037dbSmrg # Restore the uninstalled library and exit 8528302b15bdSmrg if test "$opt_mode" = relink; then 8529b85037dbSmrg ( cd "$output_objdir" && \ 8530b85037dbSmrg $RM "${realname}T" && \ 8531b85037dbSmrg $MV "${realname}U" "$realname" ) 8532b85037dbSmrg fi 8533b85037dbSmrg 8534b85037dbSmrg exit $lt_exit 8535b85037dbSmrg } 8536b85037dbSmrg done 8537b85037dbSmrg IFS="$save_ifs" 8538b85037dbSmrg 8539b85037dbSmrg # Restore the uninstalled library and exit 8540302b15bdSmrg if test "$opt_mode" = relink; then 8541b85037dbSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 8542b85037dbSmrg 8543b85037dbSmrg if test -n "$convenience"; then 8544b85037dbSmrg if test -z "$whole_archive_flag_spec"; then 8545b85037dbSmrg func_show_eval '${RM}r "$gentop"' 8546b85037dbSmrg fi 8547b85037dbSmrg fi 8548b85037dbSmrg 8549b85037dbSmrg exit $EXIT_SUCCESS 8550b85037dbSmrg fi 8551b85037dbSmrg 8552b85037dbSmrg # Create links to the real library. 8553b85037dbSmrg for linkname in $linknames; do 8554b85037dbSmrg if test "$realname" != "$linkname"; then 8555b85037dbSmrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 8556b85037dbSmrg fi 8557b85037dbSmrg done 8558b85037dbSmrg 8559b85037dbSmrg # If -module or -export-dynamic was specified, set the dlname. 8560b85037dbSmrg if test "$module" = yes || test "$export_dynamic" = yes; then 8561b85037dbSmrg # On all known operating systems, these are identical. 8562b85037dbSmrg dlname="$soname" 8563b85037dbSmrg fi 8564b85037dbSmrg fi 8565b85037dbSmrg ;; 8566b85037dbSmrg 8567b85037dbSmrg obj) 8568b85037dbSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 8569b85037dbSmrg func_warning "\`-dlopen' is ignored for objects" 8570b85037dbSmrg fi 8571b85037dbSmrg 8572b85037dbSmrg case " $deplibs" in 8573b85037dbSmrg *\ -l* | *\ -L*) 8574b85037dbSmrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 8575b85037dbSmrg esac 8576b85037dbSmrg 8577b85037dbSmrg test -n "$rpath" && \ 8578b85037dbSmrg func_warning "\`-rpath' is ignored for objects" 8579b85037dbSmrg 8580b85037dbSmrg test -n "$xrpath" && \ 8581b85037dbSmrg func_warning "\`-R' is ignored for objects" 8582b85037dbSmrg 8583b85037dbSmrg test -n "$vinfo" && \ 8584b85037dbSmrg func_warning "\`-version-info' is ignored for objects" 8585b85037dbSmrg 8586b85037dbSmrg test -n "$release" && \ 8587b85037dbSmrg func_warning "\`-release' is ignored for objects" 8588b85037dbSmrg 8589b85037dbSmrg case $output in 8590b85037dbSmrg *.lo) 8591b85037dbSmrg test -n "$objs$old_deplibs" && \ 8592b85037dbSmrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 8593b85037dbSmrg 8594b85037dbSmrg libobj=$output 8595b85037dbSmrg func_lo2o "$libobj" 8596b85037dbSmrg obj=$func_lo2o_result 8597b85037dbSmrg ;; 8598b85037dbSmrg *) 8599b85037dbSmrg libobj= 8600b85037dbSmrg obj="$output" 8601b85037dbSmrg ;; 8602b85037dbSmrg esac 8603b85037dbSmrg 8604b85037dbSmrg # Delete the old objects. 8605b85037dbSmrg $opt_dry_run || $RM $obj $libobj 8606b85037dbSmrg 8607b85037dbSmrg # Objects from convenience libraries. This assumes 8608b85037dbSmrg # single-version convenience libraries. Whenever we create 8609b85037dbSmrg # different ones for PIC/non-PIC, this we'll have to duplicate 8610b85037dbSmrg # the extraction. 8611b85037dbSmrg reload_conv_objs= 8612b85037dbSmrg gentop= 8613b85037dbSmrg # reload_cmds runs $LD directly, so let us get rid of 8614b85037dbSmrg # -Wl from whole_archive_flag_spec and hope we can get by with 8615b85037dbSmrg # turning comma into space.. 8616b85037dbSmrg wl= 8617b85037dbSmrg 8618b85037dbSmrg if test -n "$convenience"; then 8619b85037dbSmrg if test -n "$whole_archive_flag_spec"; then 8620b85037dbSmrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 8621b85037dbSmrg reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 8622b85037dbSmrg else 8623b85037dbSmrg gentop="$output_objdir/${obj}x" 8624302b15bdSmrg func_append generated " $gentop" 8625b85037dbSmrg 8626b85037dbSmrg func_extract_archives $gentop $convenience 8627b85037dbSmrg reload_conv_objs="$reload_objs $func_extract_archives_result" 8628b85037dbSmrg fi 8629b85037dbSmrg fi 8630b85037dbSmrg 8631302b15bdSmrg # If we're not building shared, we need to use non_pic_objs 8632302b15bdSmrg test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" 8633302b15bdSmrg 8634b85037dbSmrg # Create the old-style object. 8635b85037dbSmrg reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 8636b85037dbSmrg 8637b85037dbSmrg output="$obj" 8638b85037dbSmrg func_execute_cmds "$reload_cmds" 'exit $?' 8639b85037dbSmrg 8640b85037dbSmrg # Exit if we aren't doing a library object file. 8641b85037dbSmrg if test -z "$libobj"; then 8642b85037dbSmrg if test -n "$gentop"; then 8643b85037dbSmrg func_show_eval '${RM}r "$gentop"' 8644b85037dbSmrg fi 8645b85037dbSmrg 8646b85037dbSmrg exit $EXIT_SUCCESS 8647b85037dbSmrg fi 8648b85037dbSmrg 8649b85037dbSmrg if test "$build_libtool_libs" != yes; then 8650b85037dbSmrg if test -n "$gentop"; then 8651b85037dbSmrg func_show_eval '${RM}r "$gentop"' 8652b85037dbSmrg fi 8653b85037dbSmrg 8654b85037dbSmrg # Create an invalid libtool object if no PIC, so that we don't 8655b85037dbSmrg # accidentally link it into a program. 8656b85037dbSmrg # $show "echo timestamp > $libobj" 8657b85037dbSmrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 8658b85037dbSmrg exit $EXIT_SUCCESS 8659b85037dbSmrg fi 8660b85037dbSmrg 8661b85037dbSmrg if test -n "$pic_flag" || test "$pic_mode" != default; then 8662b85037dbSmrg # Only do commands if we really have different PIC objects. 8663b85037dbSmrg reload_objs="$libobjs $reload_conv_objs" 8664b85037dbSmrg output="$libobj" 8665b85037dbSmrg func_execute_cmds "$reload_cmds" 'exit $?' 8666b85037dbSmrg fi 8667b85037dbSmrg 8668b85037dbSmrg if test -n "$gentop"; then 8669b85037dbSmrg func_show_eval '${RM}r "$gentop"' 8670b85037dbSmrg fi 8671b85037dbSmrg 8672b85037dbSmrg exit $EXIT_SUCCESS 8673b85037dbSmrg ;; 8674b85037dbSmrg 8675b85037dbSmrg prog) 8676b85037dbSmrg case $host in 8677b85037dbSmrg *cygwin*) func_stripname '' '.exe' "$output" 8678b85037dbSmrg output=$func_stripname_result.exe;; 8679b85037dbSmrg esac 8680b85037dbSmrg test -n "$vinfo" && \ 8681b85037dbSmrg func_warning "\`-version-info' is ignored for programs" 8682b85037dbSmrg 8683b85037dbSmrg test -n "$release" && \ 8684b85037dbSmrg func_warning "\`-release' is ignored for programs" 8685b85037dbSmrg 8686b85037dbSmrg test "$preload" = yes \ 8687b85037dbSmrg && test "$dlopen_support" = unknown \ 8688b85037dbSmrg && test "$dlopen_self" = unknown \ 8689b85037dbSmrg && test "$dlopen_self_static" = unknown && \ 8690b85037dbSmrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 8691b85037dbSmrg 8692b85037dbSmrg case $host in 8693b85037dbSmrg *-*-rhapsody* | *-*-darwin1.[012]) 8694b85037dbSmrg # On Rhapsody replace the C library is the System framework 8695b85037dbSmrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 8696b85037dbSmrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 8697b85037dbSmrg ;; 8698b85037dbSmrg esac 8699b85037dbSmrg 8700b85037dbSmrg case $host in 8701b85037dbSmrg *-*-darwin*) 8702b85037dbSmrg # Don't allow lazy linking, it breaks C++ global constructors 8703b85037dbSmrg # But is supposedly fixed on 10.4 or later (yay!). 8704b85037dbSmrg if test "$tagname" = CXX ; then 8705b85037dbSmrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 8706b85037dbSmrg 10.[0123]) 8707302b15bdSmrg func_append compile_command " ${wl}-bind_at_load" 8708302b15bdSmrg func_append finalize_command " ${wl}-bind_at_load" 8709b85037dbSmrg ;; 8710b85037dbSmrg esac 8711b85037dbSmrg fi 8712b85037dbSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 8713b85037dbSmrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8714b85037dbSmrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8715b85037dbSmrg ;; 8716b85037dbSmrg esac 8717b85037dbSmrg 8718b85037dbSmrg 8719b85037dbSmrg # move library search paths that coincide with paths to not yet 8720b85037dbSmrg # installed libraries to the beginning of the library search list 8721b85037dbSmrg new_libs= 8722b85037dbSmrg for path in $notinst_path; do 8723b85037dbSmrg case " $new_libs " in 8724b85037dbSmrg *" -L$path/$objdir "*) ;; 8725b85037dbSmrg *) 8726b85037dbSmrg case " $compile_deplibs " in 8727b85037dbSmrg *" -L$path/$objdir "*) 8728302b15bdSmrg func_append new_libs " -L$path/$objdir" ;; 8729b85037dbSmrg esac 8730b85037dbSmrg ;; 8731b85037dbSmrg esac 8732b85037dbSmrg done 8733b85037dbSmrg for deplib in $compile_deplibs; do 8734b85037dbSmrg case $deplib in 8735b85037dbSmrg -L*) 8736b85037dbSmrg case " $new_libs " in 8737b85037dbSmrg *" $deplib "*) ;; 8738302b15bdSmrg *) func_append new_libs " $deplib" ;; 8739b85037dbSmrg esac 8740b85037dbSmrg ;; 8741302b15bdSmrg *) func_append new_libs " $deplib" ;; 8742b85037dbSmrg esac 8743b85037dbSmrg done 8744b85037dbSmrg compile_deplibs="$new_libs" 8745b85037dbSmrg 8746b85037dbSmrg 8747302b15bdSmrg func_append compile_command " $compile_deplibs" 8748302b15bdSmrg func_append finalize_command " $finalize_deplibs" 8749b85037dbSmrg 8750b85037dbSmrg if test -n "$rpath$xrpath"; then 8751b85037dbSmrg # If the user specified any rpath flags, then add them. 8752b85037dbSmrg for libdir in $rpath $xrpath; do 8753b85037dbSmrg # This is the magic to use -rpath. 8754b85037dbSmrg case "$finalize_rpath " in 8755b85037dbSmrg *" $libdir "*) ;; 8756302b15bdSmrg *) func_append finalize_rpath " $libdir" ;; 8757b85037dbSmrg esac 8758b85037dbSmrg done 8759b85037dbSmrg fi 8760b85037dbSmrg 8761b85037dbSmrg # Now hardcode the library paths 8762b85037dbSmrg rpath= 8763b85037dbSmrg hardcode_libdirs= 8764b85037dbSmrg for libdir in $compile_rpath $finalize_rpath; do 8765b85037dbSmrg if test -n "$hardcode_libdir_flag_spec"; then 8766b85037dbSmrg if test -n "$hardcode_libdir_separator"; then 8767b85037dbSmrg if test -z "$hardcode_libdirs"; then 8768b85037dbSmrg hardcode_libdirs="$libdir" 8769b85037dbSmrg else 8770b85037dbSmrg # Just accumulate the unique libdirs. 8771b85037dbSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8772b85037dbSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8773b85037dbSmrg ;; 8774b85037dbSmrg *) 8775302b15bdSmrg func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8776b85037dbSmrg ;; 8777b85037dbSmrg esac 8778b85037dbSmrg fi 8779b85037dbSmrg else 8780b85037dbSmrg eval flag=\"$hardcode_libdir_flag_spec\" 8781302b15bdSmrg func_append rpath " $flag" 8782b85037dbSmrg fi 8783b85037dbSmrg elif test -n "$runpath_var"; then 8784b85037dbSmrg case "$perm_rpath " in 8785b85037dbSmrg *" $libdir "*) ;; 8786302b15bdSmrg *) func_append perm_rpath " $libdir" ;; 8787b85037dbSmrg esac 8788b85037dbSmrg fi 8789b85037dbSmrg case $host in 8790b85037dbSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 8791b85037dbSmrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 8792b85037dbSmrg case :$dllsearchpath: in 8793b85037dbSmrg *":$libdir:"*) ;; 8794b85037dbSmrg ::) dllsearchpath=$libdir;; 8795302b15bdSmrg *) func_append dllsearchpath ":$libdir";; 8796b85037dbSmrg esac 8797b85037dbSmrg case :$dllsearchpath: in 8798b85037dbSmrg *":$testbindir:"*) ;; 8799b85037dbSmrg ::) dllsearchpath=$testbindir;; 8800302b15bdSmrg *) func_append dllsearchpath ":$testbindir";; 8801b85037dbSmrg esac 8802b85037dbSmrg ;; 8803b85037dbSmrg esac 8804b85037dbSmrg done 8805b85037dbSmrg # Substitute the hardcoded libdirs into the rpath. 8806b85037dbSmrg if test -n "$hardcode_libdir_separator" && 8807b85037dbSmrg test -n "$hardcode_libdirs"; then 8808b85037dbSmrg libdir="$hardcode_libdirs" 8809b85037dbSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 8810b85037dbSmrg fi 8811b85037dbSmrg compile_rpath="$rpath" 8812b85037dbSmrg 8813b85037dbSmrg rpath= 8814b85037dbSmrg hardcode_libdirs= 8815b85037dbSmrg for libdir in $finalize_rpath; do 8816b85037dbSmrg if test -n "$hardcode_libdir_flag_spec"; then 8817b85037dbSmrg if test -n "$hardcode_libdir_separator"; then 8818b85037dbSmrg if test -z "$hardcode_libdirs"; then 8819b85037dbSmrg hardcode_libdirs="$libdir" 8820b85037dbSmrg else 8821b85037dbSmrg # Just accumulate the unique libdirs. 8822b85037dbSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8823b85037dbSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8824b85037dbSmrg ;; 8825b85037dbSmrg *) 8826302b15bdSmrg func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8827b85037dbSmrg ;; 8828b85037dbSmrg esac 8829b85037dbSmrg fi 8830b85037dbSmrg else 8831b85037dbSmrg eval flag=\"$hardcode_libdir_flag_spec\" 8832302b15bdSmrg func_append rpath " $flag" 8833b85037dbSmrg fi 8834b85037dbSmrg elif test -n "$runpath_var"; then 8835b85037dbSmrg case "$finalize_perm_rpath " in 8836b85037dbSmrg *" $libdir "*) ;; 8837302b15bdSmrg *) func_append finalize_perm_rpath " $libdir" ;; 8838b85037dbSmrg esac 8839b85037dbSmrg fi 8840b85037dbSmrg done 8841b85037dbSmrg # Substitute the hardcoded libdirs into the rpath. 8842b85037dbSmrg if test -n "$hardcode_libdir_separator" && 8843b85037dbSmrg test -n "$hardcode_libdirs"; then 8844b85037dbSmrg libdir="$hardcode_libdirs" 8845b85037dbSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 8846b85037dbSmrg fi 8847b85037dbSmrg finalize_rpath="$rpath" 8848b85037dbSmrg 8849b85037dbSmrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 8850b85037dbSmrg # Transform all the library objects into standard objects. 8851b85037dbSmrg compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8852b85037dbSmrg finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8853b85037dbSmrg fi 8854b85037dbSmrg 8855b85037dbSmrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8856b85037dbSmrg 8857b85037dbSmrg # template prelinking step 8858b85037dbSmrg if test -n "$prelink_cmds"; then 8859b85037dbSmrg func_execute_cmds "$prelink_cmds" 'exit $?' 8860b85037dbSmrg fi 8861b85037dbSmrg 8862b85037dbSmrg wrappers_required=yes 8863b85037dbSmrg case $host in 8864b85037dbSmrg *cegcc* | *mingw32ce*) 8865b85037dbSmrg # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 8866b85037dbSmrg wrappers_required=no 8867b85037dbSmrg ;; 8868b85037dbSmrg *cygwin* | *mingw* ) 8869b85037dbSmrg if test "$build_libtool_libs" != yes; then 8870b85037dbSmrg wrappers_required=no 8871b85037dbSmrg fi 8872b85037dbSmrg ;; 8873b85037dbSmrg *) 8874b85037dbSmrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 8875b85037dbSmrg wrappers_required=no 8876b85037dbSmrg fi 8877b85037dbSmrg ;; 8878b85037dbSmrg esac 8879b85037dbSmrg if test "$wrappers_required" = no; then 8880b85037dbSmrg # Replace the output file specification. 8881b85037dbSmrg compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8882b85037dbSmrg link_command="$compile_command$compile_rpath" 8883b85037dbSmrg 8884b85037dbSmrg # We have no uninstalled library dependencies, so finalize right now. 8885b85037dbSmrg exit_status=0 8886b85037dbSmrg func_show_eval "$link_command" 'exit_status=$?' 8887b85037dbSmrg 8888302b15bdSmrg if test -n "$postlink_cmds"; then 8889302b15bdSmrg func_to_tool_file "$output" 8890302b15bdSmrg postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8891302b15bdSmrg func_execute_cmds "$postlink_cmds" 'exit $?' 8892302b15bdSmrg fi 8893302b15bdSmrg 8894b85037dbSmrg # Delete the generated files. 8895b85037dbSmrg if test -f "$output_objdir/${outputname}S.${objext}"; then 8896b85037dbSmrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8897b85037dbSmrg fi 8898b85037dbSmrg 8899b85037dbSmrg exit $exit_status 8900b85037dbSmrg fi 8901b85037dbSmrg 8902b85037dbSmrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 8903b85037dbSmrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 8904b85037dbSmrg fi 8905b85037dbSmrg if test -n "$finalize_shlibpath"; then 8906b85037dbSmrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 8907b85037dbSmrg fi 8908b85037dbSmrg 8909b85037dbSmrg compile_var= 8910b85037dbSmrg finalize_var= 8911b85037dbSmrg if test -n "$runpath_var"; then 8912b85037dbSmrg if test -n "$perm_rpath"; then 8913b85037dbSmrg # We should set the runpath_var. 8914b85037dbSmrg rpath= 8915b85037dbSmrg for dir in $perm_rpath; do 8916302b15bdSmrg func_append rpath "$dir:" 8917b85037dbSmrg done 8918b85037dbSmrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8919b85037dbSmrg fi 8920b85037dbSmrg if test -n "$finalize_perm_rpath"; then 8921b85037dbSmrg # We should set the runpath_var. 8922b85037dbSmrg rpath= 8923b85037dbSmrg for dir in $finalize_perm_rpath; do 8924302b15bdSmrg func_append rpath "$dir:" 8925b85037dbSmrg done 8926b85037dbSmrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8927b85037dbSmrg fi 8928b85037dbSmrg fi 8929b85037dbSmrg 8930b85037dbSmrg if test "$no_install" = yes; then 8931b85037dbSmrg # We don't need to create a wrapper script. 8932b85037dbSmrg link_command="$compile_var$compile_command$compile_rpath" 8933b85037dbSmrg # Replace the output file specification. 8934b85037dbSmrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8935b85037dbSmrg # Delete the old output file. 8936b85037dbSmrg $opt_dry_run || $RM $output 8937b85037dbSmrg # Link the executable and exit 8938b85037dbSmrg func_show_eval "$link_command" 'exit $?' 8939302b15bdSmrg 8940302b15bdSmrg if test -n "$postlink_cmds"; then 8941302b15bdSmrg func_to_tool_file "$output" 8942302b15bdSmrg postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8943302b15bdSmrg func_execute_cmds "$postlink_cmds" 'exit $?' 8944302b15bdSmrg fi 8945302b15bdSmrg 8946b85037dbSmrg exit $EXIT_SUCCESS 8947b85037dbSmrg fi 8948b85037dbSmrg 8949b85037dbSmrg if test "$hardcode_action" = relink; then 8950b85037dbSmrg # Fast installation is not supported 8951b85037dbSmrg link_command="$compile_var$compile_command$compile_rpath" 8952b85037dbSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 8953b85037dbSmrg 8954b85037dbSmrg func_warning "this platform does not like uninstalled shared libraries" 8955b85037dbSmrg func_warning "\`$output' will be relinked during installation" 8956b85037dbSmrg else 8957b85037dbSmrg if test "$fast_install" != no; then 8958b85037dbSmrg link_command="$finalize_var$compile_command$finalize_rpath" 8959b85037dbSmrg if test "$fast_install" = yes; then 8960b85037dbSmrg relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 8961b85037dbSmrg else 8962b85037dbSmrg # fast_install is set to needless 8963b85037dbSmrg relink_command= 8964b85037dbSmrg fi 8965b85037dbSmrg else 8966b85037dbSmrg link_command="$compile_var$compile_command$compile_rpath" 8967b85037dbSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 8968b85037dbSmrg fi 8969b85037dbSmrg fi 8970b85037dbSmrg 8971b85037dbSmrg # Replace the output file specification. 8972b85037dbSmrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8973b85037dbSmrg 8974b85037dbSmrg # Delete the old output files. 8975b85037dbSmrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8976b85037dbSmrg 8977b85037dbSmrg func_show_eval "$link_command" 'exit $?' 8978b85037dbSmrg 8979302b15bdSmrg if test -n "$postlink_cmds"; then 8980302b15bdSmrg func_to_tool_file "$output_objdir/$outputname" 8981302b15bdSmrg postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8982302b15bdSmrg func_execute_cmds "$postlink_cmds" 'exit $?' 8983302b15bdSmrg fi 8984302b15bdSmrg 8985b85037dbSmrg # Now create the wrapper script. 8986b85037dbSmrg func_verbose "creating $output" 8987b85037dbSmrg 8988b85037dbSmrg # Quote the relink command for shipping. 8989b85037dbSmrg if test -n "$relink_command"; then 8990b85037dbSmrg # Preserve any variables that may affect compiler behavior 8991b85037dbSmrg for var in $variables_saved_for_relink; do 8992b85037dbSmrg if eval test -z \"\${$var+set}\"; then 8993b85037dbSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 8994b85037dbSmrg elif eval var_value=\$$var; test -z "$var_value"; then 8995b85037dbSmrg relink_command="$var=; export $var; $relink_command" 8996b85037dbSmrg else 8997b85037dbSmrg func_quote_for_eval "$var_value" 8998b85037dbSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8999b85037dbSmrg fi 9000b85037dbSmrg done 9001b85037dbSmrg relink_command="(cd `pwd`; $relink_command)" 9002b85037dbSmrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9003b85037dbSmrg fi 9004b85037dbSmrg 9005b85037dbSmrg # Only actually do things if not in dry run mode. 9006b85037dbSmrg $opt_dry_run || { 9007b85037dbSmrg # win32 will think the script is a binary if it has 9008b85037dbSmrg # a .exe suffix, so we strip it off here. 9009b85037dbSmrg case $output in 9010b85037dbSmrg *.exe) func_stripname '' '.exe' "$output" 9011b85037dbSmrg output=$func_stripname_result ;; 9012b85037dbSmrg esac 9013b85037dbSmrg # test for cygwin because mv fails w/o .exe extensions 9014b85037dbSmrg case $host in 9015b85037dbSmrg *cygwin*) 9016b85037dbSmrg exeext=.exe 9017b85037dbSmrg func_stripname '' '.exe' "$outputname" 9018b85037dbSmrg outputname=$func_stripname_result ;; 9019b85037dbSmrg *) exeext= ;; 9020b85037dbSmrg esac 9021b85037dbSmrg case $host in 9022b85037dbSmrg *cygwin* | *mingw* ) 9023b85037dbSmrg func_dirname_and_basename "$output" "" "." 9024b85037dbSmrg output_name=$func_basename_result 9025b85037dbSmrg output_path=$func_dirname_result 9026b85037dbSmrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 9027b85037dbSmrg cwrapper="$output_path/$output_name.exe" 9028b85037dbSmrg $RM $cwrappersource $cwrapper 9029b85037dbSmrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 9030b85037dbSmrg 9031b85037dbSmrg func_emit_cwrapperexe_src > $cwrappersource 9032b85037dbSmrg 9033b85037dbSmrg # The wrapper executable is built using the $host compiler, 9034b85037dbSmrg # because it contains $host paths and files. If cross- 9035b85037dbSmrg # compiling, it, like the target executable, must be 9036b85037dbSmrg # executed on the $host or under an emulation environment. 9037b85037dbSmrg $opt_dry_run || { 9038b85037dbSmrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 9039b85037dbSmrg $STRIP $cwrapper 9040b85037dbSmrg } 9041b85037dbSmrg 9042b85037dbSmrg # Now, create the wrapper script for func_source use: 9043b85037dbSmrg func_ltwrapper_scriptname $cwrapper 9044b85037dbSmrg $RM $func_ltwrapper_scriptname_result 9045b85037dbSmrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 9046b85037dbSmrg $opt_dry_run || { 9047b85037dbSmrg # note: this script will not be executed, so do not chmod. 9048b85037dbSmrg if test "x$build" = "x$host" ; then 9049b85037dbSmrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 9050b85037dbSmrg else 9051b85037dbSmrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 9052b85037dbSmrg fi 9053b85037dbSmrg } 9054b85037dbSmrg ;; 9055b85037dbSmrg * ) 9056b85037dbSmrg $RM $output 9057b85037dbSmrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 9058b85037dbSmrg 9059b85037dbSmrg func_emit_wrapper no > $output 9060b85037dbSmrg chmod +x $output 9061b85037dbSmrg ;; 9062b85037dbSmrg esac 9063b85037dbSmrg } 9064b85037dbSmrg exit $EXIT_SUCCESS 9065b85037dbSmrg ;; 9066b85037dbSmrg esac 9067b85037dbSmrg 9068b85037dbSmrg # See if we need to build an old-fashioned archive. 9069b85037dbSmrg for oldlib in $oldlibs; do 9070b85037dbSmrg 9071b85037dbSmrg if test "$build_libtool_libs" = convenience; then 9072b85037dbSmrg oldobjs="$libobjs_save $symfileobj" 9073b85037dbSmrg addlibs="$convenience" 9074b85037dbSmrg build_libtool_libs=no 9075b85037dbSmrg else 9076b85037dbSmrg if test "$build_libtool_libs" = module; then 9077b85037dbSmrg oldobjs="$libobjs_save" 9078b85037dbSmrg build_libtool_libs=no 9079b85037dbSmrg else 9080b85037dbSmrg oldobjs="$old_deplibs $non_pic_objects" 9081b85037dbSmrg if test "$preload" = yes && test -f "$symfileobj"; then 9082302b15bdSmrg func_append oldobjs " $symfileobj" 9083b85037dbSmrg fi 9084b85037dbSmrg fi 9085b85037dbSmrg addlibs="$old_convenience" 9086b85037dbSmrg fi 9087b85037dbSmrg 9088b85037dbSmrg if test -n "$addlibs"; then 9089b85037dbSmrg gentop="$output_objdir/${outputname}x" 9090302b15bdSmrg func_append generated " $gentop" 9091b85037dbSmrg 9092b85037dbSmrg func_extract_archives $gentop $addlibs 9093302b15bdSmrg func_append oldobjs " $func_extract_archives_result" 9094b85037dbSmrg fi 9095b85037dbSmrg 9096b85037dbSmrg # Do each command in the archive commands. 9097b85037dbSmrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 9098b85037dbSmrg cmds=$old_archive_from_new_cmds 9099b85037dbSmrg else 9100b85037dbSmrg 9101b85037dbSmrg # Add any objects from preloaded convenience libraries 9102b85037dbSmrg if test -n "$dlprefiles"; then 9103b85037dbSmrg gentop="$output_objdir/${outputname}x" 9104302b15bdSmrg func_append generated " $gentop" 9105b85037dbSmrg 9106b85037dbSmrg func_extract_archives $gentop $dlprefiles 9107302b15bdSmrg func_append oldobjs " $func_extract_archives_result" 9108b85037dbSmrg fi 9109b85037dbSmrg 9110b85037dbSmrg # POSIX demands no paths to be encoded in archives. We have 9111b85037dbSmrg # to avoid creating archives with duplicate basenames if we 9112b85037dbSmrg # might have to extract them afterwards, e.g., when creating a 9113b85037dbSmrg # static archive out of a convenience library, or when linking 9114b85037dbSmrg # the entirety of a libtool archive into another (currently 9115b85037dbSmrg # not supported by libtool). 9116b85037dbSmrg if (for obj in $oldobjs 9117b85037dbSmrg do 9118b85037dbSmrg func_basename "$obj" 9119b85037dbSmrg $ECHO "$func_basename_result" 9120b85037dbSmrg done | sort | sort -uc >/dev/null 2>&1); then 9121b85037dbSmrg : 9122b85037dbSmrg else 9123b85037dbSmrg echo "copying selected object files to avoid basename conflicts..." 9124b85037dbSmrg gentop="$output_objdir/${outputname}x" 9125302b15bdSmrg func_append generated " $gentop" 9126b85037dbSmrg func_mkdir_p "$gentop" 9127b85037dbSmrg save_oldobjs=$oldobjs 9128b85037dbSmrg oldobjs= 9129b85037dbSmrg counter=1 9130b85037dbSmrg for obj in $save_oldobjs 9131b85037dbSmrg do 9132b85037dbSmrg func_basename "$obj" 9133b85037dbSmrg objbase="$func_basename_result" 9134b85037dbSmrg case " $oldobjs " in 9135b85037dbSmrg " ") oldobjs=$obj ;; 9136b85037dbSmrg *[\ /]"$objbase "*) 9137b85037dbSmrg while :; do 9138b85037dbSmrg # Make sure we don't pick an alternate name that also 9139b85037dbSmrg # overlaps. 9140b85037dbSmrg newobj=lt$counter-$objbase 9141b85037dbSmrg func_arith $counter + 1 9142b85037dbSmrg counter=$func_arith_result 9143b85037dbSmrg case " $oldobjs " in 9144b85037dbSmrg *[\ /]"$newobj "*) ;; 9145b85037dbSmrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 9146b85037dbSmrg esac 9147b85037dbSmrg done 9148b85037dbSmrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 9149302b15bdSmrg func_append oldobjs " $gentop/$newobj" 9150b85037dbSmrg ;; 9151302b15bdSmrg *) func_append oldobjs " $obj" ;; 9152b85037dbSmrg esac 9153b85037dbSmrg done 9154b85037dbSmrg fi 9155b85037dbSmrg eval cmds=\"$old_archive_cmds\" 9156b85037dbSmrg 9157b85037dbSmrg func_len " $cmds" 9158b85037dbSmrg len=$func_len_result 9159b85037dbSmrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 9160b85037dbSmrg cmds=$old_archive_cmds 9161302b15bdSmrg elif test -n "$archiver_list_spec"; then 9162302b15bdSmrg func_verbose "using command file archive linking..." 9163302b15bdSmrg for obj in $oldobjs 9164302b15bdSmrg do 9165302b15bdSmrg func_to_tool_file "$obj" 9166302b15bdSmrg $ECHO "$func_to_tool_file_result" 9167302b15bdSmrg done > $output_objdir/$libname.libcmd 9168302b15bdSmrg func_to_tool_file "$output_objdir/$libname.libcmd" 9169302b15bdSmrg oldobjs=" $archiver_list_spec$func_to_tool_file_result" 9170302b15bdSmrg cmds=$old_archive_cmds 9171b85037dbSmrg else 9172b85037dbSmrg # the command line is too long to link in one step, link in parts 9173b85037dbSmrg func_verbose "using piecewise archive linking..." 9174b85037dbSmrg save_RANLIB=$RANLIB 9175b85037dbSmrg RANLIB=: 9176b85037dbSmrg objlist= 9177b85037dbSmrg concat_cmds= 9178b85037dbSmrg save_oldobjs=$oldobjs 9179b85037dbSmrg oldobjs= 9180b85037dbSmrg # Is there a better way of finding the last object in the list? 9181b85037dbSmrg for obj in $save_oldobjs 9182b85037dbSmrg do 9183b85037dbSmrg last_oldobj=$obj 9184b85037dbSmrg done 9185b85037dbSmrg eval test_cmds=\"$old_archive_cmds\" 9186b85037dbSmrg func_len " $test_cmds" 9187b85037dbSmrg len0=$func_len_result 9188b85037dbSmrg len=$len0 9189b85037dbSmrg for obj in $save_oldobjs 9190b85037dbSmrg do 9191b85037dbSmrg func_len " $obj" 9192b85037dbSmrg func_arith $len + $func_len_result 9193b85037dbSmrg len=$func_arith_result 9194b85037dbSmrg func_append objlist " $obj" 9195b85037dbSmrg if test "$len" -lt "$max_cmd_len"; then 9196b85037dbSmrg : 9197b85037dbSmrg else 9198b85037dbSmrg # the above command should be used before it gets too long 9199b85037dbSmrg oldobjs=$objlist 9200b85037dbSmrg if test "$obj" = "$last_oldobj" ; then 9201b85037dbSmrg RANLIB=$save_RANLIB 9202b85037dbSmrg fi 9203b85037dbSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 9204b85037dbSmrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 9205b85037dbSmrg objlist= 9206b85037dbSmrg len=$len0 9207b85037dbSmrg fi 9208b85037dbSmrg done 9209b85037dbSmrg RANLIB=$save_RANLIB 9210b85037dbSmrg oldobjs=$objlist 9211b85037dbSmrg if test "X$oldobjs" = "X" ; then 9212b85037dbSmrg eval cmds=\"\$concat_cmds\" 9213b85037dbSmrg else 9214b85037dbSmrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 9215b85037dbSmrg fi 9216b85037dbSmrg fi 9217b85037dbSmrg fi 9218b85037dbSmrg func_execute_cmds "$cmds" 'exit $?' 9219b85037dbSmrg done 9220b85037dbSmrg 9221b85037dbSmrg test -n "$generated" && \ 9222b85037dbSmrg func_show_eval "${RM}r$generated" 9223b85037dbSmrg 9224b85037dbSmrg # Now create the libtool archive. 9225b85037dbSmrg case $output in 9226b85037dbSmrg *.la) 9227b85037dbSmrg old_library= 9228b85037dbSmrg test "$build_old_libs" = yes && old_library="$libname.$libext" 9229b85037dbSmrg func_verbose "creating $output" 9230b85037dbSmrg 9231b85037dbSmrg # Preserve any variables that may affect compiler behavior 9232b85037dbSmrg for var in $variables_saved_for_relink; do 9233b85037dbSmrg if eval test -z \"\${$var+set}\"; then 9234b85037dbSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9235b85037dbSmrg elif eval var_value=\$$var; test -z "$var_value"; then 9236b85037dbSmrg relink_command="$var=; export $var; $relink_command" 9237b85037dbSmrg else 9238b85037dbSmrg func_quote_for_eval "$var_value" 9239b85037dbSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9240b85037dbSmrg fi 9241b85037dbSmrg done 9242b85037dbSmrg # Quote the link command for shipping. 9243b85037dbSmrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 9244b85037dbSmrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9245b85037dbSmrg if test "$hardcode_automatic" = yes ; then 9246b85037dbSmrg relink_command= 9247b85037dbSmrg fi 9248b85037dbSmrg 9249b85037dbSmrg # Only create the output if not a dry run. 9250b85037dbSmrg $opt_dry_run || { 9251b85037dbSmrg for installed in no yes; do 9252b85037dbSmrg if test "$installed" = yes; then 9253b85037dbSmrg if test -z "$install_libdir"; then 9254b85037dbSmrg break 9255b85037dbSmrg fi 9256b85037dbSmrg output="$output_objdir/$outputname"i 9257b85037dbSmrg # Replace all uninstalled libtool libraries with the installed ones 9258b85037dbSmrg newdependency_libs= 9259b85037dbSmrg for deplib in $dependency_libs; do 9260b85037dbSmrg case $deplib in 9261b85037dbSmrg *.la) 9262b85037dbSmrg func_basename "$deplib" 9263b85037dbSmrg name="$func_basename_result" 9264b85037dbSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 9265b85037dbSmrg test -z "$libdir" && \ 9266b85037dbSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 9267302b15bdSmrg func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 9268302b15bdSmrg ;; 9269302b15bdSmrg -L*) 9270302b15bdSmrg func_stripname -L '' "$deplib" 9271302b15bdSmrg func_replace_sysroot "$func_stripname_result" 9272302b15bdSmrg func_append newdependency_libs " -L$func_replace_sysroot_result" 9273302b15bdSmrg ;; 9274302b15bdSmrg -R*) 9275302b15bdSmrg func_stripname -R '' "$deplib" 9276302b15bdSmrg func_replace_sysroot "$func_stripname_result" 9277302b15bdSmrg func_append newdependency_libs " -R$func_replace_sysroot_result" 9278b85037dbSmrg ;; 9279302b15bdSmrg *) func_append newdependency_libs " $deplib" ;; 9280b85037dbSmrg esac 9281b85037dbSmrg done 9282b85037dbSmrg dependency_libs="$newdependency_libs" 9283b85037dbSmrg newdlfiles= 9284b85037dbSmrg 9285b85037dbSmrg for lib in $dlfiles; do 9286b85037dbSmrg case $lib in 9287b85037dbSmrg *.la) 9288b85037dbSmrg func_basename "$lib" 9289b85037dbSmrg name="$func_basename_result" 9290b85037dbSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9291b85037dbSmrg test -z "$libdir" && \ 9292b85037dbSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 9293302b15bdSmrg func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 9294b85037dbSmrg ;; 9295302b15bdSmrg *) func_append newdlfiles " $lib" ;; 9296b85037dbSmrg esac 9297b85037dbSmrg done 9298b85037dbSmrg dlfiles="$newdlfiles" 9299b85037dbSmrg newdlprefiles= 9300b85037dbSmrg for lib in $dlprefiles; do 9301b85037dbSmrg case $lib in 9302b85037dbSmrg *.la) 9303b85037dbSmrg # Only pass preopened files to the pseudo-archive (for 9304b85037dbSmrg # eventual linking with the app. that links it) if we 9305b85037dbSmrg # didn't already link the preopened objects directly into 9306b85037dbSmrg # the library: 9307b85037dbSmrg func_basename "$lib" 9308b85037dbSmrg name="$func_basename_result" 9309b85037dbSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9310b85037dbSmrg test -z "$libdir" && \ 9311b85037dbSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 9312302b15bdSmrg func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 9313b85037dbSmrg ;; 9314b85037dbSmrg esac 9315b85037dbSmrg done 9316b85037dbSmrg dlprefiles="$newdlprefiles" 9317b85037dbSmrg else 9318b85037dbSmrg newdlfiles= 9319b85037dbSmrg for lib in $dlfiles; do 9320b85037dbSmrg case $lib in 9321b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9322b85037dbSmrg *) abs=`pwd`"/$lib" ;; 9323b85037dbSmrg esac 9324302b15bdSmrg func_append newdlfiles " $abs" 9325b85037dbSmrg done 9326b85037dbSmrg dlfiles="$newdlfiles" 9327b85037dbSmrg newdlprefiles= 9328b85037dbSmrg for lib in $dlprefiles; do 9329b85037dbSmrg case $lib in 9330b85037dbSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9331b85037dbSmrg *) abs=`pwd`"/$lib" ;; 9332b85037dbSmrg esac 9333302b15bdSmrg func_append newdlprefiles " $abs" 9334b85037dbSmrg done 9335b85037dbSmrg dlprefiles="$newdlprefiles" 9336b85037dbSmrg fi 9337b85037dbSmrg $RM $output 9338b85037dbSmrg # place dlname in correct position for cygwin 9339b85037dbSmrg # In fact, it would be nice if we could use this code for all target 9340b85037dbSmrg # systems that can't hard-code library paths into their executables 9341b85037dbSmrg # and that have no shared library path variable independent of PATH, 9342b85037dbSmrg # but it turns out we can't easily determine that from inspecting 9343b85037dbSmrg # libtool variables, so we have to hard-code the OSs to which it 9344b85037dbSmrg # applies here; at the moment, that means platforms that use the PE 9345b85037dbSmrg # object format with DLL files. See the long comment at the top of 9346b85037dbSmrg # tests/bindir.at for full details. 9347b85037dbSmrg tdlname=$dlname 9348b85037dbSmrg case $host,$output,$installed,$module,$dlname in 9349b85037dbSmrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 9350b85037dbSmrg # If a -bindir argument was supplied, place the dll there. 9351b85037dbSmrg if test "x$bindir" != x ; 9352b85037dbSmrg then 9353b85037dbSmrg func_relative_path "$install_libdir" "$bindir" 9354b85037dbSmrg tdlname=$func_relative_path_result$dlname 9355b85037dbSmrg else 9356b85037dbSmrg # Otherwise fall back on heuristic. 9357b85037dbSmrg tdlname=../bin/$dlname 9358b85037dbSmrg fi 9359b85037dbSmrg ;; 9360b85037dbSmrg esac 9361b85037dbSmrg $ECHO > $output "\ 9362b85037dbSmrg# $outputname - a libtool library file 9363b85037dbSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 9364b85037dbSmrg# 9365b85037dbSmrg# Please DO NOT delete this file! 9366b85037dbSmrg# It is necessary for linking the library. 9367b85037dbSmrg 9368b85037dbSmrg# The name that we can dlopen(3). 9369b85037dbSmrgdlname='$tdlname' 9370b85037dbSmrg 9371b85037dbSmrg# Names of this library. 9372b85037dbSmrglibrary_names='$library_names' 9373b85037dbSmrg 9374b85037dbSmrg# The name of the static archive. 9375b85037dbSmrgold_library='$old_library' 9376b85037dbSmrg 9377b85037dbSmrg# Linker flags that can not go in dependency_libs. 9378b85037dbSmrginherited_linker_flags='$new_inherited_linker_flags' 9379b85037dbSmrg 9380b85037dbSmrg# Libraries that this one depends upon. 9381b85037dbSmrgdependency_libs='$dependency_libs' 9382b85037dbSmrg 9383b85037dbSmrg# Names of additional weak libraries provided by this library 9384b85037dbSmrgweak_library_names='$weak_libs' 9385b85037dbSmrg 9386b85037dbSmrg# Version information for $libname. 9387b85037dbSmrgcurrent=$current 9388b85037dbSmrgage=$age 9389b85037dbSmrgrevision=$revision 9390b85037dbSmrg 9391b85037dbSmrg# Is this an already installed library? 9392b85037dbSmrginstalled=$installed 9393b85037dbSmrg 9394b85037dbSmrg# Should we warn about portability when linking against -modules? 9395b85037dbSmrgshouldnotlink=$module 9396b85037dbSmrg 9397b85037dbSmrg# Files to dlopen/dlpreopen 9398b85037dbSmrgdlopen='$dlfiles' 9399b85037dbSmrgdlpreopen='$dlprefiles' 9400b85037dbSmrg 9401b85037dbSmrg# Directory that this library needs to be installed in: 9402b85037dbSmrglibdir='$install_libdir'" 9403b85037dbSmrg if test "$installed" = no && test "$need_relink" = yes; then 9404b85037dbSmrg $ECHO >> $output "\ 9405b85037dbSmrgrelink_command=\"$relink_command\"" 9406b85037dbSmrg fi 9407b85037dbSmrg done 9408b85037dbSmrg } 9409b85037dbSmrg 9410b85037dbSmrg # Do a symbolic link so that the libtool archive can be found in 9411b85037dbSmrg # LD_LIBRARY_PATH before the program is installed. 9412b85037dbSmrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 9413b85037dbSmrg ;; 9414b85037dbSmrg esac 9415b85037dbSmrg exit $EXIT_SUCCESS 9416b85037dbSmrg} 9417b85037dbSmrg 9418302b15bdSmrg{ test "$opt_mode" = link || test "$opt_mode" = relink; } && 9419b85037dbSmrg func_mode_link ${1+"$@"} 9420b85037dbSmrg 9421b85037dbSmrg 9422b85037dbSmrg# func_mode_uninstall arg... 9423b85037dbSmrgfunc_mode_uninstall () 9424b85037dbSmrg{ 9425b85037dbSmrg $opt_debug 9426b85037dbSmrg RM="$nonopt" 9427b85037dbSmrg files= 9428b85037dbSmrg rmforce= 9429b85037dbSmrg exit_status=0 9430b85037dbSmrg 9431b85037dbSmrg # This variable tells wrapper scripts just to set variables rather 9432b85037dbSmrg # than running their programs. 9433b85037dbSmrg libtool_install_magic="$magic" 9434b85037dbSmrg 9435b85037dbSmrg for arg 9436b85037dbSmrg do 9437b85037dbSmrg case $arg in 9438302b15bdSmrg -f) func_append RM " $arg"; rmforce=yes ;; 9439302b15bdSmrg -*) func_append RM " $arg" ;; 9440302b15bdSmrg *) func_append files " $arg" ;; 9441b85037dbSmrg esac 9442b85037dbSmrg done 9443b85037dbSmrg 9444b85037dbSmrg test -z "$RM" && \ 9445b85037dbSmrg func_fatal_help "you must specify an RM program" 9446b85037dbSmrg 9447b85037dbSmrg rmdirs= 9448b85037dbSmrg 9449b85037dbSmrg for file in $files; do 9450b85037dbSmrg func_dirname "$file" "" "." 9451b85037dbSmrg dir="$func_dirname_result" 9452b85037dbSmrg if test "X$dir" = X.; then 9453302b15bdSmrg odir="$objdir" 9454b85037dbSmrg else 9455302b15bdSmrg odir="$dir/$objdir" 9456b85037dbSmrg fi 9457b85037dbSmrg func_basename "$file" 9458b85037dbSmrg name="$func_basename_result" 9459302b15bdSmrg test "$opt_mode" = uninstall && odir="$dir" 9460b85037dbSmrg 9461302b15bdSmrg # Remember odir for removal later, being careful to avoid duplicates 9462302b15bdSmrg if test "$opt_mode" = clean; then 9463b85037dbSmrg case " $rmdirs " in 9464302b15bdSmrg *" $odir "*) ;; 9465302b15bdSmrg *) func_append rmdirs " $odir" ;; 9466b85037dbSmrg esac 9467b85037dbSmrg fi 9468b85037dbSmrg 9469b85037dbSmrg # Don't error if the file doesn't exist and rm -f was used. 9470b85037dbSmrg if { test -L "$file"; } >/dev/null 2>&1 || 9471b85037dbSmrg { test -h "$file"; } >/dev/null 2>&1 || 9472b85037dbSmrg test -f "$file"; then 9473b85037dbSmrg : 9474b85037dbSmrg elif test -d "$file"; then 9475b85037dbSmrg exit_status=1 9476b85037dbSmrg continue 9477b85037dbSmrg elif test "$rmforce" = yes; then 9478b85037dbSmrg continue 9479b85037dbSmrg fi 9480b85037dbSmrg 9481b85037dbSmrg rmfiles="$file" 9482b85037dbSmrg 9483b85037dbSmrg case $name in 9484b85037dbSmrg *.la) 9485b85037dbSmrg # Possibly a libtool archive, so verify it. 9486b85037dbSmrg if func_lalib_p "$file"; then 9487b85037dbSmrg func_source $dir/$name 9488b85037dbSmrg 9489b85037dbSmrg # Delete the libtool libraries and symlinks. 9490b85037dbSmrg for n in $library_names; do 9491302b15bdSmrg func_append rmfiles " $odir/$n" 9492b85037dbSmrg done 9493302b15bdSmrg test -n "$old_library" && func_append rmfiles " $odir/$old_library" 9494b85037dbSmrg 9495302b15bdSmrg case "$opt_mode" in 9496b85037dbSmrg clean) 9497302b15bdSmrg case " $library_names " in 9498b85037dbSmrg *" $dlname "*) ;; 9499302b15bdSmrg *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 9500b85037dbSmrg esac 9501302b15bdSmrg test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 9502b85037dbSmrg ;; 9503b85037dbSmrg uninstall) 9504b85037dbSmrg if test -n "$library_names"; then 9505b85037dbSmrg # Do each command in the postuninstall commands. 9506b85037dbSmrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9507b85037dbSmrg fi 9508b85037dbSmrg 9509b85037dbSmrg if test -n "$old_library"; then 9510b85037dbSmrg # Do each command in the old_postuninstall commands. 9511b85037dbSmrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9512b85037dbSmrg fi 9513b85037dbSmrg # FIXME: should reinstall the best remaining shared library. 9514b85037dbSmrg ;; 9515b85037dbSmrg esac 9516b85037dbSmrg fi 9517b85037dbSmrg ;; 9518b85037dbSmrg 9519b85037dbSmrg *.lo) 9520b85037dbSmrg # Possibly a libtool object, so verify it. 9521b85037dbSmrg if func_lalib_p "$file"; then 9522b85037dbSmrg 9523b85037dbSmrg # Read the .lo file 9524b85037dbSmrg func_source $dir/$name 9525b85037dbSmrg 9526b85037dbSmrg # Add PIC object to the list of files to remove. 9527b85037dbSmrg if test -n "$pic_object" && 9528b85037dbSmrg test "$pic_object" != none; then 9529302b15bdSmrg func_append rmfiles " $dir/$pic_object" 9530b85037dbSmrg fi 9531b85037dbSmrg 9532b85037dbSmrg # Add non-PIC object to the list of files to remove. 9533b85037dbSmrg if test -n "$non_pic_object" && 9534b85037dbSmrg test "$non_pic_object" != none; then 9535302b15bdSmrg func_append rmfiles " $dir/$non_pic_object" 9536b85037dbSmrg fi 9537b85037dbSmrg fi 9538b85037dbSmrg ;; 9539b85037dbSmrg 9540b85037dbSmrg *) 9541302b15bdSmrg if test "$opt_mode" = clean ; then 9542b85037dbSmrg noexename=$name 9543b85037dbSmrg case $file in 9544b85037dbSmrg *.exe) 9545b85037dbSmrg func_stripname '' '.exe' "$file" 9546b85037dbSmrg file=$func_stripname_result 9547b85037dbSmrg func_stripname '' '.exe' "$name" 9548b85037dbSmrg noexename=$func_stripname_result 9549b85037dbSmrg # $file with .exe has already been added to rmfiles, 9550b85037dbSmrg # add $file without .exe 9551302b15bdSmrg func_append rmfiles " $file" 9552b85037dbSmrg ;; 9553b85037dbSmrg esac 9554b85037dbSmrg # Do a test to see if this is a libtool program. 9555b85037dbSmrg if func_ltwrapper_p "$file"; then 9556b85037dbSmrg if func_ltwrapper_executable_p "$file"; then 9557b85037dbSmrg func_ltwrapper_scriptname "$file" 9558b85037dbSmrg relink_command= 9559b85037dbSmrg func_source $func_ltwrapper_scriptname_result 9560302b15bdSmrg func_append rmfiles " $func_ltwrapper_scriptname_result" 9561b85037dbSmrg else 9562b85037dbSmrg relink_command= 9563b85037dbSmrg func_source $dir/$noexename 9564b85037dbSmrg fi 9565b85037dbSmrg 9566b85037dbSmrg # note $name still contains .exe if it was in $file originally 9567b85037dbSmrg # as does the version of $file that was added into $rmfiles 9568302b15bdSmrg func_append rmfiles " $odir/$name $odir/${name}S.${objext}" 9569b85037dbSmrg if test "$fast_install" = yes && test -n "$relink_command"; then 9570302b15bdSmrg func_append rmfiles " $odir/lt-$name" 9571b85037dbSmrg fi 9572b85037dbSmrg if test "X$noexename" != "X$name" ; then 9573302b15bdSmrg func_append rmfiles " $odir/lt-${noexename}.c" 9574b85037dbSmrg fi 9575b85037dbSmrg fi 9576b85037dbSmrg fi 9577b85037dbSmrg ;; 9578b85037dbSmrg esac 9579b85037dbSmrg func_show_eval "$RM $rmfiles" 'exit_status=1' 9580b85037dbSmrg done 9581b85037dbSmrg 9582b85037dbSmrg # Try to remove the ${objdir}s in the directories where we deleted files 9583b85037dbSmrg for dir in $rmdirs; do 9584b85037dbSmrg if test -d "$dir"; then 9585b85037dbSmrg func_show_eval "rmdir $dir >/dev/null 2>&1" 9586b85037dbSmrg fi 9587b85037dbSmrg done 9588b85037dbSmrg 9589b85037dbSmrg exit $exit_status 9590b85037dbSmrg} 9591b85037dbSmrg 9592302b15bdSmrg{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && 9593b85037dbSmrg func_mode_uninstall ${1+"$@"} 9594b85037dbSmrg 9595302b15bdSmrgtest -z "$opt_mode" && { 9596b85037dbSmrg help="$generic_help" 9597b85037dbSmrg func_fatal_help "you must specify a MODE" 9598b85037dbSmrg} 9599b85037dbSmrg 9600b85037dbSmrgtest -z "$exec_cmd" && \ 9601302b15bdSmrg func_fatal_help "invalid operation mode \`$opt_mode'" 9602b85037dbSmrg 9603b85037dbSmrgif test -n "$exec_cmd"; then 9604b85037dbSmrg eval exec "$exec_cmd" 9605b85037dbSmrg exit $EXIT_FAILURE 9606b85037dbSmrgfi 9607b85037dbSmrg 9608b85037dbSmrgexit $exit_status 9609b85037dbSmrg 9610b85037dbSmrg 9611b85037dbSmrg# The TAGs below are defined such that we never get into a situation 9612b85037dbSmrg# in which we disable both kinds of libraries. Given conflicting 9613b85037dbSmrg# choices, we go for a static library, that is the most portable, 9614b85037dbSmrg# since we can't tell whether shared libraries were disabled because 9615b85037dbSmrg# the user asked for that or because the platform doesn't support 9616b85037dbSmrg# them. This is particularly important on AIX, because we don't 9617b85037dbSmrg# support having both static and shared libraries enabled at the same 9618b85037dbSmrg# time on that platform, so we default to a shared-only configuration. 9619b85037dbSmrg# If a disable-shared tag is given, we'll fallback to a static-only 9620b85037dbSmrg# configuration. But we'll never go from static-only to shared-only. 9621b85037dbSmrg 9622b85037dbSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 9623b85037dbSmrgbuild_libtool_libs=no 9624b85037dbSmrgbuild_old_libs=yes 9625b85037dbSmrg# ### END LIBTOOL TAG CONFIG: disable-shared 9626b85037dbSmrg 9627b85037dbSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 9628b85037dbSmrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 9629b85037dbSmrg# ### END LIBTOOL TAG CONFIG: disable-static 9630b85037dbSmrg 9631b85037dbSmrg# Local Variables: 9632b85037dbSmrg# mode:shell-script 9633b85037dbSmrg# sh-indentation:2 9634b85037dbSmrg# End: 9635b85037dbSmrg# vi:sw=2 9636b85037dbSmrg 9637