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