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