ltmain.sh revision 3c15da26
1d656433aSmrg 23c15da26Smrg# libtool (GNU libtool) 2.4 3d656433aSmrg# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 4d656433aSmrg 5555991fdSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 6555991fdSmrg# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 7d656433aSmrg# This is free software; see the source for copying conditions. There is NO 8d656433aSmrg# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9d656433aSmrg 10d656433aSmrg# GNU Libtool is free software; you can redistribute it and/or modify 11126a8a12Smrg# it under the terms of the GNU General Public License as published by 12126a8a12Smrg# the Free Software Foundation; either version 2 of the License, or 13126a8a12Smrg# (at your option) any later version. 14126a8a12Smrg# 15d656433aSmrg# As a special exception to the GNU General Public License, 16d656433aSmrg# if you distribute this file as part of a program or library that 17d656433aSmrg# is built using GNU Libtool, you may include this file under the 18d656433aSmrg# same distribution terms that you use for the rest of that program. 19d656433aSmrg# 20d656433aSmrg# GNU Libtool is distributed in the hope that it will be useful, but 21126a8a12Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 22126a8a12Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23126a8a12Smrg# General Public License for more details. 24126a8a12Smrg# 25126a8a12Smrg# You should have received a copy of the GNU General Public License 26d656433aSmrg# along with GNU Libtool; see the file COPYING. If not, a copy 27d656433aSmrg# can be downloaded from http://www.gnu.org/licenses/gpl.html, 28d656433aSmrg# or obtained by writing to the Free Software Foundation, Inc., 29d656433aSmrg# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30d656433aSmrg 31d656433aSmrg# Usage: $progname [OPTION]... [MODE-ARG]... 32d656433aSmrg# 33d656433aSmrg# Provide generalized library-building support services. 34126a8a12Smrg# 35555991fdSmrg# --config show all configuration variables 36555991fdSmrg# --debug enable verbose shell tracing 37555991fdSmrg# -n, --dry-run display commands without modifying any files 38555991fdSmrg# --features display basic configuration information and exit 39555991fdSmrg# --mode=MODE use operation mode MODE 40555991fdSmrg# --preserve-dup-deps don't remove duplicate dependency libraries 41555991fdSmrg# --quiet, --silent don't print informational messages 42555991fdSmrg# --no-quiet, --no-silent 43555991fdSmrg# print informational messages (default) 44555991fdSmrg# --tag=TAG use configuration variables from tag TAG 45555991fdSmrg# -v, --verbose print more informational messages than default 46555991fdSmrg# --no-verbose don't print the extra informational messages 47555991fdSmrg# --version print version information 48555991fdSmrg# -h, --help, --help-all print short, long, or detailed help message 49d656433aSmrg# 50d656433aSmrg# MODE must be one of the following: 51d656433aSmrg# 52555991fdSmrg# clean remove files from the build directory 53555991fdSmrg# compile compile a source file into a libtool object 54555991fdSmrg# execute automatically set library path, then run a program 55555991fdSmrg# finish complete the installation of libtool libraries 56555991fdSmrg# install install libraries or executables 57555991fdSmrg# link create a library or an executable 58555991fdSmrg# uninstall remove libraries from an installed directory 59d656433aSmrg# 60555991fdSmrg# MODE-ARGS vary depending on the MODE. When passed as first option, 61555991fdSmrg# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 62d656433aSmrg# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 63d656433aSmrg# 64d656433aSmrg# When reporting a bug, please describe a test case to reproduce it and 65d656433aSmrg# include the following information: 66d656433aSmrg# 67555991fdSmrg# host-triplet: $host 68555991fdSmrg# shell: $SHELL 69555991fdSmrg# compiler: $LTCC 70555991fdSmrg# compiler flags: $LTCFLAGS 71555991fdSmrg# linker: $LD (gnu? $with_gnu_ld) 723c15da26Smrg# $progname: (GNU libtool) 2.4 73555991fdSmrg# automake: $automake_version 74555991fdSmrg# autoconf: $autoconf_version 75d656433aSmrg# 76d656433aSmrg# Report bugs to <bug-libtool@gnu.org>. 773c15da26Smrg# GNU libtool home page: <http://www.gnu.org/software/libtool/>. 783c15da26Smrg# General help using GNU software: <http://www.gnu.org/gethelp/>. 79d656433aSmrg 80555991fdSmrgPROGRAM=libtool 81d656433aSmrgPACKAGE=libtool 823c15da26SmrgVERSION=2.4 83d656433aSmrgTIMESTAMP="" 843c15da26Smrgpackage_revision=1.3293 85d656433aSmrg 86d656433aSmrg# Be Bourne compatible 87d656433aSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 88d656433aSmrg emulate sh 89d656433aSmrg NULLCMD=: 90d656433aSmrg # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 91d656433aSmrg # is contrary to our usage. Disable this feature. 92d656433aSmrg alias -g '${1+"$@"}'='"$@"' 93d656433aSmrg setopt NO_GLOB_SUBST 94d656433aSmrgelse 95d656433aSmrg case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 96d656433aSmrgfi 97d656433aSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 98d656433aSmrgDUALCASE=1; export DUALCASE # for MKS sh 99d656433aSmrg 100555991fdSmrg# A function that is used when there is no print builtin or printf. 101555991fdSmrgfunc_fallback_echo () 102555991fdSmrg{ 103555991fdSmrg eval 'cat <<_LTECHO_EOF 104555991fdSmrg$1 105555991fdSmrg_LTECHO_EOF' 106555991fdSmrg} 107555991fdSmrg 108d656433aSmrg# NLS nuisances: We save the old values to restore during execute mode. 109d656433aSmrglt_user_locale= 110d656433aSmrglt_safe_locale= 111d656433aSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 112d656433aSmrgdo 113d656433aSmrg eval "if test \"\${$lt_var+set}\" = set; then 114d656433aSmrg save_$lt_var=\$$lt_var 115d656433aSmrg $lt_var=C 116d656433aSmrg export $lt_var 117d656433aSmrg lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 118d656433aSmrg lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 119d656433aSmrg fi" 120d656433aSmrgdone 121555991fdSmrgLC_ALL=C 122555991fdSmrgLANGUAGE=C 123555991fdSmrgexport LANGUAGE LC_ALL 124d656433aSmrg 125d656433aSmrg$lt_unset CDPATH 126d656433aSmrg 127d656433aSmrg 128555991fdSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 129555991fdSmrg# is ksh but when the shell is invoked as "sh" and the current value of 130555991fdSmrg# the _XPG environment variable is not equal to 1 (one), the special 131555991fdSmrg# positional parameter $0, within a function call, is the name of the 132555991fdSmrg# function. 133555991fdSmrgprogpath="$0" 134d656433aSmrg 135d656433aSmrg 136d656433aSmrg 137d656433aSmrg: ${CP="cp -f"} 138555991fdSmrgtest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 139555991fdSmrg: ${EGREP="grep -E"} 140555991fdSmrg: ${FGREP="grep -F"} 141555991fdSmrg: ${GREP="grep"} 142d656433aSmrg: ${LN_S="ln -s"} 143d656433aSmrg: ${MAKE="make"} 144d656433aSmrg: ${MKDIR="mkdir"} 145d656433aSmrg: ${MV="mv -f"} 146d656433aSmrg: ${RM="rm -f"} 147555991fdSmrg: ${SED="sed"} 148d656433aSmrg: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 149d656433aSmrg: ${Xsed="$SED -e 1s/^X//"} 150126a8a12Smrg 151d656433aSmrg# Global variables: 152d656433aSmrgEXIT_SUCCESS=0 153d656433aSmrgEXIT_FAILURE=1 154d656433aSmrgEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 155d656433aSmrgEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 156d656433aSmrg 157d656433aSmrgexit_status=$EXIT_SUCCESS 158d656433aSmrg 159d656433aSmrg# Make sure IFS has a sensible default 160d656433aSmrglt_nl=' 161d656433aSmrg' 162d656433aSmrgIFS=" $lt_nl" 163d656433aSmrg 164d656433aSmrgdirname="s,/[^/]*$,," 165d656433aSmrgbasename="s,^.*/,," 166d656433aSmrg 1673c15da26Smrg# func_dirname file append nondir_replacement 1683c15da26Smrg# Compute the dirname of FILE. If nonempty, add APPEND to the result, 1693c15da26Smrg# otherwise set result to NONDIR_REPLACEMENT. 1703c15da26Smrgfunc_dirname () 1713c15da26Smrg{ 1723c15da26Smrg func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` 1733c15da26Smrg if test "X$func_dirname_result" = "X${1}"; then 1743c15da26Smrg func_dirname_result="${3}" 1753c15da26Smrg else 1763c15da26Smrg func_dirname_result="$func_dirname_result${2}" 1773c15da26Smrg fi 1783c15da26Smrg} # func_dirname may be replaced by extended shell implementation 1793c15da26Smrg 1803c15da26Smrg 1813c15da26Smrg# func_basename file 1823c15da26Smrgfunc_basename () 1833c15da26Smrg{ 1843c15da26Smrg func_basename_result=`$ECHO "${1}" | $SED "$basename"` 1853c15da26Smrg} # func_basename may be replaced by extended shell implementation 1863c15da26Smrg 1873c15da26Smrg 188d656433aSmrg# func_dirname_and_basename file append nondir_replacement 189d656433aSmrg# perform func_basename and func_dirname in a single function 190d656433aSmrg# call: 191d656433aSmrg# dirname: Compute the dirname of FILE. If nonempty, 192d656433aSmrg# add APPEND to the result, otherwise set result 193d656433aSmrg# to NONDIR_REPLACEMENT. 194d656433aSmrg# value returned in "$func_dirname_result" 195d656433aSmrg# basename: Compute filename of FILE. 196d656433aSmrg# value retuned in "$func_basename_result" 197d656433aSmrg# Implementation must be kept synchronized with func_dirname 198d656433aSmrg# and func_basename. For efficiency, we do not delegate to 199d656433aSmrg# those functions but instead duplicate the functionality here. 200d656433aSmrgfunc_dirname_and_basename () 201d656433aSmrg{ 2023c15da26Smrg # Extract subdirectory from the argument. 2033c15da26Smrg func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 2043c15da26Smrg if test "X$func_dirname_result" = "X${1}"; then 2053c15da26Smrg func_dirname_result="${3}" 2063c15da26Smrg else 2073c15da26Smrg func_dirname_result="$func_dirname_result${2}" 2083c15da26Smrg fi 2093c15da26Smrg func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 2103c15da26Smrg} # func_dirname_and_basename may be replaced by extended shell implementation 2113c15da26Smrg 2123c15da26Smrg 2133c15da26Smrg# func_stripname prefix suffix name 2143c15da26Smrg# strip PREFIX and SUFFIX off of NAME. 2153c15da26Smrg# PREFIX and SUFFIX must not contain globbing or regex special 2163c15da26Smrg# characters, hashes, percent signs, but SUFFIX may contain a leading 2173c15da26Smrg# dot (in which case that matches only a dot). 2183c15da26Smrg# func_strip_suffix prefix name 2193c15da26Smrgfunc_stripname () 2203c15da26Smrg{ 2213c15da26Smrg case ${2} in 2223c15da26Smrg .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; 2233c15da26Smrg *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; 2243c15da26Smrg esac 2253c15da26Smrg} # func_stripname may be replaced by extended shell implementation 226d656433aSmrg 227126a8a12Smrg 228555991fdSmrg# These SED scripts presuppose an absolute path with a trailing slash. 229555991fdSmrgpathcar='s,^/\([^/]*\).*$,\1,' 230555991fdSmrgpathcdr='s,^/[^/]*,,' 231555991fdSmrgremovedotparts=':dotsl 232555991fdSmrg s@/\./@/@g 233555991fdSmrg t dotsl 234555991fdSmrg s,/\.$,/,' 235555991fdSmrgcollapseslashes='s@/\{1,\}@/@g' 236555991fdSmrgfinalslash='s,/*$,/,' 237555991fdSmrg 238555991fdSmrg# func_normal_abspath PATH 239555991fdSmrg# Remove doubled-up and trailing slashes, "." path components, 240555991fdSmrg# and cancel out any ".." path components in PATH after making 241555991fdSmrg# it an absolute path. 242555991fdSmrg# value returned in "$func_normal_abspath_result" 243555991fdSmrgfunc_normal_abspath () 244555991fdSmrg{ 245555991fdSmrg # Start from root dir and reassemble the path. 246555991fdSmrg func_normal_abspath_result= 247555991fdSmrg func_normal_abspath_tpath=$1 248555991fdSmrg func_normal_abspath_altnamespace= 249555991fdSmrg case $func_normal_abspath_tpath in 250555991fdSmrg "") 251555991fdSmrg # Empty path, that just means $cwd. 252555991fdSmrg func_stripname '' '/' "`pwd`" 253555991fdSmrg func_normal_abspath_result=$func_stripname_result 254555991fdSmrg return 255555991fdSmrg ;; 256555991fdSmrg # The next three entries are used to spot a run of precisely 257555991fdSmrg # two leading slashes without using negated character classes; 258555991fdSmrg # we take advantage of case's first-match behaviour. 259555991fdSmrg ///*) 260555991fdSmrg # Unusual form of absolute path, do nothing. 261555991fdSmrg ;; 262555991fdSmrg //*) 263555991fdSmrg # Not necessarily an ordinary path; POSIX reserves leading '//' 264555991fdSmrg # and for example Cygwin uses it to access remote file shares 265555991fdSmrg # over CIFS/SMB, so we conserve a leading double slash if found. 266555991fdSmrg func_normal_abspath_altnamespace=/ 267555991fdSmrg ;; 268555991fdSmrg /*) 269555991fdSmrg # Absolute path, do nothing. 270555991fdSmrg ;; 271555991fdSmrg *) 272555991fdSmrg # Relative path, prepend $cwd. 273555991fdSmrg func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 274555991fdSmrg ;; 275555991fdSmrg esac 276555991fdSmrg # Cancel out all the simple stuff to save iterations. We also want 277555991fdSmrg # the path to end with a slash for ease of parsing, so make sure 278555991fdSmrg # there is one (and only one) here. 279555991fdSmrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 280555991fdSmrg -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 281555991fdSmrg while :; do 282555991fdSmrg # Processed it all yet? 283555991fdSmrg if test "$func_normal_abspath_tpath" = / ; then 284555991fdSmrg # If we ascended to the root using ".." the result may be empty now. 285555991fdSmrg if test -z "$func_normal_abspath_result" ; then 286555991fdSmrg func_normal_abspath_result=/ 287555991fdSmrg fi 288555991fdSmrg break 289555991fdSmrg fi 290555991fdSmrg func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 291555991fdSmrg -e "$pathcar"` 292555991fdSmrg func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 293555991fdSmrg -e "$pathcdr"` 294555991fdSmrg # Figure out what to do with it 295555991fdSmrg case $func_normal_abspath_tcomponent in 296555991fdSmrg "") 297555991fdSmrg # Trailing empty path component, ignore it. 298555991fdSmrg ;; 299555991fdSmrg ..) 300555991fdSmrg # Parent dir; strip last assembled component from result. 301555991fdSmrg func_dirname "$func_normal_abspath_result" 302555991fdSmrg func_normal_abspath_result=$func_dirname_result 303555991fdSmrg ;; 304555991fdSmrg *) 305555991fdSmrg # Actual path component, append it. 306555991fdSmrg func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 307555991fdSmrg ;; 308555991fdSmrg esac 309555991fdSmrg done 310555991fdSmrg # Restore leading double-slash if one was found on entry. 311555991fdSmrg func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 312555991fdSmrg} 313555991fdSmrg 314555991fdSmrg# func_relative_path SRCDIR DSTDIR 315555991fdSmrg# generates a relative path from SRCDIR to DSTDIR, with a trailing 316555991fdSmrg# slash if non-empty, suitable for immediately appending a filename 317555991fdSmrg# without needing to append a separator. 318555991fdSmrg# value returned in "$func_relative_path_result" 319555991fdSmrgfunc_relative_path () 320555991fdSmrg{ 321555991fdSmrg func_relative_path_result= 322555991fdSmrg func_normal_abspath "$1" 323555991fdSmrg func_relative_path_tlibdir=$func_normal_abspath_result 324555991fdSmrg func_normal_abspath "$2" 325555991fdSmrg func_relative_path_tbindir=$func_normal_abspath_result 326555991fdSmrg 327555991fdSmrg # Ascend the tree starting from libdir 328555991fdSmrg while :; do 329555991fdSmrg # check if we have found a prefix of bindir 330555991fdSmrg case $func_relative_path_tbindir in 331555991fdSmrg $func_relative_path_tlibdir) 332555991fdSmrg # found an exact match 333555991fdSmrg func_relative_path_tcancelled= 334555991fdSmrg break 335555991fdSmrg ;; 336555991fdSmrg $func_relative_path_tlibdir*) 337555991fdSmrg # found a matching prefix 338555991fdSmrg func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 339555991fdSmrg func_relative_path_tcancelled=$func_stripname_result 340555991fdSmrg if test -z "$func_relative_path_result"; then 341555991fdSmrg func_relative_path_result=. 342555991fdSmrg fi 343555991fdSmrg break 344555991fdSmrg ;; 345555991fdSmrg *) 346555991fdSmrg func_dirname $func_relative_path_tlibdir 347555991fdSmrg func_relative_path_tlibdir=${func_dirname_result} 348555991fdSmrg if test "x$func_relative_path_tlibdir" = x ; then 349555991fdSmrg # Have to descend all the way to the root! 350555991fdSmrg func_relative_path_result=../$func_relative_path_result 351555991fdSmrg func_relative_path_tcancelled=$func_relative_path_tbindir 352555991fdSmrg break 353555991fdSmrg fi 354555991fdSmrg func_relative_path_result=../$func_relative_path_result 355555991fdSmrg ;; 356555991fdSmrg esac 357555991fdSmrg done 358555991fdSmrg 359555991fdSmrg # Now calculate path; take care to avoid doubling-up slashes. 360555991fdSmrg func_stripname '' '/' "$func_relative_path_result" 361555991fdSmrg func_relative_path_result=$func_stripname_result 362555991fdSmrg func_stripname '/' '/' "$func_relative_path_tcancelled" 363555991fdSmrg if test "x$func_stripname_result" != x ; then 364555991fdSmrg func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 365555991fdSmrg fi 366555991fdSmrg 367555991fdSmrg # Normalisation. If bindir is libdir, return empty string, 368555991fdSmrg # else relative path ending with a slash; either way, target 369555991fdSmrg # file name can be directly appended. 370555991fdSmrg if test ! -z "$func_relative_path_result"; then 371555991fdSmrg func_stripname './' '' "$func_relative_path_result/" 372555991fdSmrg func_relative_path_result=$func_stripname_result 373555991fdSmrg fi 374555991fdSmrg} 375126a8a12Smrg 376126a8a12Smrg# The name of this program: 377d656433aSmrgfunc_dirname_and_basename "$progpath" 378d656433aSmrgprogname=$func_basename_result 379126a8a12Smrg 380d656433aSmrg# Make sure we have an absolute path for reexecution: 381d656433aSmrgcase $progpath in 382d656433aSmrg [\\/]*|[A-Za-z]:\\*) ;; 383d656433aSmrg *[\\/]*) 384d656433aSmrg progdir=$func_dirname_result 385d656433aSmrg progdir=`cd "$progdir" && pwd` 386d656433aSmrg progpath="$progdir/$progname" 387d656433aSmrg ;; 388d656433aSmrg *) 389d656433aSmrg save_IFS="$IFS" 390d656433aSmrg IFS=: 391d656433aSmrg for progdir in $PATH; do 392d656433aSmrg IFS="$save_IFS" 393d656433aSmrg test -x "$progdir/$progname" && break 394d656433aSmrg done 395d656433aSmrg IFS="$save_IFS" 396d656433aSmrg test -n "$progdir" || progdir=`pwd` 397d656433aSmrg progpath="$progdir/$progname" 398d656433aSmrg ;; 399d656433aSmrgesac 400126a8a12Smrg 401d656433aSmrg# Sed substitution that helps us do robust quoting. It backslashifies 402d656433aSmrg# metacharacters that are still active within double-quoted strings. 403d656433aSmrgXsed="${SED}"' -e 1s/^X//' 404d656433aSmrgsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 405d656433aSmrg 406d656433aSmrg# Same as above, but do not quote variable references. 407d656433aSmrgdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 408d656433aSmrg 4093c15da26Smrg# Sed substitution that turns a string into a regex matching for the 4103c15da26Smrg# string literally. 4113c15da26Smrgsed_make_literal_regex='s,[].[^$\\*\/],\\&,g' 4123c15da26Smrg 4133c15da26Smrg# Sed substitution that converts a w32 file name or path 4143c15da26Smrg# which contains forward slashes, into one that contains 4153c15da26Smrg# (escaped) backslashes. A very naive implementation. 4163c15da26Smrglt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 4173c15da26Smrg 418d656433aSmrg# Re-`\' parameter expansions in output of double_quote_subst that were 419d656433aSmrg# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 420d656433aSmrg# in input to double_quote_subst, that '$' was protected from expansion. 421d656433aSmrg# Since each input `\' is now two `\'s, look for any number of runs of 422d656433aSmrg# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 423d656433aSmrgbs='\\' 424d656433aSmrgbs2='\\\\' 425d656433aSmrgbs4='\\\\\\\\' 426d656433aSmrgdollar='\$' 427d656433aSmrgsed_double_backslash="\ 428d656433aSmrg s/$bs4/&\\ 429d656433aSmrg/g 430d656433aSmrg s/^$bs2$dollar/$bs&/ 431d656433aSmrg s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 432d656433aSmrg s/\n//g" 433d656433aSmrg 434d656433aSmrg# Standard options: 435d656433aSmrgopt_dry_run=false 436d656433aSmrgopt_help=false 437d656433aSmrgopt_quiet=false 438d656433aSmrgopt_verbose=false 439d656433aSmrgopt_warning=: 440d656433aSmrg 441d656433aSmrg# func_echo arg... 442d656433aSmrg# Echo program name prefixed message, along with the current mode 443d656433aSmrg# name if it has been set yet. 444d656433aSmrgfunc_echo () 445d656433aSmrg{ 4463c15da26Smrg $ECHO "$progname: ${opt_mode+$opt_mode: }$*" 447d656433aSmrg} 448126a8a12Smrg 449d656433aSmrg# func_verbose arg... 450d656433aSmrg# Echo program name prefixed message in verbose mode only. 451d656433aSmrgfunc_verbose () 452d656433aSmrg{ 453d656433aSmrg $opt_verbose && func_echo ${1+"$@"} 454126a8a12Smrg 455d656433aSmrg # A bug in bash halts the script if the last line of a function 456d656433aSmrg # fails when set -e is in force, so we need another command to 457d656433aSmrg # work around that: 458d656433aSmrg : 459d656433aSmrg} 460126a8a12Smrg 461555991fdSmrg# func_echo_all arg... 462555991fdSmrg# Invoke $ECHO with all args, space-separated. 463555991fdSmrgfunc_echo_all () 464555991fdSmrg{ 465555991fdSmrg $ECHO "$*" 466555991fdSmrg} 467555991fdSmrg 468d656433aSmrg# func_error arg... 469d656433aSmrg# Echo program name prefixed message to standard error. 470d656433aSmrgfunc_error () 471d656433aSmrg{ 4723c15da26Smrg $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 473d656433aSmrg} 474126a8a12Smrg 475d656433aSmrg# func_warning arg... 476d656433aSmrg# Echo program name prefixed warning message to standard error. 477d656433aSmrgfunc_warning () 478d656433aSmrg{ 4793c15da26Smrg $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 480126a8a12Smrg 481d656433aSmrg # bash bug again: 482d656433aSmrg : 483d656433aSmrg} 484126a8a12Smrg 485d656433aSmrg# func_fatal_error arg... 486d656433aSmrg# Echo program name prefixed message to standard error, and exit. 487d656433aSmrgfunc_fatal_error () 488d656433aSmrg{ 489d656433aSmrg func_error ${1+"$@"} 490d656433aSmrg exit $EXIT_FAILURE 491d656433aSmrg} 492126a8a12Smrg 493d656433aSmrg# func_fatal_help arg... 494d656433aSmrg# Echo program name prefixed message to standard error, followed by 495d656433aSmrg# a help hint, and exit. 496d656433aSmrgfunc_fatal_help () 497d656433aSmrg{ 498d656433aSmrg func_error ${1+"$@"} 499d656433aSmrg func_fatal_error "$help" 500d656433aSmrg} 501d656433aSmrghelp="Try \`$progname --help' for more information." ## default 502126a8a12Smrg 503126a8a12Smrg 504d656433aSmrg# func_grep expression filename 505d656433aSmrg# Check whether EXPRESSION matches any line of FILENAME, without output. 506d656433aSmrgfunc_grep () 507d656433aSmrg{ 508d656433aSmrg $GREP "$1" "$2" >/dev/null 2>&1 509d656433aSmrg} 510d656433aSmrg 511d656433aSmrg 512d656433aSmrg# func_mkdir_p directory-path 513d656433aSmrg# Make sure the entire path to DIRECTORY-PATH is available. 514d656433aSmrgfunc_mkdir_p () 515d656433aSmrg{ 516d656433aSmrg my_directory_path="$1" 517d656433aSmrg my_dir_list= 518d656433aSmrg 519d656433aSmrg if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 520d656433aSmrg 521d656433aSmrg # Protect directory names starting with `-' 522d656433aSmrg case $my_directory_path in 523d656433aSmrg -*) my_directory_path="./$my_directory_path" ;; 524d656433aSmrg esac 525d656433aSmrg 526d656433aSmrg # While some portion of DIR does not yet exist... 527d656433aSmrg while test ! -d "$my_directory_path"; do 528d656433aSmrg # ...make a list in topmost first order. Use a colon delimited 529d656433aSmrg # list incase some portion of path contains whitespace. 530d656433aSmrg my_dir_list="$my_directory_path:$my_dir_list" 531d656433aSmrg 532d656433aSmrg # If the last portion added has no slash in it, the list is done 533d656433aSmrg case $my_directory_path in */*) ;; *) break ;; esac 534d656433aSmrg 535d656433aSmrg # ...otherwise throw away the child directory and loop 536555991fdSmrg my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 537d656433aSmrg done 538555991fdSmrg my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 539d656433aSmrg 540d656433aSmrg save_mkdir_p_IFS="$IFS"; IFS=':' 541d656433aSmrg for my_dir in $my_dir_list; do 542d656433aSmrg IFS="$save_mkdir_p_IFS" 543d656433aSmrg # mkdir can fail with a `File exist' error if two processes 544d656433aSmrg # try to create one of the directories concurrently. Don't 545d656433aSmrg # stop in that case! 546d656433aSmrg $MKDIR "$my_dir" 2>/dev/null || : 547d656433aSmrg done 548d656433aSmrg IFS="$save_mkdir_p_IFS" 549d656433aSmrg 550d656433aSmrg # Bail out if we (or some other process) failed to create a directory. 551d656433aSmrg test -d "$my_directory_path" || \ 552d656433aSmrg func_fatal_error "Failed to create \`$1'" 553d656433aSmrg fi 554d656433aSmrg} 555126a8a12Smrg 556126a8a12Smrg 557126a8a12Smrg# func_mktempdir [string] 558126a8a12Smrg# Make a temporary directory that won't clash with other running 559126a8a12Smrg# libtool processes, and avoids race conditions if possible. If 560126a8a12Smrg# given, STRING is the basename for that directory. 561126a8a12Smrgfunc_mktempdir () 562126a8a12Smrg{ 563126a8a12Smrg my_template="${TMPDIR-/tmp}/${1-$progname}" 564126a8a12Smrg 565d656433aSmrg if test "$opt_dry_run" = ":"; then 566126a8a12Smrg # Return a directory name, but don't create it in dry-run mode 567126a8a12Smrg my_tmpdir="${my_template}-$$" 568126a8a12Smrg else 569126a8a12Smrg 570126a8a12Smrg # If mktemp works, use that first and foremost 571126a8a12Smrg my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 572126a8a12Smrg 573126a8a12Smrg if test ! -d "$my_tmpdir"; then 574d656433aSmrg # Failing that, at least try and use $RANDOM to avoid a race 575d656433aSmrg my_tmpdir="${my_template}-${RANDOM-0}$$" 576126a8a12Smrg 577d656433aSmrg save_mktempdir_umask=`umask` 578d656433aSmrg umask 0077 579d656433aSmrg $MKDIR "$my_tmpdir" 580d656433aSmrg umask $save_mktempdir_umask 581126a8a12Smrg fi 582126a8a12Smrg 583126a8a12Smrg # If we're not in dry-run mode, bomb out on failure 584d656433aSmrg test -d "$my_tmpdir" || \ 585d656433aSmrg func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 586126a8a12Smrg fi 587126a8a12Smrg 588555991fdSmrg $ECHO "$my_tmpdir" 589126a8a12Smrg} 590126a8a12Smrg 591126a8a12Smrg 592d656433aSmrg# func_quote_for_eval arg 593d656433aSmrg# Aesthetically quote ARG to be evaled later. 594d656433aSmrg# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 595d656433aSmrg# is double-quoted, suitable for a subsequent eval, whereas 596d656433aSmrg# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 597d656433aSmrg# which are still active within double quotes backslashified. 598d656433aSmrgfunc_quote_for_eval () 599126a8a12Smrg{ 600d656433aSmrg case $1 in 601d656433aSmrg *[\\\`\"\$]*) 602555991fdSmrg func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 603d656433aSmrg *) 604d656433aSmrg func_quote_for_eval_unquoted_result="$1" ;; 605d656433aSmrg esac 606d656433aSmrg 607d656433aSmrg case $func_quote_for_eval_unquoted_result in 608d656433aSmrg # Double-quote args containing shell metacharacters to delay 609d656433aSmrg # word splitting, command substitution and and variable 610d656433aSmrg # expansion for a subsequent eval. 611d656433aSmrg # Many Bourne shells cannot handle close brackets correctly 612d656433aSmrg # in scan sets, so we specify it separately. 613d656433aSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 614d656433aSmrg func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 615d656433aSmrg ;; 616d656433aSmrg *) 617d656433aSmrg func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 618126a8a12Smrg esac 619126a8a12Smrg} 620126a8a12Smrg 621126a8a12Smrg 622d656433aSmrg# func_quote_for_expand arg 623d656433aSmrg# Aesthetically quote ARG to be evaled later; same as above, 624d656433aSmrg# but do not quote variable references. 625d656433aSmrgfunc_quote_for_expand () 626126a8a12Smrg{ 627d656433aSmrg case $1 in 628d656433aSmrg *[\\\`\"]*) 629555991fdSmrg my_arg=`$ECHO "$1" | $SED \ 630d656433aSmrg -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 631126a8a12Smrg *) 632d656433aSmrg my_arg="$1" ;; 633d656433aSmrg esac 634d656433aSmrg 635d656433aSmrg case $my_arg in 636d656433aSmrg # Double-quote args containing shell metacharacters to delay 637d656433aSmrg # word splitting and command substitution for a subsequent eval. 638d656433aSmrg # Many Bourne shells cannot handle close brackets correctly 639d656433aSmrg # in scan sets, so we specify it separately. 640d656433aSmrg *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 641d656433aSmrg my_arg="\"$my_arg\"" 642d656433aSmrg ;; 643d656433aSmrg esac 644d656433aSmrg 645d656433aSmrg func_quote_for_expand_result="$my_arg" 646126a8a12Smrg} 647126a8a12Smrg 648126a8a12Smrg 649d656433aSmrg# func_show_eval cmd [fail_exp] 650d656433aSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 651d656433aSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 652d656433aSmrg# is given, then evaluate it. 653d656433aSmrgfunc_show_eval () 654126a8a12Smrg{ 655d656433aSmrg my_cmd="$1" 656d656433aSmrg my_fail_exp="${2-:}" 657126a8a12Smrg 658d656433aSmrg ${opt_silent-false} || { 659d656433aSmrg func_quote_for_expand "$my_cmd" 660d656433aSmrg eval "func_echo $func_quote_for_expand_result" 661d656433aSmrg } 662d656433aSmrg 663d656433aSmrg if ${opt_dry_run-false}; then :; else 664d656433aSmrg eval "$my_cmd" 665d656433aSmrg my_status=$? 666d656433aSmrg if test "$my_status" -eq 0; then :; else 667d656433aSmrg eval "(exit $my_status); $my_fail_exp" 668d656433aSmrg fi 669126a8a12Smrg fi 670126a8a12Smrg} 671126a8a12Smrg 672d656433aSmrg 673d656433aSmrg# func_show_eval_locale cmd [fail_exp] 674d656433aSmrg# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 675d656433aSmrg# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 676d656433aSmrg# is given, then evaluate it. Use the saved locale for evaluation. 677d656433aSmrgfunc_show_eval_locale () 678126a8a12Smrg{ 679d656433aSmrg my_cmd="$1" 680d656433aSmrg my_fail_exp="${2-:}" 681126a8a12Smrg 682d656433aSmrg ${opt_silent-false} || { 683d656433aSmrg func_quote_for_expand "$my_cmd" 684d656433aSmrg eval "func_echo $func_quote_for_expand_result" 685d656433aSmrg } 686d656433aSmrg 687d656433aSmrg if ${opt_dry_run-false}; then :; else 688d656433aSmrg eval "$lt_user_locale 689d656433aSmrg $my_cmd" 690d656433aSmrg my_status=$? 691d656433aSmrg eval "$lt_safe_locale" 692d656433aSmrg if test "$my_status" -eq 0; then :; else 693d656433aSmrg eval "(exit $my_status); $my_fail_exp" 694126a8a12Smrg fi 695d656433aSmrg fi 696126a8a12Smrg} 697126a8a12Smrg 6983c15da26Smrg# func_tr_sh 6993c15da26Smrg# Turn $1 into a string suitable for a shell variable name. 7003c15da26Smrg# Result is stored in $func_tr_sh_result. All characters 7013c15da26Smrg# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 7023c15da26Smrg# if $1 begins with a digit, a '_' is prepended as well. 7033c15da26Smrgfunc_tr_sh () 7043c15da26Smrg{ 7053c15da26Smrg case $1 in 7063c15da26Smrg [0-9]* | *[!a-zA-Z0-9_]*) 7073c15da26Smrg func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` 7083c15da26Smrg ;; 7093c15da26Smrg * ) 7103c15da26Smrg func_tr_sh_result=$1 7113c15da26Smrg ;; 7123c15da26Smrg esac 7133c15da26Smrg} 7143c15da26Smrg 715126a8a12Smrg 716d656433aSmrg# func_version 717d656433aSmrg# Echo version message to standard output and exit. 718d656433aSmrgfunc_version () 719d656433aSmrg{ 7203c15da26Smrg $opt_debug 7213c15da26Smrg 722555991fdSmrg $SED -n '/(C)/!b go 723555991fdSmrg :more 724555991fdSmrg /\./!{ 725555991fdSmrg N 726555991fdSmrg s/\n# / / 727555991fdSmrg b more 728555991fdSmrg } 729555991fdSmrg :go 730555991fdSmrg /^# '$PROGRAM' (GNU /,/# warranty; / { 731d656433aSmrg s/^# // 732d656433aSmrg s/^# *$// 733d656433aSmrg s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 734d656433aSmrg p 735d656433aSmrg }' < "$progpath" 736d656433aSmrg exit $? 737d656433aSmrg} 738d656433aSmrg 739d656433aSmrg# func_usage 740d656433aSmrg# Echo short help message to standard output and exit. 741d656433aSmrgfunc_usage () 742d656433aSmrg{ 7433c15da26Smrg $opt_debug 7443c15da26Smrg 745555991fdSmrg $SED -n '/^# Usage:/,/^# *.*--help/ { 746d656433aSmrg s/^# // 747d656433aSmrg s/^# *$// 748d656433aSmrg s/\$progname/'$progname'/ 749d656433aSmrg p 750d656433aSmrg }' < "$progpath" 751555991fdSmrg echo 752d656433aSmrg $ECHO "run \`$progname --help | more' for full usage" 753d656433aSmrg exit $? 754d656433aSmrg} 755d656433aSmrg 756555991fdSmrg# func_help [NOEXIT] 757555991fdSmrg# Echo long help message to standard output and exit, 758555991fdSmrg# unless 'noexit' is passed as argument. 759d656433aSmrgfunc_help () 760d656433aSmrg{ 7613c15da26Smrg $opt_debug 7623c15da26Smrg 763d656433aSmrg $SED -n '/^# Usage:/,/# Report bugs to/ { 7643c15da26Smrg :print 765d656433aSmrg s/^# // 766d656433aSmrg s/^# *$// 767d656433aSmrg s*\$progname*'$progname'* 768d656433aSmrg s*\$host*'"$host"'* 769d656433aSmrg s*\$SHELL*'"$SHELL"'* 770d656433aSmrg s*\$LTCC*'"$LTCC"'* 771d656433aSmrg s*\$LTCFLAGS*'"$LTCFLAGS"'* 772d656433aSmrg s*\$LD*'"$LD"'* 773d656433aSmrg s/\$with_gnu_ld/'"$with_gnu_ld"'/ 774d656433aSmrg s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 775d656433aSmrg s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 776d656433aSmrg p 7773c15da26Smrg d 7783c15da26Smrg } 7793c15da26Smrg /^# .* home page:/b print 7803c15da26Smrg /^# General help using/b print 7813c15da26Smrg ' < "$progpath" 782555991fdSmrg ret=$? 783555991fdSmrg if test -z "$1"; then 784555991fdSmrg exit $ret 785555991fdSmrg fi 786d656433aSmrg} 787d656433aSmrg 788d656433aSmrg# func_missing_arg argname 789d656433aSmrg# Echo program name prefixed message to standard error and set global 790d656433aSmrg# exit_cmd. 791d656433aSmrgfunc_missing_arg () 792d656433aSmrg{ 7933c15da26Smrg $opt_debug 7943c15da26Smrg 795555991fdSmrg func_error "missing argument for $1." 796d656433aSmrg exit_cmd=exit 797d656433aSmrg} 798d656433aSmrg 799d656433aSmrg 8003c15da26Smrg# func_split_short_opt shortopt 8013c15da26Smrg# Set func_split_short_opt_name and func_split_short_opt_arg shell 8023c15da26Smrg# variables after splitting SHORTOPT after the 2nd character. 8033c15da26Smrgfunc_split_short_opt () 8043c15da26Smrg{ 8053c15da26Smrg my_sed_short_opt='1s/^\(..\).*$/\1/;q' 8063c15da26Smrg my_sed_short_rest='1s/^..\(.*\)$/\1/;q' 8073c15da26Smrg 8083c15da26Smrg func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` 8093c15da26Smrg func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` 8103c15da26Smrg} # func_split_short_opt may be replaced by extended shell implementation 8113c15da26Smrg 8123c15da26Smrg 8133c15da26Smrg# func_split_long_opt longopt 8143c15da26Smrg# Set func_split_long_opt_name and func_split_long_opt_arg shell 8153c15da26Smrg# variables after splitting LONGOPT at the `=' sign. 8163c15da26Smrgfunc_split_long_opt () 8173c15da26Smrg{ 8183c15da26Smrg my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' 8193c15da26Smrg my_sed_long_arg='1s/^--[^=]*=//' 8203c15da26Smrg 8213c15da26Smrg func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` 8223c15da26Smrg func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` 8233c15da26Smrg} # func_split_long_opt may be replaced by extended shell implementation 8243c15da26Smrg 8253c15da26Smrgexit_cmd=: 826d656433aSmrg 827d656433aSmrg 828d656433aSmrg 829d656433aSmrg 830126a8a12Smrg 831d656433aSmrgmagic="%%%MAGIC variable%%%" 832d656433aSmrgmagic_exe="%%%MAGIC EXE variable%%%" 833126a8a12Smrg 834d656433aSmrg# Global variables. 835d656433aSmrgnonopt= 836d656433aSmrgpreserve_args= 837d656433aSmrglo2o="s/\\.lo\$/.${objext}/" 838d656433aSmrgo2lo="s/\\.${objext}\$/.lo/" 839d656433aSmrgextracted_archives= 840d656433aSmrgextracted_serial=0 841126a8a12Smrg 842d656433aSmrg# If this variable is set in any of the actions, the command in it 843d656433aSmrg# will be execed at the end. This prevents here-documents from being 844d656433aSmrg# left over by shells. 845d656433aSmrgexec_cmd= 846126a8a12Smrg 8473c15da26Smrg# func_append var value 8483c15da26Smrg# Append VALUE to the end of shell variable VAR. 8493c15da26Smrgfunc_append () 8503c15da26Smrg{ 8513c15da26Smrg eval "${1}=\$${1}\${2}" 8523c15da26Smrg} # func_append may be replaced by extended shell implementation 8533c15da26Smrg 8543c15da26Smrg# func_append_quoted var value 8553c15da26Smrg# Quote VALUE and append to the end of shell variable VAR, separated 8563c15da26Smrg# by a space. 8573c15da26Smrgfunc_append_quoted () 8583c15da26Smrg{ 8593c15da26Smrg func_quote_for_eval "${2}" 8603c15da26Smrg eval "${1}=\$${1}\\ \$func_quote_for_eval_result" 8613c15da26Smrg} # func_append_quoted may be replaced by extended shell implementation 8623c15da26Smrg 8633c15da26Smrg 8643c15da26Smrg# func_arith arithmetic-term... 8653c15da26Smrgfunc_arith () 8663c15da26Smrg{ 8673c15da26Smrg func_arith_result=`expr "${@}"` 8683c15da26Smrg} # func_arith may be replaced by extended shell implementation 8693c15da26Smrg 8703c15da26Smrg 8713c15da26Smrg# func_len string 8723c15da26Smrg# STRING may not start with a hyphen. 8733c15da26Smrgfunc_len () 8743c15da26Smrg{ 8753c15da26Smrg func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` 8763c15da26Smrg} # func_len may be replaced by extended shell implementation 8773c15da26Smrg 8783c15da26Smrg 8793c15da26Smrg# func_lo2o object 8803c15da26Smrgfunc_lo2o () 8813c15da26Smrg{ 8823c15da26Smrg func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` 8833c15da26Smrg} # func_lo2o may be replaced by extended shell implementation 8843c15da26Smrg 8853c15da26Smrg 8863c15da26Smrg# func_xform libobj-or-source 8873c15da26Smrgfunc_xform () 8883c15da26Smrg{ 8893c15da26Smrg func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` 8903c15da26Smrg} # func_xform may be replaced by extended shell implementation 8913c15da26Smrg 8923c15da26Smrg 893d656433aSmrg# func_fatal_configuration arg... 894d656433aSmrg# Echo program name prefixed message to standard error, followed by 895d656433aSmrg# a configuration failure hint, and exit. 896d656433aSmrgfunc_fatal_configuration () 897d656433aSmrg{ 898d656433aSmrg func_error ${1+"$@"} 899d656433aSmrg func_error "See the $PACKAGE documentation for more information." 900d656433aSmrg func_fatal_error "Fatal configuration error." 901d656433aSmrg} 902d656433aSmrg 903d656433aSmrg 904d656433aSmrg# func_config 905d656433aSmrg# Display the configuration for all the tags in this script. 906d656433aSmrgfunc_config () 907d656433aSmrg{ 908d656433aSmrg re_begincf='^# ### BEGIN LIBTOOL' 909d656433aSmrg re_endcf='^# ### END LIBTOOL' 910d656433aSmrg 911d656433aSmrg # Default configuration. 912d656433aSmrg $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 913126a8a12Smrg 914126a8a12Smrg # Now print the configurations for the tags. 915126a8a12Smrg for tagname in $taglist; do 916d656433aSmrg $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 917126a8a12Smrg done 918126a8a12Smrg 919d656433aSmrg exit $? 920d656433aSmrg} 921126a8a12Smrg 922d656433aSmrg# func_features 923d656433aSmrg# Display the features supported by this script. 924d656433aSmrgfunc_features () 925d656433aSmrg{ 926555991fdSmrg echo "host: $host" 927126a8a12Smrg if test "$build_libtool_libs" = yes; then 928555991fdSmrg echo "enable shared libraries" 929126a8a12Smrg else 930555991fdSmrg echo "disable shared libraries" 931126a8a12Smrg fi 932126a8a12Smrg if test "$build_old_libs" = yes; then 933555991fdSmrg echo "enable static libraries" 934126a8a12Smrg else 935555991fdSmrg echo "disable static libraries" 936126a8a12Smrg fi 937d656433aSmrg 938126a8a12Smrg exit $? 939d656433aSmrg} 940126a8a12Smrg 941d656433aSmrg# func_enable_tag tagname 942d656433aSmrg# Verify that TAGNAME is valid, and either flag an error and exit, or 943d656433aSmrg# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 944d656433aSmrg# variable here. 945d656433aSmrgfunc_enable_tag () 946d656433aSmrg{ 947d656433aSmrg # Global variable: 948d656433aSmrg tagname="$1" 949126a8a12Smrg 950d656433aSmrg re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 951d656433aSmrg re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 952d656433aSmrg sed_extractcf="/$re_begincf/,/$re_endcf/p" 953126a8a12Smrg 954d656433aSmrg # Validate tagname. 955d656433aSmrg case $tagname in 956d656433aSmrg *[!-_A-Za-z0-9,/]*) 957d656433aSmrg func_fatal_error "invalid tag name: $tagname" 958d656433aSmrg ;; 959d656433aSmrg esac 960126a8a12Smrg 961d656433aSmrg # Don't test for the "default" C tag, as we know it's 962d656433aSmrg # there but not specially marked. 963d656433aSmrg case $tagname in 964d656433aSmrg CC) ;; 965d656433aSmrg *) 966d656433aSmrg if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 967d656433aSmrg taglist="$taglist $tagname" 968d656433aSmrg 969d656433aSmrg # Evaluate the configuration. Be careful to quote the path 970d656433aSmrg # and the sed script, to avoid splitting on whitespace, but 971d656433aSmrg # also don't use non-portable quotes within backquotes within 972d656433aSmrg # quotes we have to do it in 2 steps: 973d656433aSmrg extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 974d656433aSmrg eval "$extractedcf" 975d656433aSmrg else 976d656433aSmrg func_error "ignoring unknown tag $tagname" 977d656433aSmrg fi 978d656433aSmrg ;; 979d656433aSmrg esac 980d656433aSmrg} 981d656433aSmrg 9823c15da26Smrg# func_check_version_match 9833c15da26Smrg# Ensure that we are using m4 macros, and libtool script from the same 9843c15da26Smrg# release of libtool. 9853c15da26Smrgfunc_check_version_match () 986d656433aSmrg{ 9873c15da26Smrg if test "$package_revision" != "$macro_revision"; then 9883c15da26Smrg if test "$VERSION" != "$macro_version"; then 9893c15da26Smrg if test -z "$macro_version"; then 9903c15da26Smrg cat >&2 <<_LT_EOF 9913c15da26Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9923c15da26Smrg$progname: definition of this LT_INIT comes from an older release. 9933c15da26Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 9943c15da26Smrg$progname: and run autoconf again. 9953c15da26Smrg_LT_EOF 9963c15da26Smrg else 9973c15da26Smrg cat >&2 <<_LT_EOF 9983c15da26Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9993c15da26Smrg$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 10003c15da26Smrg$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 10013c15da26Smrg$progname: and run autoconf again. 10023c15da26Smrg_LT_EOF 10033c15da26Smrg fi 10043c15da26Smrg else 10053c15da26Smrg cat >&2 <<_LT_EOF 10063c15da26Smrg$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 10073c15da26Smrg$progname: but the definition of this LT_INIT comes from revision $macro_revision. 10083c15da26Smrg$progname: You should recreate aclocal.m4 with macros from revision $package_revision 10093c15da26Smrg$progname: of $PACKAGE $VERSION and run autoconf again. 10103c15da26Smrg_LT_EOF 10113c15da26Smrg fi 1012126a8a12Smrg 10133c15da26Smrg exit $EXIT_MISMATCH 10143c15da26Smrg fi 10153c15da26Smrg} 10163c15da26Smrg 10173c15da26Smrg 10183c15da26Smrg# Shorthand for --mode=foo, only valid as the first argument 10193c15da26Smrgcase $1 in 10203c15da26Smrgclean|clea|cle|cl) 10213c15da26Smrg shift; set dummy --mode clean ${1+"$@"}; shift 10223c15da26Smrg ;; 10233c15da26Smrgcompile|compil|compi|comp|com|co|c) 10243c15da26Smrg shift; set dummy --mode compile ${1+"$@"}; shift 10253c15da26Smrg ;; 10263c15da26Smrgexecute|execut|execu|exec|exe|ex|e) 10273c15da26Smrg shift; set dummy --mode execute ${1+"$@"}; shift 10283c15da26Smrg ;; 10293c15da26Smrgfinish|finis|fini|fin|fi|f) 10303c15da26Smrg shift; set dummy --mode finish ${1+"$@"}; shift 10313c15da26Smrg ;; 10323c15da26Smrginstall|instal|insta|inst|ins|in|i) 10333c15da26Smrg shift; set dummy --mode install ${1+"$@"}; shift 10343c15da26Smrg ;; 10353c15da26Smrglink|lin|li|l) 10363c15da26Smrg shift; set dummy --mode link ${1+"$@"}; shift 10373c15da26Smrg ;; 10383c15da26Smrguninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 10393c15da26Smrg shift; set dummy --mode uninstall ${1+"$@"}; shift 10403c15da26Smrg ;; 10413c15da26Smrgesac 1042126a8a12Smrg 10433c15da26Smrg 10443c15da26Smrg 10453c15da26Smrg# Option defaults: 10463c15da26Smrgopt_debug=: 10473c15da26Smrgopt_dry_run=false 10483c15da26Smrgopt_config=false 10493c15da26Smrgopt_preserve_dup_deps=false 10503c15da26Smrgopt_features=false 10513c15da26Smrgopt_finish=false 10523c15da26Smrgopt_help=false 10533c15da26Smrgopt_help_all=false 10543c15da26Smrgopt_silent=: 10553c15da26Smrgopt_verbose=: 10563c15da26Smrgopt_silent=false 10573c15da26Smrgopt_verbose=false 10583c15da26Smrg 10593c15da26Smrg 10603c15da26Smrg# Parse options once, thoroughly. This comes as soon as possible in the 10613c15da26Smrg# script to make things like `--version' happen as quickly as we can. 10623c15da26Smrg{ 10633c15da26Smrg # this just eases exit handling 10643c15da26Smrg while test $# -gt 0; do 1065d656433aSmrg opt="$1" 1066d656433aSmrg shift 1067d656433aSmrg case $opt in 10683c15da26Smrg --debug|-x) opt_debug='set -x' 1069d656433aSmrg func_echo "enabling shell trace mode" 1070d656433aSmrg $opt_debug 1071d656433aSmrg ;; 10723c15da26Smrg --dry-run|--dryrun|-n) 10733c15da26Smrg opt_dry_run=: 1074d656433aSmrg ;; 10753c15da26Smrg --config) 10763c15da26Smrg opt_config=: 10773c15da26Smrgfunc_config 10783c15da26Smrg ;; 10793c15da26Smrg --dlopen|-dlopen) 10803c15da26Smrg optarg="$1" 10813c15da26Smrg opt_dlopen="${opt_dlopen+$opt_dlopen 10823c15da26Smrg}$optarg" 1083d656433aSmrg shift 1084d656433aSmrg ;; 1085d656433aSmrg --preserve-dup-deps) 10863c15da26Smrg opt_preserve_dup_deps=: 1087555991fdSmrg ;; 10883c15da26Smrg --features) 10893c15da26Smrg opt_features=: 10903c15da26Smrgfunc_features 1091d656433aSmrg ;; 10923c15da26Smrg --finish) 10933c15da26Smrg opt_finish=: 10943c15da26Smrgset dummy --mode finish ${1+"$@"}; shift 10953c15da26Smrg ;; 10963c15da26Smrg --help) 10973c15da26Smrg opt_help=: 10983c15da26Smrg ;; 10993c15da26Smrg --help-all) 11003c15da26Smrg opt_help_all=: 11013c15da26Smrgopt_help=': help-all' 11023c15da26Smrg ;; 11033c15da26Smrg --mode) 11043c15da26Smrg test $# = 0 && func_missing_arg $opt && break 11053c15da26Smrg optarg="$1" 11063c15da26Smrg opt_mode="$optarg" 11073c15da26Smrgcase $optarg in 11083c15da26Smrg # Valid mode arguments: 11093c15da26Smrg clean|compile|execute|finish|install|link|relink|uninstall) ;; 11103c15da26Smrg 11113c15da26Smrg # Catch anything else as an error 11123c15da26Smrg *) func_error "invalid argument for $opt" 11133c15da26Smrg exit_cmd=exit 11143c15da26Smrg break 11153c15da26Smrg ;; 11163c15da26Smrgesac 11173c15da26Smrg shift 11183c15da26Smrg ;; 11193c15da26Smrg --no-silent|--no-quiet) 1120d656433aSmrg opt_silent=false 11213c15da26Smrgfunc_append preserve_args " $opt" 1122555991fdSmrg ;; 11233c15da26Smrg --no-verbose) 1124555991fdSmrg opt_verbose=false 11253c15da26Smrgfunc_append preserve_args " $opt" 1126d656433aSmrg ;; 11273c15da26Smrg --silent|--quiet) 11283c15da26Smrg opt_silent=: 11293c15da26Smrgfunc_append preserve_args " $opt" 11303c15da26Smrg opt_verbose=false 11313c15da26Smrg ;; 11323c15da26Smrg --verbose|-v) 11333c15da26Smrg opt_verbose=: 11343c15da26Smrgfunc_append preserve_args " $opt" 11353c15da26Smrgopt_silent=false 11363c15da26Smrg ;; 11373c15da26Smrg --tag) 11383c15da26Smrg test $# = 0 && func_missing_arg $opt && break 11393c15da26Smrg optarg="$1" 11403c15da26Smrg opt_tag="$optarg" 11413c15da26Smrgfunc_append preserve_args " $opt $optarg" 11423c15da26Smrgfunc_enable_tag "$optarg" 1143d656433aSmrg shift 1144d656433aSmrg ;; 1145d656433aSmrg 11463c15da26Smrg -\?|-h) func_usage ;; 11473c15da26Smrg --help) func_help ;; 11483c15da26Smrg --version) func_version ;; 11493c15da26Smrg 1150d656433aSmrg # Separate optargs to long options: 11513c15da26Smrg --*=*) 11523c15da26Smrg func_split_long_opt "$opt" 11533c15da26Smrg set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} 1154d656433aSmrg shift 1155d656433aSmrg ;; 1156d656433aSmrg 11573c15da26Smrg # Separate non-argument short options: 11583c15da26Smrg -\?*|-h*|-n*|-v*) 11593c15da26Smrg func_split_short_opt "$opt" 11603c15da26Smrg set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} 11613c15da26Smrg shift 1162d656433aSmrg ;; 11633c15da26Smrg 11643c15da26Smrg --) break ;; 11653c15da26Smrg -*) func_fatal_help "unrecognized option \`$opt'" ;; 11663c15da26Smrg *) set dummy "$opt" ${1+"$@"}; shift; break ;; 1167d656433aSmrg esac 1168d656433aSmrg done 1169d656433aSmrg 11703c15da26Smrg # Validate options: 11713c15da26Smrg 11723c15da26Smrg # save first non-option argument 11733c15da26Smrg if test "$#" -gt 0; then 11743c15da26Smrg nonopt="$opt" 11753c15da26Smrg shift 11763c15da26Smrg fi 11773c15da26Smrg 11783c15da26Smrg # preserve --debug 11793c15da26Smrg test "$opt_debug" = : || func_append preserve_args " --debug" 1180d656433aSmrg 1181d656433aSmrg case $host in 1182d656433aSmrg *cygwin* | *mingw* | *pw32* | *cegcc*) 1183d656433aSmrg # don't eliminate duplications in $postdeps and $predeps 1184d656433aSmrg opt_duplicate_compiler_generated_deps=: 1185126a8a12Smrg ;; 1186126a8a12Smrg *) 11873c15da26Smrg opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 1188d656433aSmrg ;; 1189d656433aSmrg esac 1190126a8a12Smrg 11913c15da26Smrg $opt_help || { 11923c15da26Smrg # Sanity checks first: 11933c15da26Smrg func_check_version_match 1194d656433aSmrg 11953c15da26Smrg if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 11963c15da26Smrg func_fatal_configuration "not configured to build any kind of library" 1197d656433aSmrg fi 1198d656433aSmrg 11993c15da26Smrg # Darwin sucks 12003c15da26Smrg eval std_shrext=\"$shrext_cmds\" 1201d656433aSmrg 12023c15da26Smrg # Only execute mode is allowed to have -dlopen flags. 12033c15da26Smrg if test -n "$opt_dlopen" && test "$opt_mode" != execute; then 12043c15da26Smrg func_error "unrecognized option \`-dlopen'" 12053c15da26Smrg $ECHO "$help" 1>&2 12063c15da26Smrg exit $EXIT_FAILURE 12073c15da26Smrg fi 1208d656433aSmrg 12093c15da26Smrg # Change the help message to a mode-specific one. 12103c15da26Smrg generic_help="$help" 12113c15da26Smrg help="Try \`$progname --help --mode=$opt_mode' for more information." 12123c15da26Smrg } 1213d656433aSmrg 1214d656433aSmrg 12153c15da26Smrg # Bail if the options were screwed 12163c15da26Smrg $exit_cmd $EXIT_FAILURE 12173c15da26Smrg} 1218d656433aSmrg 1219126a8a12Smrg 1220126a8a12Smrg 1221126a8a12Smrg 12223c15da26Smrg## ----------- ## 12233c15da26Smrg## Main. ## 12243c15da26Smrg## ----------- ## 1225126a8a12Smrg 1226d656433aSmrg# func_lalib_p file 1227d656433aSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 1228d656433aSmrg# This function is only a basic sanity check; it will hardly flush out 1229d656433aSmrg# determined imposters. 1230d656433aSmrgfunc_lalib_p () 1231d656433aSmrg{ 1232d656433aSmrg test -f "$1" && 1233d656433aSmrg $SED -e 4q "$1" 2>/dev/null \ 1234d656433aSmrg | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 1235d656433aSmrg} 1236126a8a12Smrg 1237d656433aSmrg# func_lalib_unsafe_p file 1238d656433aSmrg# True iff FILE is a libtool `.la' library or `.lo' object file. 1239d656433aSmrg# This function implements the same check as func_lalib_p without 1240d656433aSmrg# resorting to external programs. To this end, it redirects stdin and 1241d656433aSmrg# closes it afterwards, without saving the original file descriptor. 1242d656433aSmrg# As a safety measure, use it only where a negative result would be 1243d656433aSmrg# fatal anyway. Works if `file' does not exist. 1244d656433aSmrgfunc_lalib_unsafe_p () 1245d656433aSmrg{ 1246d656433aSmrg lalib_p=no 1247d656433aSmrg if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 1248d656433aSmrg for lalib_p_l in 1 2 3 4 1249d656433aSmrg do 1250d656433aSmrg read lalib_p_line 1251d656433aSmrg case "$lalib_p_line" in 1252d656433aSmrg \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 1253d656433aSmrg esac 1254d656433aSmrg done 1255d656433aSmrg exec 0<&5 5<&- 1256d656433aSmrg fi 1257d656433aSmrg test "$lalib_p" = yes 1258d656433aSmrg} 1259126a8a12Smrg 1260d656433aSmrg# func_ltwrapper_script_p file 1261d656433aSmrg# True iff FILE is a libtool wrapper script 1262d656433aSmrg# This function is only a basic sanity check; it will hardly flush out 1263d656433aSmrg# determined imposters. 1264d656433aSmrgfunc_ltwrapper_script_p () 1265d656433aSmrg{ 1266d656433aSmrg func_lalib_p "$1" 1267d656433aSmrg} 1268126a8a12Smrg 1269d656433aSmrg# func_ltwrapper_executable_p file 1270d656433aSmrg# True iff FILE is a libtool wrapper executable 1271d656433aSmrg# This function is only a basic sanity check; it will hardly flush out 1272d656433aSmrg# determined imposters. 1273d656433aSmrgfunc_ltwrapper_executable_p () 1274d656433aSmrg{ 1275d656433aSmrg func_ltwrapper_exec_suffix= 1276d656433aSmrg case $1 in 1277d656433aSmrg *.exe) ;; 1278d656433aSmrg *) func_ltwrapper_exec_suffix=.exe ;; 1279d656433aSmrg esac 1280d656433aSmrg $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 1281d656433aSmrg} 1282126a8a12Smrg 1283d656433aSmrg# func_ltwrapper_scriptname file 1284d656433aSmrg# Assumes file is an ltwrapper_executable 1285d656433aSmrg# uses $file to determine the appropriate filename for a 1286d656433aSmrg# temporary ltwrapper_script. 1287d656433aSmrgfunc_ltwrapper_scriptname () 1288d656433aSmrg{ 12893c15da26Smrg func_dirname_and_basename "$1" "" "." 12903c15da26Smrg func_stripname '' '.exe' "$func_basename_result" 12913c15da26Smrg func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 1292d656433aSmrg} 1293126a8a12Smrg 1294d656433aSmrg# func_ltwrapper_p file 1295d656433aSmrg# True iff FILE is a libtool wrapper script or wrapper executable 1296d656433aSmrg# This function is only a basic sanity check; it will hardly flush out 1297d656433aSmrg# determined imposters. 1298d656433aSmrgfunc_ltwrapper_p () 1299d656433aSmrg{ 1300d656433aSmrg func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 1301d656433aSmrg} 1302126a8a12Smrg 1303126a8a12Smrg 1304d656433aSmrg# func_execute_cmds commands fail_cmd 1305d656433aSmrg# Execute tilde-delimited COMMANDS. 1306d656433aSmrg# If FAIL_CMD is given, eval that upon failure. 1307d656433aSmrg# FAIL_CMD may read-access the current command in variable CMD! 1308d656433aSmrgfunc_execute_cmds () 1309d656433aSmrg{ 1310d656433aSmrg $opt_debug 1311d656433aSmrg save_ifs=$IFS; IFS='~' 1312d656433aSmrg for cmd in $1; do 1313d656433aSmrg IFS=$save_ifs 1314d656433aSmrg eval cmd=\"$cmd\" 1315d656433aSmrg func_show_eval "$cmd" "${2-:}" 1316d656433aSmrg done 1317d656433aSmrg IFS=$save_ifs 1318d656433aSmrg} 1319d656433aSmrg 1320d656433aSmrg 1321d656433aSmrg# func_source file 1322d656433aSmrg# Source FILE, adding directory component if necessary. 1323d656433aSmrg# Note that it is not necessary on cygwin/mingw to append a dot to 1324d656433aSmrg# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 1325d656433aSmrg# behavior happens only for exec(3), not for open(2)! Also, sourcing 1326d656433aSmrg# `FILE.' does not work on cygwin managed mounts. 1327d656433aSmrgfunc_source () 1328d656433aSmrg{ 1329d656433aSmrg $opt_debug 1330d656433aSmrg case $1 in 1331d656433aSmrg */* | *\\*) . "$1" ;; 1332d656433aSmrg *) . "./$1" ;; 1333d656433aSmrg esac 1334d656433aSmrg} 1335d656433aSmrg 1336d656433aSmrg 13373c15da26Smrg# func_resolve_sysroot PATH 13383c15da26Smrg# Replace a leading = in PATH with a sysroot. Store the result into 13393c15da26Smrg# func_resolve_sysroot_result 13403c15da26Smrgfunc_resolve_sysroot () 13413c15da26Smrg{ 13423c15da26Smrg func_resolve_sysroot_result=$1 13433c15da26Smrg case $func_resolve_sysroot_result in 13443c15da26Smrg =*) 13453c15da26Smrg func_stripname '=' '' "$func_resolve_sysroot_result" 13463c15da26Smrg func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 13473c15da26Smrg ;; 13483c15da26Smrg esac 13493c15da26Smrg} 13503c15da26Smrg 13513c15da26Smrg# func_replace_sysroot PATH 13523c15da26Smrg# If PATH begins with the sysroot, replace it with = and 13533c15da26Smrg# store the result into func_replace_sysroot_result. 13543c15da26Smrgfunc_replace_sysroot () 13553c15da26Smrg{ 13563c15da26Smrg case "$lt_sysroot:$1" in 13573c15da26Smrg ?*:"$lt_sysroot"*) 13583c15da26Smrg func_stripname "$lt_sysroot" '' "$1" 13593c15da26Smrg func_replace_sysroot_result="=$func_stripname_result" 13603c15da26Smrg ;; 13613c15da26Smrg *) 13623c15da26Smrg # Including no sysroot. 13633c15da26Smrg func_replace_sysroot_result=$1 13643c15da26Smrg ;; 13653c15da26Smrg esac 13663c15da26Smrg} 13673c15da26Smrg 1368d656433aSmrg# func_infer_tag arg 1369d656433aSmrg# Infer tagged configuration to use if any are available and 1370d656433aSmrg# if one wasn't chosen via the "--tag" command line option. 1371d656433aSmrg# Only attempt this if the compiler in the base compile 1372d656433aSmrg# command doesn't match the default compiler. 1373d656433aSmrg# arg is usually of the form 'gcc ...' 1374d656433aSmrgfunc_infer_tag () 1375d656433aSmrg{ 1376d656433aSmrg $opt_debug 1377d656433aSmrg if test -n "$available_tags" && test -z "$tagname"; then 1378d656433aSmrg CC_quoted= 1379d656433aSmrg for arg in $CC; do 13803c15da26Smrg func_append_quoted CC_quoted "$arg" 1381d656433aSmrg done 1382555991fdSmrg CC_expanded=`func_echo_all $CC` 1383555991fdSmrg CC_quoted_expanded=`func_echo_all $CC_quoted` 1384d656433aSmrg case $@ in 1385d656433aSmrg # Blanks in the command may have been stripped by the calling shell, 1386d656433aSmrg # but not from the CC environment variable when configure was run. 1387555991fdSmrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1388555991fdSmrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 1389d656433aSmrg # Blanks at the start of $base_compile will cause this to fail 1390d656433aSmrg # if we don't check for them as well. 1391d656433aSmrg *) 1392d656433aSmrg for z in $available_tags; do 1393d656433aSmrg if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 1394d656433aSmrg # Evaluate the configuration. 1395d656433aSmrg eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 1396d656433aSmrg CC_quoted= 1397d656433aSmrg for arg in $CC; do 1398d656433aSmrg # Double-quote args containing other shell metacharacters. 13993c15da26Smrg func_append_quoted CC_quoted "$arg" 1400d656433aSmrg done 1401555991fdSmrg CC_expanded=`func_echo_all $CC` 1402555991fdSmrg CC_quoted_expanded=`func_echo_all $CC_quoted` 1403d656433aSmrg case "$@ " in 1404555991fdSmrg " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1405555991fdSmrg " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 1406d656433aSmrg # The compiler in the base compile command matches 1407d656433aSmrg # the one in the tagged configuration. 1408d656433aSmrg # Assume this is the tagged configuration we want. 1409d656433aSmrg tagname=$z 1410d656433aSmrg break 1411126a8a12Smrg ;; 1412126a8a12Smrg esac 1413d656433aSmrg fi 1414d656433aSmrg done 1415d656433aSmrg # If $tagname still isn't set, then no tagged configuration 1416d656433aSmrg # was found and let the user know that the "--tag" command 1417d656433aSmrg # line option must be used. 1418d656433aSmrg if test -z "$tagname"; then 1419d656433aSmrg func_echo "unable to infer tagged configuration" 1420d656433aSmrg func_fatal_error "specify a tag with \`--tag'" 1421d656433aSmrg# else 1422d656433aSmrg# func_verbose "using $tagname tagged configuration" 1423d656433aSmrg fi 1424d656433aSmrg ;; 1425d656433aSmrg esac 1426d656433aSmrg fi 1427d656433aSmrg} 1428d656433aSmrg 1429d656433aSmrg 1430d656433aSmrg 14313c15da26Smrg# func_write_libtool_object output_name pic_name nonpic_name 14323c15da26Smrg# Create a libtool object file (analogous to a ".la" file), 14333c15da26Smrg# but don't create it if we're doing a dry run. 14343c15da26Smrgfunc_write_libtool_object () 14353c15da26Smrg{ 14363c15da26Smrg write_libobj=${1} 14373c15da26Smrg if test "$build_libtool_libs" = yes; then 14383c15da26Smrg write_lobj=\'${2}\' 14393c15da26Smrg else 14403c15da26Smrg write_lobj=none 14413c15da26Smrg fi 14423c15da26Smrg 14433c15da26Smrg if test "$build_old_libs" = yes; then 14443c15da26Smrg write_oldobj=\'${3}\' 14453c15da26Smrg else 14463c15da26Smrg write_oldobj=none 14473c15da26Smrg fi 14483c15da26Smrg 14493c15da26Smrg $opt_dry_run || { 14503c15da26Smrg cat >${write_libobj}T <<EOF 14513c15da26Smrg# $write_libobj - a libtool object file 14523c15da26Smrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 14533c15da26Smrg# 14543c15da26Smrg# Please DO NOT delete this file! 14553c15da26Smrg# It is necessary for linking the library. 14563c15da26Smrg 14573c15da26Smrg# Name of the PIC object. 14583c15da26Smrgpic_object=$write_lobj 14593c15da26Smrg 14603c15da26Smrg# Name of the non-PIC object 14613c15da26Smrgnon_pic_object=$write_oldobj 14623c15da26Smrg 14633c15da26SmrgEOF 14643c15da26Smrg $MV "${write_libobj}T" "${write_libobj}" 14653c15da26Smrg } 14663c15da26Smrg} 14673c15da26Smrg 14683c15da26Smrg 14693c15da26Smrg################################################## 14703c15da26Smrg# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 14713c15da26Smrg################################################## 14723c15da26Smrg 14733c15da26Smrg# func_convert_core_file_wine_to_w32 ARG 14743c15da26Smrg# Helper function used by file name conversion functions when $build is *nix, 14753c15da26Smrg# and $host is mingw, cygwin, or some other w32 environment. Relies on a 14763c15da26Smrg# correctly configured wine environment available, with the winepath program 14773c15da26Smrg# in $build's $PATH. 14783c15da26Smrg# 14793c15da26Smrg# ARG is the $build file name to be converted to w32 format. 14803c15da26Smrg# Result is available in $func_convert_core_file_wine_to_w32_result, and will 14813c15da26Smrg# be empty on error (or when ARG is empty) 14823c15da26Smrgfunc_convert_core_file_wine_to_w32 () 14833c15da26Smrg{ 14843c15da26Smrg $opt_debug 14853c15da26Smrg func_convert_core_file_wine_to_w32_result="$1" 14863c15da26Smrg if test -n "$1"; then 14873c15da26Smrg # Unfortunately, winepath does not exit with a non-zero error code, so we 14883c15da26Smrg # are forced to check the contents of stdout. On the other hand, if the 14893c15da26Smrg # command is not found, the shell will set an exit code of 127 and print 14903c15da26Smrg # *an error message* to stdout. So we must check for both error code of 14913c15da26Smrg # zero AND non-empty stdout, which explains the odd construction: 14923c15da26Smrg func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 14933c15da26Smrg if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then 14943c15da26Smrg func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 14953c15da26Smrg $SED -e "$lt_sed_naive_backslashify"` 14963c15da26Smrg else 14973c15da26Smrg func_convert_core_file_wine_to_w32_result= 14983c15da26Smrg fi 14993c15da26Smrg fi 15003c15da26Smrg} 15013c15da26Smrg# end: func_convert_core_file_wine_to_w32 15023c15da26Smrg 15033c15da26Smrg 15043c15da26Smrg# func_convert_core_path_wine_to_w32 ARG 15053c15da26Smrg# Helper function used by path conversion functions when $build is *nix, and 15063c15da26Smrg# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 15073c15da26Smrg# configured wine environment available, with the winepath program in $build's 15083c15da26Smrg# $PATH. Assumes ARG has no leading or trailing path separator characters. 15093c15da26Smrg# 15103c15da26Smrg# ARG is path to be converted from $build format to win32. 15113c15da26Smrg# Result is available in $func_convert_core_path_wine_to_w32_result. 15123c15da26Smrg# Unconvertible file (directory) names in ARG are skipped; if no directory names 15133c15da26Smrg# are convertible, then the result may be empty. 15143c15da26Smrgfunc_convert_core_path_wine_to_w32 () 15153c15da26Smrg{ 15163c15da26Smrg $opt_debug 15173c15da26Smrg # unfortunately, winepath doesn't convert paths, only file names 15183c15da26Smrg func_convert_core_path_wine_to_w32_result="" 15193c15da26Smrg if test -n "$1"; then 15203c15da26Smrg oldIFS=$IFS 15213c15da26Smrg IFS=: 15223c15da26Smrg for func_convert_core_path_wine_to_w32_f in $1; do 15233c15da26Smrg IFS=$oldIFS 15243c15da26Smrg func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 15253c15da26Smrg if test -n "$func_convert_core_file_wine_to_w32_result" ; then 15263c15da26Smrg if test -z "$func_convert_core_path_wine_to_w32_result"; then 15273c15da26Smrg func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" 15283c15da26Smrg else 15293c15da26Smrg func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 15303c15da26Smrg fi 15313c15da26Smrg fi 15323c15da26Smrg done 15333c15da26Smrg IFS=$oldIFS 15343c15da26Smrg fi 15353c15da26Smrg} 15363c15da26Smrg# end: func_convert_core_path_wine_to_w32 15373c15da26Smrg 15383c15da26Smrg 15393c15da26Smrg# func_cygpath ARGS... 15403c15da26Smrg# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 15413c15da26Smrg# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 15423c15da26Smrg# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 15433c15da26Smrg# (2), returns the Cygwin file name or path in func_cygpath_result (input 15443c15da26Smrg# file name or path is assumed to be in w32 format, as previously converted 15453c15da26Smrg# from $build's *nix or MSYS format). In case (3), returns the w32 file name 15463c15da26Smrg# or path in func_cygpath_result (input file name or path is assumed to be in 15473c15da26Smrg# Cygwin format). Returns an empty string on error. 15483c15da26Smrg# 15493c15da26Smrg# ARGS are passed to cygpath, with the last one being the file name or path to 15503c15da26Smrg# be converted. 15513c15da26Smrg# 15523c15da26Smrg# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 15533c15da26Smrg# environment variable; do not put it in $PATH. 15543c15da26Smrgfunc_cygpath () 15553c15da26Smrg{ 15563c15da26Smrg $opt_debug 15573c15da26Smrg if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 15583c15da26Smrg func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 15593c15da26Smrg if test "$?" -ne 0; then 15603c15da26Smrg # on failure, ensure result is empty 15613c15da26Smrg func_cygpath_result= 15623c15da26Smrg fi 15633c15da26Smrg else 15643c15da26Smrg func_cygpath_result= 15653c15da26Smrg func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" 15663c15da26Smrg fi 15673c15da26Smrg} 15683c15da26Smrg#end: func_cygpath 15693c15da26Smrg 15703c15da26Smrg 15713c15da26Smrg# func_convert_core_msys_to_w32 ARG 15723c15da26Smrg# Convert file name or path ARG from MSYS format to w32 format. Return 15733c15da26Smrg# result in func_convert_core_msys_to_w32_result. 15743c15da26Smrgfunc_convert_core_msys_to_w32 () 15753c15da26Smrg{ 15763c15da26Smrg $opt_debug 15773c15da26Smrg # awkward: cmd appends spaces to result 15783c15da26Smrg func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 15793c15da26Smrg $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 15803c15da26Smrg} 15813c15da26Smrg#end: func_convert_core_msys_to_w32 15823c15da26Smrg 15833c15da26Smrg 15843c15da26Smrg# func_convert_file_check ARG1 ARG2 15853c15da26Smrg# Verify that ARG1 (a file name in $build format) was converted to $host 15863c15da26Smrg# format in ARG2. Otherwise, emit an error message, but continue (resetting 15873c15da26Smrg# func_to_host_file_result to ARG1). 15883c15da26Smrgfunc_convert_file_check () 15893c15da26Smrg{ 15903c15da26Smrg $opt_debug 15913c15da26Smrg if test -z "$2" && test -n "$1" ; then 15923c15da26Smrg func_error "Could not determine host file name corresponding to" 15933c15da26Smrg func_error " \`$1'" 15943c15da26Smrg func_error "Continuing, but uninstalled executables may not work." 15953c15da26Smrg # Fallback: 15963c15da26Smrg func_to_host_file_result="$1" 15973c15da26Smrg fi 15983c15da26Smrg} 15993c15da26Smrg# end func_convert_file_check 16003c15da26Smrg 16013c15da26Smrg 16023c15da26Smrg# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 16033c15da26Smrg# Verify that FROM_PATH (a path in $build format) was converted to $host 16043c15da26Smrg# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 16053c15da26Smrg# func_to_host_file_result to a simplistic fallback value (see below). 16063c15da26Smrgfunc_convert_path_check () 16073c15da26Smrg{ 16083c15da26Smrg $opt_debug 16093c15da26Smrg if test -z "$4" && test -n "$3"; then 16103c15da26Smrg func_error "Could not determine the host path corresponding to" 16113c15da26Smrg func_error " \`$3'" 16123c15da26Smrg func_error "Continuing, but uninstalled executables may not work." 16133c15da26Smrg # Fallback. This is a deliberately simplistic "conversion" and 16143c15da26Smrg # should not be "improved". See libtool.info. 16153c15da26Smrg if test "x$1" != "x$2"; then 16163c15da26Smrg lt_replace_pathsep_chars="s|$1|$2|g" 16173c15da26Smrg func_to_host_path_result=`echo "$3" | 16183c15da26Smrg $SED -e "$lt_replace_pathsep_chars"` 16193c15da26Smrg else 16203c15da26Smrg func_to_host_path_result="$3" 16213c15da26Smrg fi 16223c15da26Smrg fi 16233c15da26Smrg} 16243c15da26Smrg# end func_convert_path_check 16253c15da26Smrg 16263c15da26Smrg 16273c15da26Smrg# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 16283c15da26Smrg# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 16293c15da26Smrg# and appending REPL if ORIG matches BACKPAT. 16303c15da26Smrgfunc_convert_path_front_back_pathsep () 16313c15da26Smrg{ 16323c15da26Smrg $opt_debug 16333c15da26Smrg case $4 in 16343c15da26Smrg $1 ) func_to_host_path_result="$3$func_to_host_path_result" 16353c15da26Smrg ;; 16363c15da26Smrg esac 16373c15da26Smrg case $4 in 16383c15da26Smrg $2 ) func_append func_to_host_path_result "$3" 16393c15da26Smrg ;; 16403c15da26Smrg esac 16413c15da26Smrg} 16423c15da26Smrg# end func_convert_path_front_back_pathsep 16433c15da26Smrg 16443c15da26Smrg 16453c15da26Smrg################################################## 16463c15da26Smrg# $build to $host FILE NAME CONVERSION FUNCTIONS # 16473c15da26Smrg################################################## 16483c15da26Smrg# invoked via `$to_host_file_cmd ARG' 16493c15da26Smrg# 16503c15da26Smrg# In each case, ARG is the path to be converted from $build to $host format. 16513c15da26Smrg# Result will be available in $func_to_host_file_result. 16523c15da26Smrg 16533c15da26Smrg 16543c15da26Smrg# func_to_host_file ARG 16553c15da26Smrg# Converts the file name ARG from $build format to $host format. Return result 16563c15da26Smrg# in func_to_host_file_result. 16573c15da26Smrgfunc_to_host_file () 16583c15da26Smrg{ 16593c15da26Smrg $opt_debug 16603c15da26Smrg $to_host_file_cmd "$1" 16613c15da26Smrg} 16623c15da26Smrg# end func_to_host_file 16633c15da26Smrg 16643c15da26Smrg 16653c15da26Smrg# func_to_tool_file ARG LAZY 16663c15da26Smrg# converts the file name ARG from $build format to toolchain format. Return 16673c15da26Smrg# result in func_to_tool_file_result. If the conversion in use is listed 16683c15da26Smrg# in (the comma separated) LAZY, no conversion takes place. 16693c15da26Smrgfunc_to_tool_file () 16703c15da26Smrg{ 16713c15da26Smrg $opt_debug 16723c15da26Smrg case ,$2, in 16733c15da26Smrg *,"$to_tool_file_cmd",*) 16743c15da26Smrg func_to_tool_file_result=$1 16753c15da26Smrg ;; 16763c15da26Smrg *) 16773c15da26Smrg $to_tool_file_cmd "$1" 16783c15da26Smrg func_to_tool_file_result=$func_to_host_file_result 16793c15da26Smrg ;; 16803c15da26Smrg esac 16813c15da26Smrg} 16823c15da26Smrg# end func_to_tool_file 16833c15da26Smrg 16843c15da26Smrg 16853c15da26Smrg# func_convert_file_noop ARG 16863c15da26Smrg# Copy ARG to func_to_host_file_result. 16873c15da26Smrgfunc_convert_file_noop () 16883c15da26Smrg{ 16893c15da26Smrg func_to_host_file_result="$1" 16903c15da26Smrg} 16913c15da26Smrg# end func_convert_file_noop 16923c15da26Smrg 16933c15da26Smrg 16943c15da26Smrg# func_convert_file_msys_to_w32 ARG 16953c15da26Smrg# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 16963c15da26Smrg# conversion to w32 is not available inside the cwrapper. Returns result in 16973c15da26Smrg# func_to_host_file_result. 16983c15da26Smrgfunc_convert_file_msys_to_w32 () 16993c15da26Smrg{ 17003c15da26Smrg $opt_debug 17013c15da26Smrg func_to_host_file_result="$1" 17023c15da26Smrg if test -n "$1"; then 17033c15da26Smrg func_convert_core_msys_to_w32 "$1" 17043c15da26Smrg func_to_host_file_result="$func_convert_core_msys_to_w32_result" 17053c15da26Smrg fi 17063c15da26Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17073c15da26Smrg} 17083c15da26Smrg# end func_convert_file_msys_to_w32 17093c15da26Smrg 17103c15da26Smrg 17113c15da26Smrg# func_convert_file_cygwin_to_w32 ARG 17123c15da26Smrg# Convert file name ARG from Cygwin to w32 format. Returns result in 17133c15da26Smrg# func_to_host_file_result. 17143c15da26Smrgfunc_convert_file_cygwin_to_w32 () 17153c15da26Smrg{ 17163c15da26Smrg $opt_debug 17173c15da26Smrg func_to_host_file_result="$1" 17183c15da26Smrg if test -n "$1"; then 17193c15da26Smrg # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 17203c15da26Smrg # LT_CYGPATH in this case. 17213c15da26Smrg func_to_host_file_result=`cygpath -m "$1"` 17223c15da26Smrg fi 17233c15da26Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17243c15da26Smrg} 17253c15da26Smrg# end func_convert_file_cygwin_to_w32 17263c15da26Smrg 17273c15da26Smrg 17283c15da26Smrg# func_convert_file_nix_to_w32 ARG 17293c15da26Smrg# Convert file name ARG from *nix to w32 format. Requires a wine environment 17303c15da26Smrg# and a working winepath. Returns result in func_to_host_file_result. 17313c15da26Smrgfunc_convert_file_nix_to_w32 () 17323c15da26Smrg{ 17333c15da26Smrg $opt_debug 17343c15da26Smrg func_to_host_file_result="$1" 17353c15da26Smrg if test -n "$1"; then 17363c15da26Smrg func_convert_core_file_wine_to_w32 "$1" 17373c15da26Smrg func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" 17383c15da26Smrg fi 17393c15da26Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17403c15da26Smrg} 17413c15da26Smrg# end func_convert_file_nix_to_w32 17423c15da26Smrg 17433c15da26Smrg 17443c15da26Smrg# func_convert_file_msys_to_cygwin ARG 17453c15da26Smrg# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 17463c15da26Smrg# Returns result in func_to_host_file_result. 17473c15da26Smrgfunc_convert_file_msys_to_cygwin () 17483c15da26Smrg{ 17493c15da26Smrg $opt_debug 17503c15da26Smrg func_to_host_file_result="$1" 17513c15da26Smrg if test -n "$1"; then 17523c15da26Smrg func_convert_core_msys_to_w32 "$1" 17533c15da26Smrg func_cygpath -u "$func_convert_core_msys_to_w32_result" 17543c15da26Smrg func_to_host_file_result="$func_cygpath_result" 17553c15da26Smrg fi 17563c15da26Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17573c15da26Smrg} 17583c15da26Smrg# end func_convert_file_msys_to_cygwin 17593c15da26Smrg 17603c15da26Smrg 17613c15da26Smrg# func_convert_file_nix_to_cygwin ARG 17623c15da26Smrg# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 17633c15da26Smrg# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 17643c15da26Smrg# in func_to_host_file_result. 17653c15da26Smrgfunc_convert_file_nix_to_cygwin () 17663c15da26Smrg{ 17673c15da26Smrg $opt_debug 17683c15da26Smrg func_to_host_file_result="$1" 17693c15da26Smrg if test -n "$1"; then 17703c15da26Smrg # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 17713c15da26Smrg func_convert_core_file_wine_to_w32 "$1" 17723c15da26Smrg func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 17733c15da26Smrg func_to_host_file_result="$func_cygpath_result" 17743c15da26Smrg fi 17753c15da26Smrg func_convert_file_check "$1" "$func_to_host_file_result" 17763c15da26Smrg} 17773c15da26Smrg# end func_convert_file_nix_to_cygwin 17783c15da26Smrg 17793c15da26Smrg 17803c15da26Smrg############################################# 17813c15da26Smrg# $build to $host PATH CONVERSION FUNCTIONS # 17823c15da26Smrg############################################# 17833c15da26Smrg# invoked via `$to_host_path_cmd ARG' 17843c15da26Smrg# 17853c15da26Smrg# In each case, ARG is the path to be converted from $build to $host format. 17863c15da26Smrg# The result will be available in $func_to_host_path_result. 17873c15da26Smrg# 17883c15da26Smrg# Path separators are also converted from $build format to $host format. If 17893c15da26Smrg# ARG begins or ends with a path separator character, it is preserved (but 17903c15da26Smrg# converted to $host format) on output. 17913c15da26Smrg# 17923c15da26Smrg# All path conversion functions are named using the following convention: 17933c15da26Smrg# file name conversion function : func_convert_file_X_to_Y () 17943c15da26Smrg# path conversion function : func_convert_path_X_to_Y () 17953c15da26Smrg# where, for any given $build/$host combination the 'X_to_Y' value is the 17963c15da26Smrg# same. If conversion functions are added for new $build/$host combinations, 17973c15da26Smrg# the two new functions must follow this pattern, or func_init_to_host_path_cmd 17983c15da26Smrg# will break. 17993c15da26Smrg 18003c15da26Smrg 18013c15da26Smrg# func_init_to_host_path_cmd 18023c15da26Smrg# Ensures that function "pointer" variable $to_host_path_cmd is set to the 18033c15da26Smrg# appropriate value, based on the value of $to_host_file_cmd. 18043c15da26Smrgto_host_path_cmd= 18053c15da26Smrgfunc_init_to_host_path_cmd () 18063c15da26Smrg{ 18073c15da26Smrg $opt_debug 18083c15da26Smrg if test -z "$to_host_path_cmd"; then 18093c15da26Smrg func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 18103c15da26Smrg to_host_path_cmd="func_convert_path_${func_stripname_result}" 18113c15da26Smrg fi 18123c15da26Smrg} 18133c15da26Smrg 18143c15da26Smrg 18153c15da26Smrg# func_to_host_path ARG 18163c15da26Smrg# Converts the path ARG from $build format to $host format. Return result 18173c15da26Smrg# in func_to_host_path_result. 18183c15da26Smrgfunc_to_host_path () 18193c15da26Smrg{ 18203c15da26Smrg $opt_debug 18213c15da26Smrg func_init_to_host_path_cmd 18223c15da26Smrg $to_host_path_cmd "$1" 18233c15da26Smrg} 18243c15da26Smrg# end func_to_host_path 18253c15da26Smrg 18263c15da26Smrg 18273c15da26Smrg# func_convert_path_noop ARG 18283c15da26Smrg# Copy ARG to func_to_host_path_result. 18293c15da26Smrgfunc_convert_path_noop () 18303c15da26Smrg{ 18313c15da26Smrg func_to_host_path_result="$1" 18323c15da26Smrg} 18333c15da26Smrg# end func_convert_path_noop 18343c15da26Smrg 18353c15da26Smrg 18363c15da26Smrg# func_convert_path_msys_to_w32 ARG 18373c15da26Smrg# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 18383c15da26Smrg# conversion to w32 is not available inside the cwrapper. Returns result in 18393c15da26Smrg# func_to_host_path_result. 18403c15da26Smrgfunc_convert_path_msys_to_w32 () 1841d656433aSmrg{ 18423c15da26Smrg $opt_debug 18433c15da26Smrg func_to_host_path_result="$1" 18443c15da26Smrg if test -n "$1"; then 18453c15da26Smrg # Remove leading and trailing path separator characters from ARG. MSYS 18463c15da26Smrg # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 18473c15da26Smrg # and winepath ignores them completely. 18483c15da26Smrg func_stripname : : "$1" 18493c15da26Smrg func_to_host_path_tmp1=$func_stripname_result 18503c15da26Smrg func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 18513c15da26Smrg func_to_host_path_result="$func_convert_core_msys_to_w32_result" 18523c15da26Smrg func_convert_path_check : ";" \ 18533c15da26Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 18543c15da26Smrg func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18553c15da26Smrg fi 18563c15da26Smrg} 18573c15da26Smrg# end func_convert_path_msys_to_w32 1858d656433aSmrg 1859d656433aSmrg 18603c15da26Smrg# func_convert_path_cygwin_to_w32 ARG 18613c15da26Smrg# Convert path ARG from Cygwin to w32 format. Returns result in 18623c15da26Smrg# func_to_host_file_result. 18633c15da26Smrgfunc_convert_path_cygwin_to_w32 () 18643c15da26Smrg{ 18653c15da26Smrg $opt_debug 18663c15da26Smrg func_to_host_path_result="$1" 18673c15da26Smrg if test -n "$1"; then 18683c15da26Smrg # See func_convert_path_msys_to_w32: 18693c15da26Smrg func_stripname : : "$1" 18703c15da26Smrg func_to_host_path_tmp1=$func_stripname_result 18713c15da26Smrg func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 18723c15da26Smrg func_convert_path_check : ";" \ 18733c15da26Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 18743c15da26Smrg func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18753c15da26Smrg fi 18763c15da26Smrg} 18773c15da26Smrg# end func_convert_path_cygwin_to_w32 1878d656433aSmrg 1879d656433aSmrg 18803c15da26Smrg# func_convert_path_nix_to_w32 ARG 18813c15da26Smrg# Convert path ARG from *nix to w32 format. Requires a wine environment and 18823c15da26Smrg# a working winepath. Returns result in func_to_host_file_result. 18833c15da26Smrgfunc_convert_path_nix_to_w32 () 18843c15da26Smrg{ 18853c15da26Smrg $opt_debug 18863c15da26Smrg func_to_host_path_result="$1" 18873c15da26Smrg if test -n "$1"; then 18883c15da26Smrg # See func_convert_path_msys_to_w32: 18893c15da26Smrg func_stripname : : "$1" 18903c15da26Smrg func_to_host_path_tmp1=$func_stripname_result 18913c15da26Smrg func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 18923c15da26Smrg func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" 18933c15da26Smrg func_convert_path_check : ";" \ 18943c15da26Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 18953c15da26Smrg func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18963c15da26Smrg fi 18973c15da26Smrg} 18983c15da26Smrg# end func_convert_path_nix_to_w32 1899d656433aSmrg 19003c15da26Smrg 19013c15da26Smrg# func_convert_path_msys_to_cygwin ARG 19023c15da26Smrg# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 19033c15da26Smrg# Returns result in func_to_host_file_result. 19043c15da26Smrgfunc_convert_path_msys_to_cygwin () 19053c15da26Smrg{ 19063c15da26Smrg $opt_debug 19073c15da26Smrg func_to_host_path_result="$1" 19083c15da26Smrg if test -n "$1"; then 19093c15da26Smrg # See func_convert_path_msys_to_w32: 19103c15da26Smrg func_stripname : : "$1" 19113c15da26Smrg func_to_host_path_tmp1=$func_stripname_result 19123c15da26Smrg func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 19133c15da26Smrg func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 19143c15da26Smrg func_to_host_path_result="$func_cygpath_result" 19153c15da26Smrg func_convert_path_check : : \ 19163c15da26Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 19173c15da26Smrg func_convert_path_front_back_pathsep ":*" "*:" : "$1" 19183c15da26Smrg fi 19193c15da26Smrg} 19203c15da26Smrg# end func_convert_path_msys_to_cygwin 19213c15da26Smrg 19223c15da26Smrg 19233c15da26Smrg# func_convert_path_nix_to_cygwin ARG 19243c15da26Smrg# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 19253c15da26Smrg# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 19263c15da26Smrg# func_to_host_file_result. 19273c15da26Smrgfunc_convert_path_nix_to_cygwin () 19283c15da26Smrg{ 19293c15da26Smrg $opt_debug 19303c15da26Smrg func_to_host_path_result="$1" 19313c15da26Smrg if test -n "$1"; then 19323c15da26Smrg # Remove leading and trailing path separator characters from 19333c15da26Smrg # ARG. msys behavior is inconsistent here, cygpath turns them 19343c15da26Smrg # into '.;' and ';.', and winepath ignores them completely. 19353c15da26Smrg func_stripname : : "$1" 19363c15da26Smrg func_to_host_path_tmp1=$func_stripname_result 19373c15da26Smrg func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 19383c15da26Smrg func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 19393c15da26Smrg func_to_host_path_result="$func_cygpath_result" 19403c15da26Smrg func_convert_path_check : : \ 19413c15da26Smrg "$func_to_host_path_tmp1" "$func_to_host_path_result" 19423c15da26Smrg func_convert_path_front_back_pathsep ":*" "*:" : "$1" 19433c15da26Smrg fi 1944d656433aSmrg} 19453c15da26Smrg# end func_convert_path_nix_to_cygwin 19463c15da26Smrg 1947d656433aSmrg 1948d656433aSmrg# func_mode_compile arg... 1949d656433aSmrgfunc_mode_compile () 1950d656433aSmrg{ 1951d656433aSmrg $opt_debug 1952d656433aSmrg # Get the compilation command and the source file. 1953d656433aSmrg base_compile= 1954d656433aSmrg srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1955d656433aSmrg suppress_opt=yes 1956d656433aSmrg suppress_output= 1957d656433aSmrg arg_mode=normal 1958d656433aSmrg libobj= 1959d656433aSmrg later= 1960d656433aSmrg pie_flag= 1961d656433aSmrg 1962d656433aSmrg for arg 1963d656433aSmrg do 1964d656433aSmrg case $arg_mode in 1965d656433aSmrg arg ) 1966d656433aSmrg # do not "continue". Instead, add this to base_compile 1967d656433aSmrg lastarg="$arg" 1968d656433aSmrg arg_mode=normal 1969d656433aSmrg ;; 1970d656433aSmrg 1971d656433aSmrg target ) 1972d656433aSmrg libobj="$arg" 1973d656433aSmrg arg_mode=normal 1974d656433aSmrg continue 1975d656433aSmrg ;; 1976d656433aSmrg 1977d656433aSmrg normal ) 1978d656433aSmrg # Accept any command-line options. 1979d656433aSmrg case $arg in 1980d656433aSmrg -o) 1981d656433aSmrg test -n "$libobj" && \ 1982d656433aSmrg func_fatal_error "you cannot specify \`-o' more than once" 1983d656433aSmrg arg_mode=target 1984d656433aSmrg continue 1985d656433aSmrg ;; 1986d656433aSmrg 1987d656433aSmrg -pie | -fpie | -fPIE) 19883c15da26Smrg func_append pie_flag " $arg" 1989d656433aSmrg continue 1990d656433aSmrg ;; 1991d656433aSmrg 1992d656433aSmrg -shared | -static | -prefer-pic | -prefer-non-pic) 19933c15da26Smrg func_append later " $arg" 1994d656433aSmrg continue 1995d656433aSmrg ;; 1996d656433aSmrg 1997d656433aSmrg -no-suppress) 1998d656433aSmrg suppress_opt=no 1999d656433aSmrg continue 2000d656433aSmrg ;; 2001d656433aSmrg 2002d656433aSmrg -Xcompiler) 2003d656433aSmrg arg_mode=arg # the next one goes into the "base_compile" arg list 2004d656433aSmrg continue # The current "srcfile" will either be retained or 2005d656433aSmrg ;; # replaced later. I would guess that would be a bug. 2006d656433aSmrg 2007d656433aSmrg -Wc,*) 2008d656433aSmrg func_stripname '-Wc,' '' "$arg" 2009d656433aSmrg args=$func_stripname_result 2010d656433aSmrg lastarg= 2011d656433aSmrg save_ifs="$IFS"; IFS=',' 2012d656433aSmrg for arg in $args; do 2013d656433aSmrg IFS="$save_ifs" 20143c15da26Smrg func_append_quoted lastarg "$arg" 2015126a8a12Smrg done 2016126a8a12Smrg IFS="$save_ifs" 2017d656433aSmrg func_stripname ' ' '' "$lastarg" 2018d656433aSmrg lastarg=$func_stripname_result 2019126a8a12Smrg 2020126a8a12Smrg # Add the arguments to base_compile. 20213c15da26Smrg func_append base_compile " $lastarg" 2022126a8a12Smrg continue 2023126a8a12Smrg ;; 2024126a8a12Smrg 2025d656433aSmrg *) 2026126a8a12Smrg # Accept the current argument as the source file. 2027126a8a12Smrg # The previous "srcfile" becomes the current argument. 2028126a8a12Smrg # 2029126a8a12Smrg lastarg="$srcfile" 2030126a8a12Smrg srcfile="$arg" 2031126a8a12Smrg ;; 2032126a8a12Smrg esac # case $arg 2033126a8a12Smrg ;; 2034126a8a12Smrg esac # case $arg_mode 2035126a8a12Smrg 2036126a8a12Smrg # Aesthetically quote the previous argument. 20373c15da26Smrg func_append_quoted base_compile "$lastarg" 2038126a8a12Smrg done # for arg 2039126a8a12Smrg 2040126a8a12Smrg case $arg_mode in 2041126a8a12Smrg arg) 2042d656433aSmrg func_fatal_error "you must specify an argument for -Xcompile" 2043126a8a12Smrg ;; 2044126a8a12Smrg target) 2045d656433aSmrg func_fatal_error "you must specify a target with \`-o'" 2046126a8a12Smrg ;; 2047126a8a12Smrg *) 2048126a8a12Smrg # Get the name of the library object. 2049d656433aSmrg test -z "$libobj" && { 2050d656433aSmrg func_basename "$srcfile" 2051d656433aSmrg libobj="$func_basename_result" 2052d656433aSmrg } 2053126a8a12Smrg ;; 2054126a8a12Smrg esac 2055126a8a12Smrg 2056126a8a12Smrg # Recognize several different file suffixes. 2057126a8a12Smrg # If the user specifies -o file.o, it is replaced with file.lo 2058126a8a12Smrg case $libobj in 2059d656433aSmrg *.[cCFSifmso] | \ 2060d656433aSmrg *.ada | *.adb | *.ads | *.asm | \ 2061d656433aSmrg *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 2062555991fdSmrg *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) 2063d656433aSmrg func_xform "$libobj" 2064d656433aSmrg libobj=$func_xform_result 2065d656433aSmrg ;; 2066126a8a12Smrg esac 2067126a8a12Smrg 2068126a8a12Smrg case $libobj in 2069d656433aSmrg *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 2070126a8a12Smrg *) 2071d656433aSmrg func_fatal_error "cannot determine name of library object from \`$libobj'" 2072126a8a12Smrg ;; 2073126a8a12Smrg esac 2074126a8a12Smrg 2075126a8a12Smrg func_infer_tag $base_compile 2076126a8a12Smrg 2077126a8a12Smrg for arg in $later; do 2078126a8a12Smrg case $arg in 2079d656433aSmrg -shared) 2080d656433aSmrg test "$build_libtool_libs" != yes && \ 2081d656433aSmrg func_fatal_configuration "can not build a shared library" 2082d656433aSmrg build_old_libs=no 2083d656433aSmrg continue 2084d656433aSmrg ;; 2085d656433aSmrg 2086126a8a12Smrg -static) 2087d656433aSmrg build_libtool_libs=no 2088126a8a12Smrg build_old_libs=yes 2089126a8a12Smrg continue 2090126a8a12Smrg ;; 2091126a8a12Smrg 2092126a8a12Smrg -prefer-pic) 2093126a8a12Smrg pic_mode=yes 2094126a8a12Smrg continue 2095126a8a12Smrg ;; 2096126a8a12Smrg 2097126a8a12Smrg -prefer-non-pic) 2098126a8a12Smrg pic_mode=no 2099126a8a12Smrg continue 2100126a8a12Smrg ;; 2101126a8a12Smrg esac 2102126a8a12Smrg done 2103126a8a12Smrg 2104d656433aSmrg func_quote_for_eval "$libobj" 2105d656433aSmrg test "X$libobj" != "X$func_quote_for_eval_result" \ 2106d656433aSmrg && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 2107d656433aSmrg && func_warning "libobj name \`$libobj' may not contain shell special characters." 2108d656433aSmrg func_dirname_and_basename "$obj" "/" "" 2109d656433aSmrg objname="$func_basename_result" 2110d656433aSmrg xdir="$func_dirname_result" 2111126a8a12Smrg lobj=${xdir}$objdir/$objname 2112126a8a12Smrg 2113d656433aSmrg test -z "$base_compile" && \ 2114d656433aSmrg func_fatal_help "you must specify a compilation command" 2115126a8a12Smrg 2116126a8a12Smrg # Delete any leftover library objects. 2117126a8a12Smrg if test "$build_old_libs" = yes; then 2118126a8a12Smrg removelist="$obj $lobj $libobj ${libobj}T" 2119126a8a12Smrg else 2120126a8a12Smrg removelist="$lobj $libobj ${libobj}T" 2121126a8a12Smrg fi 2122126a8a12Smrg 2123126a8a12Smrg # On Cygwin there's no "real" PIC flag so we must build both object types 2124126a8a12Smrg case $host_os in 2125d656433aSmrg cygwin* | mingw* | pw32* | os2* | cegcc*) 2126126a8a12Smrg pic_mode=default 2127126a8a12Smrg ;; 2128126a8a12Smrg esac 2129126a8a12Smrg if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 2130126a8a12Smrg # non-PIC code in shared libraries is not supported 2131126a8a12Smrg pic_mode=default 2132126a8a12Smrg fi 2133126a8a12Smrg 2134126a8a12Smrg # Calculate the filename of the output object if compiler does 2135126a8a12Smrg # not support -o with -c 2136126a8a12Smrg if test "$compiler_c_o" = no; then 2137555991fdSmrg output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 2138126a8a12Smrg lockfile="$output_obj.lock" 2139126a8a12Smrg else 2140126a8a12Smrg output_obj= 2141126a8a12Smrg need_locks=no 2142126a8a12Smrg lockfile= 2143126a8a12Smrg fi 2144126a8a12Smrg 2145126a8a12Smrg # Lock this critical section if it is needed 2146126a8a12Smrg # We use this script file to make the link, it avoids creating a new file 2147126a8a12Smrg if test "$need_locks" = yes; then 2148d656433aSmrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 2149d656433aSmrg func_echo "Waiting for $lockfile to be removed" 2150126a8a12Smrg sleep 2 2151126a8a12Smrg done 2152126a8a12Smrg elif test "$need_locks" = warn; then 2153126a8a12Smrg if test -f "$lockfile"; then 2154d656433aSmrg $ECHO "\ 2155126a8a12Smrg*** ERROR, $lockfile exists and contains: 2156126a8a12Smrg`cat $lockfile 2>/dev/null` 2157126a8a12Smrg 2158126a8a12SmrgThis indicates that another process is trying to use the same 2159126a8a12Smrgtemporary object file, and libtool could not work around it because 2160126a8a12Smrgyour compiler does not support \`-c' and \`-o' together. If you 2161126a8a12Smrgrepeat this compilation, it may succeed, by chance, but you had better 2162126a8a12Smrgavoid parallel builds (make -j) in this platform, or get a better 2163126a8a12Smrgcompiler." 2164126a8a12Smrg 2165d656433aSmrg $opt_dry_run || $RM $removelist 2166126a8a12Smrg exit $EXIT_FAILURE 2167126a8a12Smrg fi 21683c15da26Smrg func_append removelist " $output_obj" 2169d656433aSmrg $ECHO "$srcfile" > "$lockfile" 2170126a8a12Smrg fi 2171126a8a12Smrg 2172d656433aSmrg $opt_dry_run || $RM $removelist 21733c15da26Smrg func_append removelist " $lockfile" 2174d656433aSmrg trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 2175d656433aSmrg 21763c15da26Smrg func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 21773c15da26Smrg srcfile=$func_to_tool_file_result 2178d656433aSmrg func_quote_for_eval "$srcfile" 2179d656433aSmrg qsrcfile=$func_quote_for_eval_result 2180126a8a12Smrg 2181126a8a12Smrg # Only build a PIC object if we are building libtool libraries. 2182126a8a12Smrg if test "$build_libtool_libs" = yes; then 2183126a8a12Smrg # Without this assignment, base_compile gets emptied. 2184126a8a12Smrg fbsd_hideous_sh_bug=$base_compile 2185126a8a12Smrg 2186126a8a12Smrg if test "$pic_mode" != no; then 2187126a8a12Smrg command="$base_compile $qsrcfile $pic_flag" 2188126a8a12Smrg else 2189126a8a12Smrg # Don't build PIC code 2190126a8a12Smrg command="$base_compile $qsrcfile" 2191126a8a12Smrg fi 2192126a8a12Smrg 2193d656433aSmrg func_mkdir_p "$xdir$objdir" 2194126a8a12Smrg 2195126a8a12Smrg if test -z "$output_obj"; then 2196126a8a12Smrg # Place PIC objects in $objdir 21973c15da26Smrg func_append command " -o $lobj" 2198126a8a12Smrg fi 2199126a8a12Smrg 2200d656433aSmrg func_show_eval_locale "$command" \ 2201d656433aSmrg 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 2202126a8a12Smrg 2203126a8a12Smrg if test "$need_locks" = warn && 2204126a8a12Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2205d656433aSmrg $ECHO "\ 2206126a8a12Smrg*** ERROR, $lockfile contains: 2207126a8a12Smrg`cat $lockfile 2>/dev/null` 2208126a8a12Smrg 2209126a8a12Smrgbut it should contain: 2210126a8a12Smrg$srcfile 2211126a8a12Smrg 2212126a8a12SmrgThis indicates that another process is trying to use the same 2213126a8a12Smrgtemporary object file, and libtool could not work around it because 2214126a8a12Smrgyour compiler does not support \`-c' and \`-o' together. If you 2215126a8a12Smrgrepeat this compilation, it may succeed, by chance, but you had better 2216126a8a12Smrgavoid parallel builds (make -j) in this platform, or get a better 2217126a8a12Smrgcompiler." 2218126a8a12Smrg 2219d656433aSmrg $opt_dry_run || $RM $removelist 2220126a8a12Smrg exit $EXIT_FAILURE 2221126a8a12Smrg fi 2222126a8a12Smrg 2223126a8a12Smrg # Just move the object if needed, then go on to compile the next one 2224126a8a12Smrg if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 2225d656433aSmrg func_show_eval '$MV "$output_obj" "$lobj"' \ 2226d656433aSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2227126a8a12Smrg fi 2228126a8a12Smrg 2229126a8a12Smrg # Allow error messages only from the first compilation. 2230126a8a12Smrg if test "$suppress_opt" = yes; then 2231d656433aSmrg suppress_output=' >/dev/null 2>&1' 2232126a8a12Smrg fi 2233126a8a12Smrg fi 2234126a8a12Smrg 2235126a8a12Smrg # Only build a position-dependent object if we build old libraries. 2236126a8a12Smrg if test "$build_old_libs" = yes; then 2237126a8a12Smrg if test "$pic_mode" != yes; then 2238126a8a12Smrg # Don't build PIC code 2239d656433aSmrg command="$base_compile $qsrcfile$pie_flag" 2240126a8a12Smrg else 2241126a8a12Smrg command="$base_compile $qsrcfile $pic_flag" 2242126a8a12Smrg fi 2243126a8a12Smrg if test "$compiler_c_o" = yes; then 22443c15da26Smrg func_append command " -o $obj" 2245126a8a12Smrg fi 2246126a8a12Smrg 2247126a8a12Smrg # Suppress compiler output if we already did a PIC compilation. 22483c15da26Smrg func_append command "$suppress_output" 2249d656433aSmrg func_show_eval_locale "$command" \ 2250d656433aSmrg '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 2251126a8a12Smrg 2252126a8a12Smrg if test "$need_locks" = warn && 2253126a8a12Smrg test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2254d656433aSmrg $ECHO "\ 2255126a8a12Smrg*** ERROR, $lockfile contains: 2256126a8a12Smrg`cat $lockfile 2>/dev/null` 2257126a8a12Smrg 2258126a8a12Smrgbut it should contain: 2259126a8a12Smrg$srcfile 2260126a8a12Smrg 2261126a8a12SmrgThis indicates that another process is trying to use the same 2262126a8a12Smrgtemporary object file, and libtool could not work around it because 2263126a8a12Smrgyour compiler does not support \`-c' and \`-o' together. If you 2264126a8a12Smrgrepeat this compilation, it may succeed, by chance, but you had better 2265126a8a12Smrgavoid parallel builds (make -j) in this platform, or get a better 2266126a8a12Smrgcompiler." 2267126a8a12Smrg 2268d656433aSmrg $opt_dry_run || $RM $removelist 2269126a8a12Smrg exit $EXIT_FAILURE 2270126a8a12Smrg fi 2271126a8a12Smrg 2272126a8a12Smrg # Just move the object if needed 2273126a8a12Smrg if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 2274d656433aSmrg func_show_eval '$MV "$output_obj" "$obj"' \ 2275d656433aSmrg 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2276126a8a12Smrg fi 2277126a8a12Smrg fi 2278126a8a12Smrg 2279d656433aSmrg $opt_dry_run || { 2280d656433aSmrg func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 2281126a8a12Smrg 2282d656433aSmrg # Unlock the critical section if it was locked 2283d656433aSmrg if test "$need_locks" != no; then 2284d656433aSmrg removelist=$lockfile 2285d656433aSmrg $RM "$lockfile" 2286d656433aSmrg fi 2287d656433aSmrg } 2288126a8a12Smrg 2289126a8a12Smrg exit $EXIT_SUCCESS 2290d656433aSmrg} 2291126a8a12Smrg 2292d656433aSmrg$opt_help || { 22933c15da26Smrg test "$opt_mode" = compile && func_mode_compile ${1+"$@"} 2294d656433aSmrg} 2295126a8a12Smrg 2296d656433aSmrgfunc_mode_help () 2297d656433aSmrg{ 2298d656433aSmrg # We need to display help for each of the modes. 22993c15da26Smrg case $opt_mode in 2300d656433aSmrg "") 2301d656433aSmrg # Generic help is extracted from the usage comments 2302d656433aSmrg # at the start of this file. 2303d656433aSmrg func_help 2304d656433aSmrg ;; 2305126a8a12Smrg 2306d656433aSmrg clean) 2307d656433aSmrg $ECHO \ 2308d656433aSmrg"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 2309126a8a12Smrg 2310d656433aSmrgRemove files from the build directory. 2311126a8a12Smrg 2312d656433aSmrgRM is the name of the program to use to delete files associated with each FILE 2313d656433aSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2314d656433aSmrgto RM. 2315126a8a12Smrg 2316d656433aSmrgIf FILE is a libtool library, object or program, all the files associated 2317d656433aSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM." 2318d656433aSmrg ;; 2319126a8a12Smrg 2320d656433aSmrg compile) 2321d656433aSmrg $ECHO \ 2322d656433aSmrg"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 2323126a8a12Smrg 2324d656433aSmrgCompile a source file into a libtool library object. 2325126a8a12Smrg 2326d656433aSmrgThis mode accepts the following additional options: 2327126a8a12Smrg 2328d656433aSmrg -o OUTPUT-FILE set the output file name to OUTPUT-FILE 2329d656433aSmrg -no-suppress do not suppress compiler output for multiple passes 2330555991fdSmrg -prefer-pic try to build PIC objects only 2331555991fdSmrg -prefer-non-pic try to build non-PIC objects only 2332d656433aSmrg -shared do not build a \`.o' file suitable for static linking 2333d656433aSmrg -static only build a \`.o' file suitable for static linking 2334555991fdSmrg -Wc,FLAG pass FLAG directly to the compiler 2335126a8a12Smrg 2336d656433aSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 2337d656433aSmrgfrom the given SOURCEFILE. 2338126a8a12Smrg 2339d656433aSmrgThe output file name is determined by removing the directory component from 2340d656433aSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the 2341d656433aSmrglibrary object suffix, \`.lo'." 2342d656433aSmrg ;; 2343126a8a12Smrg 2344d656433aSmrg execute) 2345d656433aSmrg $ECHO \ 2346d656433aSmrg"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 2347126a8a12Smrg 2348d656433aSmrgAutomatically set library path, then run a program. 2349126a8a12Smrg 2350d656433aSmrgThis mode accepts the following additional options: 2351126a8a12Smrg 2352d656433aSmrg -dlopen FILE add the directory containing FILE to the library path 2353126a8a12Smrg 2354d656433aSmrgThis mode sets the library path environment variable according to \`-dlopen' 2355d656433aSmrgflags. 2356126a8a12Smrg 2357d656433aSmrgIf any of the ARGS are libtool executable wrappers, then they are translated 2358d656433aSmrginto their corresponding uninstalled binary, and any of their required library 2359d656433aSmrgdirectories are added to the library path. 2360126a8a12Smrg 2361d656433aSmrgThen, COMMAND is executed, with ARGS as arguments." 2362d656433aSmrg ;; 2363126a8a12Smrg 2364d656433aSmrg finish) 2365d656433aSmrg $ECHO \ 2366d656433aSmrg"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 2367126a8a12Smrg 2368d656433aSmrgComplete the installation of libtool libraries. 2369126a8a12Smrg 2370d656433aSmrgEach LIBDIR is a directory that contains libtool libraries. 2371126a8a12Smrg 2372d656433aSmrgThe commands that this mode executes may require superuser privileges. Use 2373d656433aSmrgthe \`--dry-run' option if you just want to see what would be executed." 2374d656433aSmrg ;; 2375126a8a12Smrg 2376d656433aSmrg install) 2377d656433aSmrg $ECHO \ 2378d656433aSmrg"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 2379126a8a12Smrg 2380d656433aSmrgInstall executables or libraries. 2381126a8a12Smrg 2382d656433aSmrgINSTALL-COMMAND is the installation command. The first component should be 2383d656433aSmrgeither the \`install' or \`cp' program. 2384126a8a12Smrg 2385d656433aSmrgThe following components of INSTALL-COMMAND are treated specially: 2386126a8a12Smrg 2387555991fdSmrg -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 2388126a8a12Smrg 2389d656433aSmrgThe rest of the components are interpreted as arguments to that command (only 2390d656433aSmrgBSD-compatible install options are recognized)." 2391d656433aSmrg ;; 2392126a8a12Smrg 2393d656433aSmrg link) 2394d656433aSmrg $ECHO \ 2395d656433aSmrg"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 2396126a8a12Smrg 2397d656433aSmrgLink object files or libraries together to form another library, or to 2398d656433aSmrgcreate an executable program. 2399126a8a12Smrg 2400d656433aSmrgLINK-COMMAND is a command using the C compiler that you would use to create 2401d656433aSmrga program from several object files. 2402126a8a12Smrg 2403d656433aSmrgThe following components of LINK-COMMAND are treated specially: 2404126a8a12Smrg 2405d656433aSmrg -all-static do not do any dynamic linking at all 2406d656433aSmrg -avoid-version do not add a version suffix if possible 2407555991fdSmrg -bindir BINDIR specify path to binaries directory (for systems where 2408555991fdSmrg libraries must be found in the PATH setting at runtime) 2409d656433aSmrg -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 2410d656433aSmrg -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 2411d656433aSmrg -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 2412d656433aSmrg -export-symbols SYMFILE 2413d656433aSmrg try to export only the symbols listed in SYMFILE 2414d656433aSmrg -export-symbols-regex REGEX 2415d656433aSmrg try to export only the symbols matching REGEX 2416d656433aSmrg -LLIBDIR search LIBDIR for required installed libraries 2417d656433aSmrg -lNAME OUTPUT-FILE requires the installed library libNAME 2418d656433aSmrg -module build a library that can dlopened 2419d656433aSmrg -no-fast-install disable the fast-install mode 2420d656433aSmrg -no-install link a not-installable executable 2421d656433aSmrg -no-undefined declare that a library does not refer to external symbols 2422d656433aSmrg -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 2423d656433aSmrg -objectlist FILE Use a list of object files found in FILE to specify objects 2424d656433aSmrg -precious-files-regex REGEX 2425d656433aSmrg don't remove output files matching REGEX 2426d656433aSmrg -release RELEASE specify package release information 2427d656433aSmrg -rpath LIBDIR the created library will eventually be installed in LIBDIR 2428d656433aSmrg -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 2429d656433aSmrg -shared only do dynamic linking of libtool libraries 2430d656433aSmrg -shrext SUFFIX override the standard shared library file extension 2431d656433aSmrg -static do not do any dynamic linking of uninstalled libtool libraries 2432d656433aSmrg -static-libtool-libs 2433d656433aSmrg do not do any dynamic linking of libtool libraries 2434d656433aSmrg -version-info CURRENT[:REVISION[:AGE]] 2435d656433aSmrg specify library version info [each variable defaults to 0] 2436d656433aSmrg -weak LIBNAME declare that the target provides the LIBNAME interface 2437555991fdSmrg -Wc,FLAG 2438555991fdSmrg -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 2439555991fdSmrg -Wl,FLAG 2440555991fdSmrg -Xlinker FLAG pass linker-specific FLAG directly to the linker 2441555991fdSmrg -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 2442126a8a12Smrg 2443d656433aSmrgAll other options (arguments beginning with \`-') are ignored. 2444126a8a12Smrg 2445d656433aSmrgEvery other argument is treated as a filename. Files ending in \`.la' are 2446d656433aSmrgtreated as uninstalled libtool libraries, other files are standard or library 2447d656433aSmrgobject files. 2448126a8a12Smrg 2449d656433aSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 2450d656433aSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is 2451d656433aSmrgrequired, except when creating a convenience library. 2452126a8a12Smrg 2453d656433aSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 2454d656433aSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'. 2455126a8a12Smrg 2456d656433aSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 2457d656433aSmrgis created, otherwise an executable program is created." 2458126a8a12Smrg ;; 2459126a8a12Smrg 2460d656433aSmrg uninstall) 2461d656433aSmrg $ECHO \ 2462d656433aSmrg"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 2463126a8a12Smrg 2464d656433aSmrgRemove libraries from an installation directory. 2465126a8a12Smrg 2466d656433aSmrgRM is the name of the program to use to delete files associated with each FILE 2467d656433aSmrg(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2468d656433aSmrgto RM. 2469126a8a12Smrg 2470d656433aSmrgIf FILE is a libtool library, all the files associated with it are deleted. 2471d656433aSmrgOtherwise, only FILE itself is deleted using RM." 2472d656433aSmrg ;; 2473126a8a12Smrg 2474d656433aSmrg *) 24753c15da26Smrg func_fatal_help "invalid operation mode \`$opt_mode'" 2476d656433aSmrg ;; 2477d656433aSmrg esac 2478126a8a12Smrg 2479555991fdSmrg echo 2480d656433aSmrg $ECHO "Try \`$progname --help' for more information about other modes." 2481d656433aSmrg} 2482126a8a12Smrg 2483555991fdSmrg# Now that we've collected a possible --mode arg, show help if necessary 2484555991fdSmrgif $opt_help; then 2485555991fdSmrg if test "$opt_help" = :; then 2486555991fdSmrg func_mode_help 2487555991fdSmrg else 2488555991fdSmrg { 2489555991fdSmrg func_help noexit 24903c15da26Smrg for opt_mode in compile link execute install finish uninstall clean; do 2491555991fdSmrg func_mode_help 2492555991fdSmrg done 2493555991fdSmrg } | sed -n '1p; 2,$s/^Usage:/ or: /p' 2494555991fdSmrg { 2495555991fdSmrg func_help noexit 24963c15da26Smrg for opt_mode in compile link execute install finish uninstall clean; do 2497555991fdSmrg echo 2498555991fdSmrg func_mode_help 2499555991fdSmrg done 2500555991fdSmrg } | 2501555991fdSmrg sed '1d 2502555991fdSmrg /^When reporting/,/^Report/{ 2503555991fdSmrg H 2504555991fdSmrg d 2505555991fdSmrg } 2506555991fdSmrg $x 2507555991fdSmrg /information about other modes/d 2508555991fdSmrg /more detailed .*MODE/d 2509555991fdSmrg s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 2510555991fdSmrg fi 2511555991fdSmrg exit $? 2512555991fdSmrgfi 2513126a8a12Smrg 2514126a8a12Smrg 2515d656433aSmrg# func_mode_execute arg... 2516d656433aSmrgfunc_mode_execute () 2517d656433aSmrg{ 2518d656433aSmrg $opt_debug 2519d656433aSmrg # The first argument is the command name. 2520d656433aSmrg cmd="$nonopt" 2521d656433aSmrg test -z "$cmd" && \ 2522d656433aSmrg func_fatal_help "you must specify a COMMAND" 2523126a8a12Smrg 2524d656433aSmrg # Handle -dlopen flags immediately. 25253c15da26Smrg for file in $opt_dlopen; do 2526d656433aSmrg test -f "$file" \ 2527d656433aSmrg || func_fatal_help "\`$file' is not a file" 2528126a8a12Smrg 2529d656433aSmrg dir= 2530d656433aSmrg case $file in 2531d656433aSmrg *.la) 25323c15da26Smrg func_resolve_sysroot "$file" 25333c15da26Smrg file=$func_resolve_sysroot_result 25343c15da26Smrg 2535d656433aSmrg # Check to see that this really is a libtool archive. 2536d656433aSmrg func_lalib_unsafe_p "$file" \ 2537d656433aSmrg || func_fatal_help "\`$lib' is not a valid libtool archive" 2538126a8a12Smrg 2539d656433aSmrg # Read the libtool library. 2540d656433aSmrg dlname= 2541d656433aSmrg library_names= 2542d656433aSmrg func_source "$file" 2543126a8a12Smrg 2544d656433aSmrg # Skip this library if it cannot be dlopened. 2545d656433aSmrg if test -z "$dlname"; then 2546d656433aSmrg # Warn if it was a shared library. 2547d656433aSmrg test -n "$library_names" && \ 2548d656433aSmrg func_warning "\`$file' was not linked with \`-export-dynamic'" 2549d656433aSmrg continue 2550d656433aSmrg fi 2551126a8a12Smrg 2552d656433aSmrg func_dirname "$file" "" "." 2553d656433aSmrg dir="$func_dirname_result" 2554126a8a12Smrg 2555d656433aSmrg if test -f "$dir/$objdir/$dlname"; then 25563c15da26Smrg func_append dir "/$objdir" 2557d656433aSmrg else 2558d656433aSmrg if test ! -f "$dir/$dlname"; then 2559d656433aSmrg func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 2560d656433aSmrg fi 2561d656433aSmrg fi 2562126a8a12Smrg ;; 2563126a8a12Smrg 2564d656433aSmrg *.lo) 2565d656433aSmrg # Just add the directory containing the .lo file. 2566d656433aSmrg func_dirname "$file" "" "." 2567d656433aSmrg dir="$func_dirname_result" 2568126a8a12Smrg ;; 2569126a8a12Smrg 2570d656433aSmrg *) 2571d656433aSmrg func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 2572126a8a12Smrg continue 2573126a8a12Smrg ;; 2574d656433aSmrg esac 2575126a8a12Smrg 2576d656433aSmrg # Get the absolute pathname. 2577d656433aSmrg absdir=`cd "$dir" && pwd` 2578d656433aSmrg test -n "$absdir" && dir="$absdir" 2579126a8a12Smrg 2580d656433aSmrg # Now add the directory to shlibpath_var. 2581d656433aSmrg if eval "test -z \"\$$shlibpath_var\""; then 2582d656433aSmrg eval "$shlibpath_var=\"\$dir\"" 2583d656433aSmrg else 2584d656433aSmrg eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 2585d656433aSmrg fi 2586d656433aSmrg done 2587126a8a12Smrg 2588d656433aSmrg # This variable tells wrapper scripts just to set shlibpath_var 2589d656433aSmrg # rather than running their programs. 2590d656433aSmrg libtool_execute_magic="$magic" 2591126a8a12Smrg 2592d656433aSmrg # Check if any of the arguments is a wrapper script. 2593d656433aSmrg args= 2594d656433aSmrg for file 2595d656433aSmrg do 2596d656433aSmrg case $file in 2597555991fdSmrg -* | *.la | *.lo ) ;; 2598d656433aSmrg *) 2599d656433aSmrg # Do a test to see if this is really a libtool program. 2600d656433aSmrg if func_ltwrapper_script_p "$file"; then 2601d656433aSmrg func_source "$file" 2602d656433aSmrg # Transform arg to wrapped name. 2603d656433aSmrg file="$progdir/$program" 2604d656433aSmrg elif func_ltwrapper_executable_p "$file"; then 2605d656433aSmrg func_ltwrapper_scriptname "$file" 2606d656433aSmrg func_source "$func_ltwrapper_scriptname_result" 2607d656433aSmrg # Transform arg to wrapped name. 2608d656433aSmrg file="$progdir/$program" 2609d656433aSmrg fi 2610d656433aSmrg ;; 2611d656433aSmrg esac 2612d656433aSmrg # Quote arguments (to preserve shell metacharacters). 26133c15da26Smrg func_append_quoted args "$file" 2614d656433aSmrg done 2615126a8a12Smrg 2616d656433aSmrg if test "X$opt_dry_run" = Xfalse; then 2617d656433aSmrg if test -n "$shlibpath_var"; then 2618d656433aSmrg # Export the shlibpath_var. 2619d656433aSmrg eval "export $shlibpath_var" 2620d656433aSmrg fi 2621126a8a12Smrg 2622d656433aSmrg # Restore saved environment variables 2623d656433aSmrg for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 2624d656433aSmrg do 2625d656433aSmrg eval "if test \"\${save_$lt_var+set}\" = set; then 2626d656433aSmrg $lt_var=\$save_$lt_var; export $lt_var 2627d656433aSmrg else 2628d656433aSmrg $lt_unset $lt_var 2629d656433aSmrg fi" 2630d656433aSmrg done 2631126a8a12Smrg 2632d656433aSmrg # Now prepare to actually exec the command. 2633d656433aSmrg exec_cmd="\$cmd$args" 2634d656433aSmrg else 2635d656433aSmrg # Display what would be done. 2636d656433aSmrg if test -n "$shlibpath_var"; then 2637d656433aSmrg eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 2638555991fdSmrg echo "export $shlibpath_var" 2639d656433aSmrg fi 2640d656433aSmrg $ECHO "$cmd$args" 2641d656433aSmrg exit $EXIT_SUCCESS 2642d656433aSmrg fi 2643d656433aSmrg} 2644126a8a12Smrg 26453c15da26Smrgtest "$opt_mode" = execute && func_mode_execute ${1+"$@"} 2646126a8a12Smrg 2647126a8a12Smrg 2648d656433aSmrg# func_mode_finish arg... 2649d656433aSmrgfunc_mode_finish () 2650d656433aSmrg{ 2651d656433aSmrg $opt_debug 26523c15da26Smrg libs= 26533c15da26Smrg libdirs= 2654d656433aSmrg admincmds= 2655126a8a12Smrg 26563c15da26Smrg for opt in "$nonopt" ${1+"$@"} 26573c15da26Smrg do 26583c15da26Smrg if test -d "$opt"; then 26593c15da26Smrg func_append libdirs " $opt" 26603c15da26Smrg 26613c15da26Smrg elif test -f "$opt"; then 26623c15da26Smrg if func_lalib_unsafe_p "$opt"; then 26633c15da26Smrg func_append libs " $opt" 26643c15da26Smrg else 26653c15da26Smrg func_warning "\`$opt' is not a valid libtool archive" 26663c15da26Smrg fi 26673c15da26Smrg 26683c15da26Smrg else 26693c15da26Smrg func_fatal_error "invalid argument \`$opt'" 26703c15da26Smrg fi 26713c15da26Smrg done 26723c15da26Smrg 26733c15da26Smrg if test -n "$libs"; then 26743c15da26Smrg if test -n "$lt_sysroot"; then 26753c15da26Smrg sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 26763c15da26Smrg sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 26773c15da26Smrg else 26783c15da26Smrg sysroot_cmd= 26793c15da26Smrg fi 26803c15da26Smrg 26813c15da26Smrg # Remove sysroot references 26823c15da26Smrg if $opt_dry_run; then 26833c15da26Smrg for lib in $libs; do 26843c15da26Smrg echo "removing references to $lt_sysroot and \`=' prefixes from $lib" 26853c15da26Smrg done 26863c15da26Smrg else 26873c15da26Smrg tmpdir=`func_mktempdir` 26883c15da26Smrg for lib in $libs; do 26893c15da26Smrg sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 26903c15da26Smrg > $tmpdir/tmp-la 26913c15da26Smrg mv -f $tmpdir/tmp-la $lib 26923c15da26Smrg done 26933c15da26Smrg ${RM}r "$tmpdir" 26943c15da26Smrg fi 26953c15da26Smrg fi 2696126a8a12Smrg 26973c15da26Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2698d656433aSmrg for libdir in $libdirs; do 2699d656433aSmrg if test -n "$finish_cmds"; then 2700d656433aSmrg # Do each command in the finish commands. 2701d656433aSmrg func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 2702d656433aSmrg'"$cmd"'"' 2703d656433aSmrg fi 2704d656433aSmrg if test -n "$finish_eval"; then 2705d656433aSmrg # Do the single finish_eval. 2706d656433aSmrg eval cmds=\"$finish_eval\" 27073c15da26Smrg $opt_dry_run || eval "$cmds" || func_append admincmds " 2708d656433aSmrg $cmds" 2709d656433aSmrg fi 2710d656433aSmrg done 2711d656433aSmrg fi 2712126a8a12Smrg 2713d656433aSmrg # Exit here if they wanted silent mode. 2714d656433aSmrg $opt_silent && exit $EXIT_SUCCESS 2715126a8a12Smrg 27163c15da26Smrg if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 27173c15da26Smrg echo "----------------------------------------------------------------------" 27183c15da26Smrg echo "Libraries have been installed in:" 27193c15da26Smrg for libdir in $libdirs; do 27203c15da26Smrg $ECHO " $libdir" 27213c15da26Smrg done 27223c15da26Smrg echo 27233c15da26Smrg echo "If you ever happen to want to link against installed libraries" 27243c15da26Smrg echo "in a given directory, LIBDIR, you must either use libtool, and" 27253c15da26Smrg echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 27263c15da26Smrg echo "flag during linking and do at least one of the following:" 27273c15da26Smrg if test -n "$shlibpath_var"; then 27283c15da26Smrg echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 27293c15da26Smrg echo " during execution" 27303c15da26Smrg fi 27313c15da26Smrg if test -n "$runpath_var"; then 27323c15da26Smrg echo " - add LIBDIR to the \`$runpath_var' environment variable" 27333c15da26Smrg echo " during linking" 27343c15da26Smrg fi 27353c15da26Smrg if test -n "$hardcode_libdir_flag_spec"; then 27363c15da26Smrg libdir=LIBDIR 27373c15da26Smrg eval flag=\"$hardcode_libdir_flag_spec\" 2738126a8a12Smrg 27393c15da26Smrg $ECHO " - use the \`$flag' linker flag" 27403c15da26Smrg fi 27413c15da26Smrg if test -n "$admincmds"; then 27423c15da26Smrg $ECHO " - have your system administrator run these commands:$admincmds" 27433c15da26Smrg fi 27443c15da26Smrg if test -f /etc/ld.so.conf; then 27453c15da26Smrg echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 27463c15da26Smrg fi 27473c15da26Smrg echo 2748126a8a12Smrg 27493c15da26Smrg echo "See any operating system documentation about shared libraries for" 27503c15da26Smrg case $host in 27513c15da26Smrg solaris2.[6789]|solaris2.1[0-9]) 27523c15da26Smrg echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 27533c15da26Smrg echo "pages." 27543c15da26Smrg ;; 27553c15da26Smrg *) 27563c15da26Smrg echo "more information, such as the ld(1) and ld.so(8) manual pages." 27573c15da26Smrg ;; 27583c15da26Smrg esac 27593c15da26Smrg echo "----------------------------------------------------------------------" 27603c15da26Smrg fi 2761d656433aSmrg exit $EXIT_SUCCESS 2762d656433aSmrg} 2763126a8a12Smrg 27643c15da26Smrgtest "$opt_mode" = finish && func_mode_finish ${1+"$@"} 2765126a8a12Smrg 2766126a8a12Smrg 2767d656433aSmrg# func_mode_install arg... 2768d656433aSmrgfunc_mode_install () 2769d656433aSmrg{ 2770d656433aSmrg $opt_debug 2771d656433aSmrg # There may be an optional sh(1) argument at the beginning of 2772d656433aSmrg # install_prog (especially on Windows NT). 2773d656433aSmrg if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 2774d656433aSmrg # Allow the use of GNU shtool's install command. 2775555991fdSmrg case $nonopt in *shtool*) :;; *) false;; esac; then 2776d656433aSmrg # Aesthetically quote it. 2777d656433aSmrg func_quote_for_eval "$nonopt" 2778d656433aSmrg install_prog="$func_quote_for_eval_result " 2779d656433aSmrg arg=$1 2780d656433aSmrg shift 2781d656433aSmrg else 2782d656433aSmrg install_prog= 2783d656433aSmrg arg=$nonopt 2784d656433aSmrg fi 2785126a8a12Smrg 2786d656433aSmrg # The real first argument should be the name of the installation program. 2787d656433aSmrg # Aesthetically quote it. 2788d656433aSmrg func_quote_for_eval "$arg" 27893c15da26Smrg func_append install_prog "$func_quote_for_eval_result" 2790555991fdSmrg install_shared_prog=$install_prog 2791555991fdSmrg case " $install_prog " in 2792555991fdSmrg *[\\\ /]cp\ *) install_cp=: ;; 2793555991fdSmrg *) install_cp=false ;; 2794555991fdSmrg esac 2795d656433aSmrg 2796d656433aSmrg # We need to accept at least all the BSD install flags. 2797d656433aSmrg dest= 2798d656433aSmrg files= 2799d656433aSmrg opts= 2800d656433aSmrg prev= 2801d656433aSmrg install_type= 2802d656433aSmrg isdir=no 2803d656433aSmrg stripme= 2804555991fdSmrg no_mode=: 2805d656433aSmrg for arg 2806d656433aSmrg do 2807555991fdSmrg arg2= 2808d656433aSmrg if test -n "$dest"; then 28093c15da26Smrg func_append files " $dest" 2810d656433aSmrg dest=$arg 2811d656433aSmrg continue 2812126a8a12Smrg fi 2813126a8a12Smrg 2814d656433aSmrg case $arg in 2815d656433aSmrg -d) isdir=yes ;; 2816d656433aSmrg -f) 2817555991fdSmrg if $install_cp; then :; else 2818555991fdSmrg prev=$arg 2819555991fdSmrg fi 2820d656433aSmrg ;; 2821d656433aSmrg -g | -m | -o) 2822d656433aSmrg prev=$arg 2823d656433aSmrg ;; 2824d656433aSmrg -s) 2825d656433aSmrg stripme=" -s" 2826d656433aSmrg continue 2827d656433aSmrg ;; 2828d656433aSmrg -*) 2829d656433aSmrg ;; 2830d656433aSmrg *) 2831d656433aSmrg # If the previous option needed an argument, then skip it. 2832d656433aSmrg if test -n "$prev"; then 2833555991fdSmrg if test "x$prev" = x-m && test -n "$install_override_mode"; then 2834555991fdSmrg arg2=$install_override_mode 2835555991fdSmrg no_mode=false 2836555991fdSmrg fi 2837d656433aSmrg prev= 2838d656433aSmrg else 2839d656433aSmrg dest=$arg 2840d656433aSmrg continue 2841d656433aSmrg fi 2842d656433aSmrg ;; 2843d656433aSmrg esac 2844126a8a12Smrg 2845d656433aSmrg # Aesthetically quote the argument. 2846d656433aSmrg func_quote_for_eval "$arg" 28473c15da26Smrg func_append install_prog " $func_quote_for_eval_result" 2848555991fdSmrg if test -n "$arg2"; then 2849555991fdSmrg func_quote_for_eval "$arg2" 2850555991fdSmrg fi 28513c15da26Smrg func_append install_shared_prog " $func_quote_for_eval_result" 2852d656433aSmrg done 2853126a8a12Smrg 2854d656433aSmrg test -z "$install_prog" && \ 2855d656433aSmrg func_fatal_help "you must specify an install program" 2856126a8a12Smrg 2857d656433aSmrg test -n "$prev" && \ 2858d656433aSmrg func_fatal_help "the \`$prev' option requires an argument" 2859126a8a12Smrg 2860555991fdSmrg if test -n "$install_override_mode" && $no_mode; then 2861555991fdSmrg if $install_cp; then :; else 2862555991fdSmrg func_quote_for_eval "$install_override_mode" 28633c15da26Smrg func_append install_shared_prog " -m $func_quote_for_eval_result" 2864555991fdSmrg fi 2865555991fdSmrg fi 2866555991fdSmrg 2867d656433aSmrg if test -z "$files"; then 2868d656433aSmrg if test -z "$dest"; then 2869d656433aSmrg func_fatal_help "no file or destination specified" 2870d656433aSmrg else 2871d656433aSmrg func_fatal_help "you must specify a destination" 2872126a8a12Smrg fi 2873126a8a12Smrg fi 2874126a8a12Smrg 2875d656433aSmrg # Strip any trailing slash from the destination. 2876d656433aSmrg func_stripname '' '/' "$dest" 2877d656433aSmrg dest=$func_stripname_result 2878126a8a12Smrg 2879d656433aSmrg # Check to see that the destination is a directory. 2880d656433aSmrg test -d "$dest" && isdir=yes 2881d656433aSmrg if test "$isdir" = yes; then 2882d656433aSmrg destdir="$dest" 2883d656433aSmrg destname= 2884d656433aSmrg else 2885d656433aSmrg func_dirname_and_basename "$dest" "" "." 2886d656433aSmrg destdir="$func_dirname_result" 2887d656433aSmrg destname="$func_basename_result" 2888d656433aSmrg 2889d656433aSmrg # Not a directory, so check to see that there is only one file specified. 2890d656433aSmrg set dummy $files; shift 2891d656433aSmrg test "$#" -gt 1 && \ 2892d656433aSmrg func_fatal_help "\`$dest' is not a directory" 2893d656433aSmrg fi 2894d656433aSmrg case $destdir in 2895d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 2896126a8a12Smrg *) 2897d656433aSmrg for file in $files; do 2898d656433aSmrg case $file in 2899d656433aSmrg *.lo) ;; 2900d656433aSmrg *) 2901d656433aSmrg func_fatal_help "\`$destdir' must be an absolute directory name" 2902d656433aSmrg ;; 2903d656433aSmrg esac 2904d656433aSmrg done 2905126a8a12Smrg ;; 2906126a8a12Smrg esac 2907126a8a12Smrg 2908d656433aSmrg # This variable tells wrapper scripts just to set variables rather 2909d656433aSmrg # than running their programs. 2910d656433aSmrg libtool_install_magic="$magic" 2911126a8a12Smrg 2912d656433aSmrg staticlibs= 2913d656433aSmrg future_libdirs= 2914d656433aSmrg current_libdirs= 2915d656433aSmrg for file in $files; do 2916126a8a12Smrg 2917d656433aSmrg # Do each installation. 2918d656433aSmrg case $file in 2919d656433aSmrg *.$libext) 2920d656433aSmrg # Do the static libraries later. 29213c15da26Smrg func_append staticlibs " $file" 2922d656433aSmrg ;; 2923d656433aSmrg 2924d656433aSmrg *.la) 29253c15da26Smrg func_resolve_sysroot "$file" 29263c15da26Smrg file=$func_resolve_sysroot_result 29273c15da26Smrg 2928d656433aSmrg # Check to see that this really is a libtool archive. 2929d656433aSmrg func_lalib_unsafe_p "$file" \ 2930d656433aSmrg || func_fatal_help "\`$file' is not a valid libtool archive" 2931d656433aSmrg 2932d656433aSmrg library_names= 2933d656433aSmrg old_library= 2934d656433aSmrg relink_command= 2935d656433aSmrg func_source "$file" 2936d656433aSmrg 2937d656433aSmrg # Add the libdir to current_libdirs if it is the destination. 2938d656433aSmrg if test "X$destdir" = "X$libdir"; then 2939d656433aSmrg case "$current_libdirs " in 2940d656433aSmrg *" $libdir "*) ;; 29413c15da26Smrg *) func_append current_libdirs " $libdir" ;; 2942126a8a12Smrg esac 2943d656433aSmrg else 2944d656433aSmrg # Note the libdir as a future libdir. 2945d656433aSmrg case "$future_libdirs " in 2946d656433aSmrg *" $libdir "*) ;; 29473c15da26Smrg *) func_append future_libdirs " $libdir" ;; 2948d656433aSmrg esac 2949d656433aSmrg fi 2950126a8a12Smrg 2951d656433aSmrg func_dirname "$file" "/" "" 2952d656433aSmrg dir="$func_dirname_result" 29533c15da26Smrg func_append dir "$objdir" 2954d656433aSmrg 2955d656433aSmrg if test -n "$relink_command"; then 2956d656433aSmrg # Determine the prefix the user has applied to our future dir. 2957555991fdSmrg inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 2958d656433aSmrg 2959d656433aSmrg # Don't allow the user to place us outside of our expected 2960d656433aSmrg # location b/c this prevents finding dependent libraries that 2961d656433aSmrg # are installed to the same prefix. 2962d656433aSmrg # At present, this check doesn't affect windows .dll's that 2963d656433aSmrg # are installed into $libdir/../bin (currently, that works fine) 2964d656433aSmrg # but it's something to keep an eye on. 2965d656433aSmrg test "$inst_prefix_dir" = "$destdir" && \ 2966d656433aSmrg func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2967d656433aSmrg 2968d656433aSmrg if test -n "$inst_prefix_dir"; then 2969d656433aSmrg # Stick the inst_prefix_dir data into the link command. 2970555991fdSmrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2971d656433aSmrg else 2972555991fdSmrg relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 2973d656433aSmrg fi 2974d656433aSmrg 2975d656433aSmrg func_warning "relinking \`$file'" 2976d656433aSmrg func_show_eval "$relink_command" \ 2977d656433aSmrg 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2978d656433aSmrg fi 2979d656433aSmrg 2980d656433aSmrg # See the names of the shared library. 2981d656433aSmrg set dummy $library_names; shift 2982d656433aSmrg if test -n "$1"; then 2983d656433aSmrg realname="$1" 2984d656433aSmrg shift 2985d656433aSmrg 2986d656433aSmrg srcname="$realname" 2987d656433aSmrg test -n "$relink_command" && srcname="$realname"T 2988d656433aSmrg 2989d656433aSmrg # Install the shared library and build the symlinks. 2990555991fdSmrg func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 2991d656433aSmrg 'exit $?' 2992d656433aSmrg tstripme="$stripme" 2993d656433aSmrg case $host_os in 2994d656433aSmrg cygwin* | mingw* | pw32* | cegcc*) 2995d656433aSmrg case $realname in 2996d656433aSmrg *.dll.a) 2997d656433aSmrg tstripme="" 2998d656433aSmrg ;; 2999d656433aSmrg esac 3000126a8a12Smrg ;; 3001126a8a12Smrg esac 3002d656433aSmrg if test -n "$tstripme" && test -n "$striplib"; then 3003d656433aSmrg func_show_eval "$striplib $destdir/$realname" 'exit $?' 3004126a8a12Smrg fi 3005d656433aSmrg 3006d656433aSmrg if test "$#" -gt 0; then 3007d656433aSmrg # Delete the old symlinks, and create new ones. 3008d656433aSmrg # Try `ln -sf' first, because the `ln' binary might depend on 3009d656433aSmrg # the symlink we replace! Solaris /bin/ln does not understand -f, 3010d656433aSmrg # so we also need to try rm && ln -s. 3011d656433aSmrg for linkname 3012d656433aSmrg do 3013d656433aSmrg test "$linkname" != "$realname" \ 3014d656433aSmrg && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 3015126a8a12Smrg done 3016126a8a12Smrg fi 3017126a8a12Smrg 3018d656433aSmrg # Do each command in the postinstall commands. 3019d656433aSmrg lib="$destdir/$realname" 3020d656433aSmrg func_execute_cmds "$postinstall_cmds" 'exit $?' 3021126a8a12Smrg fi 3022126a8a12Smrg 3023d656433aSmrg # Install the pseudo-library for information purposes. 3024d656433aSmrg func_basename "$file" 3025d656433aSmrg name="$func_basename_result" 3026d656433aSmrg instname="$dir/$name"i 3027d656433aSmrg func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 3028126a8a12Smrg 3029d656433aSmrg # Maybe install the static library, too. 30303c15da26Smrg test -n "$old_library" && func_append staticlibs " $dir/$old_library" 3031d656433aSmrg ;; 3032126a8a12Smrg 3033d656433aSmrg *.lo) 3034d656433aSmrg # Install (i.e. copy) a libtool object. 3035126a8a12Smrg 3036d656433aSmrg # Figure out destination file name, if it wasn't already specified. 3037d656433aSmrg if test -n "$destname"; then 3038d656433aSmrg destfile="$destdir/$destname" 3039d656433aSmrg else 3040d656433aSmrg func_basename "$file" 3041d656433aSmrg destfile="$func_basename_result" 3042d656433aSmrg destfile="$destdir/$destfile" 3043d656433aSmrg fi 3044d656433aSmrg 3045d656433aSmrg # Deduce the name of the destination old-style object file. 3046d656433aSmrg case $destfile in 3047d656433aSmrg *.lo) 3048d656433aSmrg func_lo2o "$destfile" 3049d656433aSmrg staticdest=$func_lo2o_result 3050d656433aSmrg ;; 3051d656433aSmrg *.$objext) 3052d656433aSmrg staticdest="$destfile" 3053d656433aSmrg destfile= 3054d656433aSmrg ;; 3055d656433aSmrg *) 3056d656433aSmrg func_fatal_help "cannot copy a libtool object to \`$destfile'" 3057d656433aSmrg ;; 3058126a8a12Smrg esac 3059126a8a12Smrg 3060d656433aSmrg # Install the libtool object if requested. 3061d656433aSmrg test -n "$destfile" && \ 3062d656433aSmrg func_show_eval "$install_prog $file $destfile" 'exit $?' 3063d656433aSmrg 3064d656433aSmrg # Install the old object if enabled. 3065d656433aSmrg if test "$build_old_libs" = yes; then 3066d656433aSmrg # Deduce the name of the old-style object file. 3067d656433aSmrg func_lo2o "$file" 3068d656433aSmrg staticobj=$func_lo2o_result 3069d656433aSmrg func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 3070126a8a12Smrg fi 3071d656433aSmrg exit $EXIT_SUCCESS 3072d656433aSmrg ;; 3073126a8a12Smrg 3074d656433aSmrg *) 3075d656433aSmrg # Figure out destination file name, if it wasn't already specified. 3076d656433aSmrg if test -n "$destname"; then 3077d656433aSmrg destfile="$destdir/$destname" 3078d656433aSmrg else 3079d656433aSmrg func_basename "$file" 3080d656433aSmrg destfile="$func_basename_result" 3081d656433aSmrg destfile="$destdir/$destfile" 3082d656433aSmrg fi 3083d656433aSmrg 3084d656433aSmrg # If the file is missing, and there is a .exe on the end, strip it 3085d656433aSmrg # because it is most likely a libtool script we actually want to 3086d656433aSmrg # install 3087d656433aSmrg stripped_ext="" 3088d656433aSmrg case $file in 3089d656433aSmrg *.exe) 3090d656433aSmrg if test ! -f "$file"; then 3091d656433aSmrg func_stripname '' '.exe' "$file" 3092d656433aSmrg file=$func_stripname_result 3093d656433aSmrg stripped_ext=".exe" 3094126a8a12Smrg fi 3095d656433aSmrg ;; 3096d656433aSmrg esac 3097126a8a12Smrg 3098d656433aSmrg # Do a test to see if this is really a libtool program. 3099d656433aSmrg case $host in 3100d656433aSmrg *cygwin* | *mingw*) 3101d656433aSmrg if func_ltwrapper_executable_p "$file"; then 3102d656433aSmrg func_ltwrapper_scriptname "$file" 3103d656433aSmrg wrapper=$func_ltwrapper_scriptname_result 3104d656433aSmrg else 3105d656433aSmrg func_stripname '' '.exe' "$file" 3106d656433aSmrg wrapper=$func_stripname_result 3107d656433aSmrg fi 3108d656433aSmrg ;; 3109d656433aSmrg *) 3110d656433aSmrg wrapper=$file 3111d656433aSmrg ;; 3112d656433aSmrg esac 3113d656433aSmrg if func_ltwrapper_script_p "$wrapper"; then 3114d656433aSmrg notinst_deplibs= 3115d656433aSmrg relink_command= 3116126a8a12Smrg 3117d656433aSmrg func_source "$wrapper" 3118126a8a12Smrg 3119d656433aSmrg # Check the variables that should have been set. 3120d656433aSmrg test -z "$generated_by_libtool_version" && \ 3121d656433aSmrg func_fatal_error "invalid libtool wrapper script \`$wrapper'" 3122d656433aSmrg 3123d656433aSmrg finalize=yes 3124d656433aSmrg for lib in $notinst_deplibs; do 3125d656433aSmrg # Check to see that each library is installed. 3126d656433aSmrg libdir= 3127d656433aSmrg if test -f "$lib"; then 3128d656433aSmrg func_source "$lib" 3129d656433aSmrg fi 3130555991fdSmrg libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 3131d656433aSmrg if test -n "$libdir" && test ! -f "$libfile"; then 3132d656433aSmrg func_warning "\`$lib' has not been installed in \`$libdir'" 3133d656433aSmrg finalize=no 3134d656433aSmrg fi 3135d656433aSmrg done 3136d656433aSmrg 3137d656433aSmrg relink_command= 3138d656433aSmrg func_source "$wrapper" 3139d656433aSmrg 3140d656433aSmrg outputname= 3141d656433aSmrg if test "$fast_install" = no && test -n "$relink_command"; then 3142d656433aSmrg $opt_dry_run || { 3143d656433aSmrg if test "$finalize" = yes; then 3144d656433aSmrg tmpdir=`func_mktempdir` 3145d656433aSmrg func_basename "$file$stripped_ext" 3146d656433aSmrg file="$func_basename_result" 3147d656433aSmrg outputname="$tmpdir/$file" 3148d656433aSmrg # Replace the output file specification. 3149555991fdSmrg relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 3150d656433aSmrg 3151d656433aSmrg $opt_silent || { 3152d656433aSmrg func_quote_for_expand "$relink_command" 3153d656433aSmrg eval "func_echo $func_quote_for_expand_result" 3154d656433aSmrg } 3155d656433aSmrg if eval "$relink_command"; then : 3156d656433aSmrg else 3157d656433aSmrg func_error "error: relink \`$file' with the above command before installing it" 3158d656433aSmrg $opt_dry_run || ${RM}r "$tmpdir" 3159d656433aSmrg continue 3160d656433aSmrg fi 3161d656433aSmrg file="$outputname" 3162d656433aSmrg else 3163d656433aSmrg func_warning "cannot relink \`$file'" 3164d656433aSmrg fi 3165d656433aSmrg } 3166126a8a12Smrg else 3167d656433aSmrg # Install the binary that we compiled earlier. 3168555991fdSmrg file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 3169126a8a12Smrg fi 3170d656433aSmrg fi 3171126a8a12Smrg 3172d656433aSmrg # remove .exe since cygwin /usr/bin/install will append another 3173d656433aSmrg # one anyway 3174d656433aSmrg case $install_prog,$host in 3175d656433aSmrg */usr/bin/install*,*cygwin*) 3176d656433aSmrg case $file:$destfile in 3177d656433aSmrg *.exe:*.exe) 3178d656433aSmrg # this is ok 3179d656433aSmrg ;; 3180d656433aSmrg *.exe:*) 3181d656433aSmrg destfile=$destfile.exe 3182d656433aSmrg ;; 3183d656433aSmrg *:*.exe) 3184d656433aSmrg func_stripname '' '.exe' "$destfile" 3185d656433aSmrg destfile=$func_stripname_result 3186d656433aSmrg ;; 3187d656433aSmrg esac 3188126a8a12Smrg ;; 3189126a8a12Smrg esac 3190d656433aSmrg func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 3191d656433aSmrg $opt_dry_run || if test -n "$outputname"; then 3192d656433aSmrg ${RM}r "$tmpdir" 3193d656433aSmrg fi 3194d656433aSmrg ;; 3195d656433aSmrg esac 3196d656433aSmrg done 3197126a8a12Smrg 3198d656433aSmrg for file in $staticlibs; do 3199d656433aSmrg func_basename "$file" 3200d656433aSmrg name="$func_basename_result" 3201126a8a12Smrg 3202d656433aSmrg # Set up the ranlib parameters. 3203d656433aSmrg oldlib="$destdir/$name" 3204126a8a12Smrg 3205d656433aSmrg func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 3206126a8a12Smrg 3207d656433aSmrg if test -n "$stripme" && test -n "$old_striplib"; then 3208d656433aSmrg func_show_eval "$old_striplib $oldlib" 'exit $?' 3209d656433aSmrg fi 3210126a8a12Smrg 3211d656433aSmrg # Do each command in the postinstall commands. 3212d656433aSmrg func_execute_cmds "$old_postinstall_cmds" 'exit $?' 3213d656433aSmrg done 3214126a8a12Smrg 3215d656433aSmrg test -n "$future_libdirs" && \ 3216d656433aSmrg func_warning "remember to run \`$progname --finish$future_libdirs'" 3217126a8a12Smrg 3218d656433aSmrg if test -n "$current_libdirs"; then 3219d656433aSmrg # Maybe just do a dry run. 3220d656433aSmrg $opt_dry_run && current_libdirs=" -n$current_libdirs" 3221d656433aSmrg exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 3222d656433aSmrg else 3223d656433aSmrg exit $EXIT_SUCCESS 3224d656433aSmrg fi 3225d656433aSmrg} 3226126a8a12Smrg 32273c15da26Smrgtest "$opt_mode" = install && func_mode_install ${1+"$@"} 3228126a8a12Smrg 3229126a8a12Smrg 3230d656433aSmrg# func_generate_dlsyms outputname originator pic_p 3231d656433aSmrg# Extract symbols from dlprefiles and create ${outputname}S.o with 3232d656433aSmrg# a dlpreopen symbol table. 3233d656433aSmrgfunc_generate_dlsyms () 3234d656433aSmrg{ 3235d656433aSmrg $opt_debug 3236d656433aSmrg my_outputname="$1" 3237d656433aSmrg my_originator="$2" 3238d656433aSmrg my_pic_p="${3-no}" 3239d656433aSmrg my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 3240d656433aSmrg my_dlsyms= 3241d656433aSmrg 3242d656433aSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3243d656433aSmrg if test -n "$NM" && test -n "$global_symbol_pipe"; then 3244d656433aSmrg my_dlsyms="${my_outputname}S.c" 3245d656433aSmrg else 3246d656433aSmrg func_error "not configured to extract global symbols from dlpreopened files" 3247d656433aSmrg fi 3248d656433aSmrg fi 3249126a8a12Smrg 3250d656433aSmrg if test -n "$my_dlsyms"; then 3251d656433aSmrg case $my_dlsyms in 3252d656433aSmrg "") ;; 3253d656433aSmrg *.c) 3254d656433aSmrg # Discover the nlist of each of the dlfiles. 3255d656433aSmrg nlist="$output_objdir/${my_outputname}.nm" 3256d656433aSmrg 3257d656433aSmrg func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 3258d656433aSmrg 3259d656433aSmrg # Parse the name list into a source file. 3260d656433aSmrg func_verbose "creating $output_objdir/$my_dlsyms" 3261d656433aSmrg 3262d656433aSmrg $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 3263d656433aSmrg/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 3264d656433aSmrg/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 3265d656433aSmrg 3266d656433aSmrg#ifdef __cplusplus 3267d656433aSmrgextern \"C\" { 3268d656433aSmrg#endif 3269d656433aSmrg 3270555991fdSmrg#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 3271555991fdSmrg#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 3272555991fdSmrg#endif 3273555991fdSmrg 32743c15da26Smrg/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 32753c15da26Smrg#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 32763c15da26Smrg/* DATA imports from DLLs on WIN32 con't be const, because runtime 32773c15da26Smrg relocations are performed -- see ld's documentation on pseudo-relocs. */ 32783c15da26Smrg# define LT_DLSYM_CONST 32793c15da26Smrg#elif defined(__osf__) 32803c15da26Smrg/* This system does not cope well with relocations in const data. */ 32813c15da26Smrg# define LT_DLSYM_CONST 32823c15da26Smrg#else 32833c15da26Smrg# define LT_DLSYM_CONST const 32843c15da26Smrg#endif 32853c15da26Smrg 3286d656433aSmrg/* External symbol declarations for the compiler. */\ 3287d656433aSmrg" 3288d656433aSmrg 3289d656433aSmrg if test "$dlself" = yes; then 3290d656433aSmrg func_verbose "generating symbol list for \`$output'" 3291d656433aSmrg 3292d656433aSmrg $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 3293d656433aSmrg 3294d656433aSmrg # Add our own program objects to the symbol list. 3295555991fdSmrg progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 3296d656433aSmrg for progfile in $progfiles; do 32973c15da26Smrg func_to_tool_file "$progfile" func_convert_file_msys_to_w32 32983c15da26Smrg func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" 32993c15da26Smrg $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 3300d656433aSmrg done 3301d656433aSmrg 3302d656433aSmrg if test -n "$exclude_expsyms"; then 3303d656433aSmrg $opt_dry_run || { 3304d656433aSmrg eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 3305d656433aSmrg eval '$MV "$nlist"T "$nlist"' 3306d656433aSmrg } 3307126a8a12Smrg fi 3308126a8a12Smrg 3309d656433aSmrg if test -n "$export_symbols_regex"; then 3310d656433aSmrg $opt_dry_run || { 3311d656433aSmrg eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 3312d656433aSmrg eval '$MV "$nlist"T "$nlist"' 3313d656433aSmrg } 3314126a8a12Smrg fi 3315d656433aSmrg 3316d656433aSmrg # Prepare the list of exported symbols 3317d656433aSmrg if test -z "$export_symbols"; then 3318d656433aSmrg export_symbols="$output_objdir/$outputname.exp" 3319d656433aSmrg $opt_dry_run || { 3320d656433aSmrg $RM $export_symbols 3321d656433aSmrg eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 3322d656433aSmrg case $host in 3323d656433aSmrg *cygwin* | *mingw* | *cegcc* ) 3324d656433aSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3325d656433aSmrg eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 3326d656433aSmrg ;; 3327126a8a12Smrg esac 3328d656433aSmrg } 3329d656433aSmrg else 3330d656433aSmrg $opt_dry_run || { 3331d656433aSmrg eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 3332d656433aSmrg eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 3333d656433aSmrg eval '$MV "$nlist"T "$nlist"' 3334d656433aSmrg case $host in 3335555991fdSmrg *cygwin* | *mingw* | *cegcc* ) 3336d656433aSmrg eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3337d656433aSmrg eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 3338d656433aSmrg ;; 3339126a8a12Smrg esac 3340d656433aSmrg } 3341126a8a12Smrg fi 3342d656433aSmrg fi 3343126a8a12Smrg 3344d656433aSmrg for dlprefile in $dlprefiles; do 3345d656433aSmrg func_verbose "extracting global C symbols from \`$dlprefile'" 3346d656433aSmrg func_basename "$dlprefile" 3347d656433aSmrg name="$func_basename_result" 33483c15da26Smrg case $host in 33493c15da26Smrg *cygwin* | *mingw* | *cegcc* ) 33503c15da26Smrg # if an import library, we need to obtain dlname 33513c15da26Smrg if func_win32_import_lib_p "$dlprefile"; then 33523c15da26Smrg func_tr_sh "$dlprefile" 33533c15da26Smrg eval "curr_lafile=\$libfile_$func_tr_sh_result" 33543c15da26Smrg dlprefile_dlbasename="" 33553c15da26Smrg if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 33563c15da26Smrg # Use subshell, to avoid clobbering current variable values 33573c15da26Smrg dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 33583c15da26Smrg if test -n "$dlprefile_dlname" ; then 33593c15da26Smrg func_basename "$dlprefile_dlname" 33603c15da26Smrg dlprefile_dlbasename="$func_basename_result" 33613c15da26Smrg else 33623c15da26Smrg # no lafile. user explicitly requested -dlpreopen <import library>. 33633c15da26Smrg $sharedlib_from_linklib_cmd "$dlprefile" 33643c15da26Smrg dlprefile_dlbasename=$sharedlib_from_linklib_result 33653c15da26Smrg fi 33663c15da26Smrg fi 33673c15da26Smrg $opt_dry_run || { 33683c15da26Smrg if test -n "$dlprefile_dlbasename" ; then 33693c15da26Smrg eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 33703c15da26Smrg else 33713c15da26Smrg func_warning "Could not compute DLL name from $name" 33723c15da26Smrg eval '$ECHO ": $name " >> "$nlist"' 33733c15da26Smrg fi 33743c15da26Smrg func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33753c15da26Smrg eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 33763c15da26Smrg $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 33773c15da26Smrg } 33783c15da26Smrg else # not an import lib 33793c15da26Smrg $opt_dry_run || { 33803c15da26Smrg eval '$ECHO ": $name " >> "$nlist"' 33813c15da26Smrg func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33823c15da26Smrg eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 33833c15da26Smrg } 33843c15da26Smrg fi 33853c15da26Smrg ;; 33863c15da26Smrg *) 33873c15da26Smrg $opt_dry_run || { 33883c15da26Smrg eval '$ECHO ": $name " >> "$nlist"' 33893c15da26Smrg func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33903c15da26Smrg eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 33913c15da26Smrg } 33923c15da26Smrg ;; 33933c15da26Smrg esac 3394d656433aSmrg done 3395126a8a12Smrg 3396d656433aSmrg $opt_dry_run || { 3397d656433aSmrg # Make sure we have at least an empty file. 3398d656433aSmrg test -f "$nlist" || : > "$nlist" 3399126a8a12Smrg 3400d656433aSmrg if test -n "$exclude_expsyms"; then 3401d656433aSmrg $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 3402d656433aSmrg $MV "$nlist"T "$nlist" 3403126a8a12Smrg fi 3404126a8a12Smrg 3405d656433aSmrg # Try sorting and uniquifying the output. 3406d656433aSmrg if $GREP -v "^: " < "$nlist" | 3407d656433aSmrg if sort -k 3 </dev/null >/dev/null 2>&1; then 3408d656433aSmrg sort -k 3 3409126a8a12Smrg else 3410d656433aSmrg sort +2 3411d656433aSmrg fi | 3412d656433aSmrg uniq > "$nlist"S; then 3413d656433aSmrg : 3414126a8a12Smrg else 3415d656433aSmrg $GREP -v "^: " < "$nlist" > "$nlist"S 3416126a8a12Smrg fi 3417126a8a12Smrg 3418d656433aSmrg if test -f "$nlist"S; then 3419d656433aSmrg eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 3420126a8a12Smrg else 3421555991fdSmrg echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 3422126a8a12Smrg fi 3423126a8a12Smrg 3424555991fdSmrg echo >> "$output_objdir/$my_dlsyms" "\ 3425126a8a12Smrg 3426d656433aSmrg/* The mapping between symbol names and symbols. */ 3427d656433aSmrgtypedef struct { 3428d656433aSmrg const char *name; 3429d656433aSmrg void *address; 3430d656433aSmrg} lt_dlsymlist; 34313c15da26Smrgextern LT_DLSYM_CONST lt_dlsymlist 3432d656433aSmrglt_${my_prefix}_LTX_preloaded_symbols[]; 34333c15da26SmrgLT_DLSYM_CONST lt_dlsymlist 3434d656433aSmrglt_${my_prefix}_LTX_preloaded_symbols[] = 3435d656433aSmrg{\ 3436d656433aSmrg { \"$my_originator\", (void *) 0 }," 3437d656433aSmrg 3438d656433aSmrg case $need_lib_prefix in 3439d656433aSmrg no) 3440d656433aSmrg eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 3441d656433aSmrg ;; 3442d656433aSmrg *) 3443d656433aSmrg eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 3444d656433aSmrg ;; 3445d656433aSmrg esac 3446555991fdSmrg echo >> "$output_objdir/$my_dlsyms" "\ 3447d656433aSmrg {0, (void *) 0} 3448d656433aSmrg}; 3449d656433aSmrg 3450d656433aSmrg/* This works around a problem in FreeBSD linker */ 3451d656433aSmrg#ifdef FREEBSD_WORKAROUND 3452d656433aSmrgstatic const void *lt_preloaded_setup() { 3453d656433aSmrg return lt_${my_prefix}_LTX_preloaded_symbols; 3454d656433aSmrg} 3455d656433aSmrg#endif 3456d656433aSmrg 3457d656433aSmrg#ifdef __cplusplus 3458d656433aSmrg} 3459d656433aSmrg#endif\ 3460d656433aSmrg" 3461d656433aSmrg } # !$opt_dry_run 3462d656433aSmrg 3463d656433aSmrg pic_flag_for_symtable= 3464d656433aSmrg case "$compile_command " in 3465d656433aSmrg *" -static "*) ;; 3466d656433aSmrg *) 3467d656433aSmrg case $host in 3468d656433aSmrg # compiling the symbol table file with pic_flag works around 3469d656433aSmrg # a FreeBSD bug that causes programs to crash when -lm is 3470d656433aSmrg # linked before any other PIC object. But we must not use 3471d656433aSmrg # pic_flag when linking with -static. The problem exists in 3472d656433aSmrg # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 3473d656433aSmrg *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 3474d656433aSmrg pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 3475d656433aSmrg *-*-hpux*) 3476d656433aSmrg pic_flag_for_symtable=" $pic_flag" ;; 3477d656433aSmrg *) 3478d656433aSmrg if test "X$my_pic_p" != Xno; then 3479d656433aSmrg pic_flag_for_symtable=" $pic_flag" 3480126a8a12Smrg fi 3481d656433aSmrg ;; 3482d656433aSmrg esac 3483d656433aSmrg ;; 3484d656433aSmrg esac 3485d656433aSmrg symtab_cflags= 3486d656433aSmrg for arg in $LTCFLAGS; do 3487d656433aSmrg case $arg in 3488d656433aSmrg -pie | -fpie | -fPIE) ;; 34893c15da26Smrg *) func_append symtab_cflags " $arg" ;; 3490d656433aSmrg esac 3491d656433aSmrg done 3492126a8a12Smrg 3493d656433aSmrg # Now compile the dynamic symbol file. 3494d656433aSmrg func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 3495126a8a12Smrg 3496d656433aSmrg # Clean up the generated files. 3497d656433aSmrg func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 3498d656433aSmrg 3499d656433aSmrg # Transform the symbol file into the correct name. 3500d656433aSmrg symfileobj="$output_objdir/${my_outputname}S.$objext" 3501d656433aSmrg case $host in 3502d656433aSmrg *cygwin* | *mingw* | *cegcc* ) 3503d656433aSmrg if test -f "$output_objdir/$my_outputname.def"; then 3504555991fdSmrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3505555991fdSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3506d656433aSmrg else 3507555991fdSmrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3508555991fdSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3509d656433aSmrg fi 3510d656433aSmrg ;; 3511d656433aSmrg *) 3512555991fdSmrg compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3513555991fdSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3514126a8a12Smrg ;; 3515126a8a12Smrg esac 3516d656433aSmrg ;; 3517d656433aSmrg *) 3518d656433aSmrg func_fatal_error "unknown suffix for \`$my_dlsyms'" 3519d656433aSmrg ;; 3520d656433aSmrg esac 3521d656433aSmrg else 3522d656433aSmrg # We keep going just in case the user didn't refer to 3523d656433aSmrg # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 3524d656433aSmrg # really was required. 3525d656433aSmrg 3526d656433aSmrg # Nullify the symbol file. 3527555991fdSmrg compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 3528555991fdSmrg finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 3529126a8a12Smrg fi 3530d656433aSmrg} 3531126a8a12Smrg 3532d656433aSmrg# func_win32_libid arg 3533d656433aSmrg# return the library type of file 'arg' 3534d656433aSmrg# 3535d656433aSmrg# Need a lot of goo to handle *both* DLLs and import libs 3536d656433aSmrg# Has to be a shell function in order to 'eat' the argument 3537d656433aSmrg# that is supplied when $file_magic_command is called. 3538555991fdSmrg# Despite the name, also deal with 64 bit binaries. 3539d656433aSmrgfunc_win32_libid () 3540d656433aSmrg{ 3541d656433aSmrg $opt_debug 3542d656433aSmrg win32_libid_type="unknown" 3543d656433aSmrg win32_fileres=`file -L $1 2>/dev/null` 3544d656433aSmrg case $win32_fileres in 3545d656433aSmrg *ar\ archive\ import\ library*) # definitely import 3546d656433aSmrg win32_libid_type="x86 archive import" 3547d656433aSmrg ;; 3548d656433aSmrg *ar\ archive*) # could be an import, or static 3549555991fdSmrg # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 3550d656433aSmrg if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 3551555991fdSmrg $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 35523c15da26Smrg func_to_tool_file "$1" func_convert_file_msys_to_w32 35533c15da26Smrg win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 3554d656433aSmrg $SED -n -e ' 3555d656433aSmrg 1,100{ 3556d656433aSmrg / I /{ 3557d656433aSmrg s,.*,import, 3558d656433aSmrg p 3559d656433aSmrg q 3560d656433aSmrg } 3561d656433aSmrg }'` 3562d656433aSmrg case $win32_nmres in 3563d656433aSmrg import*) win32_libid_type="x86 archive import";; 3564d656433aSmrg *) win32_libid_type="x86 archive static";; 3565d656433aSmrg esac 3566d656433aSmrg fi 3567d656433aSmrg ;; 3568d656433aSmrg *DLL*) 3569d656433aSmrg win32_libid_type="x86 DLL" 3570d656433aSmrg ;; 3571d656433aSmrg *executable*) # but shell scripts are "executable" too... 3572d656433aSmrg case $win32_fileres in 3573d656433aSmrg *MS\ Windows\ PE\ Intel*) 3574d656433aSmrg win32_libid_type="x86 DLL" 3575d656433aSmrg ;; 3576d656433aSmrg esac 3577d656433aSmrg ;; 3578d656433aSmrg esac 3579d656433aSmrg $ECHO "$win32_libid_type" 3580d656433aSmrg} 3581126a8a12Smrg 35823c15da26Smrg# func_cygming_dll_for_implib ARG 35833c15da26Smrg# 35843c15da26Smrg# Platform-specific function to extract the 35853c15da26Smrg# name of the DLL associated with the specified 35863c15da26Smrg# import library ARG. 35873c15da26Smrg# Invoked by eval'ing the libtool variable 35883c15da26Smrg# $sharedlib_from_linklib_cmd 35893c15da26Smrg# Result is available in the variable 35903c15da26Smrg# $sharedlib_from_linklib_result 35913c15da26Smrgfunc_cygming_dll_for_implib () 35923c15da26Smrg{ 35933c15da26Smrg $opt_debug 35943c15da26Smrg sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 35953c15da26Smrg} 35963c15da26Smrg 35973c15da26Smrg# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 35983c15da26Smrg# 35993c15da26Smrg# The is the core of a fallback implementation of a 36003c15da26Smrg# platform-specific function to extract the name of the 36013c15da26Smrg# DLL associated with the specified import library LIBNAME. 36023c15da26Smrg# 36033c15da26Smrg# SECTION_NAME is either .idata$6 or .idata$7, depending 36043c15da26Smrg# on the platform and compiler that created the implib. 36053c15da26Smrg# 36063c15da26Smrg# Echos the name of the DLL associated with the 36073c15da26Smrg# specified import library. 36083c15da26Smrgfunc_cygming_dll_for_implib_fallback_core () 36093c15da26Smrg{ 36103c15da26Smrg $opt_debug 36113c15da26Smrg match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 36123c15da26Smrg $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 36133c15da26Smrg $SED '/^Contents of section '"$match_literal"':/{ 36143c15da26Smrg # Place marker at beginning of archive member dllname section 36153c15da26Smrg s/.*/====MARK====/ 36163c15da26Smrg p 36173c15da26Smrg d 36183c15da26Smrg } 36193c15da26Smrg # These lines can sometimes be longer than 43 characters, but 36203c15da26Smrg # are always uninteresting 36213c15da26Smrg /:[ ]*file format pe[i]\{,1\}-/d 36223c15da26Smrg /^In archive [^:]*:/d 36233c15da26Smrg # Ensure marker is printed 36243c15da26Smrg /^====MARK====/p 36253c15da26Smrg # Remove all lines with less than 43 characters 36263c15da26Smrg /^.\{43\}/!d 36273c15da26Smrg # From remaining lines, remove first 43 characters 36283c15da26Smrg s/^.\{43\}//' | 36293c15da26Smrg $SED -n ' 36303c15da26Smrg # Join marker and all lines until next marker into a single line 36313c15da26Smrg /^====MARK====/ b para 36323c15da26Smrg H 36333c15da26Smrg $ b para 36343c15da26Smrg b 36353c15da26Smrg :para 36363c15da26Smrg x 36373c15da26Smrg s/\n//g 36383c15da26Smrg # Remove the marker 36393c15da26Smrg s/^====MARK====// 36403c15da26Smrg # Remove trailing dots and whitespace 36413c15da26Smrg s/[\. \t]*$// 36423c15da26Smrg # Print 36433c15da26Smrg /./p' | 36443c15da26Smrg # we now have a list, one entry per line, of the stringified 36453c15da26Smrg # contents of the appropriate section of all members of the 36463c15da26Smrg # archive which possess that section. Heuristic: eliminate 36473c15da26Smrg # all those which have a first or second character that is 36483c15da26Smrg # a '.' (that is, objdump's representation of an unprintable 36493c15da26Smrg # character.) This should work for all archives with less than 36503c15da26Smrg # 0x302f exports -- but will fail for DLLs whose name actually 36513c15da26Smrg # begins with a literal '.' or a single character followed by 36523c15da26Smrg # a '.'. 36533c15da26Smrg # 36543c15da26Smrg # Of those that remain, print the first one. 36553c15da26Smrg $SED -e '/^\./d;/^.\./d;q' 36563c15da26Smrg} 36573c15da26Smrg 36583c15da26Smrg# func_cygming_gnu_implib_p ARG 36593c15da26Smrg# This predicate returns with zero status (TRUE) if 36603c15da26Smrg# ARG is a GNU/binutils-style import library. Returns 36613c15da26Smrg# with nonzero status (FALSE) otherwise. 36623c15da26Smrgfunc_cygming_gnu_implib_p () 36633c15da26Smrg{ 36643c15da26Smrg $opt_debug 36653c15da26Smrg func_to_tool_file "$1" func_convert_file_msys_to_w32 36663c15da26Smrg 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)$'` 36673c15da26Smrg test -n "$func_cygming_gnu_implib_tmp" 36683c15da26Smrg} 36693c15da26Smrg 36703c15da26Smrg# func_cygming_ms_implib_p ARG 36713c15da26Smrg# This predicate returns with zero status (TRUE) if 36723c15da26Smrg# ARG is an MS-style import library. Returns 36733c15da26Smrg# with nonzero status (FALSE) otherwise. 36743c15da26Smrgfunc_cygming_ms_implib_p () 36753c15da26Smrg{ 36763c15da26Smrg $opt_debug 36773c15da26Smrg func_to_tool_file "$1" func_convert_file_msys_to_w32 36783c15da26Smrg func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 36793c15da26Smrg test -n "$func_cygming_ms_implib_tmp" 36803c15da26Smrg} 36813c15da26Smrg 36823c15da26Smrg# func_cygming_dll_for_implib_fallback ARG 36833c15da26Smrg# Platform-specific function to extract the 36843c15da26Smrg# name of the DLL associated with the specified 36853c15da26Smrg# import library ARG. 36863c15da26Smrg# 36873c15da26Smrg# This fallback implementation is for use when $DLLTOOL 36883c15da26Smrg# does not support the --identify-strict option. 36893c15da26Smrg# Invoked by eval'ing the libtool variable 36903c15da26Smrg# $sharedlib_from_linklib_cmd 36913c15da26Smrg# Result is available in the variable 36923c15da26Smrg# $sharedlib_from_linklib_result 36933c15da26Smrgfunc_cygming_dll_for_implib_fallback () 36943c15da26Smrg{ 36953c15da26Smrg $opt_debug 36963c15da26Smrg if func_cygming_gnu_implib_p "$1" ; then 36973c15da26Smrg # binutils import library 36983c15da26Smrg sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 36993c15da26Smrg elif func_cygming_ms_implib_p "$1" ; then 37003c15da26Smrg # ms-generated import library 37013c15da26Smrg sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 37023c15da26Smrg else 37033c15da26Smrg # unknown 37043c15da26Smrg sharedlib_from_linklib_result="" 37053c15da26Smrg fi 37063c15da26Smrg} 3707126a8a12Smrg 3708126a8a12Smrg 3709d656433aSmrg# func_extract_an_archive dir oldlib 3710d656433aSmrgfunc_extract_an_archive () 3711d656433aSmrg{ 3712d656433aSmrg $opt_debug 3713d656433aSmrg f_ex_an_ar_dir="$1"; shift 3714d656433aSmrg f_ex_an_ar_oldlib="$1" 3715555991fdSmrg if test "$lock_old_archive_extraction" = yes; then 3716555991fdSmrg lockfile=$f_ex_an_ar_oldlib.lock 3717555991fdSmrg until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 3718555991fdSmrg func_echo "Waiting for $lockfile to be removed" 3719555991fdSmrg sleep 2 3720555991fdSmrg done 3721555991fdSmrg fi 3722555991fdSmrg func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 3723555991fdSmrg 'stat=$?; rm -f "$lockfile"; exit $stat' 3724555991fdSmrg if test "$lock_old_archive_extraction" = yes; then 3725555991fdSmrg $opt_dry_run || rm -f "$lockfile" 3726555991fdSmrg fi 3727d656433aSmrg if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3728d656433aSmrg : 3729d656433aSmrg else 3730d656433aSmrg func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 3731d656433aSmrg fi 3732d656433aSmrg} 3733126a8a12Smrg 3734126a8a12Smrg 3735d656433aSmrg# func_extract_archives gentop oldlib ... 3736d656433aSmrgfunc_extract_archives () 3737d656433aSmrg{ 3738d656433aSmrg $opt_debug 3739d656433aSmrg my_gentop="$1"; shift 3740d656433aSmrg my_oldlibs=${1+"$@"} 3741d656433aSmrg my_oldobjs="" 3742d656433aSmrg my_xlib="" 3743d656433aSmrg my_xabs="" 3744d656433aSmrg my_xdir="" 3745126a8a12Smrg 3746d656433aSmrg for my_xlib in $my_oldlibs; do 3747d656433aSmrg # Extract the objects. 3748d656433aSmrg case $my_xlib in 3749d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3750d656433aSmrg *) my_xabs=`pwd`"/$my_xlib" ;; 3751d656433aSmrg esac 3752d656433aSmrg func_basename "$my_xlib" 3753d656433aSmrg my_xlib="$func_basename_result" 3754d656433aSmrg my_xlib_u=$my_xlib 3755d656433aSmrg while :; do 3756d656433aSmrg case " $extracted_archives " in 3757d656433aSmrg *" $my_xlib_u "*) 3758d656433aSmrg func_arith $extracted_serial + 1 3759d656433aSmrg extracted_serial=$func_arith_result 3760d656433aSmrg my_xlib_u=lt$extracted_serial-$my_xlib ;; 3761d656433aSmrg *) break ;; 3762d656433aSmrg esac 3763d656433aSmrg done 3764d656433aSmrg extracted_archives="$extracted_archives $my_xlib_u" 3765d656433aSmrg my_xdir="$my_gentop/$my_xlib_u" 3766126a8a12Smrg 3767d656433aSmrg func_mkdir_p "$my_xdir" 3768126a8a12Smrg 3769d656433aSmrg case $host in 3770d656433aSmrg *-darwin*) 3771d656433aSmrg func_verbose "Extracting $my_xabs" 3772d656433aSmrg # Do not bother doing anything if just a dry run 3773d656433aSmrg $opt_dry_run || { 3774d656433aSmrg darwin_orig_dir=`pwd` 3775d656433aSmrg cd $my_xdir || exit $? 3776d656433aSmrg darwin_archive=$my_xabs 3777d656433aSmrg darwin_curdir=`pwd` 3778d656433aSmrg darwin_base_archive=`basename "$darwin_archive"` 3779d656433aSmrg darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 3780d656433aSmrg if test -n "$darwin_arches"; then 3781d656433aSmrg darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 3782d656433aSmrg darwin_arch= 3783d656433aSmrg func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 3784d656433aSmrg for darwin_arch in $darwin_arches ; do 3785d656433aSmrg func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3786d656433aSmrg $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3787d656433aSmrg cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3788d656433aSmrg func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3789d656433aSmrg cd "$darwin_curdir" 3790d656433aSmrg $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3791d656433aSmrg done # $darwin_arches 3792d656433aSmrg ## Okay now we've a bunch of thin objects, gotta fatten them up :) 3793d656433aSmrg darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 3794d656433aSmrg darwin_file= 3795d656433aSmrg darwin_files= 3796d656433aSmrg for darwin_file in $darwin_filelist; do 3797555991fdSmrg darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 3798d656433aSmrg $LIPO -create -output "$darwin_file" $darwin_files 3799d656433aSmrg done # $darwin_filelist 3800d656433aSmrg $RM -rf unfat-$$ 3801d656433aSmrg cd "$darwin_orig_dir" 3802d656433aSmrg else 3803d656433aSmrg cd $darwin_orig_dir 3804d656433aSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 3805d656433aSmrg fi # $darwin_arches 3806d656433aSmrg } # !$opt_dry_run 3807d656433aSmrg ;; 3808d656433aSmrg *) 3809d656433aSmrg func_extract_an_archive "$my_xdir" "$my_xabs" 3810d656433aSmrg ;; 3811126a8a12Smrg esac 3812555991fdSmrg my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 3813d656433aSmrg done 3814126a8a12Smrg 3815d656433aSmrg func_extract_archives_result="$my_oldobjs" 3816d656433aSmrg} 3817126a8a12Smrg 3818126a8a12Smrg 3819555991fdSmrg# func_emit_wrapper [arg=no] 3820d656433aSmrg# 3821555991fdSmrg# Emit a libtool wrapper script on stdout. 3822555991fdSmrg# Don't directly open a file because we may want to 3823555991fdSmrg# incorporate the script contents within a cygwin/mingw 3824555991fdSmrg# wrapper executable. Must ONLY be called from within 3825555991fdSmrg# func_mode_link because it depends on a number of variables 3826555991fdSmrg# set therein. 3827555991fdSmrg# 3828555991fdSmrg# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 3829555991fdSmrg# variable will take. If 'yes', then the emitted script 3830555991fdSmrg# will assume that the directory in which it is stored is 3831555991fdSmrg# the $objdir directory. This is a cygwin/mingw-specific 3832555991fdSmrg# behavior. 3833555991fdSmrgfunc_emit_wrapper () 3834d656433aSmrg{ 3835555991fdSmrg func_emit_wrapper_arg1=${1-no} 3836126a8a12Smrg 3837d656433aSmrg $ECHO "\ 3838d656433aSmrg#! $SHELL 3839126a8a12Smrg 3840d656433aSmrg# $output - temporary wrapper script for $objdir/$outputname 3841d656433aSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3842d656433aSmrg# 3843d656433aSmrg# The $output program cannot be directly executed until all the libtool 3844d656433aSmrg# libraries that it depends on are installed. 3845d656433aSmrg# 3846d656433aSmrg# This wrapper script should never be moved out of the build directory. 3847d656433aSmrg# If it is, it will not operate correctly. 3848126a8a12Smrg 3849d656433aSmrg# Sed substitution that helps us do robust quoting. It backslashifies 3850d656433aSmrg# metacharacters that are still active within double-quoted strings. 3851d656433aSmrgsed_quote_subst='$sed_quote_subst' 3852126a8a12Smrg 3853d656433aSmrg# Be Bourne compatible 3854d656433aSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 3855d656433aSmrg emulate sh 3856d656433aSmrg NULLCMD=: 3857d656433aSmrg # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 3858d656433aSmrg # is contrary to our usage. Disable this feature. 3859d656433aSmrg alias -g '\${1+\"\$@\"}'='\"\$@\"' 3860d656433aSmrg setopt NO_GLOB_SUBST 3861d656433aSmrgelse 3862d656433aSmrg case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 3863d656433aSmrgfi 3864d656433aSmrgBIN_SH=xpg4; export BIN_SH # for Tru64 3865d656433aSmrgDUALCASE=1; export DUALCASE # for MKS sh 3866126a8a12Smrg 3867d656433aSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout 3868d656433aSmrg# if CDPATH is set. 3869d656433aSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 3870126a8a12Smrg 3871d656433aSmrgrelink_command=\"$relink_command\" 3872126a8a12Smrg 3873d656433aSmrg# This environment variable determines our operation mode. 3874d656433aSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then 3875d656433aSmrg # install mode needs the following variables: 3876d656433aSmrg generated_by_libtool_version='$macro_version' 3877d656433aSmrg notinst_deplibs='$notinst_deplibs' 3878d656433aSmrgelse 3879d656433aSmrg # When we are sourced in execute mode, \$file and \$ECHO are already set. 3880d656433aSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 3881555991fdSmrg file=\"\$0\"" 3882555991fdSmrg 3883555991fdSmrg qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 3884555991fdSmrg $ECHO "\ 3885555991fdSmrg 3886555991fdSmrg# A function that is used when there is no print builtin or printf. 3887555991fdSmrgfunc_fallback_echo () 3888555991fdSmrg{ 3889555991fdSmrg eval 'cat <<_LTECHO_EOF 3890555991fdSmrg\$1 3891555991fdSmrg_LTECHO_EOF' 3892555991fdSmrg} 3893555991fdSmrg ECHO=\"$qECHO\" 3894555991fdSmrg fi 3895555991fdSmrg 3896555991fdSmrg# Very basic option parsing. These options are (a) specific to 3897555991fdSmrg# the libtool wrapper, (b) are identical between the wrapper 3898555991fdSmrg# /script/ and the wrapper /executable/ which is used only on 3899555991fdSmrg# windows platforms, and (c) all begin with the string "--lt-" 3900555991fdSmrg# (application programs are unlikely to have options which match 3901555991fdSmrg# this pattern). 3902555991fdSmrg# 3903555991fdSmrg# There are only two supported options: --lt-debug and 3904555991fdSmrg# --lt-dump-script. There is, deliberately, no --lt-help. 3905555991fdSmrg# 3906555991fdSmrg# The first argument to this parsing function should be the 3907555991fdSmrg# script's $0 value, followed by "$@". 3908555991fdSmrglt_option_debug= 3909555991fdSmrgfunc_parse_lt_options () 3910555991fdSmrg{ 3911555991fdSmrg lt_script_arg0=\$0 3912555991fdSmrg shift 3913555991fdSmrg for lt_opt 3914555991fdSmrg do 3915555991fdSmrg case \"\$lt_opt\" in 3916555991fdSmrg --lt-debug) lt_option_debug=1 ;; 3917555991fdSmrg --lt-dump-script) 3918555991fdSmrg lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 3919555991fdSmrg test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 3920555991fdSmrg lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 3921555991fdSmrg cat \"\$lt_dump_D/\$lt_dump_F\" 3922555991fdSmrg exit 0 3923555991fdSmrg ;; 3924555991fdSmrg --lt-*) 3925555991fdSmrg \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 3926555991fdSmrg exit 1 3927555991fdSmrg ;; 3928555991fdSmrg esac 3929555991fdSmrg done 3930555991fdSmrg 3931555991fdSmrg # Print the debug banner immediately: 3932555991fdSmrg if test -n \"\$lt_option_debug\"; then 3933555991fdSmrg echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 3934555991fdSmrg fi 3935555991fdSmrg} 3936555991fdSmrg 3937555991fdSmrg# Used when --lt-debug. Prints its arguments to stdout 3938555991fdSmrg# (redirection is the responsibility of the caller) 3939555991fdSmrgfunc_lt_dump_args () 3940555991fdSmrg{ 3941555991fdSmrg lt_dump_args_N=1; 3942555991fdSmrg for lt_arg 3943555991fdSmrg do 3944555991fdSmrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 3945555991fdSmrg lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 3946555991fdSmrg done 3947555991fdSmrg} 3948555991fdSmrg 3949555991fdSmrg# Core function for launching the target application 3950555991fdSmrgfunc_exec_program_core () 3951555991fdSmrg{ 3952d656433aSmrg" 3953555991fdSmrg case $host in 3954555991fdSmrg # Backslashes separate directories on plain windows 3955555991fdSmrg *-*-mingw | *-*-os2* | *-cegcc*) 3956555991fdSmrg $ECHO "\ 3957555991fdSmrg if test -n \"\$lt_option_debug\"; then 3958555991fdSmrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 3959555991fdSmrg func_lt_dump_args \${1+\"\$@\"} 1>&2 3960555991fdSmrg fi 3961555991fdSmrg exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 3962555991fdSmrg" 3963555991fdSmrg ;; 3964555991fdSmrg 3965555991fdSmrg *) 3966555991fdSmrg $ECHO "\ 3967555991fdSmrg if test -n \"\$lt_option_debug\"; then 3968555991fdSmrg \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 3969555991fdSmrg func_lt_dump_args \${1+\"\$@\"} 1>&2 3970555991fdSmrg fi 3971555991fdSmrg exec \"\$progdir/\$program\" \${1+\"\$@\"} 3972555991fdSmrg" 3973555991fdSmrg ;; 3974555991fdSmrg esac 3975555991fdSmrg $ECHO "\ 3976555991fdSmrg \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 3977555991fdSmrg exit 1 3978555991fdSmrg} 3979555991fdSmrg 3980555991fdSmrg# A function to encapsulate launching the target application 3981555991fdSmrg# Strips options in the --lt-* namespace from \$@ and 3982555991fdSmrg# launches target application with the remaining arguments. 3983555991fdSmrgfunc_exec_program () 3984555991fdSmrg{ 3985555991fdSmrg for lt_wr_arg 3986555991fdSmrg do 3987555991fdSmrg case \$lt_wr_arg in 3988555991fdSmrg --lt-*) ;; 3989555991fdSmrg *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 3990555991fdSmrg esac 3991555991fdSmrg shift 3992555991fdSmrg done 3993555991fdSmrg func_exec_program_core \${1+\"\$@\"} 3994555991fdSmrg} 3995555991fdSmrg 3996555991fdSmrg # Parse options 3997555991fdSmrg func_parse_lt_options \"\$0\" \${1+\"\$@\"} 3998126a8a12Smrg 3999d656433aSmrg # Find the directory that this script lives in. 4000555991fdSmrg thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 4001d656433aSmrg test \"x\$thisdir\" = \"x\$file\" && thisdir=. 4002126a8a12Smrg 4003d656433aSmrg # Follow symbolic links until we get to the real thisdir. 4004555991fdSmrg file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 4005d656433aSmrg while test -n \"\$file\"; do 4006555991fdSmrg destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 4007126a8a12Smrg 4008d656433aSmrg # If there was a directory component, then change thisdir. 4009d656433aSmrg if test \"x\$destdir\" != \"x\$file\"; then 4010d656433aSmrg case \"\$destdir\" in 4011d656433aSmrg [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 4012d656433aSmrg *) thisdir=\"\$thisdir/\$destdir\" ;; 4013d656433aSmrg esac 4014d656433aSmrg fi 4015126a8a12Smrg 4016555991fdSmrg file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 4017555991fdSmrg file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 4018d656433aSmrg done 4019126a8a12Smrg 4020d656433aSmrg # Usually 'no', except on cygwin/mingw when embedded into 4021d656433aSmrg # the cwrapper. 4022555991fdSmrg WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 4023d656433aSmrg if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 4024d656433aSmrg # special case for '.' 4025d656433aSmrg if test \"\$thisdir\" = \".\"; then 4026d656433aSmrg thisdir=\`pwd\` 4027d656433aSmrg fi 4028d656433aSmrg # remove .libs from thisdir 4029d656433aSmrg case \"\$thisdir\" in 4030555991fdSmrg *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 4031d656433aSmrg $objdir ) thisdir=. ;; 4032d656433aSmrg esac 4033d656433aSmrg fi 4034126a8a12Smrg 4035d656433aSmrg # Try to get the absolute directory name. 4036d656433aSmrg absdir=\`cd \"\$thisdir\" && pwd\` 4037d656433aSmrg test -n \"\$absdir\" && thisdir=\"\$absdir\" 4038d656433aSmrg" 4039126a8a12Smrg 4040d656433aSmrg if test "$fast_install" = yes; then 4041d656433aSmrg $ECHO "\ 4042d656433aSmrg program=lt-'$outputname'$exeext 4043d656433aSmrg progdir=\"\$thisdir/$objdir\" 4044126a8a12Smrg 4045d656433aSmrg if test ! -f \"\$progdir/\$program\" || 4046d656433aSmrg { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 4047d656433aSmrg test \"X\$file\" != \"X\$progdir/\$program\"; }; then 4048126a8a12Smrg 4049d656433aSmrg file=\"\$\$-\$program\" 4050126a8a12Smrg 4051d656433aSmrg if test ! -d \"\$progdir\"; then 4052d656433aSmrg $MKDIR \"\$progdir\" 4053d656433aSmrg else 4054d656433aSmrg $RM \"\$progdir/\$file\" 4055d656433aSmrg fi" 4056126a8a12Smrg 4057d656433aSmrg $ECHO "\ 4058126a8a12Smrg 4059d656433aSmrg # relink executable if necessary 4060d656433aSmrg if test -n \"\$relink_command\"; then 4061d656433aSmrg if relink_command_output=\`eval \$relink_command 2>&1\`; then : 4062d656433aSmrg else 4063d656433aSmrg $ECHO \"\$relink_command_output\" >&2 4064d656433aSmrg $RM \"\$progdir/\$file\" 4065d656433aSmrg exit 1 4066d656433aSmrg fi 4067d656433aSmrg fi 4068126a8a12Smrg 4069d656433aSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 4070d656433aSmrg { $RM \"\$progdir/\$program\"; 4071d656433aSmrg $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 4072d656433aSmrg $RM \"\$progdir/\$file\" 4073d656433aSmrg fi" 4074d656433aSmrg else 4075d656433aSmrg $ECHO "\ 4076d656433aSmrg program='$outputname' 4077d656433aSmrg progdir=\"\$thisdir/$objdir\" 4078d656433aSmrg" 4079d656433aSmrg fi 4080126a8a12Smrg 4081d656433aSmrg $ECHO "\ 4082126a8a12Smrg 4083d656433aSmrg if test -f \"\$progdir/\$program\"; then" 4084126a8a12Smrg 40853c15da26Smrg # fixup the dll searchpath if we need to. 40863c15da26Smrg # 40873c15da26Smrg # Fix the DLL searchpath if we need to. Do this before prepending 40883c15da26Smrg # to shlibpath, because on Windows, both are PATH and uninstalled 40893c15da26Smrg # libraries must come first. 40903c15da26Smrg if test -n "$dllsearchpath"; then 40913c15da26Smrg $ECHO "\ 40923c15da26Smrg # Add the dll search path components to the executable PATH 40933c15da26Smrg PATH=$dllsearchpath:\$PATH 40943c15da26Smrg" 40953c15da26Smrg fi 40963c15da26Smrg 4097d656433aSmrg # Export our shlibpath_var if we have one. 4098d656433aSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4099d656433aSmrg $ECHO "\ 4100d656433aSmrg # Add our own library path to $shlibpath_var 4101d656433aSmrg $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 4102126a8a12Smrg 4103d656433aSmrg # Some systems cannot cope with colon-terminated $shlibpath_var 4104d656433aSmrg # The second colon is a workaround for a bug in BeOS R4 sed 4105555991fdSmrg $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 4106126a8a12Smrg 4107d656433aSmrg export $shlibpath_var 4108d656433aSmrg" 4109126a8a12Smrg fi 4110126a8a12Smrg 4111d656433aSmrg $ECHO "\ 4112d656433aSmrg if test \"\$libtool_execute_magic\" != \"$magic\"; then 4113d656433aSmrg # Run the actual program with our arguments. 4114555991fdSmrg func_exec_program \${1+\"\$@\"} 4115d656433aSmrg fi 4116d656433aSmrg else 4117d656433aSmrg # The program doesn't exist. 4118d656433aSmrg \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 4119d656433aSmrg \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 4120555991fdSmrg \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 4121d656433aSmrg exit 1 4122d656433aSmrg fi 4123d656433aSmrgfi\ 4124d656433aSmrg" 4125d656433aSmrg} 4126126a8a12Smrg 4127126a8a12Smrg 4128d656433aSmrg# func_emit_cwrapperexe_src 4129d656433aSmrg# emit the source code for a wrapper executable on stdout 4130d656433aSmrg# Must ONLY be called from within func_mode_link because 4131d656433aSmrg# it depends on a number of variable set therein. 4132d656433aSmrgfunc_emit_cwrapperexe_src () 4133d656433aSmrg{ 4134d656433aSmrg cat <<EOF 4135126a8a12Smrg 4136d656433aSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4137d656433aSmrg Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 4138126a8a12Smrg 4139d656433aSmrg The $output program cannot be directly executed until all the libtool 4140d656433aSmrg libraries that it depends on are installed. 4141126a8a12Smrg 4142d656433aSmrg This wrapper executable should never be moved out of the build directory. 4143d656433aSmrg If it is, it will not operate correctly. 4144d656433aSmrg*/ 4145d656433aSmrgEOF 4146d656433aSmrg cat <<"EOF" 4147555991fdSmrg#ifdef _MSC_VER 4148555991fdSmrg# define _CRT_SECURE_NO_DEPRECATE 1 4149555991fdSmrg#endif 4150d656433aSmrg#include <stdio.h> 4151d656433aSmrg#include <stdlib.h> 4152d656433aSmrg#ifdef _MSC_VER 4153d656433aSmrg# include <direct.h> 4154d656433aSmrg# include <process.h> 4155d656433aSmrg# include <io.h> 4156d656433aSmrg#else 4157d656433aSmrg# include <unistd.h> 4158d656433aSmrg# include <stdint.h> 4159d656433aSmrg# ifdef __CYGWIN__ 4160d656433aSmrg# include <io.h> 4161d656433aSmrg# endif 4162d656433aSmrg#endif 4163d656433aSmrg#include <malloc.h> 4164d656433aSmrg#include <stdarg.h> 4165d656433aSmrg#include <assert.h> 4166d656433aSmrg#include <string.h> 4167d656433aSmrg#include <ctype.h> 4168d656433aSmrg#include <errno.h> 4169d656433aSmrg#include <fcntl.h> 4170d656433aSmrg#include <sys/stat.h> 4171d656433aSmrg 4172555991fdSmrg/* declarations of non-ANSI functions */ 4173555991fdSmrg#if defined(__MINGW32__) 4174555991fdSmrg# ifdef __STRICT_ANSI__ 4175555991fdSmrgint _putenv (const char *); 4176555991fdSmrg# endif 4177555991fdSmrg#elif defined(__CYGWIN__) 4178555991fdSmrg# ifdef __STRICT_ANSI__ 4179555991fdSmrgchar *realpath (const char *, char *); 4180555991fdSmrgint putenv (char *); 4181555991fdSmrgint setenv (const char *, const char *, int); 4182555991fdSmrg# endif 4183555991fdSmrg/* #elif defined (other platforms) ... */ 4184555991fdSmrg#endif 4185555991fdSmrg 4186555991fdSmrg/* portability defines, excluding path handling macros */ 4187555991fdSmrg#if defined(_MSC_VER) 4188555991fdSmrg# define setmode _setmode 4189555991fdSmrg# define stat _stat 4190555991fdSmrg# define chmod _chmod 4191555991fdSmrg# define getcwd _getcwd 4192555991fdSmrg# define putenv _putenv 4193555991fdSmrg# define S_IXUSR _S_IEXEC 4194555991fdSmrg# ifndef _INTPTR_T_DEFINED 4195555991fdSmrg# define _INTPTR_T_DEFINED 4196555991fdSmrg# define intptr_t int 4197555991fdSmrg# endif 4198555991fdSmrg#elif defined(__MINGW32__) 4199555991fdSmrg# define setmode _setmode 4200555991fdSmrg# define stat _stat 4201555991fdSmrg# define chmod _chmod 4202555991fdSmrg# define getcwd _getcwd 4203555991fdSmrg# define putenv _putenv 4204555991fdSmrg#elif defined(__CYGWIN__) 4205555991fdSmrg# define HAVE_SETENV 4206555991fdSmrg# define FOPEN_WB "wb" 4207555991fdSmrg/* #elif defined (other platforms) ... */ 4208555991fdSmrg#endif 4209555991fdSmrg 4210d656433aSmrg#if defined(PATH_MAX) 4211d656433aSmrg# define LT_PATHMAX PATH_MAX 4212d656433aSmrg#elif defined(MAXPATHLEN) 4213d656433aSmrg# define LT_PATHMAX MAXPATHLEN 4214d656433aSmrg#else 4215d656433aSmrg# define LT_PATHMAX 1024 4216d656433aSmrg#endif 4217d656433aSmrg 4218d656433aSmrg#ifndef S_IXOTH 4219d656433aSmrg# define S_IXOTH 0 4220d656433aSmrg#endif 4221d656433aSmrg#ifndef S_IXGRP 4222d656433aSmrg# define S_IXGRP 0 4223d656433aSmrg#endif 4224d656433aSmrg 4225555991fdSmrg/* path handling portability macros */ 4226d656433aSmrg#ifndef DIR_SEPARATOR 4227d656433aSmrg# define DIR_SEPARATOR '/' 4228d656433aSmrg# define PATH_SEPARATOR ':' 4229d656433aSmrg#endif 4230d656433aSmrg 4231d656433aSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4232d656433aSmrg defined (__OS2__) 4233d656433aSmrg# define HAVE_DOS_BASED_FILE_SYSTEM 4234d656433aSmrg# define FOPEN_WB "wb" 4235d656433aSmrg# ifndef DIR_SEPARATOR_2 4236d656433aSmrg# define DIR_SEPARATOR_2 '\\' 4237d656433aSmrg# endif 4238d656433aSmrg# ifndef PATH_SEPARATOR_2 4239d656433aSmrg# define PATH_SEPARATOR_2 ';' 4240d656433aSmrg# endif 4241d656433aSmrg#endif 4242d656433aSmrg 4243d656433aSmrg#ifndef DIR_SEPARATOR_2 4244d656433aSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4245d656433aSmrg#else /* DIR_SEPARATOR_2 */ 4246d656433aSmrg# define IS_DIR_SEPARATOR(ch) \ 4247d656433aSmrg (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4248d656433aSmrg#endif /* DIR_SEPARATOR_2 */ 4249d656433aSmrg 4250d656433aSmrg#ifndef PATH_SEPARATOR_2 4251d656433aSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 4252d656433aSmrg#else /* PATH_SEPARATOR_2 */ 4253d656433aSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 4254d656433aSmrg#endif /* PATH_SEPARATOR_2 */ 4255d656433aSmrg 4256d656433aSmrg#ifndef FOPEN_WB 4257d656433aSmrg# define FOPEN_WB "w" 4258d656433aSmrg#endif 4259d656433aSmrg#ifndef _O_BINARY 4260d656433aSmrg# define _O_BINARY 0 4261d656433aSmrg#endif 4262d656433aSmrg 4263d656433aSmrg#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4264d656433aSmrg#define XFREE(stale) do { \ 4265d656433aSmrg if (stale) { free ((void *) stale); stale = 0; } \ 4266d656433aSmrg} while (0) 4267d656433aSmrg 4268555991fdSmrg#if defined(LT_DEBUGWRAPPER) 4269555991fdSmrgstatic int lt_debug = 1; 4270d656433aSmrg#else 4271555991fdSmrgstatic int lt_debug = 0; 4272d656433aSmrg#endif 4273d656433aSmrg 4274555991fdSmrgconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 4275d656433aSmrg 4276d656433aSmrgvoid *xmalloc (size_t num); 4277d656433aSmrgchar *xstrdup (const char *string); 4278d656433aSmrgconst char *base_name (const char *name); 4279d656433aSmrgchar *find_executable (const char *wrapper); 4280d656433aSmrgchar *chase_symlinks (const char *pathspec); 4281d656433aSmrgint make_executable (const char *path); 4282d656433aSmrgint check_executable (const char *path); 4283d656433aSmrgchar *strendzap (char *str, const char *pat); 4284555991fdSmrgvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 4285555991fdSmrgvoid lt_fatal (const char *file, int line, const char *message, ...); 4286555991fdSmrgstatic const char *nonnull (const char *s); 4287555991fdSmrgstatic const char *nonempty (const char *s); 4288d656433aSmrgvoid lt_setenv (const char *name, const char *value); 4289d656433aSmrgchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 4290d656433aSmrgvoid lt_update_exe_path (const char *name, const char *value); 4291d656433aSmrgvoid lt_update_lib_path (const char *name, const char *value); 4292555991fdSmrgchar **prepare_spawn (char **argv); 4293555991fdSmrgvoid lt_dump_script (FILE *f); 4294d656433aSmrgEOF 4295d656433aSmrg 4296d656433aSmrg cat <<EOF 42973c15da26Smrgvolatile const char * MAGIC_EXE = "$magic_exe"; 4298d656433aSmrgconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 4299d656433aSmrgEOF 4300d656433aSmrg 4301d656433aSmrg if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 43023c15da26Smrg func_to_host_path "$temp_rpath" 4303d656433aSmrg cat <<EOF 43043c15da26Smrgconst char * LIB_PATH_VALUE = "$func_to_host_path_result"; 4305126a8a12SmrgEOF 4306126a8a12Smrg else 4307d656433aSmrg cat <<"EOF" 4308d656433aSmrgconst char * LIB_PATH_VALUE = ""; 4309d656433aSmrgEOF 4310126a8a12Smrg fi 4311d656433aSmrg 4312d656433aSmrg if test -n "$dllsearchpath"; then 43133c15da26Smrg func_to_host_path "$dllsearchpath:" 4314d656433aSmrg cat <<EOF 4315d656433aSmrgconst char * EXE_PATH_VARNAME = "PATH"; 43163c15da26Smrgconst char * EXE_PATH_VALUE = "$func_to_host_path_result"; 4317d656433aSmrgEOF 4318126a8a12Smrg else 4319d656433aSmrg cat <<"EOF" 4320d656433aSmrgconst char * EXE_PATH_VARNAME = ""; 4321d656433aSmrgconst char * EXE_PATH_VALUE = ""; 4322d656433aSmrgEOF 4323126a8a12Smrg fi 4324d656433aSmrg 4325d656433aSmrg if test "$fast_install" = yes; then 4326d656433aSmrg cat <<EOF 4327d656433aSmrgconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 4328d656433aSmrgEOF 4329126a8a12Smrg else 4330d656433aSmrg cat <<EOF 4331d656433aSmrgconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 4332d656433aSmrgEOF 4333126a8a12Smrg fi 4334126a8a12Smrg 4335126a8a12Smrg 4336d656433aSmrg cat <<"EOF" 4337126a8a12Smrg 4338d656433aSmrg#define LTWRAPPER_OPTION_PREFIX "--lt-" 4339126a8a12Smrg 4340d656433aSmrgstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 4341d656433aSmrgstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 4342555991fdSmrgstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 4343126a8a12Smrg 4344d656433aSmrgint 4345d656433aSmrgmain (int argc, char *argv[]) 4346d656433aSmrg{ 4347d656433aSmrg char **newargz; 4348d656433aSmrg int newargc; 4349d656433aSmrg char *tmp_pathspec; 4350d656433aSmrg char *actual_cwrapper_path; 4351d656433aSmrg char *actual_cwrapper_name; 4352d656433aSmrg char *target_name; 4353d656433aSmrg char *lt_argv_zero; 4354d656433aSmrg intptr_t rval = 127; 4355126a8a12Smrg 4356d656433aSmrg int i; 4357126a8a12Smrg 4358d656433aSmrg program_name = (char *) xstrdup (base_name (argv[0])); 4359555991fdSmrg newargz = XMALLOC (char *, argc + 1); 4360126a8a12Smrg 4361555991fdSmrg /* very simple arg parsing; don't want to rely on getopt 4362555991fdSmrg * also, copy all non cwrapper options to newargz, except 4363555991fdSmrg * argz[0], which is handled differently 4364555991fdSmrg */ 4365555991fdSmrg newargc=0; 4366d656433aSmrg for (i = 1; i < argc; i++) 4367d656433aSmrg { 4368d656433aSmrg if (strcmp (argv[i], dumpscript_opt) == 0) 4369d656433aSmrg { 4370d656433aSmrgEOF 4371d656433aSmrg case "$host" in 4372d656433aSmrg *mingw* | *cygwin* ) 4373d656433aSmrg # make stdout use "unix" line endings 4374d656433aSmrg echo " setmode(1,_O_BINARY);" 4375d656433aSmrg ;; 4376d656433aSmrg esac 4377126a8a12Smrg 4378d656433aSmrg cat <<"EOF" 4379555991fdSmrg lt_dump_script (stdout); 4380d656433aSmrg return 0; 4381d656433aSmrg } 4382555991fdSmrg if (strcmp (argv[i], debug_opt) == 0) 4383555991fdSmrg { 4384555991fdSmrg lt_debug = 1; 4385555991fdSmrg continue; 4386555991fdSmrg } 4387555991fdSmrg if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 4388555991fdSmrg { 4389555991fdSmrg /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 4390555991fdSmrg namespace, but it is not one of the ones we know about and 4391555991fdSmrg have already dealt with, above (inluding dump-script), then 4392555991fdSmrg report an error. Otherwise, targets might begin to believe 4393555991fdSmrg they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 4394555991fdSmrg namespace. The first time any user complains about this, we'll 4395555991fdSmrg need to make LTWRAPPER_OPTION_PREFIX a configure-time option 4396555991fdSmrg or a configure.ac-settable value. 4397555991fdSmrg */ 4398555991fdSmrg lt_fatal (__FILE__, __LINE__, 4399555991fdSmrg "unrecognized %s option: '%s'", 4400555991fdSmrg ltwrapper_option_prefix, argv[i]); 4401555991fdSmrg } 4402555991fdSmrg /* otherwise ... */ 4403555991fdSmrg newargz[++newargc] = xstrdup (argv[i]); 4404d656433aSmrg } 4405555991fdSmrg newargz[++newargc] = NULL; 4406555991fdSmrg 4407555991fdSmrgEOF 4408555991fdSmrg cat <<EOF 4409555991fdSmrg /* The GNU banner must be the first non-error debug message */ 4410555991fdSmrg lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 4411555991fdSmrgEOF 4412555991fdSmrg cat <<"EOF" 4413555991fdSmrg lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 4414555991fdSmrg lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 4415126a8a12Smrg 4416d656433aSmrg tmp_pathspec = find_executable (argv[0]); 4417d656433aSmrg if (tmp_pathspec == NULL) 4418555991fdSmrg lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 4419555991fdSmrg lt_debugprintf (__FILE__, __LINE__, 4420555991fdSmrg "(main) found exe (before symlink chase) at: %s\n", 4421555991fdSmrg tmp_pathspec); 4422d656433aSmrg 4423d656433aSmrg actual_cwrapper_path = chase_symlinks (tmp_pathspec); 4424555991fdSmrg lt_debugprintf (__FILE__, __LINE__, 4425555991fdSmrg "(main) found exe (after symlink chase) at: %s\n", 4426555991fdSmrg actual_cwrapper_path); 4427d656433aSmrg XFREE (tmp_pathspec); 4428d656433aSmrg 4429555991fdSmrg actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 4430d656433aSmrg strendzap (actual_cwrapper_path, actual_cwrapper_name); 4431d656433aSmrg 4432d656433aSmrg /* wrapper name transforms */ 4433d656433aSmrg strendzap (actual_cwrapper_name, ".exe"); 4434d656433aSmrg tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 4435d656433aSmrg XFREE (actual_cwrapper_name); 4436d656433aSmrg actual_cwrapper_name = tmp_pathspec; 4437d656433aSmrg tmp_pathspec = 0; 4438d656433aSmrg 4439d656433aSmrg /* target_name transforms -- use actual target program name; might have lt- prefix */ 4440d656433aSmrg target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 4441d656433aSmrg strendzap (target_name, ".exe"); 4442d656433aSmrg tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 4443d656433aSmrg XFREE (target_name); 4444d656433aSmrg target_name = tmp_pathspec; 4445d656433aSmrg tmp_pathspec = 0; 4446d656433aSmrg 4447555991fdSmrg lt_debugprintf (__FILE__, __LINE__, 4448555991fdSmrg "(main) libtool target name: %s\n", 4449555991fdSmrg target_name); 4450d656433aSmrgEOF 4451126a8a12Smrg 4452d656433aSmrg cat <<EOF 4453d656433aSmrg newargz[0] = 4454d656433aSmrg XMALLOC (char, (strlen (actual_cwrapper_path) + 4455d656433aSmrg strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 4456d656433aSmrg strcpy (newargz[0], actual_cwrapper_path); 4457d656433aSmrg strcat (newargz[0], "$objdir"); 4458d656433aSmrg strcat (newargz[0], "/"); 4459d656433aSmrgEOF 4460126a8a12Smrg 4461d656433aSmrg cat <<"EOF" 4462d656433aSmrg /* stop here, and copy so we don't have to do this twice */ 4463d656433aSmrg tmp_pathspec = xstrdup (newargz[0]); 4464126a8a12Smrg 4465d656433aSmrg /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 4466d656433aSmrg strcat (newargz[0], actual_cwrapper_name); 4467126a8a12Smrg 4468d656433aSmrg /* DO want the lt- prefix here if it exists, so use target_name */ 4469d656433aSmrg lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 4470d656433aSmrg XFREE (tmp_pathspec); 4471d656433aSmrg tmp_pathspec = NULL; 4472d656433aSmrgEOF 4473126a8a12Smrg 4474d656433aSmrg case $host_os in 4475d656433aSmrg mingw*) 4476d656433aSmrg cat <<"EOF" 4477d656433aSmrg { 4478d656433aSmrg char* p; 4479d656433aSmrg while ((p = strchr (newargz[0], '\\')) != NULL) 4480d656433aSmrg { 4481d656433aSmrg *p = '/'; 4482d656433aSmrg } 4483d656433aSmrg while ((p = strchr (lt_argv_zero, '\\')) != NULL) 4484d656433aSmrg { 4485d656433aSmrg *p = '/'; 4486d656433aSmrg } 4487d656433aSmrg } 4488d656433aSmrgEOF 4489d656433aSmrg ;; 4490d656433aSmrg esac 4491126a8a12Smrg 4492d656433aSmrg cat <<"EOF" 4493d656433aSmrg XFREE (target_name); 4494d656433aSmrg XFREE (actual_cwrapper_path); 4495d656433aSmrg XFREE (actual_cwrapper_name); 4496126a8a12Smrg 4497d656433aSmrg lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 4498d656433aSmrg lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 44993c15da26Smrg /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 45003c15da26Smrg be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 45013c15da26Smrg because on Windows, both *_VARNAMEs are PATH but uninstalled 45023c15da26Smrg libraries must come first. */ 4503d656433aSmrg lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 45043c15da26Smrg lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 4505126a8a12Smrg 4506555991fdSmrg lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 4507555991fdSmrg nonnull (lt_argv_zero)); 4508d656433aSmrg for (i = 0; i < newargc; i++) 4509d656433aSmrg { 4510555991fdSmrg lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 4511555991fdSmrg i, nonnull (newargz[i])); 4512d656433aSmrg } 4513126a8a12Smrg 4514d656433aSmrgEOF 4515126a8a12Smrg 4516d656433aSmrg case $host_os in 4517d656433aSmrg mingw*) 4518d656433aSmrg cat <<"EOF" 4519d656433aSmrg /* execv doesn't actually work on mingw as expected on unix */ 4520555991fdSmrg newargz = prepare_spawn (newargz); 4521d656433aSmrg rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 4522d656433aSmrg if (rval == -1) 4523d656433aSmrg { 4524d656433aSmrg /* failed to start process */ 4525555991fdSmrg lt_debugprintf (__FILE__, __LINE__, 4526555991fdSmrg "(main) failed to launch target \"%s\": %s\n", 4527555991fdSmrg lt_argv_zero, nonnull (strerror (errno))); 4528d656433aSmrg return 127; 4529d656433aSmrg } 4530d656433aSmrg return rval; 4531d656433aSmrgEOF 4532d656433aSmrg ;; 4533d656433aSmrg *) 4534d656433aSmrg cat <<"EOF" 4535d656433aSmrg execv (lt_argv_zero, newargz); 4536d656433aSmrg return rval; /* =127, but avoids unused variable warning */ 4537d656433aSmrgEOF 4538d656433aSmrg ;; 4539d656433aSmrg esac 4540126a8a12Smrg 4541d656433aSmrg cat <<"EOF" 4542d656433aSmrg} 4543126a8a12Smrg 4544d656433aSmrgvoid * 4545d656433aSmrgxmalloc (size_t num) 4546d656433aSmrg{ 4547d656433aSmrg void *p = (void *) malloc (num); 4548d656433aSmrg if (!p) 4549555991fdSmrg lt_fatal (__FILE__, __LINE__, "memory exhausted"); 4550126a8a12Smrg 4551d656433aSmrg return p; 4552d656433aSmrg} 4553126a8a12Smrg 4554d656433aSmrgchar * 4555d656433aSmrgxstrdup (const char *string) 4556d656433aSmrg{ 4557d656433aSmrg return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 4558d656433aSmrg string) : NULL; 4559d656433aSmrg} 4560126a8a12Smrg 4561d656433aSmrgconst char * 4562d656433aSmrgbase_name (const char *name) 4563d656433aSmrg{ 4564d656433aSmrg const char *base; 4565126a8a12Smrg 4566d656433aSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4567d656433aSmrg /* Skip over the disk name in MSDOS pathnames. */ 4568d656433aSmrg if (isalpha ((unsigned char) name[0]) && name[1] == ':') 4569d656433aSmrg name += 2; 4570d656433aSmrg#endif 4571126a8a12Smrg 4572d656433aSmrg for (base = name; *name; name++) 4573d656433aSmrg if (IS_DIR_SEPARATOR (*name)) 4574d656433aSmrg base = name + 1; 4575d656433aSmrg return base; 4576d656433aSmrg} 4577126a8a12Smrg 4578d656433aSmrgint 4579d656433aSmrgcheck_executable (const char *path) 4580d656433aSmrg{ 4581d656433aSmrg struct stat st; 4582126a8a12Smrg 4583555991fdSmrg lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 4584555991fdSmrg nonempty (path)); 4585d656433aSmrg if ((!path) || (!*path)) 4586d656433aSmrg return 0; 4587126a8a12Smrg 4588d656433aSmrg if ((stat (path, &st) >= 0) 4589d656433aSmrg && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 4590d656433aSmrg return 1; 4591d656433aSmrg else 4592d656433aSmrg return 0; 4593d656433aSmrg} 4594126a8a12Smrg 4595d656433aSmrgint 4596d656433aSmrgmake_executable (const char *path) 4597d656433aSmrg{ 4598d656433aSmrg int rval = 0; 4599d656433aSmrg struct stat st; 4600126a8a12Smrg 4601555991fdSmrg lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 4602555991fdSmrg nonempty (path)); 4603d656433aSmrg if ((!path) || (!*path)) 4604d656433aSmrg return 0; 4605126a8a12Smrg 4606d656433aSmrg if (stat (path, &st) >= 0) 4607d656433aSmrg { 4608d656433aSmrg rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 4609d656433aSmrg } 4610d656433aSmrg return rval; 4611d656433aSmrg} 4612126a8a12Smrg 4613d656433aSmrg/* Searches for the full path of the wrapper. Returns 4614d656433aSmrg newly allocated full path name if found, NULL otherwise 4615d656433aSmrg Does not chase symlinks, even on platforms that support them. 4616d656433aSmrg*/ 4617d656433aSmrgchar * 4618d656433aSmrgfind_executable (const char *wrapper) 4619d656433aSmrg{ 4620d656433aSmrg int has_slash = 0; 4621d656433aSmrg const char *p; 4622d656433aSmrg const char *p_next; 4623d656433aSmrg /* static buffer for getcwd */ 4624d656433aSmrg char tmp[LT_PATHMAX + 1]; 4625d656433aSmrg int tmp_len; 4626d656433aSmrg char *concat_name; 4627126a8a12Smrg 4628555991fdSmrg lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 4629555991fdSmrg nonempty (wrapper)); 4630126a8a12Smrg 4631d656433aSmrg if ((wrapper == NULL) || (*wrapper == '\0')) 4632d656433aSmrg return NULL; 4633126a8a12Smrg 4634d656433aSmrg /* Absolute path? */ 4635d656433aSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4636d656433aSmrg if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 4637d656433aSmrg { 4638d656433aSmrg concat_name = xstrdup (wrapper); 4639d656433aSmrg if (check_executable (concat_name)) 4640d656433aSmrg return concat_name; 4641d656433aSmrg XFREE (concat_name); 4642d656433aSmrg } 4643d656433aSmrg else 4644d656433aSmrg { 4645d656433aSmrg#endif 4646d656433aSmrg if (IS_DIR_SEPARATOR (wrapper[0])) 4647d656433aSmrg { 4648d656433aSmrg concat_name = xstrdup (wrapper); 4649d656433aSmrg if (check_executable (concat_name)) 4650d656433aSmrg return concat_name; 4651d656433aSmrg XFREE (concat_name); 4652d656433aSmrg } 4653d656433aSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4654d656433aSmrg } 4655d656433aSmrg#endif 4656126a8a12Smrg 4657d656433aSmrg for (p = wrapper; *p; p++) 4658d656433aSmrg if (*p == '/') 4659d656433aSmrg { 4660d656433aSmrg has_slash = 1; 4661d656433aSmrg break; 4662d656433aSmrg } 4663d656433aSmrg if (!has_slash) 4664d656433aSmrg { 4665d656433aSmrg /* no slashes; search PATH */ 4666d656433aSmrg const char *path = getenv ("PATH"); 4667d656433aSmrg if (path != NULL) 4668d656433aSmrg { 4669d656433aSmrg for (p = path; *p; p = p_next) 4670d656433aSmrg { 4671d656433aSmrg const char *q; 4672d656433aSmrg size_t p_len; 4673d656433aSmrg for (q = p; *q; q++) 4674d656433aSmrg if (IS_PATH_SEPARATOR (*q)) 4675d656433aSmrg break; 4676d656433aSmrg p_len = q - p; 4677d656433aSmrg p_next = (*q == '\0' ? q : q + 1); 4678d656433aSmrg if (p_len == 0) 4679d656433aSmrg { 4680d656433aSmrg /* empty path: current directory */ 4681d656433aSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 4682555991fdSmrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4683555991fdSmrg nonnull (strerror (errno))); 4684d656433aSmrg tmp_len = strlen (tmp); 4685d656433aSmrg concat_name = 4686d656433aSmrg XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4687d656433aSmrg memcpy (concat_name, tmp, tmp_len); 4688d656433aSmrg concat_name[tmp_len] = '/'; 4689d656433aSmrg strcpy (concat_name + tmp_len + 1, wrapper); 4690d656433aSmrg } 4691d656433aSmrg else 4692d656433aSmrg { 4693d656433aSmrg concat_name = 4694d656433aSmrg XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 4695d656433aSmrg memcpy (concat_name, p, p_len); 4696d656433aSmrg concat_name[p_len] = '/'; 4697d656433aSmrg strcpy (concat_name + p_len + 1, wrapper); 4698d656433aSmrg } 4699d656433aSmrg if (check_executable (concat_name)) 4700d656433aSmrg return concat_name; 4701d656433aSmrg XFREE (concat_name); 4702d656433aSmrg } 4703d656433aSmrg } 4704d656433aSmrg /* not found in PATH; assume curdir */ 4705d656433aSmrg } 4706d656433aSmrg /* Relative path | not found in path: prepend cwd */ 4707d656433aSmrg if (getcwd (tmp, LT_PATHMAX) == NULL) 4708555991fdSmrg lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4709555991fdSmrg nonnull (strerror (errno))); 4710d656433aSmrg tmp_len = strlen (tmp); 4711d656433aSmrg concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4712d656433aSmrg memcpy (concat_name, tmp, tmp_len); 4713d656433aSmrg concat_name[tmp_len] = '/'; 4714d656433aSmrg strcpy (concat_name + tmp_len + 1, wrapper); 4715126a8a12Smrg 4716d656433aSmrg if (check_executable (concat_name)) 4717d656433aSmrg return concat_name; 4718d656433aSmrg XFREE (concat_name); 4719d656433aSmrg return NULL; 4720d656433aSmrg} 4721126a8a12Smrg 4722d656433aSmrgchar * 4723d656433aSmrgchase_symlinks (const char *pathspec) 4724d656433aSmrg{ 4725d656433aSmrg#ifndef S_ISLNK 4726d656433aSmrg return xstrdup (pathspec); 4727d656433aSmrg#else 4728d656433aSmrg char buf[LT_PATHMAX]; 4729d656433aSmrg struct stat s; 4730d656433aSmrg char *tmp_pathspec = xstrdup (pathspec); 4731d656433aSmrg char *p; 4732d656433aSmrg int has_symlinks = 0; 4733d656433aSmrg while (strlen (tmp_pathspec) && !has_symlinks) 4734d656433aSmrg { 4735555991fdSmrg lt_debugprintf (__FILE__, __LINE__, 4736555991fdSmrg "checking path component for symlinks: %s\n", 4737555991fdSmrg tmp_pathspec); 4738d656433aSmrg if (lstat (tmp_pathspec, &s) == 0) 4739d656433aSmrg { 4740d656433aSmrg if (S_ISLNK (s.st_mode) != 0) 4741d656433aSmrg { 4742d656433aSmrg has_symlinks = 1; 4743d656433aSmrg break; 4744d656433aSmrg } 4745126a8a12Smrg 4746d656433aSmrg /* search backwards for last DIR_SEPARATOR */ 4747d656433aSmrg p = tmp_pathspec + strlen (tmp_pathspec) - 1; 4748d656433aSmrg while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4749d656433aSmrg p--; 4750d656433aSmrg if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4751d656433aSmrg { 4752d656433aSmrg /* no more DIR_SEPARATORS left */ 4753d656433aSmrg break; 4754d656433aSmrg } 4755d656433aSmrg *p = '\0'; 4756d656433aSmrg } 4757d656433aSmrg else 4758d656433aSmrg { 4759555991fdSmrg lt_fatal (__FILE__, __LINE__, 4760555991fdSmrg "error accessing file \"%s\": %s", 4761555991fdSmrg tmp_pathspec, nonnull (strerror (errno))); 4762d656433aSmrg } 4763d656433aSmrg } 4764d656433aSmrg XFREE (tmp_pathspec); 4765126a8a12Smrg 4766d656433aSmrg if (!has_symlinks) 4767d656433aSmrg { 4768d656433aSmrg return xstrdup (pathspec); 4769d656433aSmrg } 4770126a8a12Smrg 4771d656433aSmrg tmp_pathspec = realpath (pathspec, buf); 4772d656433aSmrg if (tmp_pathspec == 0) 4773d656433aSmrg { 4774555991fdSmrg lt_fatal (__FILE__, __LINE__, 4775555991fdSmrg "could not follow symlinks for %s", pathspec); 4776d656433aSmrg } 4777d656433aSmrg return xstrdup (tmp_pathspec); 4778d656433aSmrg#endif 4779d656433aSmrg} 4780126a8a12Smrg 4781d656433aSmrgchar * 4782d656433aSmrgstrendzap (char *str, const char *pat) 4783d656433aSmrg{ 4784d656433aSmrg size_t len, patlen; 4785126a8a12Smrg 4786d656433aSmrg assert (str != NULL); 4787d656433aSmrg assert (pat != NULL); 4788126a8a12Smrg 4789d656433aSmrg len = strlen (str); 4790d656433aSmrg patlen = strlen (pat); 4791126a8a12Smrg 4792d656433aSmrg if (patlen <= len) 4793d656433aSmrg { 4794d656433aSmrg str += len - patlen; 4795d656433aSmrg if (strcmp (str, pat) == 0) 4796d656433aSmrg *str = '\0'; 4797d656433aSmrg } 4798d656433aSmrg return str; 4799d656433aSmrg} 4800126a8a12Smrg 4801555991fdSmrgvoid 4802555991fdSmrglt_debugprintf (const char *file, int line, const char *fmt, ...) 4803555991fdSmrg{ 4804555991fdSmrg va_list args; 4805555991fdSmrg if (lt_debug) 4806555991fdSmrg { 4807555991fdSmrg (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 4808555991fdSmrg va_start (args, fmt); 4809555991fdSmrg (void) vfprintf (stderr, fmt, args); 4810555991fdSmrg va_end (args); 4811555991fdSmrg } 4812555991fdSmrg} 4813555991fdSmrg 4814d656433aSmrgstatic void 4815555991fdSmrglt_error_core (int exit_status, const char *file, 4816555991fdSmrg int line, const char *mode, 4817d656433aSmrg const char *message, va_list ap) 4818d656433aSmrg{ 4819555991fdSmrg fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 4820d656433aSmrg vfprintf (stderr, message, ap); 4821d656433aSmrg fprintf (stderr, ".\n"); 4822126a8a12Smrg 4823d656433aSmrg if (exit_status >= 0) 4824d656433aSmrg exit (exit_status); 4825d656433aSmrg} 4826126a8a12Smrg 4827d656433aSmrgvoid 4828555991fdSmrglt_fatal (const char *file, int line, const char *message, ...) 4829d656433aSmrg{ 4830d656433aSmrg va_list ap; 4831d656433aSmrg va_start (ap, message); 4832555991fdSmrg lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 4833d656433aSmrg va_end (ap); 4834d656433aSmrg} 4835126a8a12Smrg 4836555991fdSmrgstatic const char * 4837555991fdSmrgnonnull (const char *s) 4838555991fdSmrg{ 4839555991fdSmrg return s ? s : "(null)"; 4840555991fdSmrg} 4841555991fdSmrg 4842555991fdSmrgstatic const char * 4843555991fdSmrgnonempty (const char *s) 4844555991fdSmrg{ 4845555991fdSmrg return (s && !*s) ? "(empty)" : nonnull (s); 4846555991fdSmrg} 4847555991fdSmrg 4848d656433aSmrgvoid 4849d656433aSmrglt_setenv (const char *name, const char *value) 4850d656433aSmrg{ 4851555991fdSmrg lt_debugprintf (__FILE__, __LINE__, 4852555991fdSmrg "(lt_setenv) setting '%s' to '%s'\n", 4853555991fdSmrg nonnull (name), nonnull (value)); 4854d656433aSmrg { 4855d656433aSmrg#ifdef HAVE_SETENV 4856d656433aSmrg /* always make a copy, for consistency with !HAVE_SETENV */ 4857d656433aSmrg char *str = xstrdup (value); 4858d656433aSmrg setenv (name, str, 1); 4859d656433aSmrg#else 4860d656433aSmrg int len = strlen (name) + 1 + strlen (value) + 1; 4861d656433aSmrg char *str = XMALLOC (char, len); 4862d656433aSmrg sprintf (str, "%s=%s", name, value); 4863d656433aSmrg if (putenv (str) != EXIT_SUCCESS) 4864d656433aSmrg { 4865d656433aSmrg XFREE (str); 4866d656433aSmrg } 4867d656433aSmrg#endif 4868d656433aSmrg } 4869d656433aSmrg} 4870126a8a12Smrg 4871d656433aSmrgchar * 4872d656433aSmrglt_extend_str (const char *orig_value, const char *add, int to_end) 4873d656433aSmrg{ 4874d656433aSmrg char *new_value; 4875d656433aSmrg if (orig_value && *orig_value) 4876d656433aSmrg { 4877d656433aSmrg int orig_value_len = strlen (orig_value); 4878d656433aSmrg int add_len = strlen (add); 4879d656433aSmrg new_value = XMALLOC (char, add_len + orig_value_len + 1); 4880d656433aSmrg if (to_end) 4881d656433aSmrg { 4882d656433aSmrg strcpy (new_value, orig_value); 4883d656433aSmrg strcpy (new_value + orig_value_len, add); 4884d656433aSmrg } 4885d656433aSmrg else 4886d656433aSmrg { 4887d656433aSmrg strcpy (new_value, add); 4888d656433aSmrg strcpy (new_value + add_len, orig_value); 4889d656433aSmrg } 4890d656433aSmrg } 4891d656433aSmrg else 4892d656433aSmrg { 4893d656433aSmrg new_value = xstrdup (add); 4894d656433aSmrg } 4895d656433aSmrg return new_value; 4896d656433aSmrg} 4897126a8a12Smrg 4898d656433aSmrgvoid 4899d656433aSmrglt_update_exe_path (const char *name, const char *value) 4900d656433aSmrg{ 4901555991fdSmrg lt_debugprintf (__FILE__, __LINE__, 4902555991fdSmrg "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 4903555991fdSmrg nonnull (name), nonnull (value)); 4904126a8a12Smrg 4905d656433aSmrg if (name && *name && value && *value) 4906d656433aSmrg { 4907d656433aSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 4908d656433aSmrg /* some systems can't cope with a ':'-terminated path #' */ 4909d656433aSmrg int len = strlen (new_value); 4910d656433aSmrg while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 4911d656433aSmrg { 4912d656433aSmrg new_value[len-1] = '\0'; 4913d656433aSmrg } 4914d656433aSmrg lt_setenv (name, new_value); 4915d656433aSmrg XFREE (new_value); 4916d656433aSmrg } 4917d656433aSmrg} 4918126a8a12Smrg 4919d656433aSmrgvoid 4920d656433aSmrglt_update_lib_path (const char *name, const char *value) 4921d656433aSmrg{ 4922555991fdSmrg lt_debugprintf (__FILE__, __LINE__, 4923555991fdSmrg "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 4924555991fdSmrg nonnull (name), nonnull (value)); 4925126a8a12Smrg 4926d656433aSmrg if (name && *name && value && *value) 4927d656433aSmrg { 4928d656433aSmrg char *new_value = lt_extend_str (getenv (name), value, 0); 4929d656433aSmrg lt_setenv (name, new_value); 4930d656433aSmrg XFREE (new_value); 4931d656433aSmrg } 4932d656433aSmrg} 4933126a8a12Smrg 4934555991fdSmrgEOF 4935555991fdSmrg case $host_os in 4936555991fdSmrg mingw*) 4937555991fdSmrg cat <<"EOF" 4938555991fdSmrg 4939555991fdSmrg/* Prepares an argument vector before calling spawn(). 4940555991fdSmrg Note that spawn() does not by itself call the command interpreter 4941555991fdSmrg (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 4942555991fdSmrg ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 4943555991fdSmrg GetVersionEx(&v); 4944555991fdSmrg v.dwPlatformId == VER_PLATFORM_WIN32_NT; 4945555991fdSmrg }) ? "cmd.exe" : "command.com"). 4946555991fdSmrg Instead it simply concatenates the arguments, separated by ' ', and calls 4947555991fdSmrg CreateProcess(). We must quote the arguments since Win32 CreateProcess() 4948555991fdSmrg interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 4949555991fdSmrg special way: 4950555991fdSmrg - Space and tab are interpreted as delimiters. They are not treated as 4951555991fdSmrg delimiters if they are surrounded by double quotes: "...". 4952555991fdSmrg - Unescaped double quotes are removed from the input. Their only effect is 4953555991fdSmrg that within double quotes, space and tab are treated like normal 4954555991fdSmrg characters. 4955555991fdSmrg - Backslashes not followed by double quotes are not special. 4956555991fdSmrg - But 2*n+1 backslashes followed by a double quote become 4957555991fdSmrg n backslashes followed by a double quote (n >= 0): 4958555991fdSmrg \" -> " 4959555991fdSmrg \\\" -> \" 4960555991fdSmrg \\\\\" -> \\" 4961555991fdSmrg */ 4962555991fdSmrg#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" 4963555991fdSmrg#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" 4964555991fdSmrgchar ** 4965555991fdSmrgprepare_spawn (char **argv) 4966555991fdSmrg{ 4967555991fdSmrg size_t argc; 4968555991fdSmrg char **new_argv; 4969555991fdSmrg size_t i; 4970555991fdSmrg 4971555991fdSmrg /* Count number of arguments. */ 4972555991fdSmrg for (argc = 0; argv[argc] != NULL; argc++) 4973555991fdSmrg ; 4974555991fdSmrg 4975555991fdSmrg /* Allocate new argument vector. */ 4976555991fdSmrg new_argv = XMALLOC (char *, argc + 1); 4977555991fdSmrg 4978555991fdSmrg /* Put quoted arguments into the new argument vector. */ 4979555991fdSmrg for (i = 0; i < argc; i++) 4980555991fdSmrg { 4981555991fdSmrg const char *string = argv[i]; 4982555991fdSmrg 4983555991fdSmrg if (string[0] == '\0') 4984555991fdSmrg new_argv[i] = xstrdup ("\"\""); 4985555991fdSmrg else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 4986555991fdSmrg { 4987555991fdSmrg int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 4988555991fdSmrg size_t length; 4989555991fdSmrg unsigned int backslashes; 4990555991fdSmrg const char *s; 4991555991fdSmrg char *quoted_string; 4992555991fdSmrg char *p; 4993555991fdSmrg 4994555991fdSmrg length = 0; 4995555991fdSmrg backslashes = 0; 4996555991fdSmrg if (quote_around) 4997555991fdSmrg length++; 4998555991fdSmrg for (s = string; *s != '\0'; s++) 4999555991fdSmrg { 5000555991fdSmrg char c = *s; 5001555991fdSmrg if (c == '"') 5002555991fdSmrg length += backslashes + 1; 5003555991fdSmrg length++; 5004555991fdSmrg if (c == '\\') 5005555991fdSmrg backslashes++; 5006555991fdSmrg else 5007555991fdSmrg backslashes = 0; 5008555991fdSmrg } 5009555991fdSmrg if (quote_around) 5010555991fdSmrg length += backslashes + 1; 5011555991fdSmrg 5012555991fdSmrg quoted_string = XMALLOC (char, length + 1); 5013555991fdSmrg 5014555991fdSmrg p = quoted_string; 5015555991fdSmrg backslashes = 0; 5016555991fdSmrg if (quote_around) 5017555991fdSmrg *p++ = '"'; 5018555991fdSmrg for (s = string; *s != '\0'; s++) 5019555991fdSmrg { 5020555991fdSmrg char c = *s; 5021555991fdSmrg if (c == '"') 5022555991fdSmrg { 5023555991fdSmrg unsigned int j; 5024555991fdSmrg for (j = backslashes + 1; j > 0; j--) 5025555991fdSmrg *p++ = '\\'; 5026555991fdSmrg } 5027555991fdSmrg *p++ = c; 5028555991fdSmrg if (c == '\\') 5029555991fdSmrg backslashes++; 5030555991fdSmrg else 5031555991fdSmrg backslashes = 0; 5032555991fdSmrg } 5033555991fdSmrg if (quote_around) 5034555991fdSmrg { 5035555991fdSmrg unsigned int j; 5036555991fdSmrg for (j = backslashes; j > 0; j--) 5037555991fdSmrg *p++ = '\\'; 5038555991fdSmrg *p++ = '"'; 5039555991fdSmrg } 5040555991fdSmrg *p = '\0'; 5041555991fdSmrg 5042555991fdSmrg new_argv[i] = quoted_string; 5043555991fdSmrg } 5044555991fdSmrg else 5045555991fdSmrg new_argv[i] = (char *) string; 5046555991fdSmrg } 5047555991fdSmrg new_argv[argc] = NULL; 5048555991fdSmrg 5049555991fdSmrg return new_argv; 5050555991fdSmrg} 5051555991fdSmrgEOF 5052555991fdSmrg ;; 5053555991fdSmrg esac 5054555991fdSmrg 5055555991fdSmrg cat <<"EOF" 5056555991fdSmrgvoid lt_dump_script (FILE* f) 5057555991fdSmrg{ 5058555991fdSmrgEOF 5059555991fdSmrg func_emit_wrapper yes | 5060555991fdSmrg $SED -e 's/\([\\"]\)/\\\1/g' \ 5061555991fdSmrg -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' 5062126a8a12Smrg 5063555991fdSmrg cat <<"EOF" 5064555991fdSmrg} 5065d656433aSmrgEOF 5066d656433aSmrg} 5067d656433aSmrg# end: func_emit_cwrapperexe_src 5068126a8a12Smrg 5069555991fdSmrg# func_win32_import_lib_p ARG 5070555991fdSmrg# True if ARG is an import lib, as indicated by $file_magic_cmd 5071555991fdSmrgfunc_win32_import_lib_p () 5072555991fdSmrg{ 5073555991fdSmrg $opt_debug 5074555991fdSmrg case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 5075555991fdSmrg *import*) : ;; 5076555991fdSmrg *) false ;; 5077555991fdSmrg esac 5078555991fdSmrg} 5079555991fdSmrg 5080d656433aSmrg# func_mode_link arg... 5081d656433aSmrgfunc_mode_link () 5082d656433aSmrg{ 5083d656433aSmrg $opt_debug 5084d656433aSmrg case $host in 5085d656433aSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5086d656433aSmrg # It is impossible to link a dll without this setting, and 5087d656433aSmrg # we shouldn't force the makefile maintainer to figure out 5088d656433aSmrg # which system we are compiling for in order to pass an extra 5089d656433aSmrg # flag for every libtool invocation. 5090d656433aSmrg # allow_undefined=no 5091126a8a12Smrg 5092d656433aSmrg # FIXME: Unfortunately, there are problems with the above when trying 5093d656433aSmrg # to make a dll which has undefined symbols, in which case not 5094d656433aSmrg # even a static library is built. For now, we need to specify 5095d656433aSmrg # -no-undefined on the libtool link line when we can be certain 5096d656433aSmrg # that all symbols are satisfied, otherwise we get a static library. 5097d656433aSmrg allow_undefined=yes 5098d656433aSmrg ;; 5099d656433aSmrg *) 5100d656433aSmrg allow_undefined=yes 5101d656433aSmrg ;; 5102d656433aSmrg esac 5103d656433aSmrg libtool_args=$nonopt 5104d656433aSmrg base_compile="$nonopt $@" 5105d656433aSmrg compile_command=$nonopt 5106d656433aSmrg finalize_command=$nonopt 5107126a8a12Smrg 5108d656433aSmrg compile_rpath= 5109d656433aSmrg finalize_rpath= 5110d656433aSmrg compile_shlibpath= 5111d656433aSmrg finalize_shlibpath= 5112d656433aSmrg convenience= 5113d656433aSmrg old_convenience= 5114d656433aSmrg deplibs= 5115d656433aSmrg old_deplibs= 5116d656433aSmrg compiler_flags= 5117d656433aSmrg linker_flags= 5118d656433aSmrg dllsearchpath= 5119d656433aSmrg lib_search_path=`pwd` 5120d656433aSmrg inst_prefix_dir= 5121d656433aSmrg new_inherited_linker_flags= 5122126a8a12Smrg 5123d656433aSmrg avoid_version=no 5124555991fdSmrg bindir= 5125d656433aSmrg dlfiles= 5126d656433aSmrg dlprefiles= 5127d656433aSmrg dlself=no 5128d656433aSmrg export_dynamic=no 5129d656433aSmrg export_symbols= 5130d656433aSmrg export_symbols_regex= 5131d656433aSmrg generated= 5132d656433aSmrg libobjs= 5133d656433aSmrg ltlibs= 5134d656433aSmrg module=no 5135d656433aSmrg no_install=no 5136d656433aSmrg objs= 5137d656433aSmrg non_pic_objects= 5138d656433aSmrg precious_files_regex= 5139d656433aSmrg prefer_static_libs=no 5140d656433aSmrg preload=no 5141d656433aSmrg prev= 5142d656433aSmrg prevarg= 5143d656433aSmrg release= 5144d656433aSmrg rpath= 5145d656433aSmrg xrpath= 5146d656433aSmrg perm_rpath= 5147d656433aSmrg temp_rpath= 5148d656433aSmrg thread_safe=no 5149d656433aSmrg vinfo= 5150d656433aSmrg vinfo_number=no 5151d656433aSmrg weak_libs= 5152d656433aSmrg single_module="${wl}-single_module" 5153d656433aSmrg func_infer_tag $base_compile 5154126a8a12Smrg 5155d656433aSmrg # We need to know -static, to get the right output filenames. 5156d656433aSmrg for arg 5157d656433aSmrg do 5158d656433aSmrg case $arg in 5159d656433aSmrg -shared) 5160d656433aSmrg test "$build_libtool_libs" != yes && \ 5161d656433aSmrg func_fatal_configuration "can not build a shared library" 5162d656433aSmrg build_old_libs=no 5163d656433aSmrg break 5164d656433aSmrg ;; 5165d656433aSmrg -all-static | -static | -static-libtool-libs) 5166d656433aSmrg case $arg in 5167d656433aSmrg -all-static) 5168d656433aSmrg if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 5169d656433aSmrg func_warning "complete static linking is impossible in this configuration" 5170126a8a12Smrg fi 5171d656433aSmrg if test -n "$link_static_flag"; then 5172d656433aSmrg dlopen_self=$dlopen_self_static 5173126a8a12Smrg fi 5174d656433aSmrg prefer_static_libs=yes 5175126a8a12Smrg ;; 5176d656433aSmrg -static) 5177d656433aSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 5178d656433aSmrg dlopen_self=$dlopen_self_static 5179d656433aSmrg fi 5180d656433aSmrg prefer_static_libs=built 5181d656433aSmrg ;; 5182d656433aSmrg -static-libtool-libs) 5183d656433aSmrg if test -z "$pic_flag" && test -n "$link_static_flag"; then 5184d656433aSmrg dlopen_self=$dlopen_self_static 5185d656433aSmrg fi 5186d656433aSmrg prefer_static_libs=yes 5187126a8a12Smrg ;; 5188126a8a12Smrg esac 5189d656433aSmrg build_libtool_libs=no 5190d656433aSmrg build_old_libs=yes 5191d656433aSmrg break 5192d656433aSmrg ;; 5193d656433aSmrg esac 5194d656433aSmrg done 5195126a8a12Smrg 5196d656433aSmrg # See if our shared archives depend on static archives. 5197d656433aSmrg test -n "$old_archive_from_new_cmds" && build_old_libs=yes 5198126a8a12Smrg 5199d656433aSmrg # Go through the arguments, transforming them on the way. 5200d656433aSmrg while test "$#" -gt 0; do 5201d656433aSmrg arg="$1" 5202d656433aSmrg shift 5203d656433aSmrg func_quote_for_eval "$arg" 5204d656433aSmrg qarg=$func_quote_for_eval_unquoted_result 5205d656433aSmrg func_append libtool_args " $func_quote_for_eval_result" 5206126a8a12Smrg 5207d656433aSmrg # If the previous option needs an argument, assign it. 5208d656433aSmrg if test -n "$prev"; then 5209d656433aSmrg case $prev in 5210d656433aSmrg output) 5211d656433aSmrg func_append compile_command " @OUTPUT@" 5212d656433aSmrg func_append finalize_command " @OUTPUT@" 5213d656433aSmrg ;; 5214d656433aSmrg esac 5215126a8a12Smrg 5216d656433aSmrg case $prev in 5217555991fdSmrg bindir) 5218555991fdSmrg bindir="$arg" 5219555991fdSmrg prev= 5220555991fdSmrg continue 5221555991fdSmrg ;; 5222d656433aSmrg dlfiles|dlprefiles) 5223d656433aSmrg if test "$preload" = no; then 5224d656433aSmrg # Add the symbol object into the linking commands. 5225d656433aSmrg func_append compile_command " @SYMFILE@" 5226d656433aSmrg func_append finalize_command " @SYMFILE@" 5227d656433aSmrg preload=yes 5228d656433aSmrg fi 5229d656433aSmrg case $arg in 5230d656433aSmrg *.la | *.lo) ;; # We handle these cases below. 5231d656433aSmrg force) 5232d656433aSmrg if test "$dlself" = no; then 5233d656433aSmrg dlself=needless 5234d656433aSmrg export_dynamic=yes 5235d656433aSmrg fi 5236d656433aSmrg prev= 5237d656433aSmrg continue 5238d656433aSmrg ;; 5239d656433aSmrg self) 5240d656433aSmrg if test "$prev" = dlprefiles; then 5241d656433aSmrg dlself=yes 5242d656433aSmrg elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 5243d656433aSmrg dlself=yes 5244d656433aSmrg else 5245d656433aSmrg dlself=needless 5246d656433aSmrg export_dynamic=yes 5247d656433aSmrg fi 5248d656433aSmrg prev= 5249d656433aSmrg continue 5250126a8a12Smrg ;; 5251126a8a12Smrg *) 5252d656433aSmrg if test "$prev" = dlfiles; then 52533c15da26Smrg func_append dlfiles " $arg" 5254d656433aSmrg else 52553c15da26Smrg func_append dlprefiles " $arg" 5256d656433aSmrg fi 5257d656433aSmrg prev= 5258d656433aSmrg continue 5259126a8a12Smrg ;; 5260126a8a12Smrg esac 5261d656433aSmrg ;; 5262d656433aSmrg expsyms) 5263d656433aSmrg export_symbols="$arg" 5264d656433aSmrg test -f "$arg" \ 5265d656433aSmrg || func_fatal_error "symbol file \`$arg' does not exist" 5266d656433aSmrg prev= 5267d656433aSmrg continue 5268d656433aSmrg ;; 5269d656433aSmrg expsyms_regex) 5270d656433aSmrg export_symbols_regex="$arg" 5271d656433aSmrg prev= 5272d656433aSmrg continue 5273d656433aSmrg ;; 5274d656433aSmrg framework) 5275d656433aSmrg case $host in 5276d656433aSmrg *-*-darwin*) 5277d656433aSmrg case "$deplibs " in 5278d656433aSmrg *" $qarg.ltframework "*) ;; 52793c15da26Smrg *) func_append deplibs " $qarg.ltframework" # this is fixed later 5280d656433aSmrg ;; 5281d656433aSmrg esac 5282d656433aSmrg ;; 5283d656433aSmrg esac 5284d656433aSmrg prev= 5285d656433aSmrg continue 5286d656433aSmrg ;; 5287d656433aSmrg inst_prefix) 5288d656433aSmrg inst_prefix_dir="$arg" 5289d656433aSmrg prev= 5290d656433aSmrg continue 5291d656433aSmrg ;; 5292d656433aSmrg objectlist) 5293d656433aSmrg if test -f "$arg"; then 5294d656433aSmrg save_arg=$arg 5295d656433aSmrg moreargs= 5296d656433aSmrg for fil in `cat "$save_arg"` 5297d656433aSmrg do 52983c15da26Smrg# func_append moreargs " $fil" 5299d656433aSmrg arg=$fil 5300d656433aSmrg # A libtool-controlled object. 5301126a8a12Smrg 5302d656433aSmrg # Check to see that this really is a libtool object. 5303d656433aSmrg if func_lalib_unsafe_p "$arg"; then 5304d656433aSmrg pic_object= 5305d656433aSmrg non_pic_object= 5306126a8a12Smrg 5307d656433aSmrg # Read the .lo file 5308d656433aSmrg func_source "$arg" 5309126a8a12Smrg 5310d656433aSmrg if test -z "$pic_object" || 5311d656433aSmrg test -z "$non_pic_object" || 5312d656433aSmrg test "$pic_object" = none && 5313d656433aSmrg test "$non_pic_object" = none; then 5314d656433aSmrg func_fatal_error "cannot find name of object for \`$arg'" 5315d656433aSmrg fi 5316126a8a12Smrg 5317d656433aSmrg # Extract subdirectory from the argument. 5318d656433aSmrg func_dirname "$arg" "/" "" 5319d656433aSmrg xdir="$func_dirname_result" 5320126a8a12Smrg 5321d656433aSmrg if test "$pic_object" != none; then 5322d656433aSmrg # Prepend the subdirectory the object is found in. 5323d656433aSmrg pic_object="$xdir$pic_object" 5324126a8a12Smrg 5325d656433aSmrg if test "$prev" = dlfiles; then 5326d656433aSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 53273c15da26Smrg func_append dlfiles " $pic_object" 5328d656433aSmrg prev= 5329d656433aSmrg continue 5330d656433aSmrg else 5331d656433aSmrg # If libtool objects are unsupported, then we need to preload. 5332d656433aSmrg prev=dlprefiles 5333d656433aSmrg fi 5334d656433aSmrg fi 5335126a8a12Smrg 5336d656433aSmrg # CHECK ME: I think I busted this. -Ossama 5337d656433aSmrg if test "$prev" = dlprefiles; then 5338d656433aSmrg # Preload the old-style object. 53393c15da26Smrg func_append dlprefiles " $pic_object" 5340d656433aSmrg prev= 5341d656433aSmrg fi 5342126a8a12Smrg 5343d656433aSmrg # A PIC object. 5344d656433aSmrg func_append libobjs " $pic_object" 5345d656433aSmrg arg="$pic_object" 5346d656433aSmrg fi 5347126a8a12Smrg 5348d656433aSmrg # Non-PIC object. 5349d656433aSmrg if test "$non_pic_object" != none; then 5350d656433aSmrg # Prepend the subdirectory the object is found in. 5351d656433aSmrg non_pic_object="$xdir$non_pic_object" 5352126a8a12Smrg 5353d656433aSmrg # A standard non-PIC object 5354d656433aSmrg func_append non_pic_objects " $non_pic_object" 5355d656433aSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 5356d656433aSmrg arg="$non_pic_object" 5357d656433aSmrg fi 5358d656433aSmrg else 5359d656433aSmrg # If the PIC object exists, use it instead. 5360d656433aSmrg # $xdir was prepended to $pic_object above. 5361d656433aSmrg non_pic_object="$pic_object" 5362d656433aSmrg func_append non_pic_objects " $non_pic_object" 5363d656433aSmrg fi 5364d656433aSmrg else 5365d656433aSmrg # Only an error if not doing a dry-run. 5366d656433aSmrg if $opt_dry_run; then 5367d656433aSmrg # Extract subdirectory from the argument. 5368d656433aSmrg func_dirname "$arg" "/" "" 5369d656433aSmrg xdir="$func_dirname_result" 5370d656433aSmrg 5371d656433aSmrg func_lo2o "$arg" 5372d656433aSmrg pic_object=$xdir$objdir/$func_lo2o_result 5373d656433aSmrg non_pic_object=$xdir$func_lo2o_result 5374d656433aSmrg func_append libobjs " $pic_object" 5375d656433aSmrg func_append non_pic_objects " $non_pic_object" 5376d656433aSmrg else 5377d656433aSmrg func_fatal_error "\`$arg' is not a valid libtool object" 5378d656433aSmrg fi 5379d656433aSmrg fi 5380d656433aSmrg done 5381d656433aSmrg else 5382d656433aSmrg func_fatal_error "link input file \`$arg' does not exist" 5383d656433aSmrg fi 5384d656433aSmrg arg=$save_arg 5385d656433aSmrg prev= 5386d656433aSmrg continue 5387d656433aSmrg ;; 5388d656433aSmrg precious_regex) 5389d656433aSmrg precious_files_regex="$arg" 5390d656433aSmrg prev= 5391d656433aSmrg continue 5392d656433aSmrg ;; 5393d656433aSmrg release) 5394d656433aSmrg release="-$arg" 5395d656433aSmrg prev= 5396d656433aSmrg continue 5397d656433aSmrg ;; 5398d656433aSmrg rpath | xrpath) 5399d656433aSmrg # We need an absolute path. 5400d656433aSmrg case $arg in 5401d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 5402d656433aSmrg *) 5403d656433aSmrg func_fatal_error "only absolute run-paths are allowed" 5404d656433aSmrg ;; 5405d656433aSmrg esac 5406d656433aSmrg if test "$prev" = rpath; then 5407d656433aSmrg case "$rpath " in 5408d656433aSmrg *" $arg "*) ;; 54093c15da26Smrg *) func_append rpath " $arg" ;; 5410d656433aSmrg esac 5411d656433aSmrg else 5412d656433aSmrg case "$xrpath " in 5413d656433aSmrg *" $arg "*) ;; 54143c15da26Smrg *) func_append xrpath " $arg" ;; 5415d656433aSmrg esac 5416d656433aSmrg fi 5417d656433aSmrg prev= 5418d656433aSmrg continue 5419d656433aSmrg ;; 5420d656433aSmrg shrext) 5421d656433aSmrg shrext_cmds="$arg" 5422d656433aSmrg prev= 5423d656433aSmrg continue 5424d656433aSmrg ;; 5425d656433aSmrg weak) 54263c15da26Smrg func_append weak_libs " $arg" 5427d656433aSmrg prev= 5428d656433aSmrg continue 5429d656433aSmrg ;; 5430d656433aSmrg xcclinker) 54313c15da26Smrg func_append linker_flags " $qarg" 54323c15da26Smrg func_append compiler_flags " $qarg" 5433d656433aSmrg prev= 5434d656433aSmrg func_append compile_command " $qarg" 5435d656433aSmrg func_append finalize_command " $qarg" 5436d656433aSmrg continue 5437d656433aSmrg ;; 5438d656433aSmrg xcompiler) 54393c15da26Smrg func_append compiler_flags " $qarg" 5440d656433aSmrg prev= 5441d656433aSmrg func_append compile_command " $qarg" 5442d656433aSmrg func_append finalize_command " $qarg" 5443d656433aSmrg continue 5444d656433aSmrg ;; 5445d656433aSmrg xlinker) 54463c15da26Smrg func_append linker_flags " $qarg" 54473c15da26Smrg func_append compiler_flags " $wl$qarg" 5448d656433aSmrg prev= 5449d656433aSmrg func_append compile_command " $wl$qarg" 5450d656433aSmrg func_append finalize_command " $wl$qarg" 5451d656433aSmrg continue 5452d656433aSmrg ;; 5453d656433aSmrg *) 5454d656433aSmrg eval "$prev=\"\$arg\"" 5455d656433aSmrg prev= 5456d656433aSmrg continue 5457d656433aSmrg ;; 5458126a8a12Smrg esac 5459d656433aSmrg fi # test -n "$prev" 5460126a8a12Smrg 5461d656433aSmrg prevarg="$arg" 5462126a8a12Smrg 5463d656433aSmrg case $arg in 5464d656433aSmrg -all-static) 5465d656433aSmrg if test -n "$link_static_flag"; then 5466d656433aSmrg # See comment for -static flag below, for more details. 5467d656433aSmrg func_append compile_command " $link_static_flag" 5468d656433aSmrg func_append finalize_command " $link_static_flag" 5469d656433aSmrg fi 5470d656433aSmrg continue 5471d656433aSmrg ;; 5472126a8a12Smrg 5473d656433aSmrg -allow-undefined) 5474d656433aSmrg # FIXME: remove this flag sometime in the future. 5475d656433aSmrg func_fatal_error "\`-allow-undefined' must not be used because it is the default" 5476d656433aSmrg ;; 5477126a8a12Smrg 5478d656433aSmrg -avoid-version) 5479d656433aSmrg avoid_version=yes 5480d656433aSmrg continue 5481d656433aSmrg ;; 5482126a8a12Smrg 5483555991fdSmrg -bindir) 5484555991fdSmrg prev=bindir 5485555991fdSmrg continue 5486555991fdSmrg ;; 5487555991fdSmrg 5488d656433aSmrg -dlopen) 5489d656433aSmrg prev=dlfiles 5490d656433aSmrg continue 5491d656433aSmrg ;; 5492126a8a12Smrg 5493d656433aSmrg -dlpreopen) 5494d656433aSmrg prev=dlprefiles 5495d656433aSmrg continue 5496d656433aSmrg ;; 5497126a8a12Smrg 5498d656433aSmrg -export-dynamic) 5499d656433aSmrg export_dynamic=yes 5500d656433aSmrg continue 5501d656433aSmrg ;; 5502126a8a12Smrg 5503d656433aSmrg -export-symbols | -export-symbols-regex) 5504d656433aSmrg if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 5505d656433aSmrg func_fatal_error "more than one -exported-symbols argument is not allowed" 5506d656433aSmrg fi 5507d656433aSmrg if test "X$arg" = "X-export-symbols"; then 5508d656433aSmrg prev=expsyms 5509d656433aSmrg else 5510d656433aSmrg prev=expsyms_regex 5511d656433aSmrg fi 5512d656433aSmrg continue 5513d656433aSmrg ;; 5514126a8a12Smrg 5515d656433aSmrg -framework) 5516d656433aSmrg prev=framework 5517d656433aSmrg continue 5518d656433aSmrg ;; 5519126a8a12Smrg 5520d656433aSmrg -inst-prefix-dir) 5521d656433aSmrg prev=inst_prefix 5522d656433aSmrg continue 5523d656433aSmrg ;; 5524126a8a12Smrg 5525d656433aSmrg # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 5526d656433aSmrg # so, if we see these flags be careful not to treat them like -L 5527d656433aSmrg -L[A-Z][A-Z]*:*) 5528d656433aSmrg case $with_gcc/$host in 5529d656433aSmrg no/*-*-irix* | /*-*-irix*) 5530d656433aSmrg func_append compile_command " $arg" 5531d656433aSmrg func_append finalize_command " $arg" 5532d656433aSmrg ;; 5533d656433aSmrg esac 5534d656433aSmrg continue 5535d656433aSmrg ;; 5536126a8a12Smrg 5537d656433aSmrg -L*) 55383c15da26Smrg func_stripname "-L" '' "$arg" 55393c15da26Smrg if test -z "$func_stripname_result"; then 5540d656433aSmrg if test "$#" -gt 0; then 5541d656433aSmrg func_fatal_error "require no space between \`-L' and \`$1'" 5542d656433aSmrg else 5543d656433aSmrg func_fatal_error "need path for \`-L' option" 5544d656433aSmrg fi 5545d656433aSmrg fi 55463c15da26Smrg func_resolve_sysroot "$func_stripname_result" 55473c15da26Smrg dir=$func_resolve_sysroot_result 5548d656433aSmrg # We need an absolute path. 5549d656433aSmrg case $dir in 5550d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 5551d656433aSmrg *) 5552d656433aSmrg absdir=`cd "$dir" && pwd` 5553d656433aSmrg test -z "$absdir" && \ 5554d656433aSmrg func_fatal_error "cannot determine absolute directory name of \`$dir'" 5555d656433aSmrg dir="$absdir" 5556d656433aSmrg ;; 5557d656433aSmrg esac 5558d656433aSmrg case "$deplibs " in 55593c15da26Smrg *" -L$dir "* | *" $arg "*) 55603c15da26Smrg # Will only happen for absolute or sysroot arguments 55613c15da26Smrg ;; 5562d656433aSmrg *) 55633c15da26Smrg # Preserve sysroot, but never include relative directories 55643c15da26Smrg case $dir in 55653c15da26Smrg [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 55663c15da26Smrg *) func_append deplibs " -L$dir" ;; 55673c15da26Smrg esac 55683c15da26Smrg func_append lib_search_path " $dir" 5569d656433aSmrg ;; 5570d656433aSmrg esac 5571d656433aSmrg case $host in 5572d656433aSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5573555991fdSmrg testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 5574d656433aSmrg case :$dllsearchpath: in 5575d656433aSmrg *":$dir:"*) ;; 5576d656433aSmrg ::) dllsearchpath=$dir;; 55773c15da26Smrg *) func_append dllsearchpath ":$dir";; 5578d656433aSmrg esac 5579d656433aSmrg case :$dllsearchpath: in 5580d656433aSmrg *":$testbindir:"*) ;; 5581d656433aSmrg ::) dllsearchpath=$testbindir;; 55823c15da26Smrg *) func_append dllsearchpath ":$testbindir";; 5583d656433aSmrg esac 5584d656433aSmrg ;; 5585d656433aSmrg esac 5586d656433aSmrg continue 5587d656433aSmrg ;; 5588126a8a12Smrg 5589d656433aSmrg -l*) 5590d656433aSmrg if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 5591d656433aSmrg case $host in 5592555991fdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 5593d656433aSmrg # These systems don't actually have a C or math library (as such) 5594d656433aSmrg continue 5595d656433aSmrg ;; 5596d656433aSmrg *-*-os2*) 5597d656433aSmrg # These systems don't actually have a C library (as such) 5598d656433aSmrg test "X$arg" = "X-lc" && continue 5599d656433aSmrg ;; 5600d656433aSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5601d656433aSmrg # Do not include libc due to us having libc/libc_r. 5602d656433aSmrg test "X$arg" = "X-lc" && continue 5603d656433aSmrg ;; 5604d656433aSmrg *-*-rhapsody* | *-*-darwin1.[012]) 5605d656433aSmrg # Rhapsody C and math libraries are in the System framework 56063c15da26Smrg func_append deplibs " System.ltframework" 5607d656433aSmrg continue 5608d656433aSmrg ;; 5609d656433aSmrg *-*-sco3.2v5* | *-*-sco5v6*) 5610d656433aSmrg # Causes problems with __ctype 5611d656433aSmrg test "X$arg" = "X-lc" && continue 5612d656433aSmrg ;; 5613d656433aSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 5614d656433aSmrg # Compiler inserts libc in the correct place for threads to work 5615d656433aSmrg test "X$arg" = "X-lc" && continue 5616d656433aSmrg ;; 5617d656433aSmrg esac 5618d656433aSmrg elif test "X$arg" = "X-lc_r"; then 5619d656433aSmrg case $host in 5620d656433aSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5621d656433aSmrg # Do not include libc_r directly, use -pthread flag. 5622d656433aSmrg continue 5623d656433aSmrg ;; 5624d656433aSmrg esac 5625d656433aSmrg fi 56263c15da26Smrg func_append deplibs " $arg" 5627d656433aSmrg continue 5628d656433aSmrg ;; 5629126a8a12Smrg 5630d656433aSmrg -module) 5631d656433aSmrg module=yes 5632d656433aSmrg continue 5633d656433aSmrg ;; 5634126a8a12Smrg 5635d656433aSmrg # Tru64 UNIX uses -model [arg] to determine the layout of C++ 5636d656433aSmrg # classes, name mangling, and exception handling. 5637d656433aSmrg # Darwin uses the -arch flag to determine output architecture. 56383c15da26Smrg -model|-arch|-isysroot|--sysroot) 56393c15da26Smrg func_append compiler_flags " $arg" 5640d656433aSmrg func_append compile_command " $arg" 5641d656433aSmrg func_append finalize_command " $arg" 5642d656433aSmrg prev=xcompiler 5643d656433aSmrg continue 5644d656433aSmrg ;; 5645126a8a12Smrg 5646d656433aSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 56473c15da26Smrg func_append compiler_flags " $arg" 5648d656433aSmrg func_append compile_command " $arg" 5649d656433aSmrg func_append finalize_command " $arg" 5650d656433aSmrg case "$new_inherited_linker_flags " in 5651d656433aSmrg *" $arg "*) ;; 56523c15da26Smrg * ) func_append new_inherited_linker_flags " $arg" ;; 5653d656433aSmrg esac 5654d656433aSmrg continue 5655d656433aSmrg ;; 5656126a8a12Smrg 5657d656433aSmrg -multi_module) 5658d656433aSmrg single_module="${wl}-multi_module" 5659d656433aSmrg continue 5660d656433aSmrg ;; 5661126a8a12Smrg 5662d656433aSmrg -no-fast-install) 5663d656433aSmrg fast_install=no 5664d656433aSmrg continue 5665d656433aSmrg ;; 5666126a8a12Smrg 5667d656433aSmrg -no-install) 5668d656433aSmrg case $host in 5669d656433aSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 5670d656433aSmrg # The PATH hackery in wrapper scripts is required on Windows 5671d656433aSmrg # and Darwin in order for the loader to find any dlls it needs. 5672d656433aSmrg func_warning "\`-no-install' is ignored for $host" 5673d656433aSmrg func_warning "assuming \`-no-fast-install' instead" 5674d656433aSmrg fast_install=no 5675d656433aSmrg ;; 5676d656433aSmrg *) no_install=yes ;; 5677d656433aSmrg esac 5678d656433aSmrg continue 5679d656433aSmrg ;; 5680126a8a12Smrg 5681d656433aSmrg -no-undefined) 5682d656433aSmrg allow_undefined=no 5683d656433aSmrg continue 5684d656433aSmrg ;; 5685126a8a12Smrg 5686d656433aSmrg -objectlist) 5687d656433aSmrg prev=objectlist 5688d656433aSmrg continue 5689d656433aSmrg ;; 5690126a8a12Smrg 5691d656433aSmrg -o) prev=output ;; 5692126a8a12Smrg 5693d656433aSmrg -precious-files-regex) 5694d656433aSmrg prev=precious_regex 5695d656433aSmrg continue 5696d656433aSmrg ;; 5697126a8a12Smrg 5698d656433aSmrg -release) 5699d656433aSmrg prev=release 5700d656433aSmrg continue 5701d656433aSmrg ;; 5702126a8a12Smrg 5703d656433aSmrg -rpath) 5704d656433aSmrg prev=rpath 5705d656433aSmrg continue 5706d656433aSmrg ;; 5707126a8a12Smrg 5708d656433aSmrg -R) 5709d656433aSmrg prev=xrpath 5710d656433aSmrg continue 5711d656433aSmrg ;; 5712126a8a12Smrg 5713d656433aSmrg -R*) 5714d656433aSmrg func_stripname '-R' '' "$arg" 5715d656433aSmrg dir=$func_stripname_result 5716d656433aSmrg # We need an absolute path. 5717d656433aSmrg case $dir in 5718d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) ;; 57193c15da26Smrg =*) 57203c15da26Smrg func_stripname '=' '' "$dir" 57213c15da26Smrg dir=$lt_sysroot$func_stripname_result 57223c15da26Smrg ;; 5723d656433aSmrg *) 5724d656433aSmrg func_fatal_error "only absolute run-paths are allowed" 5725d656433aSmrg ;; 5726d656433aSmrg esac 5727d656433aSmrg case "$xrpath " in 5728d656433aSmrg *" $dir "*) ;; 57293c15da26Smrg *) func_append xrpath " $dir" ;; 5730d656433aSmrg esac 5731d656433aSmrg continue 5732d656433aSmrg ;; 5733126a8a12Smrg 5734d656433aSmrg -shared) 5735d656433aSmrg # The effects of -shared are defined in a previous loop. 5736d656433aSmrg continue 5737d656433aSmrg ;; 5738126a8a12Smrg 5739d656433aSmrg -shrext) 5740d656433aSmrg prev=shrext 5741d656433aSmrg continue 5742d656433aSmrg ;; 5743126a8a12Smrg 5744d656433aSmrg -static | -static-libtool-libs) 5745d656433aSmrg # The effects of -static are defined in a previous loop. 5746d656433aSmrg # We used to do the same as -all-static on platforms that 5747d656433aSmrg # didn't have a PIC flag, but the assumption that the effects 5748d656433aSmrg # would be equivalent was wrong. It would break on at least 5749d656433aSmrg # Digital Unix and AIX. 5750d656433aSmrg continue 5751d656433aSmrg ;; 5752126a8a12Smrg 5753d656433aSmrg -thread-safe) 5754d656433aSmrg thread_safe=yes 5755d656433aSmrg continue 5756d656433aSmrg ;; 5757126a8a12Smrg 5758d656433aSmrg -version-info) 5759d656433aSmrg prev=vinfo 5760d656433aSmrg continue 5761d656433aSmrg ;; 5762126a8a12Smrg 5763d656433aSmrg -version-number) 5764d656433aSmrg prev=vinfo 5765d656433aSmrg vinfo_number=yes 5766d656433aSmrg continue 5767d656433aSmrg ;; 5768126a8a12Smrg 5769d656433aSmrg -weak) 5770d656433aSmrg prev=weak 5771d656433aSmrg continue 5772d656433aSmrg ;; 5773126a8a12Smrg 5774d656433aSmrg -Wc,*) 5775d656433aSmrg func_stripname '-Wc,' '' "$arg" 5776d656433aSmrg args=$func_stripname_result 5777d656433aSmrg arg= 5778d656433aSmrg save_ifs="$IFS"; IFS=',' 5779d656433aSmrg for flag in $args; do 5780d656433aSmrg IFS="$save_ifs" 5781d656433aSmrg func_quote_for_eval "$flag" 57823c15da26Smrg func_append arg " $func_quote_for_eval_result" 57833c15da26Smrg func_append compiler_flags " $func_quote_for_eval_result" 5784d656433aSmrg done 5785d656433aSmrg IFS="$save_ifs" 5786d656433aSmrg func_stripname ' ' '' "$arg" 5787d656433aSmrg arg=$func_stripname_result 5788d656433aSmrg ;; 5789126a8a12Smrg 5790d656433aSmrg -Wl,*) 5791d656433aSmrg func_stripname '-Wl,' '' "$arg" 5792d656433aSmrg args=$func_stripname_result 5793d656433aSmrg arg= 5794d656433aSmrg save_ifs="$IFS"; IFS=',' 5795d656433aSmrg for flag in $args; do 5796d656433aSmrg IFS="$save_ifs" 5797d656433aSmrg func_quote_for_eval "$flag" 57983c15da26Smrg func_append arg " $wl$func_quote_for_eval_result" 57993c15da26Smrg func_append compiler_flags " $wl$func_quote_for_eval_result" 58003c15da26Smrg func_append linker_flags " $func_quote_for_eval_result" 5801d656433aSmrg done 5802d656433aSmrg IFS="$save_ifs" 5803d656433aSmrg func_stripname ' ' '' "$arg" 5804d656433aSmrg arg=$func_stripname_result 5805d656433aSmrg ;; 5806126a8a12Smrg 5807d656433aSmrg -Xcompiler) 5808d656433aSmrg prev=xcompiler 5809d656433aSmrg continue 5810d656433aSmrg ;; 5811126a8a12Smrg 5812d656433aSmrg -Xlinker) 5813d656433aSmrg prev=xlinker 5814d656433aSmrg continue 5815d656433aSmrg ;; 5816126a8a12Smrg 5817d656433aSmrg -XCClinker) 5818d656433aSmrg prev=xcclinker 5819d656433aSmrg continue 5820d656433aSmrg ;; 5821126a8a12Smrg 5822d656433aSmrg # -msg_* for osf cc 5823d656433aSmrg -msg_*) 5824d656433aSmrg func_quote_for_eval "$arg" 5825d656433aSmrg arg="$func_quote_for_eval_result" 5826d656433aSmrg ;; 5827126a8a12Smrg 5828555991fdSmrg # Flags to be passed through unchanged, with rationale: 5829555991fdSmrg # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 5830555991fdSmrg # -r[0-9][0-9]* specify processor for the SGI compiler 5831555991fdSmrg # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 5832555991fdSmrg # +DA*, +DD* enable 64-bit mode for the HP compiler 5833555991fdSmrg # -q* compiler args for the IBM compiler 5834555991fdSmrg # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 5835555991fdSmrg # -F/path path to uninstalled frameworks, gcc on darwin 5836555991fdSmrg # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 5837555991fdSmrg # @file GCC response files 5838555991fdSmrg # -tp=* Portland pgcc target processor selection 58393c15da26Smrg # --sysroot=* for sysroot support 58403c15da26Smrg # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 5841d656433aSmrg -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 58423c15da26Smrg -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 58433c15da26Smrg -O*|-flto*|-fwhopr*|-fuse-linker-plugin) 5844d656433aSmrg func_quote_for_eval "$arg" 5845d656433aSmrg arg="$func_quote_for_eval_result" 5846d656433aSmrg func_append compile_command " $arg" 5847d656433aSmrg func_append finalize_command " $arg" 58483c15da26Smrg func_append compiler_flags " $arg" 5849d656433aSmrg continue 5850d656433aSmrg ;; 5851126a8a12Smrg 5852d656433aSmrg # Some other compiler flag. 5853d656433aSmrg -* | +*) 5854d656433aSmrg func_quote_for_eval "$arg" 5855d656433aSmrg arg="$func_quote_for_eval_result" 5856d656433aSmrg ;; 5857126a8a12Smrg 5858d656433aSmrg *.$objext) 5859d656433aSmrg # A standard object. 58603c15da26Smrg func_append objs " $arg" 5861d656433aSmrg ;; 5862d656433aSmrg 5863d656433aSmrg *.lo) 5864d656433aSmrg # A libtool-controlled object. 5865d656433aSmrg 5866d656433aSmrg # Check to see that this really is a libtool object. 5867d656433aSmrg if func_lalib_unsafe_p "$arg"; then 5868d656433aSmrg pic_object= 5869d656433aSmrg non_pic_object= 5870d656433aSmrg 5871d656433aSmrg # Read the .lo file 5872d656433aSmrg func_source "$arg" 5873d656433aSmrg 5874d656433aSmrg if test -z "$pic_object" || 5875d656433aSmrg test -z "$non_pic_object" || 5876d656433aSmrg test "$pic_object" = none && 5877d656433aSmrg test "$non_pic_object" = none; then 5878d656433aSmrg func_fatal_error "cannot find name of object for \`$arg'" 5879d656433aSmrg fi 5880d656433aSmrg 5881d656433aSmrg # Extract subdirectory from the argument. 5882d656433aSmrg func_dirname "$arg" "/" "" 5883d656433aSmrg xdir="$func_dirname_result" 5884d656433aSmrg 5885d656433aSmrg if test "$pic_object" != none; then 5886d656433aSmrg # Prepend the subdirectory the object is found in. 5887d656433aSmrg pic_object="$xdir$pic_object" 5888d656433aSmrg 5889d656433aSmrg if test "$prev" = dlfiles; then 5890d656433aSmrg if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 58913c15da26Smrg func_append dlfiles " $pic_object" 5892d656433aSmrg prev= 5893d656433aSmrg continue 5894d656433aSmrg else 5895d656433aSmrg # If libtool objects are unsupported, then we need to preload. 5896d656433aSmrg prev=dlprefiles 5897d656433aSmrg fi 5898d656433aSmrg fi 5899d656433aSmrg 5900d656433aSmrg # CHECK ME: I think I busted this. -Ossama 5901d656433aSmrg if test "$prev" = dlprefiles; then 5902d656433aSmrg # Preload the old-style object. 59033c15da26Smrg func_append dlprefiles " $pic_object" 5904d656433aSmrg prev= 5905d656433aSmrg fi 5906d656433aSmrg 5907d656433aSmrg # A PIC object. 5908d656433aSmrg func_append libobjs " $pic_object" 5909d656433aSmrg arg="$pic_object" 5910d656433aSmrg fi 5911d656433aSmrg 5912d656433aSmrg # Non-PIC object. 5913d656433aSmrg if test "$non_pic_object" != none; then 5914d656433aSmrg # Prepend the subdirectory the object is found in. 5915d656433aSmrg non_pic_object="$xdir$non_pic_object" 5916d656433aSmrg 5917d656433aSmrg # A standard non-PIC object 5918d656433aSmrg func_append non_pic_objects " $non_pic_object" 5919d656433aSmrg if test -z "$pic_object" || test "$pic_object" = none ; then 5920d656433aSmrg arg="$non_pic_object" 5921d656433aSmrg fi 5922d656433aSmrg else 5923d656433aSmrg # If the PIC object exists, use it instead. 5924d656433aSmrg # $xdir was prepended to $pic_object above. 5925d656433aSmrg non_pic_object="$pic_object" 5926d656433aSmrg func_append non_pic_objects " $non_pic_object" 5927d656433aSmrg fi 5928d656433aSmrg else 5929d656433aSmrg # Only an error if not doing a dry-run. 5930d656433aSmrg if $opt_dry_run; then 5931d656433aSmrg # Extract subdirectory from the argument. 5932d656433aSmrg func_dirname "$arg" "/" "" 5933d656433aSmrg xdir="$func_dirname_result" 5934d656433aSmrg 5935d656433aSmrg func_lo2o "$arg" 5936d656433aSmrg pic_object=$xdir$objdir/$func_lo2o_result 5937d656433aSmrg non_pic_object=$xdir$func_lo2o_result 5938d656433aSmrg func_append libobjs " $pic_object" 5939d656433aSmrg func_append non_pic_objects " $non_pic_object" 5940d656433aSmrg else 5941d656433aSmrg func_fatal_error "\`$arg' is not a valid libtool object" 5942d656433aSmrg fi 5943d656433aSmrg fi 5944d656433aSmrg ;; 5945d656433aSmrg 5946d656433aSmrg *.$libext) 5947d656433aSmrg # An archive. 59483c15da26Smrg func_append deplibs " $arg" 59493c15da26Smrg func_append old_deplibs " $arg" 5950d656433aSmrg continue 5951d656433aSmrg ;; 5952d656433aSmrg 5953d656433aSmrg *.la) 5954d656433aSmrg # A libtool-controlled library. 5955d656433aSmrg 59563c15da26Smrg func_resolve_sysroot "$arg" 5957d656433aSmrg if test "$prev" = dlfiles; then 5958d656433aSmrg # This library was specified with -dlopen. 59593c15da26Smrg func_append dlfiles " $func_resolve_sysroot_result" 5960d656433aSmrg prev= 5961d656433aSmrg elif test "$prev" = dlprefiles; then 5962d656433aSmrg # The library was specified with -dlpreopen. 59633c15da26Smrg func_append dlprefiles " $func_resolve_sysroot_result" 5964d656433aSmrg prev= 5965d656433aSmrg else 59663c15da26Smrg func_append deplibs " $func_resolve_sysroot_result" 5967d656433aSmrg fi 5968d656433aSmrg continue 5969d656433aSmrg ;; 5970d656433aSmrg 5971d656433aSmrg # Some other compiler argument. 5972d656433aSmrg *) 5973d656433aSmrg # Unknown arguments in both finalize_command and compile_command need 5974d656433aSmrg # to be aesthetically quoted because they are evaled later. 5975d656433aSmrg func_quote_for_eval "$arg" 5976d656433aSmrg arg="$func_quote_for_eval_result" 5977d656433aSmrg ;; 5978d656433aSmrg esac # arg 5979d656433aSmrg 5980d656433aSmrg # Now actually substitute the argument into the commands. 5981d656433aSmrg if test -n "$arg"; then 5982d656433aSmrg func_append compile_command " $arg" 5983d656433aSmrg func_append finalize_command " $arg" 5984d656433aSmrg fi 5985d656433aSmrg done # argument parsing loop 5986d656433aSmrg 5987d656433aSmrg test -n "$prev" && \ 5988d656433aSmrg func_fatal_help "the \`$prevarg' option requires an argument" 5989d656433aSmrg 5990d656433aSmrg if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 5991d656433aSmrg eval arg=\"$export_dynamic_flag_spec\" 5992d656433aSmrg func_append compile_command " $arg" 5993d656433aSmrg func_append finalize_command " $arg" 5994d656433aSmrg fi 5995d656433aSmrg 5996d656433aSmrg oldlibs= 5997d656433aSmrg # calculate the name of the file, without its directory 5998d656433aSmrg func_basename "$output" 5999d656433aSmrg outputname="$func_basename_result" 6000d656433aSmrg libobjs_save="$libobjs" 6001d656433aSmrg 6002d656433aSmrg if test -n "$shlibpath_var"; then 6003d656433aSmrg # get the directories listed in $shlibpath_var 6004555991fdSmrg eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 6005126a8a12Smrg else 6006d656433aSmrg shlib_search_path= 6007126a8a12Smrg fi 6008d656433aSmrg eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 6009d656433aSmrg eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 6010126a8a12Smrg 6011d656433aSmrg func_dirname "$output" "/" "" 6012d656433aSmrg output_objdir="$func_dirname_result$objdir" 60133c15da26Smrg func_to_tool_file "$output_objdir/" 60143c15da26Smrg tool_output_objdir=$func_to_tool_file_result 6015d656433aSmrg # Create the object directory. 6016d656433aSmrg func_mkdir_p "$output_objdir" 6017126a8a12Smrg 6018d656433aSmrg # Determine the type of output 6019d656433aSmrg case $output in 6020d656433aSmrg "") 6021d656433aSmrg func_fatal_help "you must specify an output file" 6022d656433aSmrg ;; 6023d656433aSmrg *.$libext) linkmode=oldlib ;; 6024d656433aSmrg *.lo | *.$objext) linkmode=obj ;; 6025d656433aSmrg *.la) linkmode=lib ;; 6026d656433aSmrg *) linkmode=prog ;; # Anything else should be a program. 6027d656433aSmrg esac 6028d656433aSmrg 6029d656433aSmrg specialdeplibs= 6030d656433aSmrg 6031d656433aSmrg libs= 6032d656433aSmrg # Find all interdependent deplibs by searching for libraries 6033d656433aSmrg # that are linked more than once (e.g. -la -lb -la) 6034d656433aSmrg for deplib in $deplibs; do 60353c15da26Smrg if $opt_preserve_dup_deps ; then 6036d656433aSmrg case "$libs " in 60373c15da26Smrg *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6038d656433aSmrg esac 6039d656433aSmrg fi 60403c15da26Smrg func_append libs " $deplib" 6041d656433aSmrg done 6042d656433aSmrg 6043d656433aSmrg if test "$linkmode" = lib; then 6044d656433aSmrg libs="$predeps $libs $compiler_lib_search_path $postdeps" 6045d656433aSmrg 6046d656433aSmrg # Compute libraries that are listed more than once in $predeps 6047d656433aSmrg # $postdeps and mark them as special (i.e., whose duplicates are 6048d656433aSmrg # not to be eliminated). 6049d656433aSmrg pre_post_deps= 6050d656433aSmrg if $opt_duplicate_compiler_generated_deps; then 6051d656433aSmrg for pre_post_dep in $predeps $postdeps; do 6052d656433aSmrg case "$pre_post_deps " in 60533c15da26Smrg *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 6054d656433aSmrg esac 60553c15da26Smrg func_append pre_post_deps " $pre_post_dep" 6056d656433aSmrg done 6057d656433aSmrg fi 6058d656433aSmrg pre_post_deps= 6059d656433aSmrg fi 6060d656433aSmrg 6061d656433aSmrg deplibs= 6062d656433aSmrg newdependency_libs= 6063d656433aSmrg newlib_search_path= 6064d656433aSmrg need_relink=no # whether we're linking any uninstalled libtool libraries 6065d656433aSmrg notinst_deplibs= # not-installed libtool libraries 6066d656433aSmrg notinst_path= # paths that contain not-installed libtool libraries 6067d656433aSmrg 6068d656433aSmrg case $linkmode in 6069d656433aSmrg lib) 6070d656433aSmrg passes="conv dlpreopen link" 6071d656433aSmrg for file in $dlfiles $dlprefiles; do 6072d656433aSmrg case $file in 6073d656433aSmrg *.la) ;; 6074d656433aSmrg *) 6075d656433aSmrg func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 6076d656433aSmrg ;; 6077d656433aSmrg esac 6078d656433aSmrg done 6079d656433aSmrg ;; 6080d656433aSmrg prog) 6081d656433aSmrg compile_deplibs= 6082d656433aSmrg finalize_deplibs= 6083d656433aSmrg alldeplibs=no 6084d656433aSmrg newdlfiles= 6085d656433aSmrg newdlprefiles= 6086d656433aSmrg passes="conv scan dlopen dlpreopen link" 6087d656433aSmrg ;; 6088d656433aSmrg *) passes="conv" 6089d656433aSmrg ;; 6090d656433aSmrg esac 6091d656433aSmrg 6092d656433aSmrg for pass in $passes; do 6093d656433aSmrg # The preopen pass in lib mode reverses $deplibs; put it back here 6094d656433aSmrg # so that -L comes before libs that need it for instance... 6095d656433aSmrg if test "$linkmode,$pass" = "lib,link"; then 6096d656433aSmrg ## FIXME: Find the place where the list is rebuilt in the wrong 6097d656433aSmrg ## order, and fix it there properly 6098d656433aSmrg tmp_deplibs= 6099d656433aSmrg for deplib in $deplibs; do 6100d656433aSmrg tmp_deplibs="$deplib $tmp_deplibs" 6101d656433aSmrg done 6102d656433aSmrg deplibs="$tmp_deplibs" 6103d656433aSmrg fi 6104d656433aSmrg 6105d656433aSmrg if test "$linkmode,$pass" = "lib,link" || 6106d656433aSmrg test "$linkmode,$pass" = "prog,scan"; then 6107d656433aSmrg libs="$deplibs" 6108d656433aSmrg deplibs= 6109d656433aSmrg fi 6110d656433aSmrg if test "$linkmode" = prog; then 6111d656433aSmrg case $pass in 6112d656433aSmrg dlopen) libs="$dlfiles" ;; 6113d656433aSmrg dlpreopen) libs="$dlprefiles" ;; 6114d656433aSmrg link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 6115d656433aSmrg esac 6116d656433aSmrg fi 6117d656433aSmrg if test "$linkmode,$pass" = "lib,dlpreopen"; then 6118d656433aSmrg # Collect and forward deplibs of preopened libtool libs 6119d656433aSmrg for lib in $dlprefiles; do 6120d656433aSmrg # Ignore non-libtool-libs 6121d656433aSmrg dependency_libs= 61223c15da26Smrg func_resolve_sysroot "$lib" 6123d656433aSmrg case $lib in 61243c15da26Smrg *.la) func_source "$func_resolve_sysroot_result" ;; 6125d656433aSmrg esac 6126d656433aSmrg 6127d656433aSmrg # Collect preopened libtool deplibs, except any this library 6128d656433aSmrg # has declared as weak libs 6129d656433aSmrg for deplib in $dependency_libs; do 6130555991fdSmrg func_basename "$deplib" 6131555991fdSmrg deplib_base=$func_basename_result 6132d656433aSmrg case " $weak_libs " in 6133d656433aSmrg *" $deplib_base "*) ;; 61343c15da26Smrg *) func_append deplibs " $deplib" ;; 6135d656433aSmrg esac 6136d656433aSmrg done 6137d656433aSmrg done 6138d656433aSmrg libs="$dlprefiles" 6139d656433aSmrg fi 6140d656433aSmrg if test "$pass" = dlopen; then 6141d656433aSmrg # Collect dlpreopened libraries 6142d656433aSmrg save_deplibs="$deplibs" 6143d656433aSmrg deplibs= 6144d656433aSmrg fi 6145d656433aSmrg 6146d656433aSmrg for deplib in $libs; do 6147d656433aSmrg lib= 6148d656433aSmrg found=no 6149d656433aSmrg case $deplib in 6150d656433aSmrg -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 6151d656433aSmrg if test "$linkmode,$pass" = "prog,link"; then 6152d656433aSmrg compile_deplibs="$deplib $compile_deplibs" 6153d656433aSmrg finalize_deplibs="$deplib $finalize_deplibs" 6154d656433aSmrg else 61553c15da26Smrg func_append compiler_flags " $deplib" 6156d656433aSmrg if test "$linkmode" = lib ; then 6157d656433aSmrg case "$new_inherited_linker_flags " in 6158d656433aSmrg *" $deplib "*) ;; 61593c15da26Smrg * ) func_append new_inherited_linker_flags " $deplib" ;; 6160d656433aSmrg esac 6161d656433aSmrg fi 6162d656433aSmrg fi 6163d656433aSmrg continue 6164d656433aSmrg ;; 6165d656433aSmrg -l*) 6166d656433aSmrg if test "$linkmode" != lib && test "$linkmode" != prog; then 6167d656433aSmrg func_warning "\`-l' is ignored for archives/objects" 6168d656433aSmrg continue 6169d656433aSmrg fi 6170d656433aSmrg func_stripname '-l' '' "$deplib" 6171d656433aSmrg name=$func_stripname_result 6172d656433aSmrg if test "$linkmode" = lib; then 6173d656433aSmrg searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 6174d656433aSmrg else 6175d656433aSmrg searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 6176d656433aSmrg fi 6177d656433aSmrg for searchdir in $searchdirs; do 6178d656433aSmrg for search_ext in .la $std_shrext .so .a; do 6179d656433aSmrg # Search the libtool library 6180d656433aSmrg lib="$searchdir/lib${name}${search_ext}" 6181d656433aSmrg if test -f "$lib"; then 6182d656433aSmrg if test "$search_ext" = ".la"; then 6183d656433aSmrg found=yes 6184d656433aSmrg else 6185d656433aSmrg found=no 6186d656433aSmrg fi 6187d656433aSmrg break 2 6188d656433aSmrg fi 6189d656433aSmrg done 6190d656433aSmrg done 6191d656433aSmrg if test "$found" != yes; then 6192d656433aSmrg # deplib doesn't seem to be a libtool library 6193d656433aSmrg if test "$linkmode,$pass" = "prog,link"; then 6194d656433aSmrg compile_deplibs="$deplib $compile_deplibs" 6195d656433aSmrg finalize_deplibs="$deplib $finalize_deplibs" 6196d656433aSmrg else 6197d656433aSmrg deplibs="$deplib $deplibs" 6198d656433aSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6199d656433aSmrg fi 6200d656433aSmrg continue 6201d656433aSmrg else # deplib is a libtool library 6202d656433aSmrg # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 6203d656433aSmrg # We need to do some special things here, and not later. 6204d656433aSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6205d656433aSmrg case " $predeps $postdeps " in 6206d656433aSmrg *" $deplib "*) 6207d656433aSmrg if func_lalib_p "$lib"; then 6208d656433aSmrg library_names= 6209d656433aSmrg old_library= 6210d656433aSmrg func_source "$lib" 6211d656433aSmrg for l in $old_library $library_names; do 6212d656433aSmrg ll="$l" 6213d656433aSmrg done 6214d656433aSmrg if test "X$ll" = "X$old_library" ; then # only static version available 6215d656433aSmrg found=no 6216d656433aSmrg func_dirname "$lib" "" "." 6217d656433aSmrg ladir="$func_dirname_result" 6218d656433aSmrg lib=$ladir/$old_library 6219d656433aSmrg if test "$linkmode,$pass" = "prog,link"; then 6220d656433aSmrg compile_deplibs="$deplib $compile_deplibs" 6221d656433aSmrg finalize_deplibs="$deplib $finalize_deplibs" 6222d656433aSmrg else 6223d656433aSmrg deplibs="$deplib $deplibs" 6224d656433aSmrg test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6225d656433aSmrg fi 6226d656433aSmrg continue 6227d656433aSmrg fi 6228d656433aSmrg fi 6229d656433aSmrg ;; 6230d656433aSmrg *) ;; 6231d656433aSmrg esac 6232d656433aSmrg fi 6233d656433aSmrg fi 6234d656433aSmrg ;; # -l 6235d656433aSmrg *.ltframework) 6236d656433aSmrg if test "$linkmode,$pass" = "prog,link"; then 6237d656433aSmrg compile_deplibs="$deplib $compile_deplibs" 6238d656433aSmrg finalize_deplibs="$deplib $finalize_deplibs" 6239d656433aSmrg else 6240d656433aSmrg deplibs="$deplib $deplibs" 6241d656433aSmrg if test "$linkmode" = lib ; then 6242d656433aSmrg case "$new_inherited_linker_flags " in 6243d656433aSmrg *" $deplib "*) ;; 62443c15da26Smrg * ) func_append new_inherited_linker_flags " $deplib" ;; 6245d656433aSmrg esac 6246d656433aSmrg fi 6247d656433aSmrg fi 6248d656433aSmrg continue 6249d656433aSmrg ;; 6250d656433aSmrg -L*) 6251d656433aSmrg case $linkmode in 6252d656433aSmrg lib) 6253d656433aSmrg deplibs="$deplib $deplibs" 6254d656433aSmrg test "$pass" = conv && continue 6255d656433aSmrg newdependency_libs="$deplib $newdependency_libs" 6256d656433aSmrg func_stripname '-L' '' "$deplib" 62573c15da26Smrg func_resolve_sysroot "$func_stripname_result" 62583c15da26Smrg func_append newlib_search_path " $func_resolve_sysroot_result" 6259d656433aSmrg ;; 6260d656433aSmrg prog) 6261d656433aSmrg if test "$pass" = conv; then 6262d656433aSmrg deplibs="$deplib $deplibs" 6263d656433aSmrg continue 6264d656433aSmrg fi 6265d656433aSmrg if test "$pass" = scan; then 6266d656433aSmrg deplibs="$deplib $deplibs" 6267d656433aSmrg else 6268d656433aSmrg compile_deplibs="$deplib $compile_deplibs" 6269d656433aSmrg finalize_deplibs="$deplib $finalize_deplibs" 6270d656433aSmrg fi 6271d656433aSmrg func_stripname '-L' '' "$deplib" 62723c15da26Smrg func_resolve_sysroot "$func_stripname_result" 62733c15da26Smrg func_append newlib_search_path " $func_resolve_sysroot_result" 6274d656433aSmrg ;; 6275d656433aSmrg *) 6276d656433aSmrg func_warning "\`-L' is ignored for archives/objects" 6277d656433aSmrg ;; 6278d656433aSmrg esac # linkmode 6279d656433aSmrg continue 6280d656433aSmrg ;; # -L 6281d656433aSmrg -R*) 6282d656433aSmrg if test "$pass" = link; then 6283d656433aSmrg func_stripname '-R' '' "$deplib" 62843c15da26Smrg func_resolve_sysroot "$func_stripname_result" 62853c15da26Smrg dir=$func_resolve_sysroot_result 6286d656433aSmrg # Make sure the xrpath contains only unique directories. 6287d656433aSmrg case "$xrpath " in 6288d656433aSmrg *" $dir "*) ;; 62893c15da26Smrg *) func_append xrpath " $dir" ;; 6290d656433aSmrg esac 6291d656433aSmrg fi 6292d656433aSmrg deplibs="$deplib $deplibs" 6293d656433aSmrg continue 6294d656433aSmrg ;; 62953c15da26Smrg *.la) 62963c15da26Smrg func_resolve_sysroot "$deplib" 62973c15da26Smrg lib=$func_resolve_sysroot_result 62983c15da26Smrg ;; 6299d656433aSmrg *.$libext) 6300d656433aSmrg if test "$pass" = conv; then 6301d656433aSmrg deplibs="$deplib $deplibs" 6302d656433aSmrg continue 6303d656433aSmrg fi 6304d656433aSmrg case $linkmode in 6305d656433aSmrg lib) 6306d656433aSmrg # Linking convenience modules into shared libraries is allowed, 6307d656433aSmrg # but linking other static libraries is non-portable. 6308d656433aSmrg case " $dlpreconveniencelibs " in 6309d656433aSmrg *" $deplib "*) ;; 6310d656433aSmrg *) 6311d656433aSmrg valid_a_lib=no 6312d656433aSmrg case $deplibs_check_method in 6313d656433aSmrg match_pattern*) 6314d656433aSmrg set dummy $deplibs_check_method; shift 6315d656433aSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 6316555991fdSmrg if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 6317d656433aSmrg | $EGREP "$match_pattern_regex" > /dev/null; then 6318d656433aSmrg valid_a_lib=yes 6319d656433aSmrg fi 6320d656433aSmrg ;; 6321d656433aSmrg pass_all) 6322d656433aSmrg valid_a_lib=yes 6323d656433aSmrg ;; 6324d656433aSmrg esac 6325d656433aSmrg if test "$valid_a_lib" != yes; then 6326555991fdSmrg echo 6327d656433aSmrg $ECHO "*** Warning: Trying to link with static lib archive $deplib." 6328555991fdSmrg echo "*** I have the capability to make that library automatically link in when" 6329555991fdSmrg echo "*** you link to this library. But I can only do this if you have a" 6330555991fdSmrg echo "*** shared version of the library, which you do not appear to have" 6331555991fdSmrg echo "*** because the file extensions .$libext of this argument makes me believe" 6332555991fdSmrg echo "*** that it is just a static archive that I should not use here." 6333d656433aSmrg else 6334555991fdSmrg echo 6335d656433aSmrg $ECHO "*** Warning: Linking the shared library $output against the" 6336d656433aSmrg $ECHO "*** static library $deplib is not portable!" 6337d656433aSmrg deplibs="$deplib $deplibs" 6338d656433aSmrg fi 6339d656433aSmrg ;; 6340d656433aSmrg esac 6341d656433aSmrg continue 6342d656433aSmrg ;; 6343d656433aSmrg prog) 6344d656433aSmrg if test "$pass" != link; then 6345d656433aSmrg deplibs="$deplib $deplibs" 6346d656433aSmrg else 6347d656433aSmrg compile_deplibs="$deplib $compile_deplibs" 6348d656433aSmrg finalize_deplibs="$deplib $finalize_deplibs" 6349d656433aSmrg fi 6350d656433aSmrg continue 6351d656433aSmrg ;; 6352d656433aSmrg esac # linkmode 6353d656433aSmrg ;; # *.$libext 6354d656433aSmrg *.lo | *.$objext) 6355d656433aSmrg if test "$pass" = conv; then 6356d656433aSmrg deplibs="$deplib $deplibs" 6357d656433aSmrg elif test "$linkmode" = prog; then 6358d656433aSmrg if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 6359d656433aSmrg # If there is no dlopen support or we're linking statically, 6360d656433aSmrg # we need to preload. 63613c15da26Smrg func_append newdlprefiles " $deplib" 6362d656433aSmrg compile_deplibs="$deplib $compile_deplibs" 6363d656433aSmrg finalize_deplibs="$deplib $finalize_deplibs" 6364d656433aSmrg else 63653c15da26Smrg func_append newdlfiles " $deplib" 6366d656433aSmrg fi 6367d656433aSmrg fi 6368d656433aSmrg continue 6369d656433aSmrg ;; 6370d656433aSmrg %DEPLIBS%) 6371d656433aSmrg alldeplibs=yes 6372d656433aSmrg continue 6373d656433aSmrg ;; 6374d656433aSmrg esac # case $deplib 6375d656433aSmrg 6376d656433aSmrg if test "$found" = yes || test -f "$lib"; then : 6377d656433aSmrg else 6378d656433aSmrg func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 6379d656433aSmrg fi 6380d656433aSmrg 6381d656433aSmrg # Check to see that this really is a libtool archive. 6382d656433aSmrg func_lalib_unsafe_p "$lib" \ 6383d656433aSmrg || func_fatal_error "\`$lib' is not a valid libtool archive" 6384d656433aSmrg 6385d656433aSmrg func_dirname "$lib" "" "." 6386d656433aSmrg ladir="$func_dirname_result" 6387d656433aSmrg 6388d656433aSmrg dlname= 6389d656433aSmrg dlopen= 6390d656433aSmrg dlpreopen= 6391d656433aSmrg libdir= 6392d656433aSmrg library_names= 6393d656433aSmrg old_library= 6394d656433aSmrg inherited_linker_flags= 6395d656433aSmrg # If the library was installed with an old release of libtool, 6396d656433aSmrg # it will not redefine variables installed, or shouldnotlink 6397d656433aSmrg installed=yes 6398d656433aSmrg shouldnotlink=no 6399d656433aSmrg avoidtemprpath= 6400d656433aSmrg 6401d656433aSmrg 6402d656433aSmrg # Read the .la file 6403d656433aSmrg func_source "$lib" 6404d656433aSmrg 6405d656433aSmrg # Convert "-framework foo" to "foo.ltframework" 6406d656433aSmrg if test -n "$inherited_linker_flags"; then 6407555991fdSmrg tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 6408d656433aSmrg for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 6409d656433aSmrg case " $new_inherited_linker_flags " in 6410d656433aSmrg *" $tmp_inherited_linker_flag "*) ;; 64113c15da26Smrg *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 6412d656433aSmrg esac 6413d656433aSmrg done 6414d656433aSmrg fi 6415555991fdSmrg dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 6416d656433aSmrg if test "$linkmode,$pass" = "lib,link" || 6417d656433aSmrg test "$linkmode,$pass" = "prog,scan" || 6418d656433aSmrg { test "$linkmode" != prog && test "$linkmode" != lib; }; then 64193c15da26Smrg test -n "$dlopen" && func_append dlfiles " $dlopen" 64203c15da26Smrg test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 6421d656433aSmrg fi 6422d656433aSmrg 6423d656433aSmrg if test "$pass" = conv; then 6424d656433aSmrg # Only check for convenience libraries 6425d656433aSmrg deplibs="$lib $deplibs" 6426d656433aSmrg if test -z "$libdir"; then 6427d656433aSmrg if test -z "$old_library"; then 6428d656433aSmrg func_fatal_error "cannot find name of link library for \`$lib'" 6429d656433aSmrg fi 6430d656433aSmrg # It is a libtool convenience library, so add in its objects. 64313c15da26Smrg func_append convenience " $ladir/$objdir/$old_library" 64323c15da26Smrg func_append old_convenience " $ladir/$objdir/$old_library" 6433d656433aSmrg elif test "$linkmode" != prog && test "$linkmode" != lib; then 6434d656433aSmrg func_fatal_error "\`$lib' is not a convenience library" 6435d656433aSmrg fi 6436d656433aSmrg tmp_libs= 6437d656433aSmrg for deplib in $dependency_libs; do 6438d656433aSmrg deplibs="$deplib $deplibs" 64393c15da26Smrg if $opt_preserve_dup_deps ; then 6440d656433aSmrg case "$tmp_libs " in 64413c15da26Smrg *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6442d656433aSmrg esac 6443d656433aSmrg fi 64443c15da26Smrg func_append tmp_libs " $deplib" 6445d656433aSmrg done 6446d656433aSmrg continue 6447d656433aSmrg fi # $pass = conv 6448d656433aSmrg 6449d656433aSmrg 6450d656433aSmrg # Get the name of the library we link against. 6451d656433aSmrg linklib= 64523c15da26Smrg if test -n "$old_library" && 64533c15da26Smrg { test "$prefer_static_libs" = yes || 64543c15da26Smrg test "$prefer_static_libs,$installed" = "built,no"; }; then 64553c15da26Smrg linklib=$old_library 64563c15da26Smrg else 64573c15da26Smrg for l in $old_library $library_names; do 64583c15da26Smrg linklib="$l" 64593c15da26Smrg done 64603c15da26Smrg fi 6461d656433aSmrg if test -z "$linklib"; then 6462d656433aSmrg func_fatal_error "cannot find name of link library for \`$lib'" 6463d656433aSmrg fi 6464d656433aSmrg 6465d656433aSmrg # This library was specified with -dlopen. 6466d656433aSmrg if test "$pass" = dlopen; then 6467d656433aSmrg if test -z "$libdir"; then 6468d656433aSmrg func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 6469d656433aSmrg fi 6470d656433aSmrg if test -z "$dlname" || 6471d656433aSmrg test "$dlopen_support" != yes || 6472d656433aSmrg test "$build_libtool_libs" = no; then 6473d656433aSmrg # If there is no dlname, no dlopen support or we're linking 6474d656433aSmrg # statically, we need to preload. We also need to preload any 6475d656433aSmrg # dependent libraries so libltdl's deplib preloader doesn't 6476d656433aSmrg # bomb out in the load deplibs phase. 64773c15da26Smrg func_append dlprefiles " $lib $dependency_libs" 6478d656433aSmrg else 64793c15da26Smrg func_append newdlfiles " $lib" 6480d656433aSmrg fi 6481d656433aSmrg continue 6482d656433aSmrg fi # $pass = dlopen 6483d656433aSmrg 6484d656433aSmrg # We need an absolute path. 6485d656433aSmrg case $ladir in 6486d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 6487d656433aSmrg *) 6488d656433aSmrg abs_ladir=`cd "$ladir" && pwd` 6489d656433aSmrg if test -z "$abs_ladir"; then 6490d656433aSmrg func_warning "cannot determine absolute directory name of \`$ladir'" 6491d656433aSmrg func_warning "passing it literally to the linker, although it might fail" 6492d656433aSmrg abs_ladir="$ladir" 6493d656433aSmrg fi 6494d656433aSmrg ;; 6495d656433aSmrg esac 6496d656433aSmrg func_basename "$lib" 6497d656433aSmrg laname="$func_basename_result" 6498d656433aSmrg 6499d656433aSmrg # Find the relevant object directory and library name. 6500d656433aSmrg if test "X$installed" = Xyes; then 65013c15da26Smrg if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6502d656433aSmrg func_warning "library \`$lib' was moved." 6503d656433aSmrg dir="$ladir" 6504d656433aSmrg absdir="$abs_ladir" 6505d656433aSmrg libdir="$abs_ladir" 6506d656433aSmrg else 65073c15da26Smrg dir="$lt_sysroot$libdir" 65083c15da26Smrg absdir="$lt_sysroot$libdir" 6509d656433aSmrg fi 6510d656433aSmrg test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 6511d656433aSmrg else 6512d656433aSmrg if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6513d656433aSmrg dir="$ladir" 6514d656433aSmrg absdir="$abs_ladir" 6515d656433aSmrg # Remove this search path later 65163c15da26Smrg func_append notinst_path " $abs_ladir" 6517d656433aSmrg else 6518d656433aSmrg dir="$ladir/$objdir" 6519d656433aSmrg absdir="$abs_ladir/$objdir" 6520d656433aSmrg # Remove this search path later 65213c15da26Smrg func_append notinst_path " $abs_ladir" 6522d656433aSmrg fi 6523d656433aSmrg fi # $installed = yes 6524d656433aSmrg func_stripname 'lib' '.la' "$laname" 6525d656433aSmrg name=$func_stripname_result 6526d656433aSmrg 6527d656433aSmrg # This library was specified with -dlpreopen. 6528d656433aSmrg if test "$pass" = dlpreopen; then 6529d656433aSmrg if test -z "$libdir" && test "$linkmode" = prog; then 6530d656433aSmrg func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 6531d656433aSmrg fi 65323c15da26Smrg case "$host" in 65333c15da26Smrg # special handling for platforms with PE-DLLs. 65343c15da26Smrg *cygwin* | *mingw* | *cegcc* ) 65353c15da26Smrg # Linker will automatically link against shared library if both 65363c15da26Smrg # static and shared are present. Therefore, ensure we extract 65373c15da26Smrg # symbols from the import library if a shared library is present 65383c15da26Smrg # (otherwise, the dlopen module name will be incorrect). We do 65393c15da26Smrg # this by putting the import library name into $newdlprefiles. 65403c15da26Smrg # We recover the dlopen module name by 'saving' the la file 65413c15da26Smrg # name in a special purpose variable, and (later) extracting the 65423c15da26Smrg # dlname from the la file. 65433c15da26Smrg if test -n "$dlname"; then 65443c15da26Smrg func_tr_sh "$dir/$linklib" 65453c15da26Smrg eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 65463c15da26Smrg func_append newdlprefiles " $dir/$linklib" 65473c15da26Smrg else 65483c15da26Smrg func_append newdlprefiles " $dir/$old_library" 65493c15da26Smrg # Keep a list of preopened convenience libraries to check 65503c15da26Smrg # that they are being used correctly in the link pass. 65513c15da26Smrg test -z "$libdir" && \ 65523c15da26Smrg func_append dlpreconveniencelibs " $dir/$old_library" 65533c15da26Smrg fi 65543c15da26Smrg ;; 65553c15da26Smrg * ) 65563c15da26Smrg # Prefer using a static library (so that no silly _DYNAMIC symbols 65573c15da26Smrg # are required to link). 65583c15da26Smrg if test -n "$old_library"; then 65593c15da26Smrg func_append newdlprefiles " $dir/$old_library" 65603c15da26Smrg # Keep a list of preopened convenience libraries to check 65613c15da26Smrg # that they are being used correctly in the link pass. 65623c15da26Smrg test -z "$libdir" && \ 65633c15da26Smrg func_append dlpreconveniencelibs " $dir/$old_library" 65643c15da26Smrg # Otherwise, use the dlname, so that lt_dlopen finds it. 65653c15da26Smrg elif test -n "$dlname"; then 65663c15da26Smrg func_append newdlprefiles " $dir/$dlname" 65673c15da26Smrg else 65683c15da26Smrg func_append newdlprefiles " $dir/$linklib" 65693c15da26Smrg fi 65703c15da26Smrg ;; 65713c15da26Smrg esac 6572d656433aSmrg fi # $pass = dlpreopen 6573d656433aSmrg 6574d656433aSmrg if test -z "$libdir"; then 6575d656433aSmrg # Link the convenience library 6576d656433aSmrg if test "$linkmode" = lib; then 6577d656433aSmrg deplibs="$dir/$old_library $deplibs" 6578d656433aSmrg elif test "$linkmode,$pass" = "prog,link"; then 6579d656433aSmrg compile_deplibs="$dir/$old_library $compile_deplibs" 6580d656433aSmrg finalize_deplibs="$dir/$old_library $finalize_deplibs" 6581d656433aSmrg else 6582d656433aSmrg deplibs="$lib $deplibs" # used for prog,scan pass 6583d656433aSmrg fi 6584d656433aSmrg continue 6585d656433aSmrg fi 6586d656433aSmrg 6587d656433aSmrg 6588d656433aSmrg if test "$linkmode" = prog && test "$pass" != link; then 65893c15da26Smrg func_append newlib_search_path " $ladir" 6590d656433aSmrg deplibs="$lib $deplibs" 6591d656433aSmrg 6592d656433aSmrg linkalldeplibs=no 6593d656433aSmrg if test "$link_all_deplibs" != no || test -z "$library_names" || 6594d656433aSmrg test "$build_libtool_libs" = no; then 6595d656433aSmrg linkalldeplibs=yes 6596d656433aSmrg fi 6597d656433aSmrg 6598d656433aSmrg tmp_libs= 6599d656433aSmrg for deplib in $dependency_libs; do 6600d656433aSmrg case $deplib in 6601d656433aSmrg -L*) func_stripname '-L' '' "$deplib" 66023c15da26Smrg func_resolve_sysroot "$func_stripname_result" 66033c15da26Smrg func_append newlib_search_path " $func_resolve_sysroot_result" 6604d656433aSmrg ;; 6605d656433aSmrg esac 6606d656433aSmrg # Need to link against all dependency_libs? 6607d656433aSmrg if test "$linkalldeplibs" = yes; then 6608d656433aSmrg deplibs="$deplib $deplibs" 6609d656433aSmrg else 6610d656433aSmrg # Need to hardcode shared library paths 6611d656433aSmrg # or/and link against static libraries 6612d656433aSmrg newdependency_libs="$deplib $newdependency_libs" 6613d656433aSmrg fi 66143c15da26Smrg if $opt_preserve_dup_deps ; then 6615d656433aSmrg case "$tmp_libs " in 66163c15da26Smrg *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6617d656433aSmrg esac 6618d656433aSmrg fi 66193c15da26Smrg func_append tmp_libs " $deplib" 6620d656433aSmrg done # for deplib 6621d656433aSmrg continue 6622d656433aSmrg fi # $linkmode = prog... 6623d656433aSmrg 6624d656433aSmrg if test "$linkmode,$pass" = "prog,link"; then 6625d656433aSmrg if test -n "$library_names" && 6626d656433aSmrg { { test "$prefer_static_libs" = no || 6627d656433aSmrg test "$prefer_static_libs,$installed" = "built,yes"; } || 6628d656433aSmrg test -z "$old_library"; }; then 6629d656433aSmrg # We need to hardcode the library path 6630d656433aSmrg if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 6631d656433aSmrg # Make sure the rpath contains only unique directories. 6632d656433aSmrg case "$temp_rpath:" in 6633d656433aSmrg *"$absdir:"*) ;; 66343c15da26Smrg *) func_append temp_rpath "$absdir:" ;; 6635d656433aSmrg esac 6636d656433aSmrg fi 6637d656433aSmrg 6638d656433aSmrg # Hardcode the library path. 6639d656433aSmrg # Skip directories that are in the system default run-time 6640d656433aSmrg # search path. 6641d656433aSmrg case " $sys_lib_dlsearch_path " in 6642d656433aSmrg *" $absdir "*) ;; 6643d656433aSmrg *) 6644d656433aSmrg case "$compile_rpath " in 6645d656433aSmrg *" $absdir "*) ;; 66463c15da26Smrg *) func_append compile_rpath " $absdir" ;; 6647d656433aSmrg esac 6648d656433aSmrg ;; 6649d656433aSmrg esac 6650d656433aSmrg case " $sys_lib_dlsearch_path " in 6651d656433aSmrg *" $libdir "*) ;; 6652d656433aSmrg *) 6653d656433aSmrg case "$finalize_rpath " in 6654d656433aSmrg *" $libdir "*) ;; 66553c15da26Smrg *) func_append finalize_rpath " $libdir" ;; 6656d656433aSmrg esac 6657d656433aSmrg ;; 6658d656433aSmrg esac 6659d656433aSmrg fi # $linkmode,$pass = prog,link... 6660d656433aSmrg 6661d656433aSmrg if test "$alldeplibs" = yes && 6662d656433aSmrg { test "$deplibs_check_method" = pass_all || 6663d656433aSmrg { test "$build_libtool_libs" = yes && 6664d656433aSmrg test -n "$library_names"; }; }; then 6665d656433aSmrg # We only need to search for static libraries 6666d656433aSmrg continue 6667d656433aSmrg fi 6668d656433aSmrg fi 6669d656433aSmrg 6670d656433aSmrg link_static=no # Whether the deplib will be linked statically 6671d656433aSmrg use_static_libs=$prefer_static_libs 6672d656433aSmrg if test "$use_static_libs" = built && test "$installed" = yes; then 6673d656433aSmrg use_static_libs=no 6674d656433aSmrg fi 6675d656433aSmrg if test -n "$library_names" && 6676d656433aSmrg { test "$use_static_libs" = no || test -z "$old_library"; }; then 6677d656433aSmrg case $host in 6678d656433aSmrg *cygwin* | *mingw* | *cegcc*) 6679d656433aSmrg # No point in relinking DLLs because paths are not encoded 66803c15da26Smrg func_append notinst_deplibs " $lib" 6681d656433aSmrg need_relink=no 6682d656433aSmrg ;; 6683d656433aSmrg *) 6684d656433aSmrg if test "$installed" = no; then 66853c15da26Smrg func_append notinst_deplibs " $lib" 6686d656433aSmrg need_relink=yes 6687d656433aSmrg fi 6688d656433aSmrg ;; 6689d656433aSmrg esac 6690d656433aSmrg # This is a shared library 6691d656433aSmrg 6692d656433aSmrg # Warn about portability, can't link against -module's on some 6693d656433aSmrg # systems (darwin). Don't bleat about dlopened modules though! 6694d656433aSmrg dlopenmodule="" 6695d656433aSmrg for dlpremoduletest in $dlprefiles; do 6696d656433aSmrg if test "X$dlpremoduletest" = "X$lib"; then 6697d656433aSmrg dlopenmodule="$dlpremoduletest" 6698d656433aSmrg break 6699d656433aSmrg fi 6700d656433aSmrg done 6701d656433aSmrg if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 6702555991fdSmrg echo 6703d656433aSmrg if test "$linkmode" = prog; then 6704d656433aSmrg $ECHO "*** Warning: Linking the executable $output against the loadable module" 6705d656433aSmrg else 6706d656433aSmrg $ECHO "*** Warning: Linking the shared library $output against the loadable module" 6707d656433aSmrg fi 6708d656433aSmrg $ECHO "*** $linklib is not portable!" 6709d656433aSmrg fi 6710d656433aSmrg if test "$linkmode" = lib && 6711d656433aSmrg test "$hardcode_into_libs" = yes; then 6712d656433aSmrg # Hardcode the library path. 6713d656433aSmrg # Skip directories that are in the system default run-time 6714d656433aSmrg # search path. 6715d656433aSmrg case " $sys_lib_dlsearch_path " in 6716d656433aSmrg *" $absdir "*) ;; 6717d656433aSmrg *) 6718d656433aSmrg case "$compile_rpath " in 6719d656433aSmrg *" $absdir "*) ;; 67203c15da26Smrg *) func_append compile_rpath " $absdir" ;; 6721d656433aSmrg esac 6722d656433aSmrg ;; 6723d656433aSmrg esac 6724d656433aSmrg case " $sys_lib_dlsearch_path " in 6725d656433aSmrg *" $libdir "*) ;; 6726d656433aSmrg *) 6727d656433aSmrg case "$finalize_rpath " in 6728d656433aSmrg *" $libdir "*) ;; 67293c15da26Smrg *) func_append finalize_rpath " $libdir" ;; 6730d656433aSmrg esac 6731d656433aSmrg ;; 6732d656433aSmrg esac 6733d656433aSmrg fi 6734d656433aSmrg 6735d656433aSmrg if test -n "$old_archive_from_expsyms_cmds"; then 6736d656433aSmrg # figure out the soname 6737d656433aSmrg set dummy $library_names 6738d656433aSmrg shift 6739d656433aSmrg realname="$1" 6740d656433aSmrg shift 6741d656433aSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 6742d656433aSmrg # use dlname if we got it. it's perfectly good, no? 6743d656433aSmrg if test -n "$dlname"; then 6744d656433aSmrg soname="$dlname" 6745d656433aSmrg elif test -n "$soname_spec"; then 6746d656433aSmrg # bleh windows 6747d656433aSmrg case $host in 6748d656433aSmrg *cygwin* | mingw* | *cegcc*) 6749d656433aSmrg func_arith $current - $age 6750d656433aSmrg major=$func_arith_result 6751d656433aSmrg versuffix="-$major" 6752d656433aSmrg ;; 6753d656433aSmrg esac 6754d656433aSmrg eval soname=\"$soname_spec\" 6755d656433aSmrg else 6756d656433aSmrg soname="$realname" 6757d656433aSmrg fi 6758d656433aSmrg 6759d656433aSmrg # Make a new name for the extract_expsyms_cmds to use 6760d656433aSmrg soroot="$soname" 6761d656433aSmrg func_basename "$soroot" 6762d656433aSmrg soname="$func_basename_result" 6763d656433aSmrg func_stripname 'lib' '.dll' "$soname" 6764d656433aSmrg newlib=libimp-$func_stripname_result.a 6765d656433aSmrg 6766d656433aSmrg # If the library has no export list, then create one now 6767d656433aSmrg if test -f "$output_objdir/$soname-def"; then : 6768d656433aSmrg else 6769d656433aSmrg func_verbose "extracting exported symbol list from \`$soname'" 6770d656433aSmrg func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 6771d656433aSmrg fi 6772d656433aSmrg 6773d656433aSmrg # Create $newlib 6774d656433aSmrg if test -f "$output_objdir/$newlib"; then :; else 6775d656433aSmrg func_verbose "generating import library for \`$soname'" 6776d656433aSmrg func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 6777d656433aSmrg fi 6778d656433aSmrg # make sure the library variables are pointing to the new library 6779d656433aSmrg dir=$output_objdir 6780d656433aSmrg linklib=$newlib 6781d656433aSmrg fi # test -n "$old_archive_from_expsyms_cmds" 6782d656433aSmrg 67833c15da26Smrg if test "$linkmode" = prog || test "$opt_mode" != relink; then 6784d656433aSmrg add_shlibpath= 6785d656433aSmrg add_dir= 6786d656433aSmrg add= 6787d656433aSmrg lib_linked=yes 6788d656433aSmrg case $hardcode_action in 6789d656433aSmrg immediate | unsupported) 6790d656433aSmrg if test "$hardcode_direct" = no; then 6791d656433aSmrg add="$dir/$linklib" 6792d656433aSmrg case $host in 6793d656433aSmrg *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 6794d656433aSmrg *-*-sysv4*uw2*) add_dir="-L$dir" ;; 6795d656433aSmrg *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 6796d656433aSmrg *-*-unixware7*) add_dir="-L$dir" ;; 6797d656433aSmrg *-*-darwin* ) 6798d656433aSmrg # if the lib is a (non-dlopened) module then we can not 6799d656433aSmrg # link against it, someone is ignoring the earlier warnings 6800d656433aSmrg if /usr/bin/file -L $add 2> /dev/null | 6801d656433aSmrg $GREP ": [^:]* bundle" >/dev/null ; then 6802d656433aSmrg if test "X$dlopenmodule" != "X$lib"; then 6803d656433aSmrg $ECHO "*** Warning: lib $linklib is a module, not a shared library" 6804d656433aSmrg if test -z "$old_library" ; then 6805555991fdSmrg echo 6806555991fdSmrg echo "*** And there doesn't seem to be a static archive available" 6807555991fdSmrg echo "*** The link will probably fail, sorry" 6808d656433aSmrg else 6809d656433aSmrg add="$dir/$old_library" 6810d656433aSmrg fi 6811d656433aSmrg elif test -n "$old_library"; then 6812d656433aSmrg add="$dir/$old_library" 6813d656433aSmrg fi 6814d656433aSmrg fi 6815d656433aSmrg esac 6816d656433aSmrg elif test "$hardcode_minus_L" = no; then 6817d656433aSmrg case $host in 6818d656433aSmrg *-*-sunos*) add_shlibpath="$dir" ;; 6819d656433aSmrg esac 6820d656433aSmrg add_dir="-L$dir" 6821d656433aSmrg add="-l$name" 6822d656433aSmrg elif test "$hardcode_shlibpath_var" = no; then 6823d656433aSmrg add_shlibpath="$dir" 6824d656433aSmrg add="-l$name" 6825d656433aSmrg else 6826d656433aSmrg lib_linked=no 6827d656433aSmrg fi 6828d656433aSmrg ;; 6829d656433aSmrg relink) 6830d656433aSmrg if test "$hardcode_direct" = yes && 6831d656433aSmrg test "$hardcode_direct_absolute" = no; then 6832d656433aSmrg add="$dir/$linklib" 6833d656433aSmrg elif test "$hardcode_minus_L" = yes; then 6834d656433aSmrg add_dir="-L$dir" 6835d656433aSmrg # Try looking first in the location we're being installed to. 6836d656433aSmrg if test -n "$inst_prefix_dir"; then 6837d656433aSmrg case $libdir in 6838d656433aSmrg [\\/]*) 68393c15da26Smrg func_append add_dir " -L$inst_prefix_dir$libdir" 6840d656433aSmrg ;; 6841d656433aSmrg esac 6842d656433aSmrg fi 6843d656433aSmrg add="-l$name" 6844d656433aSmrg elif test "$hardcode_shlibpath_var" = yes; then 6845d656433aSmrg add_shlibpath="$dir" 6846d656433aSmrg add="-l$name" 6847d656433aSmrg else 6848d656433aSmrg lib_linked=no 6849d656433aSmrg fi 6850d656433aSmrg ;; 6851d656433aSmrg *) lib_linked=no ;; 6852d656433aSmrg esac 6853d656433aSmrg 6854d656433aSmrg if test "$lib_linked" != yes; then 6855d656433aSmrg func_fatal_configuration "unsupported hardcode properties" 6856d656433aSmrg fi 6857d656433aSmrg 6858d656433aSmrg if test -n "$add_shlibpath"; then 6859d656433aSmrg case :$compile_shlibpath: in 6860d656433aSmrg *":$add_shlibpath:"*) ;; 68613c15da26Smrg *) func_append compile_shlibpath "$add_shlibpath:" ;; 6862d656433aSmrg esac 6863d656433aSmrg fi 6864d656433aSmrg if test "$linkmode" = prog; then 6865d656433aSmrg test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 6866d656433aSmrg test -n "$add" && compile_deplibs="$add $compile_deplibs" 6867d656433aSmrg else 6868d656433aSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 6869d656433aSmrg test -n "$add" && deplibs="$add $deplibs" 6870d656433aSmrg if test "$hardcode_direct" != yes && 6871d656433aSmrg test "$hardcode_minus_L" != yes && 6872d656433aSmrg test "$hardcode_shlibpath_var" = yes; then 6873d656433aSmrg case :$finalize_shlibpath: in 6874d656433aSmrg *":$libdir:"*) ;; 68753c15da26Smrg *) func_append finalize_shlibpath "$libdir:" ;; 6876d656433aSmrg esac 6877d656433aSmrg fi 6878d656433aSmrg fi 6879d656433aSmrg fi 6880d656433aSmrg 68813c15da26Smrg if test "$linkmode" = prog || test "$opt_mode" = relink; then 6882d656433aSmrg add_shlibpath= 6883d656433aSmrg add_dir= 6884d656433aSmrg add= 6885d656433aSmrg # Finalize command for both is simple: just hardcode it. 6886d656433aSmrg if test "$hardcode_direct" = yes && 6887d656433aSmrg test "$hardcode_direct_absolute" = no; then 6888d656433aSmrg add="$libdir/$linklib" 6889d656433aSmrg elif test "$hardcode_minus_L" = yes; then 6890d656433aSmrg add_dir="-L$libdir" 6891d656433aSmrg add="-l$name" 6892d656433aSmrg elif test "$hardcode_shlibpath_var" = yes; then 6893d656433aSmrg case :$finalize_shlibpath: in 6894d656433aSmrg *":$libdir:"*) ;; 68953c15da26Smrg *) func_append finalize_shlibpath "$libdir:" ;; 6896d656433aSmrg esac 6897d656433aSmrg add="-l$name" 6898d656433aSmrg elif test "$hardcode_automatic" = yes; then 6899d656433aSmrg if test -n "$inst_prefix_dir" && 6900d656433aSmrg test -f "$inst_prefix_dir$libdir/$linklib" ; then 6901d656433aSmrg add="$inst_prefix_dir$libdir/$linklib" 6902d656433aSmrg else 6903d656433aSmrg add="$libdir/$linklib" 6904d656433aSmrg fi 6905d656433aSmrg else 6906d656433aSmrg # We cannot seem to hardcode it, guess we'll fake it. 6907d656433aSmrg add_dir="-L$libdir" 6908d656433aSmrg # Try looking first in the location we're being installed to. 6909d656433aSmrg if test -n "$inst_prefix_dir"; then 6910d656433aSmrg case $libdir in 6911d656433aSmrg [\\/]*) 69123c15da26Smrg func_append add_dir " -L$inst_prefix_dir$libdir" 6913d656433aSmrg ;; 6914d656433aSmrg esac 6915d656433aSmrg fi 6916d656433aSmrg add="-l$name" 6917d656433aSmrg fi 6918d656433aSmrg 6919d656433aSmrg if test "$linkmode" = prog; then 6920d656433aSmrg test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 6921d656433aSmrg test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 6922d656433aSmrg else 6923d656433aSmrg test -n "$add_dir" && deplibs="$add_dir $deplibs" 6924d656433aSmrg test -n "$add" && deplibs="$add $deplibs" 6925d656433aSmrg fi 6926d656433aSmrg fi 6927d656433aSmrg elif test "$linkmode" = prog; then 6928d656433aSmrg # Here we assume that one of hardcode_direct or hardcode_minus_L 6929d656433aSmrg # is not unsupported. This is valid on all known static and 6930d656433aSmrg # shared platforms. 6931d656433aSmrg if test "$hardcode_direct" != unsupported; then 6932d656433aSmrg test -n "$old_library" && linklib="$old_library" 6933d656433aSmrg compile_deplibs="$dir/$linklib $compile_deplibs" 6934d656433aSmrg finalize_deplibs="$dir/$linklib $finalize_deplibs" 6935d656433aSmrg else 6936d656433aSmrg compile_deplibs="-l$name -L$dir $compile_deplibs" 6937d656433aSmrg finalize_deplibs="-l$name -L$dir $finalize_deplibs" 6938d656433aSmrg fi 6939d656433aSmrg elif test "$build_libtool_libs" = yes; then 6940d656433aSmrg # Not a shared library 6941d656433aSmrg if test "$deplibs_check_method" != pass_all; then 6942d656433aSmrg # We're trying link a shared library against a static one 6943d656433aSmrg # but the system doesn't support it. 6944d656433aSmrg 6945d656433aSmrg # Just print a warning and add the library to dependency_libs so 6946d656433aSmrg # that the program can be linked against the static library. 6947555991fdSmrg echo 6948d656433aSmrg $ECHO "*** Warning: This system can not link to static lib archive $lib." 6949555991fdSmrg echo "*** I have the capability to make that library automatically link in when" 6950555991fdSmrg echo "*** you link to this library. But I can only do this if you have a" 6951555991fdSmrg echo "*** shared version of the library, which you do not appear to have." 6952d656433aSmrg if test "$module" = yes; then 6953555991fdSmrg echo "*** But as you try to build a module library, libtool will still create " 6954555991fdSmrg echo "*** a static module, that should work as long as the dlopening application" 6955555991fdSmrg echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 6956d656433aSmrg if test -z "$global_symbol_pipe"; then 6957555991fdSmrg echo 6958555991fdSmrg echo "*** However, this would only work if libtool was able to extract symbol" 6959555991fdSmrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 6960555991fdSmrg echo "*** not find such a program. So, this module is probably useless." 6961555991fdSmrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 6962d656433aSmrg fi 6963d656433aSmrg if test "$build_old_libs" = no; then 6964d656433aSmrg build_libtool_libs=module 6965d656433aSmrg build_old_libs=yes 6966d656433aSmrg else 6967d656433aSmrg build_libtool_libs=no 6968d656433aSmrg fi 6969d656433aSmrg fi 6970d656433aSmrg else 6971d656433aSmrg deplibs="$dir/$old_library $deplibs" 6972d656433aSmrg link_static=yes 6973d656433aSmrg fi 6974d656433aSmrg fi # link shared/static library? 6975d656433aSmrg 6976d656433aSmrg if test "$linkmode" = lib; then 6977d656433aSmrg if test -n "$dependency_libs" && 6978d656433aSmrg { test "$hardcode_into_libs" != yes || 6979d656433aSmrg test "$build_old_libs" = yes || 6980d656433aSmrg test "$link_static" = yes; }; then 6981d656433aSmrg # Extract -R from dependency_libs 6982d656433aSmrg temp_deplibs= 6983d656433aSmrg for libdir in $dependency_libs; do 6984d656433aSmrg case $libdir in 6985d656433aSmrg -R*) func_stripname '-R' '' "$libdir" 6986d656433aSmrg temp_xrpath=$func_stripname_result 6987d656433aSmrg case " $xrpath " in 6988d656433aSmrg *" $temp_xrpath "*) ;; 69893c15da26Smrg *) func_append xrpath " $temp_xrpath";; 6990d656433aSmrg esac;; 69913c15da26Smrg *) func_append temp_deplibs " $libdir";; 6992d656433aSmrg esac 6993d656433aSmrg done 6994d656433aSmrg dependency_libs="$temp_deplibs" 6995d656433aSmrg fi 6996d656433aSmrg 69973c15da26Smrg func_append newlib_search_path " $absdir" 6998d656433aSmrg # Link against this library 6999d656433aSmrg test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 7000d656433aSmrg # ... and its dependency_libs 7001d656433aSmrg tmp_libs= 7002d656433aSmrg for deplib in $dependency_libs; do 7003d656433aSmrg newdependency_libs="$deplib $newdependency_libs" 70043c15da26Smrg case $deplib in 70053c15da26Smrg -L*) func_stripname '-L' '' "$deplib" 70063c15da26Smrg func_resolve_sysroot "$func_stripname_result";; 70073c15da26Smrg *) func_resolve_sysroot "$deplib" ;; 70083c15da26Smrg esac 70093c15da26Smrg if $opt_preserve_dup_deps ; then 7010d656433aSmrg case "$tmp_libs " in 70113c15da26Smrg *" $func_resolve_sysroot_result "*) 70123c15da26Smrg func_append specialdeplibs " $func_resolve_sysroot_result" ;; 7013d656433aSmrg esac 7014d656433aSmrg fi 70153c15da26Smrg func_append tmp_libs " $func_resolve_sysroot_result" 7016d656433aSmrg done 7017d656433aSmrg 7018d656433aSmrg if test "$link_all_deplibs" != no; then 7019d656433aSmrg # Add the search paths of all dependency libraries 7020d656433aSmrg for deplib in $dependency_libs; do 7021555991fdSmrg path= 7022d656433aSmrg case $deplib in 7023d656433aSmrg -L*) path="$deplib" ;; 7024d656433aSmrg *.la) 70253c15da26Smrg func_resolve_sysroot "$deplib" 70263c15da26Smrg deplib=$func_resolve_sysroot_result 7027d656433aSmrg func_dirname "$deplib" "" "." 70283c15da26Smrg dir=$func_dirname_result 7029d656433aSmrg # We need an absolute path. 7030d656433aSmrg case $dir in 7031d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 7032d656433aSmrg *) 7033d656433aSmrg absdir=`cd "$dir" && pwd` 7034d656433aSmrg if test -z "$absdir"; then 7035d656433aSmrg func_warning "cannot determine absolute directory name of \`$dir'" 7036d656433aSmrg absdir="$dir" 7037d656433aSmrg fi 7038d656433aSmrg ;; 7039d656433aSmrg esac 7040d656433aSmrg if $GREP "^installed=no" $deplib > /dev/null; then 7041d656433aSmrg case $host in 7042d656433aSmrg *-*-darwin*) 7043d656433aSmrg depdepl= 7044d656433aSmrg eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 7045d656433aSmrg if test -n "$deplibrary_names" ; then 7046d656433aSmrg for tmp in $deplibrary_names ; do 7047d656433aSmrg depdepl=$tmp 7048d656433aSmrg done 7049d656433aSmrg if test -f "$absdir/$objdir/$depdepl" ; then 7050d656433aSmrg depdepl="$absdir/$objdir/$depdepl" 7051d656433aSmrg darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7052d656433aSmrg if test -z "$darwin_install_name"; then 7053d656433aSmrg darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7054d656433aSmrg fi 70553c15da26Smrg func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 70563c15da26Smrg func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" 7057d656433aSmrg path= 7058d656433aSmrg fi 7059d656433aSmrg fi 7060d656433aSmrg ;; 7061d656433aSmrg *) 7062d656433aSmrg path="-L$absdir/$objdir" 7063d656433aSmrg ;; 7064d656433aSmrg esac 7065d656433aSmrg else 7066d656433aSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 7067d656433aSmrg test -z "$libdir" && \ 7068d656433aSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 7069d656433aSmrg test "$absdir" != "$libdir" && \ 7070d656433aSmrg func_warning "\`$deplib' seems to be moved" 7071d656433aSmrg 7072d656433aSmrg path="-L$absdir" 7073d656433aSmrg fi 7074d656433aSmrg ;; 7075d656433aSmrg esac 7076d656433aSmrg case " $deplibs " in 7077d656433aSmrg *" $path "*) ;; 7078d656433aSmrg *) deplibs="$path $deplibs" ;; 7079d656433aSmrg esac 7080d656433aSmrg done 7081d656433aSmrg fi # link_all_deplibs != no 7082d656433aSmrg fi # linkmode = lib 7083d656433aSmrg done # for deplib in $libs 7084d656433aSmrg if test "$pass" = link; then 7085d656433aSmrg if test "$linkmode" = "prog"; then 7086d656433aSmrg compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 7087d656433aSmrg finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 7088d656433aSmrg else 7089555991fdSmrg compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7090d656433aSmrg fi 7091d656433aSmrg fi 7092d656433aSmrg dependency_libs="$newdependency_libs" 7093d656433aSmrg if test "$pass" = dlpreopen; then 7094d656433aSmrg # Link the dlpreopened libraries before other libraries 7095d656433aSmrg for deplib in $save_deplibs; do 7096d656433aSmrg deplibs="$deplib $deplibs" 7097d656433aSmrg done 7098d656433aSmrg fi 7099d656433aSmrg if test "$pass" != dlopen; then 7100d656433aSmrg if test "$pass" != conv; then 7101d656433aSmrg # Make sure lib_search_path contains only unique directories. 7102d656433aSmrg lib_search_path= 7103d656433aSmrg for dir in $newlib_search_path; do 7104d656433aSmrg case "$lib_search_path " in 7105d656433aSmrg *" $dir "*) ;; 71063c15da26Smrg *) func_append lib_search_path " $dir" ;; 7107d656433aSmrg esac 7108d656433aSmrg done 7109d656433aSmrg newlib_search_path= 7110d656433aSmrg fi 7111d656433aSmrg 7112d656433aSmrg if test "$linkmode,$pass" != "prog,link"; then 7113d656433aSmrg vars="deplibs" 7114d656433aSmrg else 7115d656433aSmrg vars="compile_deplibs finalize_deplibs" 7116d656433aSmrg fi 7117d656433aSmrg for var in $vars dependency_libs; do 7118d656433aSmrg # Add libraries to $var in reverse order 7119d656433aSmrg eval tmp_libs=\"\$$var\" 7120d656433aSmrg new_libs= 7121d656433aSmrg for deplib in $tmp_libs; do 7122d656433aSmrg # FIXME: Pedantically, this is the right thing to do, so 7123d656433aSmrg # that some nasty dependency loop isn't accidentally 7124d656433aSmrg # broken: 7125d656433aSmrg #new_libs="$deplib $new_libs" 7126d656433aSmrg # Pragmatically, this seems to cause very few problems in 7127d656433aSmrg # practice: 7128d656433aSmrg case $deplib in 7129d656433aSmrg -L*) new_libs="$deplib $new_libs" ;; 7130d656433aSmrg -R*) ;; 7131d656433aSmrg *) 7132d656433aSmrg # And here is the reason: when a library appears more 7133d656433aSmrg # than once as an explicit dependence of a library, or 7134d656433aSmrg # is implicitly linked in more than once by the 7135d656433aSmrg # compiler, it is considered special, and multiple 7136d656433aSmrg # occurrences thereof are not removed. Compare this 7137d656433aSmrg # with having the same library being listed as a 7138d656433aSmrg # dependency of multiple other libraries: in this case, 7139d656433aSmrg # we know (pedantically, we assume) the library does not 7140d656433aSmrg # need to be listed more than once, so we keep only the 7141d656433aSmrg # last copy. This is not always right, but it is rare 7142d656433aSmrg # enough that we require users that really mean to play 7143d656433aSmrg # such unportable linking tricks to link the library 7144d656433aSmrg # using -Wl,-lname, so that libtool does not consider it 7145d656433aSmrg # for duplicate removal. 7146d656433aSmrg case " $specialdeplibs " in 7147d656433aSmrg *" $deplib "*) new_libs="$deplib $new_libs" ;; 7148d656433aSmrg *) 7149d656433aSmrg case " $new_libs " in 7150d656433aSmrg *" $deplib "*) ;; 7151d656433aSmrg *) new_libs="$deplib $new_libs" ;; 7152d656433aSmrg esac 7153d656433aSmrg ;; 7154d656433aSmrg esac 7155d656433aSmrg ;; 7156d656433aSmrg esac 7157d656433aSmrg done 7158d656433aSmrg tmp_libs= 7159d656433aSmrg for deplib in $new_libs; do 7160d656433aSmrg case $deplib in 7161d656433aSmrg -L*) 7162d656433aSmrg case " $tmp_libs " in 7163d656433aSmrg *" $deplib "*) ;; 71643c15da26Smrg *) func_append tmp_libs " $deplib" ;; 7165d656433aSmrg esac 7166d656433aSmrg ;; 71673c15da26Smrg *) func_append tmp_libs " $deplib" ;; 7168d656433aSmrg esac 7169d656433aSmrg done 7170d656433aSmrg eval $var=\"$tmp_libs\" 7171d656433aSmrg done # for var 7172d656433aSmrg fi 7173d656433aSmrg # Last step: remove runtime libs from dependency_libs 7174d656433aSmrg # (they stay in deplibs) 7175d656433aSmrg tmp_libs= 7176d656433aSmrg for i in $dependency_libs ; do 7177d656433aSmrg case " $predeps $postdeps $compiler_lib_search_path " in 7178d656433aSmrg *" $i "*) 7179d656433aSmrg i="" 7180d656433aSmrg ;; 7181d656433aSmrg esac 7182d656433aSmrg if test -n "$i" ; then 71833c15da26Smrg func_append tmp_libs " $i" 7184d656433aSmrg fi 7185d656433aSmrg done 7186d656433aSmrg dependency_libs=$tmp_libs 7187d656433aSmrg done # for pass 7188d656433aSmrg if test "$linkmode" = prog; then 7189d656433aSmrg dlfiles="$newdlfiles" 7190d656433aSmrg fi 7191d656433aSmrg if test "$linkmode" = prog || test "$linkmode" = lib; then 7192d656433aSmrg dlprefiles="$newdlprefiles" 7193d656433aSmrg fi 7194d656433aSmrg 7195d656433aSmrg case $linkmode in 7196d656433aSmrg oldlib) 7197d656433aSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7198d656433aSmrg func_warning "\`-dlopen' is ignored for archives" 7199d656433aSmrg fi 7200d656433aSmrg 7201d656433aSmrg case " $deplibs" in 7202d656433aSmrg *\ -l* | *\ -L*) 7203d656433aSmrg func_warning "\`-l' and \`-L' are ignored for archives" ;; 7204d656433aSmrg esac 7205d656433aSmrg 7206d656433aSmrg test -n "$rpath" && \ 7207d656433aSmrg func_warning "\`-rpath' is ignored for archives" 7208d656433aSmrg 7209d656433aSmrg test -n "$xrpath" && \ 7210d656433aSmrg func_warning "\`-R' is ignored for archives" 7211d656433aSmrg 7212d656433aSmrg test -n "$vinfo" && \ 7213d656433aSmrg func_warning "\`-version-info/-version-number' is ignored for archives" 7214d656433aSmrg 7215d656433aSmrg test -n "$release" && \ 7216d656433aSmrg func_warning "\`-release' is ignored for archives" 7217d656433aSmrg 7218d656433aSmrg test -n "$export_symbols$export_symbols_regex" && \ 7219d656433aSmrg func_warning "\`-export-symbols' is ignored for archives" 7220d656433aSmrg 7221d656433aSmrg # Now set the variables for building old libraries. 7222d656433aSmrg build_libtool_libs=no 7223d656433aSmrg oldlibs="$output" 72243c15da26Smrg func_append objs "$old_deplibs" 7225d656433aSmrg ;; 7226d656433aSmrg 7227d656433aSmrg lib) 7228d656433aSmrg # Make sure we only generate libraries of the form `libNAME.la'. 7229d656433aSmrg case $outputname in 7230d656433aSmrg lib*) 7231d656433aSmrg func_stripname 'lib' '.la' "$outputname" 7232d656433aSmrg name=$func_stripname_result 7233d656433aSmrg eval shared_ext=\"$shrext_cmds\" 7234d656433aSmrg eval libname=\"$libname_spec\" 7235d656433aSmrg ;; 7236d656433aSmrg *) 7237d656433aSmrg test "$module" = no && \ 7238d656433aSmrg func_fatal_help "libtool library \`$output' must begin with \`lib'" 7239d656433aSmrg 7240d656433aSmrg if test "$need_lib_prefix" != no; then 7241d656433aSmrg # Add the "lib" prefix for modules if required 7242d656433aSmrg func_stripname '' '.la' "$outputname" 7243d656433aSmrg name=$func_stripname_result 7244d656433aSmrg eval shared_ext=\"$shrext_cmds\" 7245d656433aSmrg eval libname=\"$libname_spec\" 7246d656433aSmrg else 7247d656433aSmrg func_stripname '' '.la' "$outputname" 7248d656433aSmrg libname=$func_stripname_result 7249d656433aSmrg fi 7250d656433aSmrg ;; 7251d656433aSmrg esac 7252d656433aSmrg 7253d656433aSmrg if test -n "$objs"; then 7254d656433aSmrg if test "$deplibs_check_method" != pass_all; then 7255d656433aSmrg func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 7256d656433aSmrg else 7257555991fdSmrg echo 7258d656433aSmrg $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 7259d656433aSmrg $ECHO "*** objects $objs is not portable!" 72603c15da26Smrg func_append libobjs " $objs" 7261d656433aSmrg fi 7262d656433aSmrg fi 7263d656433aSmrg 7264d656433aSmrg test "$dlself" != no && \ 7265d656433aSmrg func_warning "\`-dlopen self' is ignored for libtool libraries" 7266d656433aSmrg 7267d656433aSmrg set dummy $rpath 7268d656433aSmrg shift 7269d656433aSmrg test "$#" -gt 1 && \ 7270d656433aSmrg func_warning "ignoring multiple \`-rpath's for a libtool library" 7271d656433aSmrg 7272d656433aSmrg install_libdir="$1" 7273d656433aSmrg 7274d656433aSmrg oldlibs= 7275d656433aSmrg if test -z "$rpath"; then 7276d656433aSmrg if test "$build_libtool_libs" = yes; then 7277d656433aSmrg # Building a libtool convenience library. 7278d656433aSmrg # Some compilers have problems with a `.al' extension so 7279d656433aSmrg # convenience libraries should have the same extension an 7280d656433aSmrg # archive normally would. 7281d656433aSmrg oldlibs="$output_objdir/$libname.$libext $oldlibs" 7282d656433aSmrg build_libtool_libs=convenience 7283d656433aSmrg build_old_libs=yes 7284d656433aSmrg fi 7285d656433aSmrg 7286d656433aSmrg test -n "$vinfo" && \ 7287d656433aSmrg func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 7288d656433aSmrg 7289d656433aSmrg test -n "$release" && \ 7290d656433aSmrg func_warning "\`-release' is ignored for convenience libraries" 7291d656433aSmrg else 7292d656433aSmrg 7293d656433aSmrg # Parse the version information argument. 7294d656433aSmrg save_ifs="$IFS"; IFS=':' 7295d656433aSmrg set dummy $vinfo 0 0 0 7296d656433aSmrg shift 7297d656433aSmrg IFS="$save_ifs" 7298d656433aSmrg 7299d656433aSmrg test -n "$7" && \ 7300d656433aSmrg func_fatal_help "too many parameters to \`-version-info'" 7301d656433aSmrg 7302d656433aSmrg # convert absolute version numbers to libtool ages 7303d656433aSmrg # this retains compatibility with .la files and attempts 7304d656433aSmrg # to make the code below a bit more comprehensible 7305d656433aSmrg 7306d656433aSmrg case $vinfo_number in 7307d656433aSmrg yes) 7308d656433aSmrg number_major="$1" 7309d656433aSmrg number_minor="$2" 7310d656433aSmrg number_revision="$3" 7311d656433aSmrg # 7312d656433aSmrg # There are really only two kinds -- those that 7313d656433aSmrg # use the current revision as the major version 7314d656433aSmrg # and those that subtract age and use age as 7315d656433aSmrg # a minor version. But, then there is irix 7316d656433aSmrg # which has an extra 1 added just for fun 7317d656433aSmrg # 7318d656433aSmrg case $version_type in 7319d656433aSmrg darwin|linux|osf|windows|none) 7320d656433aSmrg func_arith $number_major + $number_minor 7321d656433aSmrg current=$func_arith_result 7322d656433aSmrg age="$number_minor" 7323d656433aSmrg revision="$number_revision" 7324d656433aSmrg ;; 7325555991fdSmrg freebsd-aout|freebsd-elf|qnx|sunos) 7326d656433aSmrg current="$number_major" 7327d656433aSmrg revision="$number_minor" 7328d656433aSmrg age="0" 7329d656433aSmrg ;; 7330d656433aSmrg irix|nonstopux) 7331d656433aSmrg func_arith $number_major + $number_minor 7332d656433aSmrg current=$func_arith_result 7333d656433aSmrg age="$number_minor" 7334d656433aSmrg revision="$number_minor" 7335d656433aSmrg lt_irix_increment=no 7336d656433aSmrg ;; 7337d656433aSmrg esac 7338d656433aSmrg ;; 7339d656433aSmrg no) 7340d656433aSmrg current="$1" 7341d656433aSmrg revision="$2" 7342d656433aSmrg age="$3" 7343d656433aSmrg ;; 7344d656433aSmrg esac 7345d656433aSmrg 7346d656433aSmrg # Check that each of the things are valid numbers. 7347d656433aSmrg case $current in 7348d656433aSmrg 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]) ;; 7349d656433aSmrg *) 7350d656433aSmrg func_error "CURRENT \`$current' must be a nonnegative integer" 7351d656433aSmrg func_fatal_error "\`$vinfo' is not valid version information" 7352d656433aSmrg ;; 7353d656433aSmrg esac 7354d656433aSmrg 7355d656433aSmrg case $revision in 7356d656433aSmrg 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]) ;; 7357d656433aSmrg *) 7358d656433aSmrg func_error "REVISION \`$revision' must be a nonnegative integer" 7359d656433aSmrg func_fatal_error "\`$vinfo' is not valid version information" 7360d656433aSmrg ;; 7361d656433aSmrg esac 7362d656433aSmrg 7363d656433aSmrg case $age in 7364d656433aSmrg 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]) ;; 7365d656433aSmrg *) 7366d656433aSmrg func_error "AGE \`$age' must be a nonnegative integer" 7367d656433aSmrg func_fatal_error "\`$vinfo' is not valid version information" 7368d656433aSmrg ;; 7369d656433aSmrg esac 7370d656433aSmrg 7371d656433aSmrg if test "$age" -gt "$current"; then 7372d656433aSmrg func_error "AGE \`$age' is greater than the current interface number \`$current'" 7373d656433aSmrg func_fatal_error "\`$vinfo' is not valid version information" 7374d656433aSmrg fi 7375d656433aSmrg 7376d656433aSmrg # Calculate the version variables. 7377d656433aSmrg major= 7378d656433aSmrg versuffix= 7379d656433aSmrg verstring= 7380d656433aSmrg case $version_type in 7381d656433aSmrg none) ;; 7382d656433aSmrg 7383d656433aSmrg darwin) 7384d656433aSmrg # Like Linux, but with the current version available in 7385d656433aSmrg # verstring for coding it into the library header 7386d656433aSmrg func_arith $current - $age 7387d656433aSmrg major=.$func_arith_result 7388d656433aSmrg versuffix="$major.$age.$revision" 7389d656433aSmrg # Darwin ld doesn't like 0 for these options... 7390d656433aSmrg func_arith $current + 1 7391d656433aSmrg minor_current=$func_arith_result 7392d656433aSmrg xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 7393d656433aSmrg verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 7394d656433aSmrg ;; 7395d656433aSmrg 7396d656433aSmrg freebsd-aout) 7397d656433aSmrg major=".$current" 7398d656433aSmrg versuffix=".$current.$revision"; 7399d656433aSmrg ;; 7400d656433aSmrg 7401d656433aSmrg freebsd-elf) 7402d656433aSmrg major=".$current" 7403d656433aSmrg versuffix=".$current" 7404d656433aSmrg ;; 7405d656433aSmrg 7406d656433aSmrg irix | nonstopux) 7407d656433aSmrg if test "X$lt_irix_increment" = "Xno"; then 7408d656433aSmrg func_arith $current - $age 7409d656433aSmrg else 7410d656433aSmrg func_arith $current - $age + 1 7411d656433aSmrg fi 7412d656433aSmrg major=$func_arith_result 7413d656433aSmrg 7414d656433aSmrg case $version_type in 7415d656433aSmrg nonstopux) verstring_prefix=nonstopux ;; 7416d656433aSmrg *) verstring_prefix=sgi ;; 7417d656433aSmrg esac 7418d656433aSmrg verstring="$verstring_prefix$major.$revision" 7419d656433aSmrg 7420d656433aSmrg # Add in all the interfaces that we are compatible with. 7421d656433aSmrg loop=$revision 7422d656433aSmrg while test "$loop" -ne 0; do 7423d656433aSmrg func_arith $revision - $loop 7424d656433aSmrg iface=$func_arith_result 7425d656433aSmrg func_arith $loop - 1 7426d656433aSmrg loop=$func_arith_result 7427d656433aSmrg verstring="$verstring_prefix$major.$iface:$verstring" 7428d656433aSmrg done 7429d656433aSmrg 7430d656433aSmrg # Before this point, $major must not contain `.'. 7431d656433aSmrg major=.$major 7432d656433aSmrg versuffix="$major.$revision" 7433d656433aSmrg ;; 7434d656433aSmrg 7435d656433aSmrg linux) 7436d656433aSmrg func_arith $current - $age 7437d656433aSmrg major=.$func_arith_result 7438d656433aSmrg versuffix="$major.$age.$revision" 7439d656433aSmrg ;; 7440d656433aSmrg 7441d656433aSmrg osf) 7442d656433aSmrg func_arith $current - $age 7443d656433aSmrg major=.$func_arith_result 7444d656433aSmrg versuffix=".$current.$age.$revision" 7445d656433aSmrg verstring="$current.$age.$revision" 7446d656433aSmrg 7447d656433aSmrg # Add in all the interfaces that we are compatible with. 7448d656433aSmrg loop=$age 7449d656433aSmrg while test "$loop" -ne 0; do 7450d656433aSmrg func_arith $current - $loop 7451d656433aSmrg iface=$func_arith_result 7452d656433aSmrg func_arith $loop - 1 7453d656433aSmrg loop=$func_arith_result 7454d656433aSmrg verstring="$verstring:${iface}.0" 7455d656433aSmrg done 7456d656433aSmrg 7457d656433aSmrg # Make executables depend on our current version. 74583c15da26Smrg func_append verstring ":${current}.0" 7459d656433aSmrg ;; 7460d656433aSmrg 7461d656433aSmrg qnx) 7462d656433aSmrg major=".$current" 7463d656433aSmrg versuffix=".$current" 7464d656433aSmrg ;; 7465d656433aSmrg 7466d656433aSmrg sunos) 7467d656433aSmrg major=".$current" 7468d656433aSmrg versuffix=".$current.$revision" 7469d656433aSmrg ;; 7470d656433aSmrg 7471d656433aSmrg windows) 7472d656433aSmrg # Use '-' rather than '.', since we only want one 7473d656433aSmrg # extension on DOS 8.3 filesystems. 7474d656433aSmrg func_arith $current - $age 7475d656433aSmrg major=$func_arith_result 7476d656433aSmrg versuffix="-$major" 7477d656433aSmrg ;; 7478d656433aSmrg 7479d656433aSmrg *) 7480d656433aSmrg func_fatal_configuration "unknown library version type \`$version_type'" 7481d656433aSmrg ;; 7482d656433aSmrg esac 7483d656433aSmrg 7484d656433aSmrg # Clear the version info if we defaulted, and they specified a release. 7485d656433aSmrg if test -z "$vinfo" && test -n "$release"; then 7486d656433aSmrg major= 7487d656433aSmrg case $version_type in 7488d656433aSmrg darwin) 7489d656433aSmrg # we can't check for "0.0" in archive_cmds due to quoting 7490d656433aSmrg # problems, so we reset it completely 7491d656433aSmrg verstring= 7492d656433aSmrg ;; 7493d656433aSmrg *) 7494d656433aSmrg verstring="0.0" 7495d656433aSmrg ;; 7496d656433aSmrg esac 7497d656433aSmrg if test "$need_version" = no; then 7498d656433aSmrg versuffix= 7499d656433aSmrg else 7500d656433aSmrg versuffix=".0.0" 7501d656433aSmrg fi 7502d656433aSmrg fi 7503d656433aSmrg 7504d656433aSmrg # Remove version info from name if versioning should be avoided 7505d656433aSmrg if test "$avoid_version" = yes && test "$need_version" = no; then 7506d656433aSmrg major= 7507d656433aSmrg versuffix= 7508d656433aSmrg verstring="" 7509d656433aSmrg fi 7510d656433aSmrg 7511d656433aSmrg # Check to see if the archive will have undefined symbols. 7512d656433aSmrg if test "$allow_undefined" = yes; then 7513d656433aSmrg if test "$allow_undefined_flag" = unsupported; then 7514d656433aSmrg func_warning "undefined symbols not allowed in $host shared libraries" 7515d656433aSmrg build_libtool_libs=no 7516d656433aSmrg build_old_libs=yes 7517d656433aSmrg fi 7518d656433aSmrg else 7519d656433aSmrg # Don't allow undefined symbols. 7520d656433aSmrg allow_undefined_flag="$no_undefined_flag" 7521d656433aSmrg fi 7522d656433aSmrg 7523d656433aSmrg fi 7524d656433aSmrg 7525d656433aSmrg func_generate_dlsyms "$libname" "$libname" "yes" 75263c15da26Smrg func_append libobjs " $symfileobj" 7527d656433aSmrg test "X$libobjs" = "X " && libobjs= 7528d656433aSmrg 75293c15da26Smrg if test "$opt_mode" != relink; then 7530d656433aSmrg # Remove our outputs, but don't remove object files since they 7531d656433aSmrg # may have been created when compiling PIC objects. 7532d656433aSmrg removelist= 7533d656433aSmrg tempremovelist=`$ECHO "$output_objdir/*"` 7534d656433aSmrg for p in $tempremovelist; do 7535d656433aSmrg case $p in 7536d656433aSmrg *.$objext | *.gcno) 7537d656433aSmrg ;; 7538d656433aSmrg $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 7539d656433aSmrg if test "X$precious_files_regex" != "X"; then 7540d656433aSmrg if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 7541d656433aSmrg then 7542d656433aSmrg continue 7543d656433aSmrg fi 7544d656433aSmrg fi 75453c15da26Smrg func_append removelist " $p" 7546d656433aSmrg ;; 7547d656433aSmrg *) ;; 7548d656433aSmrg esac 7549d656433aSmrg done 7550d656433aSmrg test -n "$removelist" && \ 7551d656433aSmrg func_show_eval "${RM}r \$removelist" 7552d656433aSmrg fi 7553d656433aSmrg 7554d656433aSmrg # Now set the variables for building old libraries. 7555d656433aSmrg if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 75563c15da26Smrg func_append oldlibs " $output_objdir/$libname.$libext" 7557d656433aSmrg 7558d656433aSmrg # Transform .lo files to .o files. 7559555991fdSmrg oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 7560d656433aSmrg fi 7561d656433aSmrg 7562d656433aSmrg # Eliminate all temporary directories. 7563d656433aSmrg #for path in $notinst_path; do 7564555991fdSmrg # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 7565555991fdSmrg # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 7566555991fdSmrg # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 7567d656433aSmrg #done 7568d656433aSmrg 7569d656433aSmrg if test -n "$xrpath"; then 7570d656433aSmrg # If the user specified any rpath flags, then add them. 7571d656433aSmrg temp_xrpath= 7572d656433aSmrg for libdir in $xrpath; do 75733c15da26Smrg func_replace_sysroot "$libdir" 75743c15da26Smrg func_append temp_xrpath " -R$func_replace_sysroot_result" 7575d656433aSmrg case "$finalize_rpath " in 7576d656433aSmrg *" $libdir "*) ;; 75773c15da26Smrg *) func_append finalize_rpath " $libdir" ;; 7578d656433aSmrg esac 7579d656433aSmrg done 7580d656433aSmrg if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 7581d656433aSmrg dependency_libs="$temp_xrpath $dependency_libs" 7582d656433aSmrg fi 7583d656433aSmrg fi 7584d656433aSmrg 7585d656433aSmrg # Make sure dlfiles contains only unique files that won't be dlpreopened 7586d656433aSmrg old_dlfiles="$dlfiles" 7587d656433aSmrg dlfiles= 7588d656433aSmrg for lib in $old_dlfiles; do 7589d656433aSmrg case " $dlprefiles $dlfiles " in 7590d656433aSmrg *" $lib "*) ;; 75913c15da26Smrg *) func_append dlfiles " $lib" ;; 7592d656433aSmrg esac 7593d656433aSmrg done 7594d656433aSmrg 7595d656433aSmrg # Make sure dlprefiles contains only unique files 7596d656433aSmrg old_dlprefiles="$dlprefiles" 7597d656433aSmrg dlprefiles= 7598d656433aSmrg for lib in $old_dlprefiles; do 7599d656433aSmrg case "$dlprefiles " in 7600d656433aSmrg *" $lib "*) ;; 76013c15da26Smrg *) func_append dlprefiles " $lib" ;; 7602d656433aSmrg esac 7603d656433aSmrg done 7604d656433aSmrg 7605d656433aSmrg if test "$build_libtool_libs" = yes; then 7606d656433aSmrg if test -n "$rpath"; then 7607d656433aSmrg case $host in 7608555991fdSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 7609d656433aSmrg # these systems don't actually have a c library (as such)! 7610d656433aSmrg ;; 7611d656433aSmrg *-*-rhapsody* | *-*-darwin1.[012]) 7612d656433aSmrg # Rhapsody C library is in the System framework 76133c15da26Smrg func_append deplibs " System.ltframework" 7614d656433aSmrg ;; 7615d656433aSmrg *-*-netbsd*) 7616d656433aSmrg # Don't link with libc until the a.out ld.so is fixed. 7617d656433aSmrg ;; 7618d656433aSmrg *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 7619d656433aSmrg # Do not include libc due to us having libc/libc_r. 7620d656433aSmrg ;; 7621d656433aSmrg *-*-sco3.2v5* | *-*-sco5v6*) 7622d656433aSmrg # Causes problems with __ctype 7623d656433aSmrg ;; 7624d656433aSmrg *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 7625d656433aSmrg # Compiler inserts libc in the correct place for threads to work 7626d656433aSmrg ;; 7627d656433aSmrg *) 7628d656433aSmrg # Add libc to deplibs on all other systems if necessary. 7629d656433aSmrg if test "$build_libtool_need_lc" = "yes"; then 76303c15da26Smrg func_append deplibs " -lc" 7631d656433aSmrg fi 7632d656433aSmrg ;; 7633d656433aSmrg esac 7634d656433aSmrg fi 7635d656433aSmrg 7636d656433aSmrg # Transform deplibs into only deplibs that can be linked in shared. 7637d656433aSmrg name_save=$name 7638d656433aSmrg libname_save=$libname 7639d656433aSmrg release_save=$release 7640d656433aSmrg versuffix_save=$versuffix 7641d656433aSmrg major_save=$major 7642d656433aSmrg # I'm not sure if I'm treating the release correctly. I think 7643d656433aSmrg # release should show up in the -l (ie -lgmp5) so we don't want to 7644d656433aSmrg # add it in twice. Is that correct? 7645d656433aSmrg release="" 7646d656433aSmrg versuffix="" 7647d656433aSmrg major="" 7648d656433aSmrg newdeplibs= 7649d656433aSmrg droppeddeps=no 7650d656433aSmrg case $deplibs_check_method in 7651d656433aSmrg pass_all) 7652d656433aSmrg # Don't check for shared/static. Everything works. 7653d656433aSmrg # This might be a little naive. We might want to check 7654d656433aSmrg # whether the library exists or not. But this is on 7655d656433aSmrg # osf3 & osf4 and I'm not really sure... Just 7656d656433aSmrg # implementing what was already the behavior. 7657d656433aSmrg newdeplibs=$deplibs 7658d656433aSmrg ;; 7659d656433aSmrg test_compile) 7660d656433aSmrg # This code stresses the "libraries are programs" paradigm to its 7661d656433aSmrg # limits. Maybe even breaks it. We compile a program, linking it 7662d656433aSmrg # against the deplibs as a proxy for the library. Then we can check 7663d656433aSmrg # whether they linked in statically or dynamically with ldd. 7664d656433aSmrg $opt_dry_run || $RM conftest.c 7665d656433aSmrg cat > conftest.c <<EOF 7666d656433aSmrg int main() { return 0; } 7667d656433aSmrgEOF 7668d656433aSmrg $opt_dry_run || $RM conftest 7669d656433aSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 7670d656433aSmrg ldd_output=`ldd conftest` 7671d656433aSmrg for i in $deplibs; do 7672d656433aSmrg case $i in 7673d656433aSmrg -l*) 7674d656433aSmrg func_stripname -l '' "$i" 7675d656433aSmrg name=$func_stripname_result 7676d656433aSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7677d656433aSmrg case " $predeps $postdeps " in 7678d656433aSmrg *" $i "*) 76793c15da26Smrg func_append newdeplibs " $i" 7680d656433aSmrg i="" 7681d656433aSmrg ;; 7682d656433aSmrg esac 7683d656433aSmrg fi 7684d656433aSmrg if test -n "$i" ; then 7685d656433aSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 7686d656433aSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7687d656433aSmrg set dummy $deplib_matches; shift 7688d656433aSmrg deplib_match=$1 7689d656433aSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 76903c15da26Smrg func_append newdeplibs " $i" 7691d656433aSmrg else 7692d656433aSmrg droppeddeps=yes 7693555991fdSmrg echo 7694d656433aSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7695555991fdSmrg echo "*** I have the capability to make that library automatically link in when" 7696555991fdSmrg echo "*** you link to this library. But I can only do this if you have a" 7697555991fdSmrg echo "*** shared version of the library, which I believe you do not have" 7698555991fdSmrg echo "*** because a test_compile did reveal that the linker did not use it for" 7699555991fdSmrg echo "*** its dynamic dependency list that programs get resolved with at runtime." 7700d656433aSmrg fi 7701d656433aSmrg fi 7702d656433aSmrg ;; 7703d656433aSmrg *) 77043c15da26Smrg func_append newdeplibs " $i" 7705d656433aSmrg ;; 7706d656433aSmrg esac 7707d656433aSmrg done 7708d656433aSmrg else 7709d656433aSmrg # Error occurred in the first compile. Let's try to salvage 7710d656433aSmrg # the situation: Compile a separate program for each library. 7711d656433aSmrg for i in $deplibs; do 7712d656433aSmrg case $i in 7713d656433aSmrg -l*) 7714d656433aSmrg func_stripname -l '' "$i" 7715d656433aSmrg name=$func_stripname_result 7716d656433aSmrg $opt_dry_run || $RM conftest 7717d656433aSmrg if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 7718d656433aSmrg ldd_output=`ldd conftest` 7719d656433aSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7720d656433aSmrg case " $predeps $postdeps " in 7721d656433aSmrg *" $i "*) 77223c15da26Smrg func_append newdeplibs " $i" 7723d656433aSmrg i="" 7724d656433aSmrg ;; 7725d656433aSmrg esac 7726d656433aSmrg fi 7727d656433aSmrg if test -n "$i" ; then 7728d656433aSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 7729d656433aSmrg deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7730d656433aSmrg set dummy $deplib_matches; shift 7731d656433aSmrg deplib_match=$1 7732d656433aSmrg if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 77333c15da26Smrg func_append newdeplibs " $i" 7734d656433aSmrg else 7735d656433aSmrg droppeddeps=yes 7736555991fdSmrg echo 7737d656433aSmrg $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7738555991fdSmrg echo "*** I have the capability to make that library automatically link in when" 7739555991fdSmrg echo "*** you link to this library. But I can only do this if you have a" 7740555991fdSmrg echo "*** shared version of the library, which you do not appear to have" 7741555991fdSmrg echo "*** because a test_compile did reveal that the linker did not use this one" 7742555991fdSmrg echo "*** as a dynamic dependency that programs can get resolved with at runtime." 7743d656433aSmrg fi 7744d656433aSmrg fi 7745d656433aSmrg else 7746d656433aSmrg droppeddeps=yes 7747555991fdSmrg echo 7748d656433aSmrg $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 7749555991fdSmrg echo "*** make it link in! You will probably need to install it or some" 7750555991fdSmrg echo "*** library that it depends on before this library will be fully" 7751555991fdSmrg echo "*** functional. Installing it before continuing would be even better." 7752d656433aSmrg fi 7753d656433aSmrg ;; 7754d656433aSmrg *) 77553c15da26Smrg func_append newdeplibs " $i" 7756d656433aSmrg ;; 7757d656433aSmrg esac 7758d656433aSmrg done 7759d656433aSmrg fi 7760d656433aSmrg ;; 7761d656433aSmrg file_magic*) 7762d656433aSmrg set dummy $deplibs_check_method; shift 7763d656433aSmrg file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7764d656433aSmrg for a_deplib in $deplibs; do 7765d656433aSmrg case $a_deplib in 7766d656433aSmrg -l*) 7767d656433aSmrg func_stripname -l '' "$a_deplib" 7768d656433aSmrg name=$func_stripname_result 7769d656433aSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7770d656433aSmrg case " $predeps $postdeps " in 7771d656433aSmrg *" $a_deplib "*) 77723c15da26Smrg func_append newdeplibs " $a_deplib" 7773d656433aSmrg a_deplib="" 7774d656433aSmrg ;; 7775d656433aSmrg esac 7776d656433aSmrg fi 7777d656433aSmrg if test -n "$a_deplib" ; then 7778d656433aSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 77793c15da26Smrg if test -n "$file_magic_glob"; then 77803c15da26Smrg libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 77813c15da26Smrg else 77823c15da26Smrg libnameglob=$libname 77833c15da26Smrg fi 77843c15da26Smrg test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` 7785d656433aSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 77863c15da26Smrg if test "$want_nocaseglob" = yes; then 77873c15da26Smrg shopt -s nocaseglob 77883c15da26Smrg potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 77893c15da26Smrg $nocaseglob 77903c15da26Smrg else 77913c15da26Smrg potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 77923c15da26Smrg fi 7793d656433aSmrg for potent_lib in $potential_libs; do 7794d656433aSmrg # Follow soft links. 7795d656433aSmrg if ls -lLd "$potent_lib" 2>/dev/null | 7796d656433aSmrg $GREP " -> " >/dev/null; then 7797d656433aSmrg continue 7798d656433aSmrg fi 7799d656433aSmrg # The statement above tries to avoid entering an 7800d656433aSmrg # endless loop below, in case of cyclic links. 7801d656433aSmrg # We might still enter an endless loop, since a link 7802d656433aSmrg # loop can be closed while we follow links, 7803d656433aSmrg # but so what? 7804d656433aSmrg potlib="$potent_lib" 7805d656433aSmrg while test -h "$potlib" 2>/dev/null; do 7806d656433aSmrg potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 7807d656433aSmrg case $potliblink in 7808d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 7809555991fdSmrg *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 7810d656433aSmrg esac 7811d656433aSmrg done 7812d656433aSmrg if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 7813d656433aSmrg $SED -e 10q | 7814d656433aSmrg $EGREP "$file_magic_regex" > /dev/null; then 78153c15da26Smrg func_append newdeplibs " $a_deplib" 7816d656433aSmrg a_deplib="" 7817d656433aSmrg break 2 7818d656433aSmrg fi 7819d656433aSmrg done 7820d656433aSmrg done 7821d656433aSmrg fi 7822d656433aSmrg if test -n "$a_deplib" ; then 7823d656433aSmrg droppeddeps=yes 7824555991fdSmrg echo 7825d656433aSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7826555991fdSmrg echo "*** I have the capability to make that library automatically link in when" 7827555991fdSmrg echo "*** you link to this library. But I can only do this if you have a" 7828555991fdSmrg echo "*** shared version of the library, which you do not appear to have" 7829555991fdSmrg echo "*** because I did check the linker path looking for a file starting" 7830d656433aSmrg if test -z "$potlib" ; then 7831d656433aSmrg $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 7832d656433aSmrg else 7833d656433aSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 7834d656433aSmrg $ECHO "*** using a file magic. Last file checked: $potlib" 7835d656433aSmrg fi 7836d656433aSmrg fi 7837d656433aSmrg ;; 7838d656433aSmrg *) 7839d656433aSmrg # Add a -L argument. 78403c15da26Smrg func_append newdeplibs " $a_deplib" 7841d656433aSmrg ;; 7842d656433aSmrg esac 7843d656433aSmrg done # Gone through all deplibs. 7844d656433aSmrg ;; 7845d656433aSmrg match_pattern*) 7846d656433aSmrg set dummy $deplibs_check_method; shift 7847d656433aSmrg match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7848d656433aSmrg for a_deplib in $deplibs; do 7849d656433aSmrg case $a_deplib in 7850d656433aSmrg -l*) 7851d656433aSmrg func_stripname -l '' "$a_deplib" 7852d656433aSmrg name=$func_stripname_result 7853d656433aSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7854d656433aSmrg case " $predeps $postdeps " in 7855d656433aSmrg *" $a_deplib "*) 78563c15da26Smrg func_append newdeplibs " $a_deplib" 7857d656433aSmrg a_deplib="" 7858d656433aSmrg ;; 7859d656433aSmrg esac 7860d656433aSmrg fi 7861d656433aSmrg if test -n "$a_deplib" ; then 7862d656433aSmrg libname=`eval "\\$ECHO \"$libname_spec\""` 7863d656433aSmrg for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7864d656433aSmrg potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 7865d656433aSmrg for potent_lib in $potential_libs; do 7866d656433aSmrg potlib="$potent_lib" # see symlink-check above in file_magic test 7867555991fdSmrg if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 7868d656433aSmrg $EGREP "$match_pattern_regex" > /dev/null; then 78693c15da26Smrg func_append newdeplibs " $a_deplib" 7870d656433aSmrg a_deplib="" 7871d656433aSmrg break 2 7872d656433aSmrg fi 7873d656433aSmrg done 7874d656433aSmrg done 7875d656433aSmrg fi 7876d656433aSmrg if test -n "$a_deplib" ; then 7877d656433aSmrg droppeddeps=yes 7878555991fdSmrg echo 7879d656433aSmrg $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7880555991fdSmrg echo "*** I have the capability to make that library automatically link in when" 7881555991fdSmrg echo "*** you link to this library. But I can only do this if you have a" 7882555991fdSmrg echo "*** shared version of the library, which you do not appear to have" 7883555991fdSmrg echo "*** because I did check the linker path looking for a file starting" 7884d656433aSmrg if test -z "$potlib" ; then 7885d656433aSmrg $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 7886d656433aSmrg else 7887d656433aSmrg $ECHO "*** with $libname and none of the candidates passed a file format test" 7888d656433aSmrg $ECHO "*** using a regex pattern. Last file checked: $potlib" 7889d656433aSmrg fi 7890d656433aSmrg fi 7891d656433aSmrg ;; 7892d656433aSmrg *) 7893d656433aSmrg # Add a -L argument. 78943c15da26Smrg func_append newdeplibs " $a_deplib" 7895d656433aSmrg ;; 7896d656433aSmrg esac 7897d656433aSmrg done # Gone through all deplibs. 7898d656433aSmrg ;; 7899d656433aSmrg none | unknown | *) 7900d656433aSmrg newdeplibs="" 7901555991fdSmrg tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 7902d656433aSmrg if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7903d656433aSmrg for i in $predeps $postdeps ; do 7904d656433aSmrg # can't use Xsed below, because $i might contain '/' 7905555991fdSmrg tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 7906d656433aSmrg done 7907d656433aSmrg fi 7908555991fdSmrg case $tmp_deplibs in 7909555991fdSmrg *[!\ \ ]*) 7910555991fdSmrg echo 7911d656433aSmrg if test "X$deplibs_check_method" = "Xnone"; then 7912555991fdSmrg echo "*** Warning: inter-library dependencies are not supported in this platform." 7913d656433aSmrg else 7914555991fdSmrg echo "*** Warning: inter-library dependencies are not known to be supported." 7915d656433aSmrg fi 7916555991fdSmrg echo "*** All declared inter-library dependencies are being dropped." 7917d656433aSmrg droppeddeps=yes 7918555991fdSmrg ;; 7919555991fdSmrg esac 7920d656433aSmrg ;; 7921d656433aSmrg esac 7922d656433aSmrg versuffix=$versuffix_save 7923d656433aSmrg major=$major_save 7924d656433aSmrg release=$release_save 7925d656433aSmrg libname=$libname_save 7926d656433aSmrg name=$name_save 7927d656433aSmrg 7928d656433aSmrg case $host in 7929d656433aSmrg *-*-rhapsody* | *-*-darwin1.[012]) 7930d656433aSmrg # On Rhapsody replace the C library with the System framework 7931555991fdSmrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 7932d656433aSmrg ;; 7933d656433aSmrg esac 7934d656433aSmrg 7935d656433aSmrg if test "$droppeddeps" = yes; then 7936d656433aSmrg if test "$module" = yes; then 7937555991fdSmrg echo 7938555991fdSmrg echo "*** Warning: libtool could not satisfy all declared inter-library" 7939d656433aSmrg $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 7940555991fdSmrg echo "*** a static module, that should work as long as the dlopening" 7941555991fdSmrg echo "*** application is linked with the -dlopen flag." 7942d656433aSmrg if test -z "$global_symbol_pipe"; then 7943555991fdSmrg echo 7944555991fdSmrg echo "*** However, this would only work if libtool was able to extract symbol" 7945555991fdSmrg echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 7946555991fdSmrg echo "*** not find such a program. So, this module is probably useless." 7947555991fdSmrg echo "*** \`nm' from GNU binutils and a full rebuild may help." 7948d656433aSmrg fi 7949d656433aSmrg if test "$build_old_libs" = no; then 7950d656433aSmrg oldlibs="$output_objdir/$libname.$libext" 7951d656433aSmrg build_libtool_libs=module 7952d656433aSmrg build_old_libs=yes 7953d656433aSmrg else 7954d656433aSmrg build_libtool_libs=no 7955d656433aSmrg fi 7956d656433aSmrg else 7957555991fdSmrg echo "*** The inter-library dependencies that have been dropped here will be" 7958555991fdSmrg echo "*** automatically added whenever a program is linked with this library" 7959555991fdSmrg echo "*** or is declared to -dlopen it." 7960d656433aSmrg 7961d656433aSmrg if test "$allow_undefined" = no; then 7962555991fdSmrg echo 7963555991fdSmrg echo "*** Since this library must not contain undefined symbols," 7964555991fdSmrg echo "*** because either the platform does not support them or" 7965555991fdSmrg echo "*** it was explicitly requested with -no-undefined," 7966555991fdSmrg echo "*** libtool will only create a static version of it." 7967d656433aSmrg if test "$build_old_libs" = no; then 7968d656433aSmrg oldlibs="$output_objdir/$libname.$libext" 7969d656433aSmrg build_libtool_libs=module 7970d656433aSmrg build_old_libs=yes 7971d656433aSmrg else 7972d656433aSmrg build_libtool_libs=no 7973d656433aSmrg fi 7974d656433aSmrg fi 7975d656433aSmrg fi 7976d656433aSmrg fi 7977d656433aSmrg # Done checking deplibs! 7978d656433aSmrg deplibs=$newdeplibs 7979d656433aSmrg fi 7980d656433aSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 7981d656433aSmrg case $host in 7982d656433aSmrg *-*-darwin*) 7983555991fdSmrg newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7984555991fdSmrg new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7985555991fdSmrg deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7986d656433aSmrg ;; 7987d656433aSmrg esac 7988d656433aSmrg 7989d656433aSmrg # move library search paths that coincide with paths to not yet 7990d656433aSmrg # installed libraries to the beginning of the library search list 7991d656433aSmrg new_libs= 7992d656433aSmrg for path in $notinst_path; do 7993d656433aSmrg case " $new_libs " in 7994d656433aSmrg *" -L$path/$objdir "*) ;; 7995d656433aSmrg *) 7996d656433aSmrg case " $deplibs " in 7997d656433aSmrg *" -L$path/$objdir "*) 79983c15da26Smrg func_append new_libs " -L$path/$objdir" ;; 7999d656433aSmrg esac 8000d656433aSmrg ;; 8001d656433aSmrg esac 8002d656433aSmrg done 8003d656433aSmrg for deplib in $deplibs; do 8004d656433aSmrg case $deplib in 8005d656433aSmrg -L*) 8006d656433aSmrg case " $new_libs " in 8007d656433aSmrg *" $deplib "*) ;; 80083c15da26Smrg *) func_append new_libs " $deplib" ;; 8009d656433aSmrg esac 8010d656433aSmrg ;; 80113c15da26Smrg *) func_append new_libs " $deplib" ;; 8012d656433aSmrg esac 8013d656433aSmrg done 8014d656433aSmrg deplibs="$new_libs" 8015d656433aSmrg 8016d656433aSmrg # All the library-specific variables (install_libdir is set above). 8017d656433aSmrg library_names= 8018d656433aSmrg old_library= 8019d656433aSmrg dlname= 8020d656433aSmrg 8021d656433aSmrg # Test again, we may have decided not to build it any more 8022d656433aSmrg if test "$build_libtool_libs" = yes; then 8023d656433aSmrg if test "$hardcode_into_libs" = yes; then 8024d656433aSmrg # Hardcode the library paths 8025d656433aSmrg hardcode_libdirs= 8026d656433aSmrg dep_rpath= 8027d656433aSmrg rpath="$finalize_rpath" 80283c15da26Smrg test "$opt_mode" != relink && rpath="$compile_rpath$rpath" 8029d656433aSmrg for libdir in $rpath; do 8030d656433aSmrg if test -n "$hardcode_libdir_flag_spec"; then 8031d656433aSmrg if test -n "$hardcode_libdir_separator"; then 80323c15da26Smrg func_replace_sysroot "$libdir" 80333c15da26Smrg libdir=$func_replace_sysroot_result 8034d656433aSmrg if test -z "$hardcode_libdirs"; then 8035d656433aSmrg hardcode_libdirs="$libdir" 8036d656433aSmrg else 8037d656433aSmrg # Just accumulate the unique libdirs. 8038d656433aSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8039d656433aSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8040d656433aSmrg ;; 8041d656433aSmrg *) 80423c15da26Smrg func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8043d656433aSmrg ;; 8044d656433aSmrg esac 8045d656433aSmrg fi 8046d656433aSmrg else 8047d656433aSmrg eval flag=\"$hardcode_libdir_flag_spec\" 80483c15da26Smrg func_append dep_rpath " $flag" 8049d656433aSmrg fi 8050d656433aSmrg elif test -n "$runpath_var"; then 8051d656433aSmrg case "$perm_rpath " in 8052d656433aSmrg *" $libdir "*) ;; 80533c15da26Smrg *) func_apped perm_rpath " $libdir" ;; 8054d656433aSmrg esac 8055d656433aSmrg fi 8056d656433aSmrg done 8057d656433aSmrg # Substitute the hardcoded libdirs into the rpath. 8058d656433aSmrg if test -n "$hardcode_libdir_separator" && 8059d656433aSmrg test -n "$hardcode_libdirs"; then 8060d656433aSmrg libdir="$hardcode_libdirs" 8061d656433aSmrg if test -n "$hardcode_libdir_flag_spec_ld"; then 8062d656433aSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 8063d656433aSmrg else 8064d656433aSmrg eval dep_rpath=\"$hardcode_libdir_flag_spec\" 8065d656433aSmrg fi 8066d656433aSmrg fi 8067d656433aSmrg if test -n "$runpath_var" && test -n "$perm_rpath"; then 8068d656433aSmrg # We should set the runpath_var. 8069d656433aSmrg rpath= 8070d656433aSmrg for dir in $perm_rpath; do 80713c15da26Smrg func_append rpath "$dir:" 8072d656433aSmrg done 8073d656433aSmrg eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 8074d656433aSmrg fi 8075d656433aSmrg test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 8076d656433aSmrg fi 8077126a8a12Smrg 8078d656433aSmrg shlibpath="$finalize_shlibpath" 80793c15da26Smrg test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 8080d656433aSmrg if test -n "$shlibpath"; then 8081d656433aSmrg eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 8082d656433aSmrg fi 8083126a8a12Smrg 8084d656433aSmrg # Get the real and link names of the library. 8085d656433aSmrg eval shared_ext=\"$shrext_cmds\" 8086d656433aSmrg eval library_names=\"$library_names_spec\" 8087d656433aSmrg set dummy $library_names 8088d656433aSmrg shift 8089d656433aSmrg realname="$1" 8090d656433aSmrg shift 8091126a8a12Smrg 8092d656433aSmrg if test -n "$soname_spec"; then 8093d656433aSmrg eval soname=\"$soname_spec\" 8094d656433aSmrg else 8095d656433aSmrg soname="$realname" 8096d656433aSmrg fi 8097d656433aSmrg if test -z "$dlname"; then 8098d656433aSmrg dlname=$soname 8099d656433aSmrg fi 8100126a8a12Smrg 8101d656433aSmrg lib="$output_objdir/$realname" 8102d656433aSmrg linknames= 8103d656433aSmrg for link 8104d656433aSmrg do 81053c15da26Smrg func_append linknames " $link" 8106d656433aSmrg done 8107126a8a12Smrg 8108d656433aSmrg # Use standard objects if they are pic 8109555991fdSmrg test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 8110d656433aSmrg test "X$libobjs" = "X " && libobjs= 8111126a8a12Smrg 8112d656433aSmrg delfiles= 8113d656433aSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 8114d656433aSmrg $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 8115d656433aSmrg export_symbols="$output_objdir/$libname.uexp" 81163c15da26Smrg func_append delfiles " $export_symbols" 8117d656433aSmrg fi 8118126a8a12Smrg 8119d656433aSmrg orig_export_symbols= 8120d656433aSmrg case $host_os in 8121d656433aSmrg cygwin* | mingw* | cegcc*) 8122d656433aSmrg if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 8123d656433aSmrg # exporting using user supplied symfile 8124d656433aSmrg if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 8125d656433aSmrg # and it's NOT already a .def file. Must figure out 8126d656433aSmrg # which of the given symbols are data symbols and tag 8127d656433aSmrg # them as such. So, trigger use of export_symbols_cmds. 8128d656433aSmrg # export_symbols gets reassigned inside the "prepare 8129d656433aSmrg # the list of exported symbols" if statement, so the 8130d656433aSmrg # include_expsyms logic still works. 8131d656433aSmrg orig_export_symbols="$export_symbols" 8132d656433aSmrg export_symbols= 8133d656433aSmrg always_export_symbols=yes 8134d656433aSmrg fi 8135d656433aSmrg fi 8136d656433aSmrg ;; 8137d656433aSmrg esac 8138126a8a12Smrg 8139d656433aSmrg # Prepare the list of exported symbols 8140d656433aSmrg if test -z "$export_symbols"; then 8141d656433aSmrg if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 8142d656433aSmrg func_verbose "generating symbol list for \`$libname.la'" 8143d656433aSmrg export_symbols="$output_objdir/$libname.exp" 8144d656433aSmrg $opt_dry_run || $RM $export_symbols 8145d656433aSmrg cmds=$export_symbols_cmds 8146d656433aSmrg save_ifs="$IFS"; IFS='~' 81473c15da26Smrg for cmd1 in $cmds; do 8148d656433aSmrg IFS="$save_ifs" 81493c15da26Smrg # Take the normal branch if the nm_file_list_spec branch 81503c15da26Smrg # doesn't work or if tool conversion is not needed. 81513c15da26Smrg case $nm_file_list_spec~$to_tool_file_cmd in 81523c15da26Smrg *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 81533c15da26Smrg try_normal_branch=yes 81543c15da26Smrg eval cmd=\"$cmd1\" 81553c15da26Smrg func_len " $cmd" 81563c15da26Smrg len=$func_len_result 81573c15da26Smrg ;; 81583c15da26Smrg *) 81593c15da26Smrg try_normal_branch=no 81603c15da26Smrg ;; 81613c15da26Smrg esac 81623c15da26Smrg if test "$try_normal_branch" = yes \ 81633c15da26Smrg && { test "$len" -lt "$max_cmd_len" \ 81643c15da26Smrg || test "$max_cmd_len" -le -1; } 81653c15da26Smrg then 81663c15da26Smrg func_show_eval "$cmd" 'exit $?' 81673c15da26Smrg skipped_export=false 81683c15da26Smrg elif test -n "$nm_file_list_spec"; then 81693c15da26Smrg func_basename "$output" 81703c15da26Smrg output_la=$func_basename_result 81713c15da26Smrg save_libobjs=$libobjs 81723c15da26Smrg save_output=$output 81733c15da26Smrg output=${output_objdir}/${output_la}.nm 81743c15da26Smrg func_to_tool_file "$output" 81753c15da26Smrg libobjs=$nm_file_list_spec$func_to_tool_file_result 81763c15da26Smrg func_append delfiles " $output" 81773c15da26Smrg func_verbose "creating $NM input file list: $output" 81783c15da26Smrg for obj in $save_libobjs; do 81793c15da26Smrg func_to_tool_file "$obj" 81803c15da26Smrg $ECHO "$func_to_tool_file_result" 81813c15da26Smrg done > "$output" 81823c15da26Smrg eval cmd=\"$cmd1\" 8183d656433aSmrg func_show_eval "$cmd" 'exit $?' 81843c15da26Smrg output=$save_output 81853c15da26Smrg libobjs=$save_libobjs 8186d656433aSmrg skipped_export=false 8187d656433aSmrg else 8188d656433aSmrg # The command line is too long to execute in one step. 8189d656433aSmrg func_verbose "using reloadable object file for export list..." 8190d656433aSmrg skipped_export=: 8191d656433aSmrg # Break out early, otherwise skipped_export may be 8192d656433aSmrg # set to false by a later but shorter cmd. 8193d656433aSmrg break 8194d656433aSmrg fi 8195d656433aSmrg done 8196d656433aSmrg IFS="$save_ifs" 8197d656433aSmrg if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 8198d656433aSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8199d656433aSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8200d656433aSmrg fi 8201d656433aSmrg fi 8202d656433aSmrg fi 8203126a8a12Smrg 8204d656433aSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 8205d656433aSmrg tmp_export_symbols="$export_symbols" 8206d656433aSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8207555991fdSmrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8208d656433aSmrg fi 8209126a8a12Smrg 8210d656433aSmrg if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 8211d656433aSmrg # The given exports_symbols file has to be filtered, so filter it. 8212d656433aSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8213d656433aSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 8214d656433aSmrg # 's' commands which not all seds can handle. GNU sed should be fine 8215d656433aSmrg # though. Also, the filter scales superlinearly with the number of 8216d656433aSmrg # global variables. join(1) would be nice here, but unfortunately 8217d656433aSmrg # isn't a blessed tool. 8218d656433aSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 82193c15da26Smrg func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8220d656433aSmrg export_symbols=$output_objdir/$libname.def 8221d656433aSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8222126a8a12Smrg fi 8223126a8a12Smrg 8224d656433aSmrg tmp_deplibs= 8225d656433aSmrg for test_deplib in $deplibs; do 8226d656433aSmrg case " $convenience " in 8227d656433aSmrg *" $test_deplib "*) ;; 8228d656433aSmrg *) 82293c15da26Smrg func_append tmp_deplibs " $test_deplib" 8230d656433aSmrg ;; 8231d656433aSmrg esac 8232d656433aSmrg done 8233d656433aSmrg deplibs="$tmp_deplibs" 8234126a8a12Smrg 8235d656433aSmrg if test -n "$convenience"; then 8236d656433aSmrg if test -n "$whole_archive_flag_spec" && 8237d656433aSmrg test "$compiler_needs_object" = yes && 8238d656433aSmrg test -z "$libobjs"; then 8239d656433aSmrg # extract the archives, so we have objects to list. 8240d656433aSmrg # TODO: could optimize this to just extract one archive. 8241d656433aSmrg whole_archive_flag_spec= 8242d656433aSmrg fi 8243d656433aSmrg if test -n "$whole_archive_flag_spec"; then 8244d656433aSmrg save_libobjs=$libobjs 8245d656433aSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8246d656433aSmrg test "X$libobjs" = "X " && libobjs= 8247d656433aSmrg else 8248d656433aSmrg gentop="$output_objdir/${outputname}x" 82493c15da26Smrg func_append generated " $gentop" 8250126a8a12Smrg 8251d656433aSmrg func_extract_archives $gentop $convenience 82523c15da26Smrg func_append libobjs " $func_extract_archives_result" 8253d656433aSmrg test "X$libobjs" = "X " && libobjs= 8254d656433aSmrg fi 8255d656433aSmrg fi 8256126a8a12Smrg 8257d656433aSmrg if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 8258d656433aSmrg eval flag=\"$thread_safe_flag_spec\" 82593c15da26Smrg func_append linker_flags " $flag" 8260d656433aSmrg fi 8261126a8a12Smrg 8262d656433aSmrg # Make a backup of the uninstalled library when relinking 82633c15da26Smrg if test "$opt_mode" = relink; then 8264d656433aSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 8265126a8a12Smrg fi 8266126a8a12Smrg 8267d656433aSmrg # Do each of the archive commands. 8268d656433aSmrg if test "$module" = yes && test -n "$module_cmds" ; then 8269d656433aSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8270d656433aSmrg eval test_cmds=\"$module_expsym_cmds\" 8271d656433aSmrg cmds=$module_expsym_cmds 8272d656433aSmrg else 8273d656433aSmrg eval test_cmds=\"$module_cmds\" 8274d656433aSmrg cmds=$module_cmds 8275d656433aSmrg fi 8276d656433aSmrg else 8277d656433aSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8278d656433aSmrg eval test_cmds=\"$archive_expsym_cmds\" 8279d656433aSmrg cmds=$archive_expsym_cmds 8280d656433aSmrg else 8281d656433aSmrg eval test_cmds=\"$archive_cmds\" 8282d656433aSmrg cmds=$archive_cmds 8283d656433aSmrg fi 8284126a8a12Smrg fi 8285126a8a12Smrg 8286d656433aSmrg if test "X$skipped_export" != "X:" && 8287d656433aSmrg func_len " $test_cmds" && 8288d656433aSmrg len=$func_len_result && 8289d656433aSmrg test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 8290d656433aSmrg : 8291d656433aSmrg else 8292d656433aSmrg # The command line is too long to link in one step, link piecewise 8293d656433aSmrg # or, if using GNU ld and skipped_export is not :, use a linker 8294d656433aSmrg # script. 8295126a8a12Smrg 8296d656433aSmrg # Save the value of $output and $libobjs because we want to 8297d656433aSmrg # use them later. If we have whole_archive_flag_spec, we 8298d656433aSmrg # want to use save_libobjs as it was before 8299d656433aSmrg # whole_archive_flag_spec was expanded, because we can't 8300d656433aSmrg # assume the linker understands whole_archive_flag_spec. 8301d656433aSmrg # This may have to be revisited, in case too many 8302d656433aSmrg # convenience libraries get linked in and end up exceeding 8303d656433aSmrg # the spec. 8304d656433aSmrg if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 8305d656433aSmrg save_libobjs=$libobjs 8306d656433aSmrg fi 8307d656433aSmrg save_output=$output 8308555991fdSmrg func_basename "$output" 8309555991fdSmrg output_la=$func_basename_result 8310126a8a12Smrg 8311d656433aSmrg # Clear the reloadable object creation command queue and 8312d656433aSmrg # initialize k to one. 8313d656433aSmrg test_cmds= 8314d656433aSmrg concat_cmds= 8315d656433aSmrg objlist= 8316d656433aSmrg last_robj= 8317d656433aSmrg k=1 8318126a8a12Smrg 8319d656433aSmrg if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 8320d656433aSmrg output=${output_objdir}/${output_la}.lnkscript 8321d656433aSmrg func_verbose "creating GNU ld script: $output" 8322555991fdSmrg echo 'INPUT (' > $output 8323d656433aSmrg for obj in $save_libobjs 8324d656433aSmrg do 83253c15da26Smrg func_to_tool_file "$obj" 83263c15da26Smrg $ECHO "$func_to_tool_file_result" >> $output 8327d656433aSmrg done 8328555991fdSmrg echo ')' >> $output 83293c15da26Smrg func_append delfiles " $output" 83303c15da26Smrg func_to_tool_file "$output" 83313c15da26Smrg output=$func_to_tool_file_result 8332d656433aSmrg elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 8333d656433aSmrg output=${output_objdir}/${output_la}.lnk 8334d656433aSmrg func_verbose "creating linker input file list: $output" 8335d656433aSmrg : > $output 8336d656433aSmrg set x $save_libobjs 8337d656433aSmrg shift 8338d656433aSmrg firstobj= 8339d656433aSmrg if test "$compiler_needs_object" = yes; then 8340d656433aSmrg firstobj="$1 " 8341d656433aSmrg shift 8342d656433aSmrg fi 8343d656433aSmrg for obj 8344d656433aSmrg do 83453c15da26Smrg func_to_tool_file "$obj" 83463c15da26Smrg $ECHO "$func_to_tool_file_result" >> $output 8347d656433aSmrg done 83483c15da26Smrg func_append delfiles " $output" 83493c15da26Smrg func_to_tool_file "$output" 83503c15da26Smrg output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 8351d656433aSmrg else 8352d656433aSmrg if test -n "$save_libobjs"; then 8353d656433aSmrg func_verbose "creating reloadable object files..." 8354d656433aSmrg output=$output_objdir/$output_la-${k}.$objext 8355d656433aSmrg eval test_cmds=\"$reload_cmds\" 8356d656433aSmrg func_len " $test_cmds" 8357d656433aSmrg len0=$func_len_result 8358d656433aSmrg len=$len0 8359d656433aSmrg 8360d656433aSmrg # Loop over the list of objects to be linked. 8361d656433aSmrg for obj in $save_libobjs 8362d656433aSmrg do 8363d656433aSmrg func_len " $obj" 8364d656433aSmrg func_arith $len + $func_len_result 8365d656433aSmrg len=$func_arith_result 8366d656433aSmrg if test "X$objlist" = X || 8367d656433aSmrg test "$len" -lt "$max_cmd_len"; then 8368d656433aSmrg func_append objlist " $obj" 8369d656433aSmrg else 8370d656433aSmrg # The command $test_cmds is almost too long, add a 8371d656433aSmrg # command to the queue. 8372d656433aSmrg if test "$k" -eq 1 ; then 8373d656433aSmrg # The first file doesn't have a previous command to add. 8374555991fdSmrg reload_objs=$objlist 8375555991fdSmrg eval concat_cmds=\"$reload_cmds\" 8376d656433aSmrg else 8377d656433aSmrg # All subsequent reloadable object files will link in 8378d656433aSmrg # the last one created. 8379555991fdSmrg reload_objs="$objlist $last_robj" 8380555991fdSmrg eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 8381d656433aSmrg fi 8382d656433aSmrg last_robj=$output_objdir/$output_la-${k}.$objext 8383d656433aSmrg func_arith $k + 1 8384d656433aSmrg k=$func_arith_result 8385d656433aSmrg output=$output_objdir/$output_la-${k}.$objext 8386555991fdSmrg objlist=" $obj" 8387d656433aSmrg func_len " $last_robj" 8388d656433aSmrg func_arith $len0 + $func_len_result 8389d656433aSmrg len=$func_arith_result 8390d656433aSmrg fi 8391d656433aSmrg done 8392d656433aSmrg # Handle the remaining objects by creating one last 8393d656433aSmrg # reloadable object file. All subsequent reloadable object 8394d656433aSmrg # files will link in the last one created. 8395d656433aSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8396555991fdSmrg reload_objs="$objlist $last_robj" 8397555991fdSmrg eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 8398d656433aSmrg if test -n "$last_robj"; then 8399d656433aSmrg eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 8400d656433aSmrg fi 84013c15da26Smrg func_append delfiles " $output" 8402126a8a12Smrg 8403d656433aSmrg else 8404d656433aSmrg output= 8405d656433aSmrg fi 8406d656433aSmrg 8407d656433aSmrg if ${skipped_export-false}; then 8408d656433aSmrg func_verbose "generating symbol list for \`$libname.la'" 8409d656433aSmrg export_symbols="$output_objdir/$libname.exp" 8410d656433aSmrg $opt_dry_run || $RM $export_symbols 8411d656433aSmrg libobjs=$output 8412d656433aSmrg # Append the command to create the export file. 8413d656433aSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8414d656433aSmrg eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 8415d656433aSmrg if test -n "$last_robj"; then 8416d656433aSmrg eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 8417d656433aSmrg fi 8418d656433aSmrg fi 8419126a8a12Smrg 8420d656433aSmrg test -n "$save_libobjs" && 8421d656433aSmrg func_verbose "creating a temporary reloadable object file: $output" 8422126a8a12Smrg 8423d656433aSmrg # Loop through the commands generated above and execute them. 8424d656433aSmrg save_ifs="$IFS"; IFS='~' 8425d656433aSmrg for cmd in $concat_cmds; do 8426d656433aSmrg IFS="$save_ifs" 8427d656433aSmrg $opt_silent || { 8428d656433aSmrg func_quote_for_expand "$cmd" 8429d656433aSmrg eval "func_echo $func_quote_for_expand_result" 8430d656433aSmrg } 8431d656433aSmrg $opt_dry_run || eval "$cmd" || { 8432d656433aSmrg lt_exit=$? 8433d656433aSmrg 8434d656433aSmrg # Restore the uninstalled library and exit 84353c15da26Smrg if test "$opt_mode" = relink; then 8436d656433aSmrg ( cd "$output_objdir" && \ 8437d656433aSmrg $RM "${realname}T" && \ 8438d656433aSmrg $MV "${realname}U" "$realname" ) 8439d656433aSmrg fi 8440126a8a12Smrg 8441d656433aSmrg exit $lt_exit 8442d656433aSmrg } 8443d656433aSmrg done 8444d656433aSmrg IFS="$save_ifs" 8445126a8a12Smrg 8446d656433aSmrg if test -n "$export_symbols_regex" && ${skipped_export-false}; then 8447d656433aSmrg func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8448d656433aSmrg func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8449126a8a12Smrg fi 8450126a8a12Smrg fi 8451126a8a12Smrg 8452d656433aSmrg if ${skipped_export-false}; then 8453d656433aSmrg if test -n "$export_symbols" && test -n "$include_expsyms"; then 8454d656433aSmrg tmp_export_symbols="$export_symbols" 8455d656433aSmrg test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8456555991fdSmrg $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8457d656433aSmrg fi 8458126a8a12Smrg 8459d656433aSmrg if test -n "$orig_export_symbols"; then 8460d656433aSmrg # The given exports_symbols file has to be filtered, so filter it. 8461d656433aSmrg func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8462d656433aSmrg # FIXME: $output_objdir/$libname.filter potentially contains lots of 8463d656433aSmrg # 's' commands which not all seds can handle. GNU sed should be fine 8464d656433aSmrg # though. Also, the filter scales superlinearly with the number of 8465d656433aSmrg # global variables. join(1) would be nice here, but unfortunately 8466d656433aSmrg # isn't a blessed tool. 8467d656433aSmrg $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 84683c15da26Smrg func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8469d656433aSmrg export_symbols=$output_objdir/$libname.def 8470d656433aSmrg $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8471d656433aSmrg fi 8472d656433aSmrg fi 8473126a8a12Smrg 8474d656433aSmrg libobjs=$output 8475d656433aSmrg # Restore the value of output. 8476d656433aSmrg output=$save_output 8477126a8a12Smrg 8478d656433aSmrg if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 8479d656433aSmrg eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8480d656433aSmrg test "X$libobjs" = "X " && libobjs= 8481d656433aSmrg fi 8482d656433aSmrg # Expand the library linking commands again to reset the 8483d656433aSmrg # value of $libobjs for piecewise linking. 8484d656433aSmrg 8485d656433aSmrg # Do each of the archive commands. 8486d656433aSmrg if test "$module" = yes && test -n "$module_cmds" ; then 8487d656433aSmrg if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8488d656433aSmrg cmds=$module_expsym_cmds 8489126a8a12Smrg else 8490d656433aSmrg cmds=$module_cmds 8491126a8a12Smrg fi 8492126a8a12Smrg else 8493d656433aSmrg if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8494d656433aSmrg cmds=$archive_expsym_cmds 8495d656433aSmrg else 8496d656433aSmrg cmds=$archive_cmds 8497d656433aSmrg fi 8498126a8a12Smrg fi 8499126a8a12Smrg fi 8500126a8a12Smrg 8501d656433aSmrg if test -n "$delfiles"; then 8502d656433aSmrg # Append the command to remove temporary files to $cmds. 8503d656433aSmrg eval cmds=\"\$cmds~\$RM $delfiles\" 8504d656433aSmrg fi 8505126a8a12Smrg 8506d656433aSmrg # Add any objects from preloaded convenience libraries 8507d656433aSmrg if test -n "$dlprefiles"; then 8508d656433aSmrg gentop="$output_objdir/${outputname}x" 85093c15da26Smrg func_append generated " $gentop" 8510126a8a12Smrg 8511d656433aSmrg func_extract_archives $gentop $dlprefiles 85123c15da26Smrg func_append libobjs " $func_extract_archives_result" 8513d656433aSmrg test "X$libobjs" = "X " && libobjs= 8514126a8a12Smrg fi 8515126a8a12Smrg 8516d656433aSmrg save_ifs="$IFS"; IFS='~' 8517d656433aSmrg for cmd in $cmds; do 8518d656433aSmrg IFS="$save_ifs" 8519d656433aSmrg eval cmd=\"$cmd\" 8520d656433aSmrg $opt_silent || { 8521d656433aSmrg func_quote_for_expand "$cmd" 8522d656433aSmrg eval "func_echo $func_quote_for_expand_result" 8523d656433aSmrg } 8524d656433aSmrg $opt_dry_run || eval "$cmd" || { 8525d656433aSmrg lt_exit=$? 8526126a8a12Smrg 8527d656433aSmrg # Restore the uninstalled library and exit 85283c15da26Smrg if test "$opt_mode" = relink; then 8529d656433aSmrg ( cd "$output_objdir" && \ 8530d656433aSmrg $RM "${realname}T" && \ 8531d656433aSmrg $MV "${realname}U" "$realname" ) 8532126a8a12Smrg fi 8533126a8a12Smrg 8534d656433aSmrg exit $lt_exit 8535d656433aSmrg } 8536d656433aSmrg done 8537d656433aSmrg IFS="$save_ifs" 8538126a8a12Smrg 8539d656433aSmrg # Restore the uninstalled library and exit 85403c15da26Smrg if test "$opt_mode" = relink; then 8541d656433aSmrg $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 8542126a8a12Smrg 8543d656433aSmrg if test -n "$convenience"; then 8544d656433aSmrg if test -z "$whole_archive_flag_spec"; then 8545d656433aSmrg func_show_eval '${RM}r "$gentop"' 8546d656433aSmrg fi 8547d656433aSmrg fi 8548126a8a12Smrg 8549d656433aSmrg exit $EXIT_SUCCESS 8550d656433aSmrg fi 8551126a8a12Smrg 8552d656433aSmrg # Create links to the real library. 8553d656433aSmrg for linkname in $linknames; do 8554d656433aSmrg if test "$realname" != "$linkname"; then 8555d656433aSmrg func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 8556126a8a12Smrg fi 8557126a8a12Smrg done 8558126a8a12Smrg 8559d656433aSmrg # If -module or -export-dynamic was specified, set the dlname. 8560d656433aSmrg if test "$module" = yes || test "$export_dynamic" = yes; then 8561d656433aSmrg # On all known operating systems, these are identical. 8562d656433aSmrg dlname="$soname" 8563d656433aSmrg fi 8564d656433aSmrg fi 8565126a8a12Smrg ;; 8566126a8a12Smrg 8567d656433aSmrg obj) 8568d656433aSmrg if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 8569d656433aSmrg func_warning "\`-dlopen' is ignored for objects" 8570d656433aSmrg fi 8571126a8a12Smrg 8572d656433aSmrg case " $deplibs" in 8573d656433aSmrg *\ -l* | *\ -L*) 8574d656433aSmrg func_warning "\`-l' and \`-L' are ignored for objects" ;; 8575126a8a12Smrg esac 8576126a8a12Smrg 8577d656433aSmrg test -n "$rpath" && \ 8578d656433aSmrg func_warning "\`-rpath' is ignored for objects" 8579126a8a12Smrg 8580d656433aSmrg test -n "$xrpath" && \ 8581d656433aSmrg func_warning "\`-R' is ignored for objects" 8582126a8a12Smrg 8583d656433aSmrg test -n "$vinfo" && \ 8584d656433aSmrg func_warning "\`-version-info' is ignored for objects" 8585d656433aSmrg 8586d656433aSmrg test -n "$release" && \ 8587d656433aSmrg func_warning "\`-release' is ignored for objects" 8588d656433aSmrg 8589d656433aSmrg case $output in 8590d656433aSmrg *.lo) 8591d656433aSmrg test -n "$objs$old_deplibs" && \ 8592d656433aSmrg func_fatal_error "cannot build library object \`$output' from non-libtool objects" 8593d656433aSmrg 8594d656433aSmrg libobj=$output 8595d656433aSmrg func_lo2o "$libobj" 8596d656433aSmrg obj=$func_lo2o_result 8597126a8a12Smrg ;; 8598126a8a12Smrg *) 8599d656433aSmrg libobj= 8600d656433aSmrg obj="$output" 8601126a8a12Smrg ;; 8602126a8a12Smrg esac 8603126a8a12Smrg 8604d656433aSmrg # Delete the old objects. 8605d656433aSmrg $opt_dry_run || $RM $obj $libobj 8606126a8a12Smrg 8607d656433aSmrg # Objects from convenience libraries. This assumes 8608d656433aSmrg # single-version convenience libraries. Whenever we create 8609d656433aSmrg # different ones for PIC/non-PIC, this we'll have to duplicate 8610d656433aSmrg # the extraction. 8611d656433aSmrg reload_conv_objs= 8612d656433aSmrg gentop= 8613d656433aSmrg # reload_cmds runs $LD directly, so let us get rid of 8614d656433aSmrg # -Wl from whole_archive_flag_spec and hope we can get by with 8615d656433aSmrg # turning comma into space.. 8616d656433aSmrg wl= 8617126a8a12Smrg 8618d656433aSmrg if test -n "$convenience"; then 8619d656433aSmrg if test -n "$whole_archive_flag_spec"; then 8620d656433aSmrg eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 8621555991fdSmrg reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 8622d656433aSmrg else 8623d656433aSmrg gentop="$output_objdir/${obj}x" 86243c15da26Smrg func_append generated " $gentop" 8625126a8a12Smrg 8626d656433aSmrg func_extract_archives $gentop $convenience 8627d656433aSmrg reload_conv_objs="$reload_objs $func_extract_archives_result" 8628d656433aSmrg fi 8629126a8a12Smrg fi 8630126a8a12Smrg 86313c15da26Smrg # If we're not building shared, we need to use non_pic_objs 86323c15da26Smrg test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" 86333c15da26Smrg 8634d656433aSmrg # Create the old-style object. 8635555991fdSmrg reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 8636126a8a12Smrg 8637d656433aSmrg output="$obj" 8638d656433aSmrg func_execute_cmds "$reload_cmds" 'exit $?' 8639126a8a12Smrg 8640d656433aSmrg # Exit if we aren't doing a library object file. 8641d656433aSmrg if test -z "$libobj"; then 8642d656433aSmrg if test -n "$gentop"; then 8643d656433aSmrg func_show_eval '${RM}r "$gentop"' 8644d656433aSmrg fi 8645d656433aSmrg 8646d656433aSmrg exit $EXIT_SUCCESS 8647126a8a12Smrg fi 8648d656433aSmrg 8649d656433aSmrg if test "$build_libtool_libs" != yes; then 8650d656433aSmrg if test -n "$gentop"; then 8651d656433aSmrg func_show_eval '${RM}r "$gentop"' 8652d656433aSmrg fi 8653d656433aSmrg 8654d656433aSmrg # Create an invalid libtool object if no PIC, so that we don't 8655d656433aSmrg # accidentally link it into a program. 8656d656433aSmrg # $show "echo timestamp > $libobj" 8657d656433aSmrg # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 8658d656433aSmrg exit $EXIT_SUCCESS 8659d656433aSmrg fi 8660d656433aSmrg 8661d656433aSmrg if test -n "$pic_flag" || test "$pic_mode" != default; then 8662d656433aSmrg # Only do commands if we really have different PIC objects. 8663d656433aSmrg reload_objs="$libobjs $reload_conv_objs" 8664d656433aSmrg output="$libobj" 8665d656433aSmrg func_execute_cmds "$reload_cmds" 'exit $?' 8666d656433aSmrg fi 8667d656433aSmrg 8668d656433aSmrg if test -n "$gentop"; then 8669d656433aSmrg func_show_eval '${RM}r "$gentop"' 8670d656433aSmrg fi 8671d656433aSmrg 8672d656433aSmrg exit $EXIT_SUCCESS 8673126a8a12Smrg ;; 8674126a8a12Smrg 8675d656433aSmrg prog) 8676d656433aSmrg case $host in 8677d656433aSmrg *cygwin*) func_stripname '' '.exe' "$output" 8678d656433aSmrg output=$func_stripname_result.exe;; 8679d656433aSmrg esac 8680d656433aSmrg test -n "$vinfo" && \ 8681d656433aSmrg func_warning "\`-version-info' is ignored for programs" 8682126a8a12Smrg 8683d656433aSmrg test -n "$release" && \ 8684d656433aSmrg func_warning "\`-release' is ignored for programs" 8685126a8a12Smrg 8686d656433aSmrg test "$preload" = yes \ 8687d656433aSmrg && test "$dlopen_support" = unknown \ 8688d656433aSmrg && test "$dlopen_self" = unknown \ 8689d656433aSmrg && test "$dlopen_self_static" = unknown && \ 8690d656433aSmrg func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 8691d656433aSmrg 8692d656433aSmrg case $host in 8693d656433aSmrg *-*-rhapsody* | *-*-darwin1.[012]) 8694d656433aSmrg # On Rhapsody replace the C library is the System framework 8695555991fdSmrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 8696555991fdSmrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 8697126a8a12Smrg ;; 8698d656433aSmrg esac 8699126a8a12Smrg 8700d656433aSmrg case $host in 8701d656433aSmrg *-*-darwin*) 8702d656433aSmrg # Don't allow lazy linking, it breaks C++ global constructors 8703d656433aSmrg # But is supposedly fixed on 10.4 or later (yay!). 8704d656433aSmrg if test "$tagname" = CXX ; then 8705d656433aSmrg case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 8706d656433aSmrg 10.[0123]) 87073c15da26Smrg func_append compile_command " ${wl}-bind_at_load" 87083c15da26Smrg func_append finalize_command " ${wl}-bind_at_load" 8709d656433aSmrg ;; 8710d656433aSmrg esac 8711126a8a12Smrg fi 8712d656433aSmrg # Time to change all our "foo.ltframework" stuff back to "-framework foo" 8713555991fdSmrg compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8714555991fdSmrg finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8715d656433aSmrg ;; 8716d656433aSmrg esac 8717126a8a12Smrg 8718126a8a12Smrg 8719d656433aSmrg # move library search paths that coincide with paths to not yet 8720d656433aSmrg # installed libraries to the beginning of the library search list 8721d656433aSmrg new_libs= 8722d656433aSmrg for path in $notinst_path; do 8723d656433aSmrg case " $new_libs " in 8724d656433aSmrg *" -L$path/$objdir "*) ;; 8725d656433aSmrg *) 8726d656433aSmrg case " $compile_deplibs " in 8727d656433aSmrg *" -L$path/$objdir "*) 87283c15da26Smrg func_append new_libs " -L$path/$objdir" ;; 8729126a8a12Smrg esac 8730d656433aSmrg ;; 8731d656433aSmrg esac 8732d656433aSmrg done 8733d656433aSmrg for deplib in $compile_deplibs; do 8734d656433aSmrg case $deplib in 8735d656433aSmrg -L*) 8736d656433aSmrg case " $new_libs " in 8737d656433aSmrg *" $deplib "*) ;; 87383c15da26Smrg *) func_append new_libs " $deplib" ;; 8739126a8a12Smrg esac 8740d656433aSmrg ;; 87413c15da26Smrg *) func_append new_libs " $deplib" ;; 8742d656433aSmrg esac 8743d656433aSmrg done 8744d656433aSmrg compile_deplibs="$new_libs" 8745126a8a12Smrg 8746126a8a12Smrg 87473c15da26Smrg func_append compile_command " $compile_deplibs" 87483c15da26Smrg func_append finalize_command " $finalize_deplibs" 8749126a8a12Smrg 8750d656433aSmrg if test -n "$rpath$xrpath"; then 8751d656433aSmrg # If the user specified any rpath flags, then add them. 8752d656433aSmrg for libdir in $rpath $xrpath; do 8753d656433aSmrg # This is the magic to use -rpath. 8754d656433aSmrg case "$finalize_rpath " in 8755d656433aSmrg *" $libdir "*) ;; 87563c15da26Smrg *) func_append finalize_rpath " $libdir" ;; 8757d656433aSmrg esac 8758d656433aSmrg done 8759d656433aSmrg fi 8760126a8a12Smrg 8761d656433aSmrg # Now hardcode the library paths 8762d656433aSmrg rpath= 8763d656433aSmrg hardcode_libdirs= 8764d656433aSmrg for libdir in $compile_rpath $finalize_rpath; do 8765d656433aSmrg if test -n "$hardcode_libdir_flag_spec"; then 8766d656433aSmrg if test -n "$hardcode_libdir_separator"; then 8767d656433aSmrg if test -z "$hardcode_libdirs"; then 8768d656433aSmrg hardcode_libdirs="$libdir" 8769d656433aSmrg else 8770d656433aSmrg # Just accumulate the unique libdirs. 8771d656433aSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8772d656433aSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8773d656433aSmrg ;; 8774d656433aSmrg *) 87753c15da26Smrg func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8776d656433aSmrg ;; 8777d656433aSmrg esac 8778d656433aSmrg fi 8779126a8a12Smrg else 8780d656433aSmrg eval flag=\"$hardcode_libdir_flag_spec\" 87813c15da26Smrg func_append rpath " $flag" 8782126a8a12Smrg fi 8783d656433aSmrg elif test -n "$runpath_var"; then 8784d656433aSmrg case "$perm_rpath " in 8785d656433aSmrg *" $libdir "*) ;; 87863c15da26Smrg *) func_append perm_rpath " $libdir" ;; 8787d656433aSmrg esac 8788d656433aSmrg fi 8789d656433aSmrg case $host in 8790d656433aSmrg *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 8791d656433aSmrg testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 8792d656433aSmrg case :$dllsearchpath: in 8793d656433aSmrg *":$libdir:"*) ;; 8794d656433aSmrg ::) dllsearchpath=$libdir;; 87953c15da26Smrg *) func_append dllsearchpath ":$libdir";; 8796d656433aSmrg esac 8797d656433aSmrg case :$dllsearchpath: in 8798d656433aSmrg *":$testbindir:"*) ;; 8799d656433aSmrg ::) dllsearchpath=$testbindir;; 88003c15da26Smrg *) func_append dllsearchpath ":$testbindir";; 8801d656433aSmrg esac 8802d656433aSmrg ;; 8803d656433aSmrg esac 8804d656433aSmrg done 8805d656433aSmrg # Substitute the hardcoded libdirs into the rpath. 8806d656433aSmrg if test -n "$hardcode_libdir_separator" && 8807d656433aSmrg test -n "$hardcode_libdirs"; then 8808d656433aSmrg libdir="$hardcode_libdirs" 8809d656433aSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 8810d656433aSmrg fi 8811d656433aSmrg compile_rpath="$rpath" 8812126a8a12Smrg 8813d656433aSmrg rpath= 8814d656433aSmrg hardcode_libdirs= 8815d656433aSmrg for libdir in $finalize_rpath; do 8816d656433aSmrg if test -n "$hardcode_libdir_flag_spec"; then 8817d656433aSmrg if test -n "$hardcode_libdir_separator"; then 8818d656433aSmrg if test -z "$hardcode_libdirs"; then 8819d656433aSmrg hardcode_libdirs="$libdir" 8820d656433aSmrg else 8821d656433aSmrg # Just accumulate the unique libdirs. 8822d656433aSmrg case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8823d656433aSmrg *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8824d656433aSmrg ;; 8825d656433aSmrg *) 88263c15da26Smrg func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8827d656433aSmrg ;; 8828d656433aSmrg esac 8829d656433aSmrg fi 8830126a8a12Smrg else 8831d656433aSmrg eval flag=\"$hardcode_libdir_flag_spec\" 88323c15da26Smrg func_append rpath " $flag" 8833126a8a12Smrg fi 8834d656433aSmrg elif test -n "$runpath_var"; then 8835d656433aSmrg case "$finalize_perm_rpath " in 8836d656433aSmrg *" $libdir "*) ;; 88373c15da26Smrg *) func_append finalize_perm_rpath " $libdir" ;; 8838d656433aSmrg esac 8839126a8a12Smrg fi 8840d656433aSmrg done 8841d656433aSmrg # Substitute the hardcoded libdirs into the rpath. 8842d656433aSmrg if test -n "$hardcode_libdir_separator" && 8843d656433aSmrg test -n "$hardcode_libdirs"; then 8844d656433aSmrg libdir="$hardcode_libdirs" 8845d656433aSmrg eval rpath=\" $hardcode_libdir_flag_spec\" 8846d656433aSmrg fi 8847d656433aSmrg finalize_rpath="$rpath" 8848126a8a12Smrg 8849d656433aSmrg if test -n "$libobjs" && test "$build_old_libs" = yes; then 8850d656433aSmrg # Transform all the library objects into standard objects. 8851555991fdSmrg compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8852555991fdSmrg finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8853d656433aSmrg fi 8854126a8a12Smrg 8855d656433aSmrg func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8856126a8a12Smrg 8857d656433aSmrg # template prelinking step 8858d656433aSmrg if test -n "$prelink_cmds"; then 8859d656433aSmrg func_execute_cmds "$prelink_cmds" 'exit $?' 8860d656433aSmrg fi 8861126a8a12Smrg 8862d656433aSmrg wrappers_required=yes 8863d656433aSmrg case $host in 8864555991fdSmrg *cegcc* | *mingw32ce*) 8865555991fdSmrg # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 8866555991fdSmrg wrappers_required=no 8867555991fdSmrg ;; 8868d656433aSmrg *cygwin* | *mingw* ) 8869d656433aSmrg if test "$build_libtool_libs" != yes; then 8870d656433aSmrg wrappers_required=no 8871d656433aSmrg fi 8872d656433aSmrg ;; 8873d656433aSmrg *) 8874d656433aSmrg if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 8875d656433aSmrg wrappers_required=no 8876d656433aSmrg fi 8877d656433aSmrg ;; 8878d656433aSmrg esac 8879d656433aSmrg if test "$wrappers_required" = no; then 8880d656433aSmrg # Replace the output file specification. 8881555991fdSmrg compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8882d656433aSmrg link_command="$compile_command$compile_rpath" 8883126a8a12Smrg 8884d656433aSmrg # We have no uninstalled library dependencies, so finalize right now. 8885d656433aSmrg exit_status=0 8886d656433aSmrg func_show_eval "$link_command" 'exit_status=$?' 8887126a8a12Smrg 88883c15da26Smrg if test -n "$postlink_cmds"; then 88893c15da26Smrg func_to_tool_file "$output" 88903c15da26Smrg postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 88913c15da26Smrg func_execute_cmds "$postlink_cmds" 'exit $?' 88923c15da26Smrg fi 88933c15da26Smrg 8894d656433aSmrg # Delete the generated files. 8895d656433aSmrg if test -f "$output_objdir/${outputname}S.${objext}"; then 8896d656433aSmrg func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8897126a8a12Smrg fi 8898126a8a12Smrg 8899d656433aSmrg exit $exit_status 8900d656433aSmrg fi 8901126a8a12Smrg 8902d656433aSmrg if test -n "$compile_shlibpath$finalize_shlibpath"; then 8903d656433aSmrg compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 8904d656433aSmrg fi 8905d656433aSmrg if test -n "$finalize_shlibpath"; then 8906d656433aSmrg finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 8907d656433aSmrg fi 8908126a8a12Smrg 8909d656433aSmrg compile_var= 8910d656433aSmrg finalize_var= 8911d656433aSmrg if test -n "$runpath_var"; then 8912d656433aSmrg if test -n "$perm_rpath"; then 8913d656433aSmrg # We should set the runpath_var. 8914d656433aSmrg rpath= 8915d656433aSmrg for dir in $perm_rpath; do 89163c15da26Smrg func_append rpath "$dir:" 8917d656433aSmrg done 8918d656433aSmrg compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8919126a8a12Smrg fi 8920d656433aSmrg if test -n "$finalize_perm_rpath"; then 8921d656433aSmrg # We should set the runpath_var. 8922d656433aSmrg rpath= 8923d656433aSmrg for dir in $finalize_perm_rpath; do 89243c15da26Smrg func_append rpath "$dir:" 8925d656433aSmrg done 8926d656433aSmrg finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8927126a8a12Smrg fi 8928d656433aSmrg fi 8929126a8a12Smrg 8930d656433aSmrg if test "$no_install" = yes; then 8931d656433aSmrg # We don't need to create a wrapper script. 8932d656433aSmrg link_command="$compile_var$compile_command$compile_rpath" 8933d656433aSmrg # Replace the output file specification. 8934555991fdSmrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8935d656433aSmrg # Delete the old output file. 8936d656433aSmrg $opt_dry_run || $RM $output 8937d656433aSmrg # Link the executable and exit 8938d656433aSmrg func_show_eval "$link_command" 'exit $?' 89393c15da26Smrg 89403c15da26Smrg if test -n "$postlink_cmds"; then 89413c15da26Smrg func_to_tool_file "$output" 89423c15da26Smrg postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 89433c15da26Smrg func_execute_cmds "$postlink_cmds" 'exit $?' 89443c15da26Smrg fi 89453c15da26Smrg 8946126a8a12Smrg exit $EXIT_SUCCESS 8947d656433aSmrg fi 8948126a8a12Smrg 8949d656433aSmrg if test "$hardcode_action" = relink; then 8950d656433aSmrg # Fast installation is not supported 8951d656433aSmrg link_command="$compile_var$compile_command$compile_rpath" 8952d656433aSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 8953d656433aSmrg 8954d656433aSmrg func_warning "this platform does not like uninstalled shared libraries" 8955d656433aSmrg func_warning "\`$output' will be relinked during installation" 8956d656433aSmrg else 8957d656433aSmrg if test "$fast_install" != no; then 8958d656433aSmrg link_command="$finalize_var$compile_command$finalize_rpath" 8959d656433aSmrg if test "$fast_install" = yes; then 8960555991fdSmrg relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 8961d656433aSmrg else 8962d656433aSmrg # fast_install is set to needless 8963d656433aSmrg relink_command= 8964d656433aSmrg fi 8965126a8a12Smrg else 8966d656433aSmrg link_command="$compile_var$compile_command$compile_rpath" 8967d656433aSmrg relink_command="$finalize_var$finalize_command$finalize_rpath" 8968126a8a12Smrg fi 8969d656433aSmrg fi 8970126a8a12Smrg 8971d656433aSmrg # Replace the output file specification. 8972555991fdSmrg link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8973126a8a12Smrg 8974d656433aSmrg # Delete the old output files. 8975d656433aSmrg $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8976126a8a12Smrg 8977d656433aSmrg func_show_eval "$link_command" 'exit $?' 8978126a8a12Smrg 89793c15da26Smrg if test -n "$postlink_cmds"; then 89803c15da26Smrg func_to_tool_file "$output_objdir/$outputname" 89813c15da26Smrg 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'` 89823c15da26Smrg func_execute_cmds "$postlink_cmds" 'exit $?' 89833c15da26Smrg fi 89843c15da26Smrg 8985d656433aSmrg # Now create the wrapper script. 8986d656433aSmrg func_verbose "creating $output" 8987126a8a12Smrg 8988d656433aSmrg # Quote the relink command for shipping. 8989d656433aSmrg if test -n "$relink_command"; then 8990d656433aSmrg # Preserve any variables that may affect compiler behavior 8991d656433aSmrg for var in $variables_saved_for_relink; do 8992d656433aSmrg if eval test -z \"\${$var+set}\"; then 8993d656433aSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 8994d656433aSmrg elif eval var_value=\$$var; test -z "$var_value"; then 8995d656433aSmrg relink_command="$var=; export $var; $relink_command" 8996126a8a12Smrg else 8997d656433aSmrg func_quote_for_eval "$var_value" 8998d656433aSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8999126a8a12Smrg fi 9000d656433aSmrg done 9001d656433aSmrg relink_command="(cd `pwd`; $relink_command)" 9002555991fdSmrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9003d656433aSmrg fi 9004d656433aSmrg 9005d656433aSmrg # Only actually do things if not in dry run mode. 9006d656433aSmrg $opt_dry_run || { 9007d656433aSmrg # win32 will think the script is a binary if it has 9008d656433aSmrg # a .exe suffix, so we strip it off here. 9009d656433aSmrg case $output in 9010d656433aSmrg *.exe) func_stripname '' '.exe' "$output" 9011d656433aSmrg output=$func_stripname_result ;; 9012d656433aSmrg esac 9013d656433aSmrg # test for cygwin because mv fails w/o .exe extensions 9014d656433aSmrg case $host in 9015d656433aSmrg *cygwin*) 9016d656433aSmrg exeext=.exe 9017d656433aSmrg func_stripname '' '.exe' "$outputname" 9018d656433aSmrg outputname=$func_stripname_result ;; 9019d656433aSmrg *) exeext= ;; 9020126a8a12Smrg esac 9021d656433aSmrg case $host in 9022d656433aSmrg *cygwin* | *mingw* ) 9023d656433aSmrg func_dirname_and_basename "$output" "" "." 9024d656433aSmrg output_name=$func_basename_result 9025d656433aSmrg output_path=$func_dirname_result 9026d656433aSmrg cwrappersource="$output_path/$objdir/lt-$output_name.c" 9027d656433aSmrg cwrapper="$output_path/$output_name.exe" 9028d656433aSmrg $RM $cwrappersource $cwrapper 9029d656433aSmrg trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 9030d656433aSmrg 9031d656433aSmrg func_emit_cwrapperexe_src > $cwrappersource 9032d656433aSmrg 9033d656433aSmrg # The wrapper executable is built using the $host compiler, 9034d656433aSmrg # because it contains $host paths and files. If cross- 9035d656433aSmrg # compiling, it, like the target executable, must be 9036d656433aSmrg # executed on the $host or under an emulation environment. 9037d656433aSmrg $opt_dry_run || { 9038d656433aSmrg $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 9039d656433aSmrg $STRIP $cwrapper 9040d656433aSmrg } 9041126a8a12Smrg 9042d656433aSmrg # Now, create the wrapper script for func_source use: 9043d656433aSmrg func_ltwrapper_scriptname $cwrapper 9044d656433aSmrg $RM $func_ltwrapper_scriptname_result 9045d656433aSmrg trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 9046d656433aSmrg $opt_dry_run || { 9047d656433aSmrg # note: this script will not be executed, so do not chmod. 9048d656433aSmrg if test "x$build" = "x$host" ; then 9049d656433aSmrg $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 9050d656433aSmrg else 9051d656433aSmrg func_emit_wrapper no > $func_ltwrapper_scriptname_result 9052d656433aSmrg fi 9053d656433aSmrg } 9054d656433aSmrg ;; 9055d656433aSmrg * ) 9056d656433aSmrg $RM $output 9057d656433aSmrg trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 9058126a8a12Smrg 9059d656433aSmrg func_emit_wrapper no > $output 9060d656433aSmrg chmod +x $output 9061d656433aSmrg ;; 9062d656433aSmrg esac 9063d656433aSmrg } 9064d656433aSmrg exit $EXIT_SUCCESS 9065d656433aSmrg ;; 9066d656433aSmrg esac 9067126a8a12Smrg 9068d656433aSmrg # See if we need to build an old-fashioned archive. 9069d656433aSmrg for oldlib in $oldlibs; do 9070126a8a12Smrg 9071d656433aSmrg if test "$build_libtool_libs" = convenience; then 9072d656433aSmrg oldobjs="$libobjs_save $symfileobj" 9073d656433aSmrg addlibs="$convenience" 9074d656433aSmrg build_libtool_libs=no 9075d656433aSmrg else 9076d656433aSmrg if test "$build_libtool_libs" = module; then 9077d656433aSmrg oldobjs="$libobjs_save" 9078d656433aSmrg build_libtool_libs=no 9079d656433aSmrg else 9080d656433aSmrg oldobjs="$old_deplibs $non_pic_objects" 9081d656433aSmrg if test "$preload" = yes && test -f "$symfileobj"; then 90823c15da26Smrg func_append oldobjs " $symfileobj" 9083d656433aSmrg fi 9084d656433aSmrg fi 9085d656433aSmrg addlibs="$old_convenience" 9086126a8a12Smrg fi 9087126a8a12Smrg 9088d656433aSmrg if test -n "$addlibs"; then 9089d656433aSmrg gentop="$output_objdir/${outputname}x" 90903c15da26Smrg func_append generated " $gentop" 9091126a8a12Smrg 9092d656433aSmrg func_extract_archives $gentop $addlibs 90933c15da26Smrg func_append oldobjs " $func_extract_archives_result" 9094d656433aSmrg fi 9095126a8a12Smrg 9096d656433aSmrg # Do each command in the archive commands. 9097d656433aSmrg if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 9098d656433aSmrg cmds=$old_archive_from_new_cmds 9099d656433aSmrg else 9100126a8a12Smrg 9101d656433aSmrg # Add any objects from preloaded convenience libraries 9102d656433aSmrg if test -n "$dlprefiles"; then 9103d656433aSmrg gentop="$output_objdir/${outputname}x" 91043c15da26Smrg func_append generated " $gentop" 9105126a8a12Smrg 9106d656433aSmrg func_extract_archives $gentop $dlprefiles 91073c15da26Smrg func_append oldobjs " $func_extract_archives_result" 9108d656433aSmrg fi 9109126a8a12Smrg 9110d656433aSmrg # POSIX demands no paths to be encoded in archives. We have 9111d656433aSmrg # to avoid creating archives with duplicate basenames if we 9112d656433aSmrg # might have to extract them afterwards, e.g., when creating a 9113d656433aSmrg # static archive out of a convenience library, or when linking 9114d656433aSmrg # the entirety of a libtool archive into another (currently 9115d656433aSmrg # not supported by libtool). 9116d656433aSmrg if (for obj in $oldobjs 9117d656433aSmrg do 9118d656433aSmrg func_basename "$obj" 9119d656433aSmrg $ECHO "$func_basename_result" 9120d656433aSmrg done | sort | sort -uc >/dev/null 2>&1); then 9121d656433aSmrg : 9122d656433aSmrg else 9123555991fdSmrg echo "copying selected object files to avoid basename conflicts..." 9124d656433aSmrg gentop="$output_objdir/${outputname}x" 91253c15da26Smrg func_append generated " $gentop" 9126d656433aSmrg func_mkdir_p "$gentop" 9127d656433aSmrg save_oldobjs=$oldobjs 9128d656433aSmrg oldobjs= 9129d656433aSmrg counter=1 9130d656433aSmrg for obj in $save_oldobjs 9131d656433aSmrg do 9132d656433aSmrg func_basename "$obj" 9133d656433aSmrg objbase="$func_basename_result" 9134d656433aSmrg case " $oldobjs " in 9135d656433aSmrg " ") oldobjs=$obj ;; 9136d656433aSmrg *[\ /]"$objbase "*) 9137d656433aSmrg while :; do 9138d656433aSmrg # Make sure we don't pick an alternate name that also 9139d656433aSmrg # overlaps. 9140d656433aSmrg newobj=lt$counter-$objbase 9141d656433aSmrg func_arith $counter + 1 9142d656433aSmrg counter=$func_arith_result 9143d656433aSmrg case " $oldobjs " in 9144d656433aSmrg *[\ /]"$newobj "*) ;; 9145d656433aSmrg *) if test ! -f "$gentop/$newobj"; then break; fi ;; 9146d656433aSmrg esac 9147d656433aSmrg done 9148d656433aSmrg func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 91493c15da26Smrg func_append oldobjs " $gentop/$newobj" 9150d656433aSmrg ;; 91513c15da26Smrg *) func_append oldobjs " $obj" ;; 9152d656433aSmrg esac 9153126a8a12Smrg done 9154126a8a12Smrg fi 9155d656433aSmrg eval cmds=\"$old_archive_cmds\" 9156126a8a12Smrg 9157d656433aSmrg func_len " $cmds" 9158d656433aSmrg len=$func_len_result 9159d656433aSmrg if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 9160d656433aSmrg cmds=$old_archive_cmds 91613c15da26Smrg elif test -n "$archiver_list_spec"; then 91623c15da26Smrg func_verbose "using command file archive linking..." 91633c15da26Smrg for obj in $oldobjs 91643c15da26Smrg do 91653c15da26Smrg func_to_tool_file "$obj" 91663c15da26Smrg $ECHO "$func_to_tool_file_result" 91673c15da26Smrg done > $output_objdir/$libname.libcmd 91683c15da26Smrg func_to_tool_file "$output_objdir/$libname.libcmd" 91693c15da26Smrg oldobjs=" $archiver_list_spec$func_to_tool_file_result" 91703c15da26Smrg cmds=$old_archive_cmds 9171d656433aSmrg else 9172d656433aSmrg # the command line is too long to link in one step, link in parts 9173d656433aSmrg func_verbose "using piecewise archive linking..." 9174d656433aSmrg save_RANLIB=$RANLIB 9175d656433aSmrg RANLIB=: 9176d656433aSmrg objlist= 9177d656433aSmrg concat_cmds= 9178d656433aSmrg save_oldobjs=$oldobjs 9179d656433aSmrg oldobjs= 9180d656433aSmrg # Is there a better way of finding the last object in the list? 9181d656433aSmrg for obj in $save_oldobjs 9182d656433aSmrg do 9183d656433aSmrg last_oldobj=$obj 9184d656433aSmrg done 9185d656433aSmrg eval test_cmds=\"$old_archive_cmds\" 9186d656433aSmrg func_len " $test_cmds" 9187d656433aSmrg len0=$func_len_result 9188d656433aSmrg len=$len0 9189d656433aSmrg for obj in $save_oldobjs 9190d656433aSmrg do 9191d656433aSmrg func_len " $obj" 9192d656433aSmrg func_arith $len + $func_len_result 9193d656433aSmrg len=$func_arith_result 9194d656433aSmrg func_append objlist " $obj" 9195d656433aSmrg if test "$len" -lt "$max_cmd_len"; then 9196d656433aSmrg : 9197d656433aSmrg else 9198d656433aSmrg # the above command should be used before it gets too long 9199d656433aSmrg oldobjs=$objlist 9200d656433aSmrg if test "$obj" = "$last_oldobj" ; then 9201d656433aSmrg RANLIB=$save_RANLIB 9202d656433aSmrg fi 9203d656433aSmrg test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 9204d656433aSmrg eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 9205d656433aSmrg objlist= 9206d656433aSmrg len=$len0 9207d656433aSmrg fi 9208d656433aSmrg done 9209d656433aSmrg RANLIB=$save_RANLIB 9210d656433aSmrg oldobjs=$objlist 9211d656433aSmrg if test "X$oldobjs" = "X" ; then 9212d656433aSmrg eval cmds=\"\$concat_cmds\" 9213d656433aSmrg else 9214d656433aSmrg eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 9215d656433aSmrg fi 9216d656433aSmrg fi 9217d656433aSmrg fi 9218d656433aSmrg func_execute_cmds "$cmds" 'exit $?' 9219126a8a12Smrg done 9220126a8a12Smrg 9221d656433aSmrg test -n "$generated" && \ 9222d656433aSmrg func_show_eval "${RM}r$generated" 9223126a8a12Smrg 9224d656433aSmrg # Now create the libtool archive. 9225d656433aSmrg case $output in 9226d656433aSmrg *.la) 9227d656433aSmrg old_library= 9228d656433aSmrg test "$build_old_libs" = yes && old_library="$libname.$libext" 9229d656433aSmrg func_verbose "creating $output" 9230126a8a12Smrg 9231d656433aSmrg # Preserve any variables that may affect compiler behavior 9232d656433aSmrg for var in $variables_saved_for_relink; do 9233d656433aSmrg if eval test -z \"\${$var+set}\"; then 9234d656433aSmrg relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9235d656433aSmrg elif eval var_value=\$$var; test -z "$var_value"; then 9236d656433aSmrg relink_command="$var=; export $var; $relink_command" 9237126a8a12Smrg else 9238d656433aSmrg func_quote_for_eval "$var_value" 9239d656433aSmrg relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9240126a8a12Smrg fi 9241d656433aSmrg done 9242d656433aSmrg # Quote the link command for shipping. 9243d656433aSmrg relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 9244555991fdSmrg relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9245d656433aSmrg if test "$hardcode_automatic" = yes ; then 9246d656433aSmrg relink_command= 9247d656433aSmrg fi 9248126a8a12Smrg 9249d656433aSmrg # Only create the output if not a dry run. 9250d656433aSmrg $opt_dry_run || { 9251d656433aSmrg for installed in no yes; do 9252d656433aSmrg if test "$installed" = yes; then 9253d656433aSmrg if test -z "$install_libdir"; then 9254d656433aSmrg break 9255d656433aSmrg fi 9256d656433aSmrg output="$output_objdir/$outputname"i 9257d656433aSmrg # Replace all uninstalled libtool libraries with the installed ones 9258d656433aSmrg newdependency_libs= 9259d656433aSmrg for deplib in $dependency_libs; do 9260d656433aSmrg case $deplib in 9261d656433aSmrg *.la) 9262d656433aSmrg func_basename "$deplib" 9263d656433aSmrg name="$func_basename_result" 9264d656433aSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 9265d656433aSmrg test -z "$libdir" && \ 9266d656433aSmrg func_fatal_error "\`$deplib' is not a valid libtool archive" 92673c15da26Smrg func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 92683c15da26Smrg ;; 92693c15da26Smrg -L*) 92703c15da26Smrg func_stripname -L '' "$deplib" 92713c15da26Smrg func_replace_sysroot "$func_stripname_result" 92723c15da26Smrg func_append newdependency_libs " -L$func_replace_sysroot_result" 92733c15da26Smrg ;; 92743c15da26Smrg -R*) 92753c15da26Smrg func_stripname -R '' "$deplib" 92763c15da26Smrg func_replace_sysroot "$func_stripname_result" 92773c15da26Smrg func_append newdependency_libs " -R$func_replace_sysroot_result" 9278d656433aSmrg ;; 92793c15da26Smrg *) func_append newdependency_libs " $deplib" ;; 9280d656433aSmrg esac 9281d656433aSmrg done 9282d656433aSmrg dependency_libs="$newdependency_libs" 9283d656433aSmrg newdlfiles= 9284d656433aSmrg 9285d656433aSmrg for lib in $dlfiles; do 9286d656433aSmrg case $lib in 9287d656433aSmrg *.la) 9288d656433aSmrg func_basename "$lib" 9289d656433aSmrg name="$func_basename_result" 9290d656433aSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9291d656433aSmrg test -z "$libdir" && \ 9292d656433aSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 92933c15da26Smrg func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 9294d656433aSmrg ;; 92953c15da26Smrg *) func_append newdlfiles " $lib" ;; 9296d656433aSmrg esac 9297d656433aSmrg done 9298d656433aSmrg dlfiles="$newdlfiles" 9299d656433aSmrg newdlprefiles= 9300d656433aSmrg for lib in $dlprefiles; do 9301d656433aSmrg case $lib in 9302d656433aSmrg *.la) 9303d656433aSmrg # Only pass preopened files to the pseudo-archive (for 9304d656433aSmrg # eventual linking with the app. that links it) if we 9305d656433aSmrg # didn't already link the preopened objects directly into 9306d656433aSmrg # the library: 9307d656433aSmrg func_basename "$lib" 9308d656433aSmrg name="$func_basename_result" 9309d656433aSmrg eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9310d656433aSmrg test -z "$libdir" && \ 9311d656433aSmrg func_fatal_error "\`$lib' is not a valid libtool archive" 93123c15da26Smrg func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 9313d656433aSmrg ;; 9314d656433aSmrg esac 9315d656433aSmrg done 9316d656433aSmrg dlprefiles="$newdlprefiles" 9317d656433aSmrg else 9318d656433aSmrg newdlfiles= 9319d656433aSmrg for lib in $dlfiles; do 9320d656433aSmrg case $lib in 9321d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9322d656433aSmrg *) abs=`pwd`"/$lib" ;; 9323d656433aSmrg esac 93243c15da26Smrg func_append newdlfiles " $abs" 9325d656433aSmrg done 9326d656433aSmrg dlfiles="$newdlfiles" 9327d656433aSmrg newdlprefiles= 9328d656433aSmrg for lib in $dlprefiles; do 9329d656433aSmrg case $lib in 9330d656433aSmrg [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9331d656433aSmrg *) abs=`pwd`"/$lib" ;; 9332d656433aSmrg esac 93333c15da26Smrg func_append newdlprefiles " $abs" 9334d656433aSmrg done 9335d656433aSmrg dlprefiles="$newdlprefiles" 9336d656433aSmrg fi 9337d656433aSmrg $RM $output 9338d656433aSmrg # place dlname in correct position for cygwin 9339555991fdSmrg # In fact, it would be nice if we could use this code for all target 9340555991fdSmrg # systems that can't hard-code library paths into their executables 9341555991fdSmrg # and that have no shared library path variable independent of PATH, 9342555991fdSmrg # but it turns out we can't easily determine that from inspecting 9343555991fdSmrg # libtool variables, so we have to hard-code the OSs to which it 9344555991fdSmrg # applies here; at the moment, that means platforms that use the PE 9345555991fdSmrg # object format with DLL files. See the long comment at the top of 9346555991fdSmrg # tests/bindir.at for full details. 9347d656433aSmrg tdlname=$dlname 9348d656433aSmrg case $host,$output,$installed,$module,$dlname in 9349555991fdSmrg *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 9350555991fdSmrg # If a -bindir argument was supplied, place the dll there. 9351555991fdSmrg if test "x$bindir" != x ; 9352555991fdSmrg then 9353555991fdSmrg func_relative_path "$install_libdir" "$bindir" 9354555991fdSmrg tdlname=$func_relative_path_result$dlname 9355555991fdSmrg else 9356555991fdSmrg # Otherwise fall back on heuristic. 9357555991fdSmrg tdlname=../bin/$dlname 9358555991fdSmrg fi 9359555991fdSmrg ;; 9360d656433aSmrg esac 9361d656433aSmrg $ECHO > $output "\ 9362d656433aSmrg# $outputname - a libtool library file 9363d656433aSmrg# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 9364d656433aSmrg# 9365d656433aSmrg# Please DO NOT delete this file! 9366d656433aSmrg# It is necessary for linking the library. 9367126a8a12Smrg 9368d656433aSmrg# The name that we can dlopen(3). 9369d656433aSmrgdlname='$tdlname' 9370126a8a12Smrg 9371d656433aSmrg# Names of this library. 9372d656433aSmrglibrary_names='$library_names' 9373126a8a12Smrg 9374d656433aSmrg# The name of the static archive. 9375d656433aSmrgold_library='$old_library' 9376126a8a12Smrg 9377d656433aSmrg# Linker flags that can not go in dependency_libs. 9378d656433aSmrginherited_linker_flags='$new_inherited_linker_flags' 9379126a8a12Smrg 9380d656433aSmrg# Libraries that this one depends upon. 9381d656433aSmrgdependency_libs='$dependency_libs' 9382126a8a12Smrg 9383d656433aSmrg# Names of additional weak libraries provided by this library 9384d656433aSmrgweak_library_names='$weak_libs' 9385126a8a12Smrg 9386d656433aSmrg# Version information for $libname. 9387d656433aSmrgcurrent=$current 9388d656433aSmrgage=$age 9389d656433aSmrgrevision=$revision 9390126a8a12Smrg 9391d656433aSmrg# Is this an already installed library? 9392d656433aSmrginstalled=$installed 9393126a8a12Smrg 9394d656433aSmrg# Should we warn about portability when linking against -modules? 9395d656433aSmrgshouldnotlink=$module 9396126a8a12Smrg 9397d656433aSmrg# Files to dlopen/dlpreopen 9398d656433aSmrgdlopen='$dlfiles' 9399d656433aSmrgdlpreopen='$dlprefiles' 9400126a8a12Smrg 9401d656433aSmrg# Directory that this library needs to be installed in: 9402d656433aSmrglibdir='$install_libdir'" 9403d656433aSmrg if test "$installed" = no && test "$need_relink" = yes; then 9404d656433aSmrg $ECHO >> $output "\ 9405d656433aSmrgrelink_command=\"$relink_command\"" 9406d656433aSmrg fi 9407d656433aSmrg done 9408d656433aSmrg } 9409126a8a12Smrg 9410d656433aSmrg # Do a symbolic link so that the libtool archive can be found in 9411d656433aSmrg # LD_LIBRARY_PATH before the program is installed. 9412d656433aSmrg func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 9413d656433aSmrg ;; 9414d656433aSmrg esac 9415d656433aSmrg exit $EXIT_SUCCESS 9416d656433aSmrg} 9417126a8a12Smrg 94183c15da26Smrg{ test "$opt_mode" = link || test "$opt_mode" = relink; } && 9419d656433aSmrg func_mode_link ${1+"$@"} 9420126a8a12Smrg 9421126a8a12Smrg 9422d656433aSmrg# func_mode_uninstall arg... 9423d656433aSmrgfunc_mode_uninstall () 9424d656433aSmrg{ 9425d656433aSmrg $opt_debug 9426d656433aSmrg RM="$nonopt" 9427126a8a12Smrg files= 9428126a8a12Smrg rmforce= 9429126a8a12Smrg exit_status=0 9430126a8a12Smrg 9431126a8a12Smrg # This variable tells wrapper scripts just to set variables rather 9432126a8a12Smrg # than running their programs. 9433126a8a12Smrg libtool_install_magic="$magic" 9434126a8a12Smrg 9435126a8a12Smrg for arg 9436126a8a12Smrg do 9437126a8a12Smrg case $arg in 94383c15da26Smrg -f) func_append RM " $arg"; rmforce=yes ;; 94393c15da26Smrg -*) func_append RM " $arg" ;; 94403c15da26Smrg *) func_append files " $arg" ;; 9441126a8a12Smrg esac 9442126a8a12Smrg done 9443126a8a12Smrg 9444d656433aSmrg test -z "$RM" && \ 9445d656433aSmrg func_fatal_help "you must specify an RM program" 9446126a8a12Smrg 9447126a8a12Smrg rmdirs= 9448126a8a12Smrg 9449126a8a12Smrg for file in $files; do 9450d656433aSmrg func_dirname "$file" "" "." 9451d656433aSmrg dir="$func_dirname_result" 9452d656433aSmrg if test "X$dir" = X.; then 94533c15da26Smrg odir="$objdir" 9454126a8a12Smrg else 94553c15da26Smrg odir="$dir/$objdir" 9456126a8a12Smrg fi 9457d656433aSmrg func_basename "$file" 9458d656433aSmrg name="$func_basename_result" 94593c15da26Smrg test "$opt_mode" = uninstall && odir="$dir" 9460126a8a12Smrg 94613c15da26Smrg # Remember odir for removal later, being careful to avoid duplicates 94623c15da26Smrg if test "$opt_mode" = clean; then 9463126a8a12Smrg case " $rmdirs " in 94643c15da26Smrg *" $odir "*) ;; 94653c15da26Smrg *) func_append rmdirs " $odir" ;; 9466126a8a12Smrg esac 9467126a8a12Smrg fi 9468126a8a12Smrg 9469126a8a12Smrg # Don't error if the file doesn't exist and rm -f was used. 9470d656433aSmrg if { test -L "$file"; } >/dev/null 2>&1 || 9471d656433aSmrg { test -h "$file"; } >/dev/null 2>&1 || 9472d656433aSmrg test -f "$file"; then 9473126a8a12Smrg : 9474126a8a12Smrg elif test -d "$file"; then 9475126a8a12Smrg exit_status=1 9476126a8a12Smrg continue 9477126a8a12Smrg elif test "$rmforce" = yes; then 9478126a8a12Smrg continue 9479126a8a12Smrg fi 9480126a8a12Smrg 9481126a8a12Smrg rmfiles="$file" 9482126a8a12Smrg 9483126a8a12Smrg case $name in 9484126a8a12Smrg *.la) 9485126a8a12Smrg # Possibly a libtool archive, so verify it. 9486d656433aSmrg if func_lalib_p "$file"; then 9487d656433aSmrg func_source $dir/$name 9488126a8a12Smrg 9489126a8a12Smrg # Delete the libtool libraries and symlinks. 9490126a8a12Smrg for n in $library_names; do 94913c15da26Smrg func_append rmfiles " $odir/$n" 9492126a8a12Smrg done 94933c15da26Smrg test -n "$old_library" && func_append rmfiles " $odir/$old_library" 9494126a8a12Smrg 94953c15da26Smrg case "$opt_mode" in 9496126a8a12Smrg clean) 94973c15da26Smrg case " $library_names " in 9498126a8a12Smrg *" $dlname "*) ;; 94993c15da26Smrg *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 9500126a8a12Smrg esac 95013c15da26Smrg test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 9502126a8a12Smrg ;; 9503126a8a12Smrg uninstall) 9504126a8a12Smrg if test -n "$library_names"; then 9505126a8a12Smrg # Do each command in the postuninstall commands. 9506d656433aSmrg func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9507126a8a12Smrg fi 9508126a8a12Smrg 9509126a8a12Smrg if test -n "$old_library"; then 9510126a8a12Smrg # Do each command in the old_postuninstall commands. 9511d656433aSmrg func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9512126a8a12Smrg fi 9513126a8a12Smrg # FIXME: should reinstall the best remaining shared library. 9514126a8a12Smrg ;; 9515126a8a12Smrg esac 9516126a8a12Smrg fi 9517126a8a12Smrg ;; 9518126a8a12Smrg 9519126a8a12Smrg *.lo) 9520126a8a12Smrg # Possibly a libtool object, so verify it. 9521d656433aSmrg if func_lalib_p "$file"; then 9522126a8a12Smrg 9523126a8a12Smrg # Read the .lo file 9524d656433aSmrg func_source $dir/$name 9525126a8a12Smrg 9526126a8a12Smrg # Add PIC object to the list of files to remove. 9527d656433aSmrg if test -n "$pic_object" && 9528d656433aSmrg test "$pic_object" != none; then 95293c15da26Smrg func_append rmfiles " $dir/$pic_object" 9530126a8a12Smrg fi 9531126a8a12Smrg 9532126a8a12Smrg # Add non-PIC object to the list of files to remove. 9533d656433aSmrg if test -n "$non_pic_object" && 9534d656433aSmrg test "$non_pic_object" != none; then 95353c15da26Smrg func_append rmfiles " $dir/$non_pic_object" 9536126a8a12Smrg fi 9537126a8a12Smrg fi 9538126a8a12Smrg ;; 9539126a8a12Smrg 9540126a8a12Smrg *) 95413c15da26Smrg if test "$opt_mode" = clean ; then 9542126a8a12Smrg noexename=$name 9543126a8a12Smrg case $file in 9544126a8a12Smrg *.exe) 9545d656433aSmrg func_stripname '' '.exe' "$file" 9546d656433aSmrg file=$func_stripname_result 9547d656433aSmrg func_stripname '' '.exe' "$name" 9548d656433aSmrg noexename=$func_stripname_result 9549126a8a12Smrg # $file with .exe has already been added to rmfiles, 9550126a8a12Smrg # add $file without .exe 95513c15da26Smrg func_append rmfiles " $file" 9552126a8a12Smrg ;; 9553126a8a12Smrg esac 9554126a8a12Smrg # Do a test to see if this is a libtool program. 9555d656433aSmrg if func_ltwrapper_p "$file"; then 9556d656433aSmrg if func_ltwrapper_executable_p "$file"; then 9557d656433aSmrg func_ltwrapper_scriptname "$file" 9558d656433aSmrg relink_command= 9559d656433aSmrg func_source $func_ltwrapper_scriptname_result 95603c15da26Smrg func_append rmfiles " $func_ltwrapper_scriptname_result" 9561d656433aSmrg else 9562d656433aSmrg relink_command= 9563d656433aSmrg func_source $dir/$noexename 9564d656433aSmrg fi 9565126a8a12Smrg 9566126a8a12Smrg # note $name still contains .exe if it was in $file originally 9567126a8a12Smrg # as does the version of $file that was added into $rmfiles 95683c15da26Smrg func_append rmfiles " $odir/$name $odir/${name}S.${objext}" 9569126a8a12Smrg if test "$fast_install" = yes && test -n "$relink_command"; then 95703c15da26Smrg func_append rmfiles " $odir/lt-$name" 9571126a8a12Smrg fi 9572126a8a12Smrg if test "X$noexename" != "X$name" ; then 95733c15da26Smrg func_append rmfiles " $odir/lt-${noexename}.c" 9574126a8a12Smrg fi 9575126a8a12Smrg fi 9576126a8a12Smrg fi 9577126a8a12Smrg ;; 9578126a8a12Smrg esac 9579d656433aSmrg func_show_eval "$RM $rmfiles" 'exit_status=1' 9580126a8a12Smrg done 9581126a8a12Smrg 9582126a8a12Smrg # Try to remove the ${objdir}s in the directories where we deleted files 9583126a8a12Smrg for dir in $rmdirs; do 9584126a8a12Smrg if test -d "$dir"; then 9585d656433aSmrg func_show_eval "rmdir $dir >/dev/null 2>&1" 9586126a8a12Smrg fi 9587126a8a12Smrg done 9588126a8a12Smrg 9589126a8a12Smrg exit $exit_status 9590d656433aSmrg} 9591126a8a12Smrg 95923c15da26Smrg{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && 9593d656433aSmrg func_mode_uninstall ${1+"$@"} 9594126a8a12Smrg 95953c15da26Smrgtest -z "$opt_mode" && { 9596d656433aSmrg help="$generic_help" 9597d656433aSmrg func_fatal_help "you must specify a MODE" 9598d656433aSmrg} 9599d656433aSmrg 9600d656433aSmrgtest -z "$exec_cmd" && \ 96013c15da26Smrg func_fatal_help "invalid operation mode \`$opt_mode'" 9602126a8a12Smrg 9603126a8a12Smrgif test -n "$exec_cmd"; then 9604d656433aSmrg eval exec "$exec_cmd" 9605126a8a12Smrg exit $EXIT_FAILURE 9606126a8a12Smrgfi 9607126a8a12Smrg 9608d656433aSmrgexit $exit_status 9609126a8a12Smrg 9610126a8a12Smrg 9611126a8a12Smrg# The TAGs below are defined such that we never get into a situation 9612126a8a12Smrg# in which we disable both kinds of libraries. Given conflicting 9613126a8a12Smrg# choices, we go for a static library, that is the most portable, 9614126a8a12Smrg# since we can't tell whether shared libraries were disabled because 9615126a8a12Smrg# the user asked for that or because the platform doesn't support 9616126a8a12Smrg# them. This is particularly important on AIX, because we don't 9617126a8a12Smrg# support having both static and shared libraries enabled at the same 9618126a8a12Smrg# time on that platform, so we default to a shared-only configuration. 9619126a8a12Smrg# If a disable-shared tag is given, we'll fallback to a static-only 9620126a8a12Smrg# configuration. But we'll never go from static-only to shared-only. 9621126a8a12Smrg 9622126a8a12Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 9623d656433aSmrgbuild_libtool_libs=no 9624d656433aSmrgbuild_old_libs=yes 9625126a8a12Smrg# ### END LIBTOOL TAG CONFIG: disable-shared 9626126a8a12Smrg 9627126a8a12Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static 9628d656433aSmrgbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 9629126a8a12Smrg# ### END LIBTOOL TAG CONFIG: disable-static 9630126a8a12Smrg 9631126a8a12Smrg# Local Variables: 9632126a8a12Smrg# mode:shell-script 9633126a8a12Smrg# sh-indentation:2 9634126a8a12Smrg# End: 9635d656433aSmrg# vi:sw=2 9636d656433aSmrg 9637