1290001Sglebius 2290001Sglebius# libtool (GNU libtool) 2.4.2 3290001Sglebius# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 4290001Sglebius 5290001Sglebius# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 6290001Sglebius# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. 7290001Sglebius# This is free software; see the source for copying conditions. There is NO 8290001Sglebius# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9290001Sglebius 10290001Sglebius# GNU Libtool is free software; you can redistribute it and/or modify 11290001Sglebius# it under the terms of the GNU General Public License as published by 12290001Sglebius# the Free Software Foundation; either version 2 of the License, or 13290001Sglebius# (at your option) any later version. 14290001Sglebius# 15290001Sglebius# As a special exception to the GNU General Public License, 16290001Sglebius# if you distribute this file as part of a program or library that 17290001Sglebius# is built using GNU Libtool, you may include this file under the 18290001Sglebius# same distribution terms that you use for the rest of that program. 19290001Sglebius# 20290001Sglebius# GNU Libtool is distributed in the hope that it will be useful, but 21290001Sglebius# WITHOUT ANY WARRANTY; without even the implied warranty of 22290001Sglebius# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23290001Sglebius# General Public License for more details. 24290001Sglebius# 25290001Sglebius# You should have received a copy of the GNU General Public License 26290001Sglebius# along with GNU Libtool; see the file COPYING. If not, a copy 27290001Sglebius# can be downloaded from http://www.gnu.org/licenses/gpl.html, 28290001Sglebius# or obtained by writing to the Free Software Foundation, Inc., 29290001Sglebius# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30290001Sglebius 31290001Sglebius# Usage: $progname [OPTION]... [MODE-ARG]... 32290001Sglebius# 33290001Sglebius# Provide generalized library-building support services. 34290001Sglebius# 35290001Sglebius# --config show all configuration variables 36290001Sglebius# --debug enable verbose shell tracing 37290001Sglebius# -n, --dry-run display commands without modifying any files 38290001Sglebius# --features display basic configuration information and exit 39290001Sglebius# --mode=MODE use operation mode MODE 40290001Sglebius# --preserve-dup-deps don't remove duplicate dependency libraries 41290001Sglebius# --quiet, --silent don't print informational messages 42290001Sglebius# --no-quiet, --no-silent 43290001Sglebius# print informational messages (default) 44290001Sglebius# --no-warn don't display warning messages 45290001Sglebius# --tag=TAG use configuration variables from tag TAG 46290001Sglebius# -v, --verbose print more informational messages than default 47290001Sglebius# --no-verbose don't print the extra informational messages 48290001Sglebius# --version print version information 49290001Sglebius# -h, --help, --help-all print short, long, or detailed help message 50290001Sglebius# 51290001Sglebius# MODE must be one of the following: 52290001Sglebius# 53290001Sglebius# clean remove files from the build directory 54290001Sglebius# compile compile a source file into a libtool object 55290001Sglebius# execute automatically set library path, then run a program 56290001Sglebius# finish complete the installation of libtool libraries 57290001Sglebius# install install libraries or executables 58290001Sglebius# link create a library or an executable 59290001Sglebius# uninstall remove libraries from an installed directory 60290001Sglebius# 61290001Sglebius# MODE-ARGS vary depending on the MODE. When passed as first option, 62290001Sglebius# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 63290001Sglebius# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 64290001Sglebius# 65290001Sglebius# When reporting a bug, please describe a test case to reproduce it and 66290001Sglebius# include the following information: 67290001Sglebius# 68290001Sglebius# host-triplet: $host 69290001Sglebius# shell: $SHELL 70290001Sglebius# compiler: $LTCC 71290001Sglebius# compiler flags: $LTCFLAGS 72290001Sglebius# linker: $LD (gnu? $with_gnu_ld) 73290001Sglebius# $progname: (GNU libtool) 2.4.2 74290001Sglebius# automake: $automake_version 75290001Sglebius# autoconf: $autoconf_version 76290001Sglebius# 77290001Sglebius# Report bugs to <bug-libtool@gnu.org>. 78290001Sglebius# GNU libtool home page: <http://www.gnu.org/software/libtool/>. 79290001Sglebius# General help using GNU software: <http://www.gnu.org/gethelp/>. 80290001Sglebius 81290001SglebiusPROGRAM=libtool 82290001SglebiusPACKAGE=libtool 83290001SglebiusVERSION=2.4.2 84290001SglebiusTIMESTAMP="" 85290001Sglebiuspackage_revision=1.3337 86290001Sglebius 87290001Sglebius# Be Bourne compatible 88290001Sglebiusif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 89290001Sglebius emulate sh 90290001Sglebius NULLCMD=: 91290001Sglebius # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 92290001Sglebius # is contrary to our usage. Disable this feature. 93290001Sglebius alias -g '${1+"$@"}'='"$@"' 94290001Sglebius setopt NO_GLOB_SUBST 95290001Sglebiuselse 96290001Sglebius case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 97290001Sglebiusfi 98290001SglebiusBIN_SH=xpg4; export BIN_SH # for Tru64 99290001SglebiusDUALCASE=1; export DUALCASE # for MKS sh 100290001Sglebius 101290001Sglebius# A function that is used when there is no print builtin or printf. 102290001Sglebiusfunc_fallback_echo () 103290001Sglebius{ 104290001Sglebius eval 'cat <<_LTECHO_EOF 105290001Sglebius$1 106290001Sglebius_LTECHO_EOF' 107290001Sglebius} 108290001Sglebius 109290001Sglebius# NLS nuisances: We save the old values to restore during execute mode. 110290001Sglebiuslt_user_locale= 111290001Sglebiuslt_safe_locale= 112290001Sglebiusfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 113290001Sglebiusdo 114290001Sglebius eval "if test \"\${$lt_var+set}\" = set; then 115290001Sglebius save_$lt_var=\$$lt_var 116290001Sglebius $lt_var=C 117290001Sglebius export $lt_var 118290001Sglebius lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 119290001Sglebius lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 120290001Sglebius fi" 121290001Sglebiusdone 122290001SglebiusLC_ALL=C 123290001SglebiusLANGUAGE=C 124290001Sglebiusexport LANGUAGE LC_ALL 125290001Sglebius 126290001Sglebius$lt_unset CDPATH 127290001Sglebius 128290001Sglebius 129290001Sglebius# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 130290001Sglebius# is ksh but when the shell is invoked as "sh" and the current value of 131290001Sglebius# the _XPG environment variable is not equal to 1 (one), the special 132290001Sglebius# positional parameter $0, within a function call, is the name of the 133290001Sglebius# function. 134290001Sglebiusprogpath="$0" 135290001Sglebius 136290001Sglebius 137290001Sglebius 138290001Sglebius: ${CP="cp -f"} 139290001Sglebiustest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 140290001Sglebius: ${MAKE="make"} 141290001Sglebius: ${MKDIR="mkdir"} 142290001Sglebius: ${MV="mv -f"} 143290001Sglebius: ${RM="rm -f"} 144290001Sglebius: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 145290001Sglebius: ${Xsed="$SED -e 1s/^X//"} 146290001Sglebius 147290001Sglebius# Global variables: 148290001SglebiusEXIT_SUCCESS=0 149290001SglebiusEXIT_FAILURE=1 150290001SglebiusEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 151290001SglebiusEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 152290001Sglebius 153290001Sglebiusexit_status=$EXIT_SUCCESS 154290001Sglebius 155290001Sglebius# Make sure IFS has a sensible default 156290001Sglebiuslt_nl=' 157290001Sglebius' 158290001SglebiusIFS=" $lt_nl" 159290001Sglebius 160290001Sglebiusdirname="s,/[^/]*$,," 161290001Sglebiusbasename="s,^.*/,," 162290001Sglebius 163290001Sglebius# func_dirname file append nondir_replacement 164290001Sglebius# Compute the dirname of FILE. If nonempty, add APPEND to the result, 165290001Sglebius# otherwise set result to NONDIR_REPLACEMENT. 166290001Sglebiusfunc_dirname () 167290001Sglebius{ 168290001Sglebius func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` 169290001Sglebius if test "X$func_dirname_result" = "X${1}"; then 170290001Sglebius func_dirname_result="${3}" 171290001Sglebius else 172290001Sglebius func_dirname_result="$func_dirname_result${2}" 173290001Sglebius fi 174290001Sglebius} # func_dirname may be replaced by extended shell implementation 175290001Sglebius 176290001Sglebius 177290001Sglebius# func_basename file 178290001Sglebiusfunc_basename () 179290001Sglebius{ 180290001Sglebius func_basename_result=`$ECHO "${1}" | $SED "$basename"` 181290001Sglebius} # func_basename may be replaced by extended shell implementation 182290001Sglebius 183290001Sglebius 184290001Sglebius# func_dirname_and_basename file append nondir_replacement 185290001Sglebius# perform func_basename and func_dirname in a single function 186290001Sglebius# call: 187290001Sglebius# dirname: Compute the dirname of FILE. If nonempty, 188290001Sglebius# add APPEND to the result, otherwise set result 189290001Sglebius# to NONDIR_REPLACEMENT. 190290001Sglebius# value returned in "$func_dirname_result" 191290001Sglebius# basename: Compute filename of FILE. 192290001Sglebius# value retuned in "$func_basename_result" 193290001Sglebius# Implementation must be kept synchronized with func_dirname 194290001Sglebius# and func_basename. For efficiency, we do not delegate to 195290001Sglebius# those functions but instead duplicate the functionality here. 196290001Sglebiusfunc_dirname_and_basename () 197290001Sglebius{ 198290001Sglebius # Extract subdirectory from the argument. 199290001Sglebius func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 200290001Sglebius if test "X$func_dirname_result" = "X${1}"; then 201290001Sglebius func_dirname_result="${3}" 202290001Sglebius else 203290001Sglebius func_dirname_result="$func_dirname_result${2}" 204290001Sglebius fi 205290001Sglebius func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 206290001Sglebius} # func_dirname_and_basename may be replaced by extended shell implementation 207290001Sglebius 208290001Sglebius 209290001Sglebius# func_stripname prefix suffix name 210290001Sglebius# strip PREFIX and SUFFIX off of NAME. 211290001Sglebius# PREFIX and SUFFIX must not contain globbing or regex special 212290001Sglebius# characters, hashes, percent signs, but SUFFIX may contain a leading 213290001Sglebius# dot (in which case that matches only a dot). 214290001Sglebius# func_strip_suffix prefix name 215290001Sglebiusfunc_stripname () 216290001Sglebius{ 217290001Sglebius case ${2} in 218290001Sglebius .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; 219290001Sglebius *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; 220290001Sglebius esac 221290001Sglebius} # func_stripname may be replaced by extended shell implementation 222290001Sglebius 223290001Sglebius 224290001Sglebius# These SED scripts presuppose an absolute path with a trailing slash. 225290001Sglebiuspathcar='s,^/\([^/]*\).*$,\1,' 226290001Sglebiuspathcdr='s,^/[^/]*,,' 227290001Sglebiusremovedotparts=':dotsl 228290001Sglebius s@/\./@/@g 229290001Sglebius t dotsl 230290001Sglebius s,/\.$,/,' 231290001Sglebiuscollapseslashes='s@/\{1,\}@/@g' 232290001Sglebiusfinalslash='s,/*$,/,' 233290001Sglebius 234290001Sglebius# func_normal_abspath PATH 235290001Sglebius# Remove doubled-up and trailing slashes, "." path components, 236290001Sglebius# and cancel out any ".." path components in PATH after making 237290001Sglebius# it an absolute path. 238290001Sglebius# value returned in "$func_normal_abspath_result" 239290001Sglebiusfunc_normal_abspath () 240290001Sglebius{ 241290001Sglebius # Start from root dir and reassemble the path. 242290001Sglebius func_normal_abspath_result= 243290001Sglebius func_normal_abspath_tpath=$1 244290001Sglebius func_normal_abspath_altnamespace= 245290001Sglebius case $func_normal_abspath_tpath in 246290001Sglebius "") 247290001Sglebius # Empty path, that just means $cwd. 248290001Sglebius func_stripname '' '/' "`pwd`" 249290001Sglebius func_normal_abspath_result=$func_stripname_result 250290001Sglebius return 251290001Sglebius ;; 252290001Sglebius # The next three entries are used to spot a run of precisely 253290001Sglebius # two leading slashes without using negated character classes; 254290001Sglebius # we take advantage of case's first-match behaviour. 255290001Sglebius ///*) 256290001Sglebius # Unusual form of absolute path, do nothing. 257290001Sglebius ;; 258290001Sglebius //*) 259290001Sglebius # Not necessarily an ordinary path; POSIX reserves leading '//' 260290001Sglebius # and for example Cygwin uses it to access remote file shares 261290001Sglebius # over CIFS/SMB, so we conserve a leading double slash if found. 262290001Sglebius func_normal_abspath_altnamespace=/ 263290001Sglebius ;; 264290001Sglebius /*) 265290001Sglebius # Absolute path, do nothing. 266290001Sglebius ;; 267290001Sglebius *) 268290001Sglebius # Relative path, prepend $cwd. 269290001Sglebius func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 270290001Sglebius ;; 271290001Sglebius esac 272290001Sglebius # Cancel out all the simple stuff to save iterations. We also want 273290001Sglebius # the path to end with a slash for ease of parsing, so make sure 274290001Sglebius # there is one (and only one) here. 275290001Sglebius func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 276290001Sglebius -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 277290001Sglebius while :; do 278290001Sglebius # Processed it all yet? 279290001Sglebius if test "$func_normal_abspath_tpath" = / ; then 280290001Sglebius # If we ascended to the root using ".." the result may be empty now. 281290001Sglebius if test -z "$func_normal_abspath_result" ; then 282290001Sglebius func_normal_abspath_result=/ 283290001Sglebius fi 284290001Sglebius break 285290001Sglebius fi 286290001Sglebius func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 287290001Sglebius -e "$pathcar"` 288290001Sglebius func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 289290001Sglebius -e "$pathcdr"` 290290001Sglebius # Figure out what to do with it 291290001Sglebius case $func_normal_abspath_tcomponent in 292290001Sglebius "") 293290001Sglebius # Trailing empty path component, ignore it. 294290001Sglebius ;; 295290001Sglebius ..) 296290001Sglebius # Parent dir; strip last assembled component from result. 297290001Sglebius func_dirname "$func_normal_abspath_result" 298290001Sglebius func_normal_abspath_result=$func_dirname_result 299290001Sglebius ;; 300290001Sglebius *) 301290001Sglebius # Actual path component, append it. 302290001Sglebius func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 303290001Sglebius ;; 304290001Sglebius esac 305290001Sglebius done 306290001Sglebius # Restore leading double-slash if one was found on entry. 307290001Sglebius func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 308290001Sglebius} 309290001Sglebius 310290001Sglebius# func_relative_path SRCDIR DSTDIR 311290001Sglebius# generates a relative path from SRCDIR to DSTDIR, with a trailing 312290001Sglebius# slash if non-empty, suitable for immediately appending a filename 313290001Sglebius# without needing to append a separator. 314290001Sglebius# value returned in "$func_relative_path_result" 315290001Sglebiusfunc_relative_path () 316290001Sglebius{ 317290001Sglebius func_relative_path_result= 318290001Sglebius func_normal_abspath "$1" 319290001Sglebius func_relative_path_tlibdir=$func_normal_abspath_result 320290001Sglebius func_normal_abspath "$2" 321290001Sglebius func_relative_path_tbindir=$func_normal_abspath_result 322290001Sglebius 323290001Sglebius # Ascend the tree starting from libdir 324290001Sglebius while :; do 325290001Sglebius # check if we have found a prefix of bindir 326290001Sglebius case $func_relative_path_tbindir in 327290001Sglebius $func_relative_path_tlibdir) 328290001Sglebius # found an exact match 329290001Sglebius func_relative_path_tcancelled= 330290001Sglebius break 331290001Sglebius ;; 332290001Sglebius $func_relative_path_tlibdir*) 333290001Sglebius # found a matching prefix 334290001Sglebius func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 335290001Sglebius func_relative_path_tcancelled=$func_stripname_result 336290001Sglebius if test -z "$func_relative_path_result"; then 337290001Sglebius func_relative_path_result=. 338290001Sglebius fi 339290001Sglebius break 340290001Sglebius ;; 341290001Sglebius *) 342290001Sglebius func_dirname $func_relative_path_tlibdir 343290001Sglebius func_relative_path_tlibdir=${func_dirname_result} 344290001Sglebius if test "x$func_relative_path_tlibdir" = x ; then 345290001Sglebius # Have to descend all the way to the root! 346290001Sglebius func_relative_path_result=../$func_relative_path_result 347290001Sglebius func_relative_path_tcancelled=$func_relative_path_tbindir 348290001Sglebius break 349290001Sglebius fi 350290001Sglebius func_relative_path_result=../$func_relative_path_result 351290001Sglebius ;; 352290001Sglebius esac 353290001Sglebius done 354290001Sglebius 355290001Sglebius # Now calculate path; take care to avoid doubling-up slashes. 356290001Sglebius func_stripname '' '/' "$func_relative_path_result" 357290001Sglebius func_relative_path_result=$func_stripname_result 358290001Sglebius func_stripname '/' '/' "$func_relative_path_tcancelled" 359290001Sglebius if test "x$func_stripname_result" != x ; then 360290001Sglebius func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 361290001Sglebius fi 362290001Sglebius 363290001Sglebius # Normalisation. If bindir is libdir, return empty string, 364290001Sglebius # else relative path ending with a slash; either way, target 365290001Sglebius # file name can be directly appended. 366290001Sglebius if test ! -z "$func_relative_path_result"; then 367290001Sglebius func_stripname './' '' "$func_relative_path_result/" 368290001Sglebius func_relative_path_result=$func_stripname_result 369290001Sglebius fi 370290001Sglebius} 371290001Sglebius 372290001Sglebius# The name of this program: 373290001Sglebiusfunc_dirname_and_basename "$progpath" 374290001Sglebiusprogname=$func_basename_result 375290001Sglebius 376290001Sglebius# Make sure we have an absolute path for reexecution: 377290001Sglebiuscase $progpath in 378290001Sglebius [\\/]*|[A-Za-z]:\\*) ;; 379290001Sglebius *[\\/]*) 380290001Sglebius progdir=$func_dirname_result 381290001Sglebius progdir=`cd "$progdir" && pwd` 382290001Sglebius progpath="$progdir/$progname" 383290001Sglebius ;; 384290001Sglebius *) 385290001Sglebius save_IFS="$IFS" 386290001Sglebius IFS=${PATH_SEPARATOR-:} 387290001Sglebius for progdir in $PATH; do 388290001Sglebius IFS="$save_IFS" 389290001Sglebius test -x "$progdir/$progname" && break 390290001Sglebius done 391290001Sglebius IFS="$save_IFS" 392290001Sglebius test -n "$progdir" || progdir=`pwd` 393290001Sglebius progpath="$progdir/$progname" 394290001Sglebius ;; 395290001Sglebiusesac 396290001Sglebius 397290001Sglebius# Sed substitution that helps us do robust quoting. It backslashifies 398290001Sglebius# metacharacters that are still active within double-quoted strings. 399290001SglebiusXsed="${SED}"' -e 1s/^X//' 400290001Sglebiussed_quote_subst='s/\([`"$\\]\)/\\\1/g' 401290001Sglebius 402290001Sglebius# Same as above, but do not quote variable references. 403290001Sglebiusdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 404290001Sglebius 405290001Sglebius# Sed substitution that turns a string into a regex matching for the 406290001Sglebius# string literally. 407290001Sglebiussed_make_literal_regex='s,[].[^$\\*\/],\\&,g' 408290001Sglebius 409290001Sglebius# Sed substitution that converts a w32 file name or path 410290001Sglebius# which contains forward slashes, into one that contains 411290001Sglebius# (escaped) backslashes. A very naive implementation. 412290001Sglebiuslt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 413290001Sglebius 414290001Sglebius# Re-`\' parameter expansions in output of double_quote_subst that were 415290001Sglebius# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 416290001Sglebius# in input to double_quote_subst, that '$' was protected from expansion. 417290001Sglebius# Since each input `\' is now two `\'s, look for any number of runs of 418290001Sglebius# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 419290001Sglebiusbs='\\' 420290001Sglebiusbs2='\\\\' 421290001Sglebiusbs4='\\\\\\\\' 422290001Sglebiusdollar='\$' 423290001Sglebiussed_double_backslash="\ 424290001Sglebius s/$bs4/&\\ 425290001Sglebius/g 426290001Sglebius s/^$bs2$dollar/$bs&/ 427290001Sglebius s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 428290001Sglebius s/\n//g" 429290001Sglebius 430290001Sglebius# Standard options: 431290001Sglebiusopt_dry_run=false 432290001Sglebiusopt_help=false 433290001Sglebiusopt_quiet=false 434290001Sglebiusopt_verbose=false 435290001Sglebiusopt_warning=: 436290001Sglebius 437290001Sglebius# func_echo arg... 438290001Sglebius# Echo program name prefixed message, along with the current mode 439290001Sglebius# name if it has been set yet. 440290001Sglebiusfunc_echo () 441290001Sglebius{ 442290001Sglebius $ECHO "$progname: ${opt_mode+$opt_mode: }$*" 443290001Sglebius} 444290001Sglebius 445290001Sglebius# func_verbose arg... 446290001Sglebius# Echo program name prefixed message in verbose mode only. 447290001Sglebiusfunc_verbose () 448290001Sglebius{ 449290001Sglebius $opt_verbose && func_echo ${1+"$@"} 450290001Sglebius 451290001Sglebius # A bug in bash halts the script if the last line of a function 452290001Sglebius # fails when set -e is in force, so we need another command to 453290001Sglebius # work around that: 454290001Sglebius : 455290001Sglebius} 456290001Sglebius 457290001Sglebius# func_echo_all arg... 458290001Sglebius# Invoke $ECHO with all args, space-separated. 459290001Sglebiusfunc_echo_all () 460290001Sglebius{ 461290001Sglebius $ECHO "$*" 462290001Sglebius} 463290001Sglebius 464290001Sglebius# func_error arg... 465290001Sglebius# Echo program name prefixed message to standard error. 466290001Sglebiusfunc_error () 467290001Sglebius{ 468290001Sglebius $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 469290001Sglebius} 470290001Sglebius 471290001Sglebius# func_warning arg... 472290001Sglebius# Echo program name prefixed warning message to standard error. 473290001Sglebiusfunc_warning () 474290001Sglebius{ 475290001Sglebius $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 476290001Sglebius 477290001Sglebius # bash bug again: 478290001Sglebius : 479290001Sglebius} 480290001Sglebius 481290001Sglebius# func_fatal_error arg... 482290001Sglebius# Echo program name prefixed message to standard error, and exit. 483290001Sglebiusfunc_fatal_error () 484290001Sglebius{ 485290001Sglebius func_error ${1+"$@"} 486290001Sglebius exit $EXIT_FAILURE 487290001Sglebius} 488290001Sglebius 489290001Sglebius# func_fatal_help arg... 490290001Sglebius# Echo program name prefixed message to standard error, followed by 491290001Sglebius# a help hint, and exit. 492290001Sglebiusfunc_fatal_help () 493290001Sglebius{ 494290001Sglebius func_error ${1+"$@"} 495290001Sglebius func_fatal_error "$help" 496290001Sglebius} 497290001Sglebiushelp="Try \`$progname --help' for more information." ## default 498290001Sglebius 499290001Sglebius 500290001Sglebius# func_grep expression filename 501290001Sglebius# Check whether EXPRESSION matches any line of FILENAME, without output. 502290001Sglebiusfunc_grep () 503290001Sglebius{ 504290001Sglebius $GREP "$1" "$2" >/dev/null 2>&1 505290001Sglebius} 506290001Sglebius 507290001Sglebius 508290001Sglebius# func_mkdir_p directory-path 509290001Sglebius# Make sure the entire path to DIRECTORY-PATH is available. 510290001Sglebiusfunc_mkdir_p () 511290001Sglebius{ 512290001Sglebius my_directory_path="$1" 513290001Sglebius my_dir_list= 514290001Sglebius 515290001Sglebius if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 516290001Sglebius 517290001Sglebius # Protect directory names starting with `-' 518290001Sglebius case $my_directory_path in 519290001Sglebius -*) my_directory_path="./$my_directory_path" ;; 520290001Sglebius esac 521290001Sglebius 522290001Sglebius # While some portion of DIR does not yet exist... 523290001Sglebius while test ! -d "$my_directory_path"; do 524290001Sglebius # ...make a list in topmost first order. Use a colon delimited 525290001Sglebius # list incase some portion of path contains whitespace. 526290001Sglebius my_dir_list="$my_directory_path:$my_dir_list" 527290001Sglebius 528290001Sglebius # If the last portion added has no slash in it, the list is done 529290001Sglebius case $my_directory_path in */*) ;; *) break ;; esac 530290001Sglebius 531290001Sglebius # ...otherwise throw away the child directory and loop 532290001Sglebius my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 533290001Sglebius done 534290001Sglebius my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 535290001Sglebius 536290001Sglebius save_mkdir_p_IFS="$IFS"; IFS=':' 537290001Sglebius for my_dir in $my_dir_list; do 538290001Sglebius IFS="$save_mkdir_p_IFS" 539290001Sglebius # mkdir can fail with a `File exist' error if two processes 540290001Sglebius # try to create one of the directories concurrently. Don't 541290001Sglebius # stop in that case! 542290001Sglebius $MKDIR "$my_dir" 2>/dev/null || : 543290001Sglebius done 544290001Sglebius IFS="$save_mkdir_p_IFS" 545290001Sglebius 546290001Sglebius # Bail out if we (or some other process) failed to create a directory. 547290001Sglebius test -d "$my_directory_path" || \ 548290001Sglebius func_fatal_error "Failed to create \`$1'" 549290001Sglebius fi 550290001Sglebius} 551290001Sglebius 552290001Sglebius 553290001Sglebius# func_mktempdir [string] 554290001Sglebius# Make a temporary directory that won't clash with other running 555290001Sglebius# libtool processes, and avoids race conditions if possible. If 556290001Sglebius# given, STRING is the basename for that directory. 557290001Sglebiusfunc_mktempdir () 558290001Sglebius{ 559290001Sglebius my_template="${TMPDIR-/tmp}/${1-$progname}" 560290001Sglebius 561290001Sglebius if test "$opt_dry_run" = ":"; then 562290001Sglebius # Return a directory name, but don't create it in dry-run mode 563290001Sglebius my_tmpdir="${my_template}-$$" 564290001Sglebius else 565290001Sglebius 566290001Sglebius # If mktemp works, use that first and foremost 567290001Sglebius my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 568290001Sglebius 569290001Sglebius if test ! -d "$my_tmpdir"; then 570290001Sglebius # Failing that, at least try and use $RANDOM to avoid a race 571290001Sglebius my_tmpdir="${my_template}-${RANDOM-0}$$" 572290001Sglebius 573290001Sglebius save_mktempdir_umask=`umask` 574290001Sglebius umask 0077 575290001Sglebius $MKDIR "$my_tmpdir" 576290001Sglebius umask $save_mktempdir_umask 577290001Sglebius fi 578290001Sglebius 579290001Sglebius # If we're not in dry-run mode, bomb out on failure 580290001Sglebius test -d "$my_tmpdir" || \ 581290001Sglebius func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 582290001Sglebius fi 583290001Sglebius 584290001Sglebius $ECHO "$my_tmpdir" 585290001Sglebius} 586290001Sglebius 587290001Sglebius 588290001Sglebius# func_quote_for_eval arg 589290001Sglebius# Aesthetically quote ARG to be evaled later. 590290001Sglebius# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 591290001Sglebius# is double-quoted, suitable for a subsequent eval, whereas 592290001Sglebius# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 593290001Sglebius# which are still active within double quotes backslashified. 594290001Sglebiusfunc_quote_for_eval () 595290001Sglebius{ 596290001Sglebius case $1 in 597290001Sglebius *[\\\`\"\$]*) 598290001Sglebius func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 599290001Sglebius *) 600290001Sglebius func_quote_for_eval_unquoted_result="$1" ;; 601290001Sglebius esac 602290001Sglebius 603290001Sglebius case $func_quote_for_eval_unquoted_result in 604290001Sglebius # Double-quote args containing shell metacharacters to delay 605290001Sglebius # word splitting, command substitution and and variable 606290001Sglebius # expansion for a subsequent eval. 607290001Sglebius # Many Bourne shells cannot handle close brackets correctly 608290001Sglebius # in scan sets, so we specify it separately. 609290001Sglebius *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 610290001Sglebius func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 611290001Sglebius ;; 612290001Sglebius *) 613290001Sglebius func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 614290001Sglebius esac 615290001Sglebius} 616290001Sglebius 617290001Sglebius 618290001Sglebius# func_quote_for_expand arg 619290001Sglebius# Aesthetically quote ARG to be evaled later; same as above, 620290001Sglebius# but do not quote variable references. 621290001Sglebiusfunc_quote_for_expand () 622290001Sglebius{ 623290001Sglebius case $1 in 624290001Sglebius *[\\\`\"]*) 625290001Sglebius my_arg=`$ECHO "$1" | $SED \ 626290001Sglebius -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 627290001Sglebius *) 628290001Sglebius my_arg="$1" ;; 629290001Sglebius esac 630290001Sglebius 631290001Sglebius case $my_arg in 632290001Sglebius # Double-quote args containing shell metacharacters to delay 633290001Sglebius # word splitting and command substitution for a subsequent eval. 634290001Sglebius # Many Bourne shells cannot handle close brackets correctly 635290001Sglebius # in scan sets, so we specify it separately. 636290001Sglebius *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 637290001Sglebius my_arg="\"$my_arg\"" 638290001Sglebius ;; 639290001Sglebius esac 640290001Sglebius 641290001Sglebius func_quote_for_expand_result="$my_arg" 642290001Sglebius} 643290001Sglebius 644290001Sglebius 645290001Sglebius# func_show_eval cmd [fail_exp] 646290001Sglebius# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 647290001Sglebius# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 648290001Sglebius# is given, then evaluate it. 649290001Sglebiusfunc_show_eval () 650290001Sglebius{ 651290001Sglebius my_cmd="$1" 652290001Sglebius my_fail_exp="${2-:}" 653290001Sglebius 654290001Sglebius ${opt_silent-false} || { 655290001Sglebius func_quote_for_expand "$my_cmd" 656290001Sglebius eval "func_echo $func_quote_for_expand_result" 657290001Sglebius } 658290001Sglebius 659290001Sglebius if ${opt_dry_run-false}; then :; else 660290001Sglebius eval "$my_cmd" 661290001Sglebius my_status=$? 662290001Sglebius if test "$my_status" -eq 0; then :; else 663290001Sglebius eval "(exit $my_status); $my_fail_exp" 664290001Sglebius fi 665290001Sglebius fi 666290001Sglebius} 667290001Sglebius 668290001Sglebius 669290001Sglebius# func_show_eval_locale cmd [fail_exp] 670290001Sglebius# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 671290001Sglebius# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 672290001Sglebius# is given, then evaluate it. Use the saved locale for evaluation. 673290001Sglebiusfunc_show_eval_locale () 674290001Sglebius{ 675290001Sglebius my_cmd="$1" 676290001Sglebius my_fail_exp="${2-:}" 677290001Sglebius 678290001Sglebius ${opt_silent-false} || { 679290001Sglebius func_quote_for_expand "$my_cmd" 680290001Sglebius eval "func_echo $func_quote_for_expand_result" 681290001Sglebius } 682290001Sglebius 683290001Sglebius if ${opt_dry_run-false}; then :; else 684290001Sglebius eval "$lt_user_locale 685290001Sglebius $my_cmd" 686290001Sglebius my_status=$? 687290001Sglebius eval "$lt_safe_locale" 688290001Sglebius if test "$my_status" -eq 0; then :; else 689290001Sglebius eval "(exit $my_status); $my_fail_exp" 690290001Sglebius fi 691290001Sglebius fi 692290001Sglebius} 693290001Sglebius 694290001Sglebius# func_tr_sh 695290001Sglebius# Turn $1 into a string suitable for a shell variable name. 696290001Sglebius# Result is stored in $func_tr_sh_result. All characters 697290001Sglebius# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 698290001Sglebius# if $1 begins with a digit, a '_' is prepended as well. 699290001Sglebiusfunc_tr_sh () 700290001Sglebius{ 701290001Sglebius case $1 in 702290001Sglebius [0-9]* | *[!a-zA-Z0-9_]*) 703290001Sglebius func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` 704290001Sglebius ;; 705290001Sglebius * ) 706290001Sglebius func_tr_sh_result=$1 707290001Sglebius ;; 708290001Sglebius esac 709290001Sglebius} 710290001Sglebius 711290001Sglebius 712290001Sglebius# func_version 713290001Sglebius# Echo version message to standard output and exit. 714290001Sglebiusfunc_version () 715290001Sglebius{ 716290001Sglebius $opt_debug 717290001Sglebius 718290001Sglebius $SED -n '/(C)/!b go 719290001Sglebius :more 720290001Sglebius /\./!{ 721290001Sglebius N 722290001Sglebius s/\n# / / 723290001Sglebius b more 724290001Sglebius } 725290001Sglebius :go 726290001Sglebius /^# '$PROGRAM' (GNU /,/# warranty; / { 727290001Sglebius s/^# // 728290001Sglebius s/^# *$// 729290001Sglebius s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 730290001Sglebius p 731290001Sglebius }' < "$progpath" 732290001Sglebius exit $? 733290001Sglebius} 734290001Sglebius 735290001Sglebius# func_usage 736290001Sglebius# Echo short help message to standard output and exit. 737290001Sglebiusfunc_usage () 738290001Sglebius{ 739290001Sglebius $opt_debug 740290001Sglebius 741290001Sglebius $SED -n '/^# Usage:/,/^# *.*--help/ { 742290001Sglebius s/^# // 743290001Sglebius s/^# *$// 744290001Sglebius s/\$progname/'$progname'/ 745290001Sglebius p 746290001Sglebius }' < "$progpath" 747290001Sglebius echo 748290001Sglebius $ECHO "run \`$progname --help | more' for full usage" 749290001Sglebius exit $? 750290001Sglebius} 751290001Sglebius 752290001Sglebius# func_help [NOEXIT] 753290001Sglebius# Echo long help message to standard output and exit, 754290001Sglebius# unless 'noexit' is passed as argument. 755290001Sglebiusfunc_help () 756290001Sglebius{ 757290001Sglebius $opt_debug 758290001Sglebius 759290001Sglebius $SED -n '/^# Usage:/,/# Report bugs to/ { 760290001Sglebius :print 761290001Sglebius s/^# // 762290001Sglebius s/^# *$// 763290001Sglebius s*\$progname*'$progname'* 764290001Sglebius s*\$host*'"$host"'* 765290001Sglebius s*\$SHELL*'"$SHELL"'* 766290001Sglebius s*\$LTCC*'"$LTCC"'* 767290001Sglebius s*\$LTCFLAGS*'"$LTCFLAGS"'* 768290001Sglebius s*\$LD*'"$LD"'* 769290001Sglebius s/\$with_gnu_ld/'"$with_gnu_ld"'/ 770290001Sglebius s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ 771290001Sglebius s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ 772290001Sglebius p 773290001Sglebius d 774290001Sglebius } 775290001Sglebius /^# .* home page:/b print 776290001Sglebius /^# General help using/b print 777290001Sglebius ' < "$progpath" 778290001Sglebius ret=$? 779290001Sglebius if test -z "$1"; then 780290001Sglebius exit $ret 781290001Sglebius fi 782290001Sglebius} 783290001Sglebius 784290001Sglebius# func_missing_arg argname 785290001Sglebius# Echo program name prefixed message to standard error and set global 786290001Sglebius# exit_cmd. 787290001Sglebiusfunc_missing_arg () 788290001Sglebius{ 789290001Sglebius $opt_debug 790290001Sglebius 791290001Sglebius func_error "missing argument for $1." 792290001Sglebius exit_cmd=exit 793290001Sglebius} 794290001Sglebius 795290001Sglebius 796290001Sglebius# func_split_short_opt shortopt 797290001Sglebius# Set func_split_short_opt_name and func_split_short_opt_arg shell 798290001Sglebius# variables after splitting SHORTOPT after the 2nd character. 799290001Sglebiusfunc_split_short_opt () 800290001Sglebius{ 801290001Sglebius my_sed_short_opt='1s/^\(..\).*$/\1/;q' 802290001Sglebius my_sed_short_rest='1s/^..\(.*\)$/\1/;q' 803290001Sglebius 804290001Sglebius func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` 805290001Sglebius func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` 806290001Sglebius} # func_split_short_opt may be replaced by extended shell implementation 807290001Sglebius 808290001Sglebius 809290001Sglebius# func_split_long_opt longopt 810290001Sglebius# Set func_split_long_opt_name and func_split_long_opt_arg shell 811290001Sglebius# variables after splitting LONGOPT at the `=' sign. 812290001Sglebiusfunc_split_long_opt () 813290001Sglebius{ 814290001Sglebius my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' 815290001Sglebius my_sed_long_arg='1s/^--[^=]*=//' 816290001Sglebius 817290001Sglebius func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` 818290001Sglebius func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` 819290001Sglebius} # func_split_long_opt may be replaced by extended shell implementation 820290001Sglebius 821290001Sglebiusexit_cmd=: 822290001Sglebius 823290001Sglebius 824290001Sglebius 825290001Sglebius 826290001Sglebius 827290001Sglebiusmagic="%%%MAGIC variable%%%" 828290001Sglebiusmagic_exe="%%%MAGIC EXE variable%%%" 829290001Sglebius 830290001Sglebius# Global variables. 831290001Sglebiusnonopt= 832290001Sglebiuspreserve_args= 833290001Sglebiuslo2o="s/\\.lo\$/.${objext}/" 834290001Sglebiuso2lo="s/\\.${objext}\$/.lo/" 835290001Sglebiusextracted_archives= 836290001Sglebiusextracted_serial=0 837290001Sglebius 838290001Sglebius# If this variable is set in any of the actions, the command in it 839290001Sglebius# will be execed at the end. This prevents here-documents from being 840290001Sglebius# left over by shells. 841290001Sglebiusexec_cmd= 842290001Sglebius 843290001Sglebius# func_append var value 844290001Sglebius# Append VALUE to the end of shell variable VAR. 845290001Sglebiusfunc_append () 846290001Sglebius{ 847290001Sglebius eval "${1}=\$${1}\${2}" 848290001Sglebius} # func_append may be replaced by extended shell implementation 849290001Sglebius 850290001Sglebius# func_append_quoted var value 851290001Sglebius# Quote VALUE and append to the end of shell variable VAR, separated 852290001Sglebius# by a space. 853290001Sglebiusfunc_append_quoted () 854290001Sglebius{ 855290001Sglebius func_quote_for_eval "${2}" 856290001Sglebius eval "${1}=\$${1}\\ \$func_quote_for_eval_result" 857290001Sglebius} # func_append_quoted may be replaced by extended shell implementation 858290001Sglebius 859290001Sglebius 860290001Sglebius# func_arith arithmetic-term... 861290001Sglebiusfunc_arith () 862290001Sglebius{ 863290001Sglebius func_arith_result=`expr "${@}"` 864290001Sglebius} # func_arith may be replaced by extended shell implementation 865290001Sglebius 866290001Sglebius 867290001Sglebius# func_len string 868290001Sglebius# STRING may not start with a hyphen. 869290001Sglebiusfunc_len () 870290001Sglebius{ 871290001Sglebius func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` 872290001Sglebius} # func_len may be replaced by extended shell implementation 873290001Sglebius 874290001Sglebius 875290001Sglebius# func_lo2o object 876290001Sglebiusfunc_lo2o () 877290001Sglebius{ 878290001Sglebius func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` 879290001Sglebius} # func_lo2o may be replaced by extended shell implementation 880290001Sglebius 881290001Sglebius 882290001Sglebius# func_xform libobj-or-source 883290001Sglebiusfunc_xform () 884290001Sglebius{ 885290001Sglebius func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` 886290001Sglebius} # func_xform may be replaced by extended shell implementation 887290001Sglebius 888290001Sglebius 889290001Sglebius# func_fatal_configuration arg... 890290001Sglebius# Echo program name prefixed message to standard error, followed by 891290001Sglebius# a configuration failure hint, and exit. 892290001Sglebiusfunc_fatal_configuration () 893290001Sglebius{ 894290001Sglebius func_error ${1+"$@"} 895290001Sglebius func_error "See the $PACKAGE documentation for more information." 896290001Sglebius func_fatal_error "Fatal configuration error." 897290001Sglebius} 898290001Sglebius 899290001Sglebius 900290001Sglebius# func_config 901290001Sglebius# Display the configuration for all the tags in this script. 902290001Sglebiusfunc_config () 903290001Sglebius{ 904290001Sglebius re_begincf='^# ### BEGIN LIBTOOL' 905290001Sglebius re_endcf='^# ### END LIBTOOL' 906290001Sglebius 907290001Sglebius # Default configuration. 908290001Sglebius $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 909290001Sglebius 910290001Sglebius # Now print the configurations for the tags. 911290001Sglebius for tagname in $taglist; do 912290001Sglebius $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 913290001Sglebius done 914290001Sglebius 915290001Sglebius exit $? 916290001Sglebius} 917290001Sglebius 918290001Sglebius# func_features 919290001Sglebius# Display the features supported by this script. 920290001Sglebiusfunc_features () 921290001Sglebius{ 922290001Sglebius echo "host: $host" 923290001Sglebius if test "$build_libtool_libs" = yes; then 924290001Sglebius echo "enable shared libraries" 925290001Sglebius else 926290001Sglebius echo "disable shared libraries" 927290001Sglebius fi 928290001Sglebius if test "$build_old_libs" = yes; then 929290001Sglebius echo "enable static libraries" 930290001Sglebius else 931290001Sglebius echo "disable static libraries" 932290001Sglebius fi 933290001Sglebius 934290001Sglebius exit $? 935290001Sglebius} 936290001Sglebius 937290001Sglebius# func_enable_tag tagname 938290001Sglebius# Verify that TAGNAME is valid, and either flag an error and exit, or 939290001Sglebius# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 940290001Sglebius# variable here. 941290001Sglebiusfunc_enable_tag () 942290001Sglebius{ 943290001Sglebius # Global variable: 944290001Sglebius tagname="$1" 945290001Sglebius 946290001Sglebius re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 947290001Sglebius re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 948290001Sglebius sed_extractcf="/$re_begincf/,/$re_endcf/p" 949290001Sglebius 950290001Sglebius # Validate tagname. 951290001Sglebius case $tagname in 952290001Sglebius *[!-_A-Za-z0-9,/]*) 953290001Sglebius func_fatal_error "invalid tag name: $tagname" 954290001Sglebius ;; 955290001Sglebius esac 956290001Sglebius 957290001Sglebius # Don't test for the "default" C tag, as we know it's 958290001Sglebius # there but not specially marked. 959290001Sglebius case $tagname in 960290001Sglebius CC) ;; 961290001Sglebius *) 962290001Sglebius if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 963290001Sglebius taglist="$taglist $tagname" 964290001Sglebius 965290001Sglebius # Evaluate the configuration. Be careful to quote the path 966290001Sglebius # and the sed script, to avoid splitting on whitespace, but 967290001Sglebius # also don't use non-portable quotes within backquotes within 968290001Sglebius # quotes we have to do it in 2 steps: 969290001Sglebius extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 970290001Sglebius eval "$extractedcf" 971290001Sglebius else 972290001Sglebius func_error "ignoring unknown tag $tagname" 973290001Sglebius fi 974290001Sglebius ;; 975290001Sglebius esac 976290001Sglebius} 977290001Sglebius 978290001Sglebius# func_check_version_match 979290001Sglebius# Ensure that we are using m4 macros, and libtool script from the same 980290001Sglebius# release of libtool. 981290001Sglebiusfunc_check_version_match () 982290001Sglebius{ 983290001Sglebius if test "$package_revision" != "$macro_revision"; then 984290001Sglebius if test "$VERSION" != "$macro_version"; then 985290001Sglebius if test -z "$macro_version"; then 986290001Sglebius cat >&2 <<_LT_EOF 987290001Sglebius$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 988290001Sglebius$progname: definition of this LT_INIT comes from an older release. 989290001Sglebius$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 990290001Sglebius$progname: and run autoconf again. 991290001Sglebius_LT_EOF 992290001Sglebius else 993290001Sglebius cat >&2 <<_LT_EOF 994290001Sglebius$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 995290001Sglebius$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 996290001Sglebius$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 997290001Sglebius$progname: and run autoconf again. 998290001Sglebius_LT_EOF 999290001Sglebius fi 1000290001Sglebius else 1001290001Sglebius cat >&2 <<_LT_EOF 1002290001Sglebius$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 1003290001Sglebius$progname: but the definition of this LT_INIT comes from revision $macro_revision. 1004290001Sglebius$progname: You should recreate aclocal.m4 with macros from revision $package_revision 1005290001Sglebius$progname: of $PACKAGE $VERSION and run autoconf again. 1006290001Sglebius_LT_EOF 1007290001Sglebius fi 1008290001Sglebius 1009290001Sglebius exit $EXIT_MISMATCH 1010290001Sglebius fi 1011290001Sglebius} 1012290001Sglebius 1013290001Sglebius 1014290001Sglebius# Shorthand for --mode=foo, only valid as the first argument 1015290001Sglebiuscase $1 in 1016290001Sglebiusclean|clea|cle|cl) 1017290001Sglebius shift; set dummy --mode clean ${1+"$@"}; shift 1018290001Sglebius ;; 1019290001Sglebiuscompile|compil|compi|comp|com|co|c) 1020290001Sglebius shift; set dummy --mode compile ${1+"$@"}; shift 1021290001Sglebius ;; 1022290001Sglebiusexecute|execut|execu|exec|exe|ex|e) 1023290001Sglebius shift; set dummy --mode execute ${1+"$@"}; shift 1024290001Sglebius ;; 1025290001Sglebiusfinish|finis|fini|fin|fi|f) 1026290001Sglebius shift; set dummy --mode finish ${1+"$@"}; shift 1027290001Sglebius ;; 1028290001Sglebiusinstall|instal|insta|inst|ins|in|i) 1029290001Sglebius shift; set dummy --mode install ${1+"$@"}; shift 1030290001Sglebius ;; 1031290001Sglebiuslink|lin|li|l) 1032290001Sglebius shift; set dummy --mode link ${1+"$@"}; shift 1033290001Sglebius ;; 1034290001Sglebiusuninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 1035290001Sglebius shift; set dummy --mode uninstall ${1+"$@"}; shift 1036290001Sglebius ;; 1037290001Sglebiusesac 1038290001Sglebius 1039290001Sglebius 1040290001Sglebius 1041290001Sglebius# Option defaults: 1042290001Sglebiusopt_debug=: 1043290001Sglebiusopt_dry_run=false 1044290001Sglebiusopt_config=false 1045290001Sglebiusopt_preserve_dup_deps=false 1046290001Sglebiusopt_features=false 1047290001Sglebiusopt_finish=false 1048290001Sglebiusopt_help=false 1049290001Sglebiusopt_help_all=false 1050290001Sglebiusopt_silent=: 1051290001Sglebiusopt_warning=: 1052290001Sglebiusopt_verbose=: 1053290001Sglebiusopt_silent=false 1054290001Sglebiusopt_verbose=false 1055290001Sglebius 1056290001Sglebius 1057290001Sglebius# Parse options once, thoroughly. This comes as soon as possible in the 1058290001Sglebius# script to make things like `--version' happen as quickly as we can. 1059290001Sglebius{ 1060290001Sglebius # this just eases exit handling 1061290001Sglebius while test $# -gt 0; do 1062290001Sglebius opt="$1" 1063290001Sglebius shift 1064290001Sglebius case $opt in 1065290001Sglebius --debug|-x) opt_debug='set -x' 1066290001Sglebius func_echo "enabling shell trace mode" 1067290001Sglebius $opt_debug 1068290001Sglebius ;; 1069290001Sglebius --dry-run|--dryrun|-n) 1070290001Sglebius opt_dry_run=: 1071290001Sglebius ;; 1072290001Sglebius --config) 1073290001Sglebius opt_config=: 1074290001Sglebiusfunc_config 1075290001Sglebius ;; 1076290001Sglebius --dlopen|-dlopen) 1077290001Sglebius optarg="$1" 1078290001Sglebius opt_dlopen="${opt_dlopen+$opt_dlopen 1079290001Sglebius}$optarg" 1080290001Sglebius shift 1081290001Sglebius ;; 1082290001Sglebius --preserve-dup-deps) 1083290001Sglebius opt_preserve_dup_deps=: 1084290001Sglebius ;; 1085290001Sglebius --features) 1086290001Sglebius opt_features=: 1087290001Sglebiusfunc_features 1088290001Sglebius ;; 1089290001Sglebius --finish) 1090290001Sglebius opt_finish=: 1091290001Sglebiusset dummy --mode finish ${1+"$@"}; shift 1092290001Sglebius ;; 1093290001Sglebius --help) 1094290001Sglebius opt_help=: 1095290001Sglebius ;; 1096290001Sglebius --help-all) 1097290001Sglebius opt_help_all=: 1098290001Sglebiusopt_help=': help-all' 1099290001Sglebius ;; 1100290001Sglebius --mode) 1101290001Sglebius test $# = 0 && func_missing_arg $opt && break 1102290001Sglebius optarg="$1" 1103290001Sglebius opt_mode="$optarg" 1104290001Sglebiuscase $optarg in 1105290001Sglebius # Valid mode arguments: 1106290001Sglebius clean|compile|execute|finish|install|link|relink|uninstall) ;; 1107290001Sglebius 1108290001Sglebius # Catch anything else as an error 1109290001Sglebius *) func_error "invalid argument for $opt" 1110290001Sglebius exit_cmd=exit 1111290001Sglebius break 1112290001Sglebius ;; 1113290001Sglebiusesac 1114290001Sglebius shift 1115290001Sglebius ;; 1116290001Sglebius --no-silent|--no-quiet) 1117290001Sglebius opt_silent=false 1118290001Sglebiusfunc_append preserve_args " $opt" 1119290001Sglebius ;; 1120290001Sglebius --no-warning|--no-warn) 1121290001Sglebius opt_warning=false 1122290001Sglebiusfunc_append preserve_args " $opt" 1123290001Sglebius ;; 1124290001Sglebius --no-verbose) 1125290001Sglebius opt_verbose=false 1126290001Sglebiusfunc_append preserve_args " $opt" 1127290001Sglebius ;; 1128290001Sglebius --silent|--quiet) 1129290001Sglebius opt_silent=: 1130290001Sglebiusfunc_append preserve_args " $opt" 1131290001Sglebius opt_verbose=false 1132290001Sglebius ;; 1133290001Sglebius --verbose|-v) 1134290001Sglebius opt_verbose=: 1135290001Sglebiusfunc_append preserve_args " $opt" 1136290001Sglebiusopt_silent=false 1137290001Sglebius ;; 1138290001Sglebius --tag) 1139290001Sglebius test $# = 0 && func_missing_arg $opt && break 1140290001Sglebius optarg="$1" 1141290001Sglebius opt_tag="$optarg" 1142290001Sglebiusfunc_append preserve_args " $opt $optarg" 1143290001Sglebiusfunc_enable_tag "$optarg" 1144290001Sglebius shift 1145290001Sglebius ;; 1146290001Sglebius 1147290001Sglebius -\?|-h) func_usage ;; 1148290001Sglebius --help) func_help ;; 1149290001Sglebius --version) func_version ;; 1150290001Sglebius 1151290001Sglebius # Separate optargs to long options: 1152290001Sglebius --*=*) 1153290001Sglebius func_split_long_opt "$opt" 1154290001Sglebius set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} 1155290001Sglebius shift 1156290001Sglebius ;; 1157290001Sglebius 1158290001Sglebius # Separate non-argument short options: 1159290001Sglebius -\?*|-h*|-n*|-v*) 1160290001Sglebius func_split_short_opt "$opt" 1161290001Sglebius set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} 1162290001Sglebius shift 1163290001Sglebius ;; 1164290001Sglebius 1165290001Sglebius --) break ;; 1166290001Sglebius -*) func_fatal_help "unrecognized option \`$opt'" ;; 1167290001Sglebius *) set dummy "$opt" ${1+"$@"}; shift; break ;; 1168290001Sglebius esac 1169290001Sglebius done 1170290001Sglebius 1171290001Sglebius # Validate options: 1172290001Sglebius 1173290001Sglebius # save first non-option argument 1174290001Sglebius if test "$#" -gt 0; then 1175290001Sglebius nonopt="$opt" 1176290001Sglebius shift 1177290001Sglebius fi 1178290001Sglebius 1179290001Sglebius # preserve --debug 1180290001Sglebius test "$opt_debug" = : || func_append preserve_args " --debug" 1181290001Sglebius 1182290001Sglebius case $host in 1183290001Sglebius *cygwin* | *mingw* | *pw32* | *cegcc*) 1184290001Sglebius # don't eliminate duplications in $postdeps and $predeps 1185290001Sglebius opt_duplicate_compiler_generated_deps=: 1186290001Sglebius ;; 1187290001Sglebius *) 1188290001Sglebius opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 1189290001Sglebius ;; 1190290001Sglebius esac 1191290001Sglebius 1192290001Sglebius $opt_help || { 1193290001Sglebius # Sanity checks first: 1194290001Sglebius func_check_version_match 1195290001Sglebius 1196290001Sglebius if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 1197290001Sglebius func_fatal_configuration "not configured to build any kind of library" 1198290001Sglebius fi 1199290001Sglebius 1200290001Sglebius # Darwin sucks 1201290001Sglebius eval std_shrext=\"$shrext_cmds\" 1202290001Sglebius 1203290001Sglebius # Only execute mode is allowed to have -dlopen flags. 1204290001Sglebius if test -n "$opt_dlopen" && test "$opt_mode" != execute; then 1205290001Sglebius func_error "unrecognized option \`-dlopen'" 1206290001Sglebius $ECHO "$help" 1>&2 1207290001Sglebius exit $EXIT_FAILURE 1208290001Sglebius fi 1209290001Sglebius 1210290001Sglebius # Change the help message to a mode-specific one. 1211290001Sglebius generic_help="$help" 1212290001Sglebius help="Try \`$progname --help --mode=$opt_mode' for more information." 1213290001Sglebius } 1214290001Sglebius 1215290001Sglebius 1216290001Sglebius # Bail if the options were screwed 1217290001Sglebius $exit_cmd $EXIT_FAILURE 1218290001Sglebius} 1219290001Sglebius 1220290001Sglebius 1221290001Sglebius 1222290001Sglebius 1223290001Sglebius## ----------- ## 1224290001Sglebius## Main. ## 1225290001Sglebius## ----------- ## 1226290001Sglebius 1227290001Sglebius# func_lalib_p file 1228290001Sglebius# True iff FILE is a libtool `.la' library or `.lo' object file. 1229290001Sglebius# This function is only a basic sanity check; it will hardly flush out 1230290001Sglebius# determined imposters. 1231290001Sglebiusfunc_lalib_p () 1232290001Sglebius{ 1233290001Sglebius test -f "$1" && 1234290001Sglebius $SED -e 4q "$1" 2>/dev/null \ 1235290001Sglebius | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 1236290001Sglebius} 1237290001Sglebius 1238290001Sglebius# func_lalib_unsafe_p file 1239290001Sglebius# True iff FILE is a libtool `.la' library or `.lo' object file. 1240290001Sglebius# This function implements the same check as func_lalib_p without 1241290001Sglebius# resorting to external programs. To this end, it redirects stdin and 1242290001Sglebius# closes it afterwards, without saving the original file descriptor. 1243290001Sglebius# As a safety measure, use it only where a negative result would be 1244290001Sglebius# fatal anyway. Works if `file' does not exist. 1245290001Sglebiusfunc_lalib_unsafe_p () 1246290001Sglebius{ 1247290001Sglebius lalib_p=no 1248290001Sglebius if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 1249290001Sglebius for lalib_p_l in 1 2 3 4 1250290001Sglebius do 1251290001Sglebius read lalib_p_line 1252290001Sglebius case "$lalib_p_line" in 1253290001Sglebius \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 1254290001Sglebius esac 1255290001Sglebius done 1256290001Sglebius exec 0<&5 5<&- 1257290001Sglebius fi 1258290001Sglebius test "$lalib_p" = yes 1259290001Sglebius} 1260290001Sglebius 1261290001Sglebius# func_ltwrapper_script_p file 1262290001Sglebius# True iff FILE is a libtool wrapper script 1263290001Sglebius# This function is only a basic sanity check; it will hardly flush out 1264290001Sglebius# determined imposters. 1265290001Sglebiusfunc_ltwrapper_script_p () 1266290001Sglebius{ 1267290001Sglebius func_lalib_p "$1" 1268290001Sglebius} 1269290001Sglebius 1270290001Sglebius# func_ltwrapper_executable_p file 1271290001Sglebius# True iff FILE is a libtool wrapper executable 1272290001Sglebius# This function is only a basic sanity check; it will hardly flush out 1273290001Sglebius# determined imposters. 1274290001Sglebiusfunc_ltwrapper_executable_p () 1275290001Sglebius{ 1276290001Sglebius func_ltwrapper_exec_suffix= 1277290001Sglebius case $1 in 1278290001Sglebius *.exe) ;; 1279290001Sglebius *) func_ltwrapper_exec_suffix=.exe ;; 1280290001Sglebius esac 1281290001Sglebius $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 1282290001Sglebius} 1283290001Sglebius 1284290001Sglebius# func_ltwrapper_scriptname file 1285290001Sglebius# Assumes file is an ltwrapper_executable 1286290001Sglebius# uses $file to determine the appropriate filename for a 1287290001Sglebius# temporary ltwrapper_script. 1288290001Sglebiusfunc_ltwrapper_scriptname () 1289290001Sglebius{ 1290290001Sglebius func_dirname_and_basename "$1" "" "." 1291290001Sglebius func_stripname '' '.exe' "$func_basename_result" 1292290001Sglebius func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 1293290001Sglebius} 1294290001Sglebius 1295290001Sglebius# func_ltwrapper_p file 1296290001Sglebius# True iff FILE is a libtool wrapper script or wrapper executable 1297290001Sglebius# This function is only a basic sanity check; it will hardly flush out 1298290001Sglebius# determined imposters. 1299290001Sglebiusfunc_ltwrapper_p () 1300290001Sglebius{ 1301290001Sglebius func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 1302290001Sglebius} 1303290001Sglebius 1304290001Sglebius 1305290001Sglebius# func_execute_cmds commands fail_cmd 1306290001Sglebius# Execute tilde-delimited COMMANDS. 1307290001Sglebius# If FAIL_CMD is given, eval that upon failure. 1308290001Sglebius# FAIL_CMD may read-access the current command in variable CMD! 1309290001Sglebiusfunc_execute_cmds () 1310290001Sglebius{ 1311290001Sglebius $opt_debug 1312290001Sglebius save_ifs=$IFS; IFS='~' 1313290001Sglebius for cmd in $1; do 1314290001Sglebius IFS=$save_ifs 1315290001Sglebius eval cmd=\"$cmd\" 1316290001Sglebius func_show_eval "$cmd" "${2-:}" 1317290001Sglebius done 1318290001Sglebius IFS=$save_ifs 1319290001Sglebius} 1320290001Sglebius 1321290001Sglebius 1322290001Sglebius# func_source file 1323290001Sglebius# Source FILE, adding directory component if necessary. 1324290001Sglebius# Note that it is not necessary on cygwin/mingw to append a dot to 1325290001Sglebius# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 1326290001Sglebius# behavior happens only for exec(3), not for open(2)! Also, sourcing 1327290001Sglebius# `FILE.' does not work on cygwin managed mounts. 1328290001Sglebiusfunc_source () 1329290001Sglebius{ 1330290001Sglebius $opt_debug 1331290001Sglebius case $1 in 1332290001Sglebius */* | *\\*) . "$1" ;; 1333290001Sglebius *) . "./$1" ;; 1334290001Sglebius esac 1335290001Sglebius} 1336290001Sglebius 1337290001Sglebius 1338290001Sglebius# func_resolve_sysroot PATH 1339290001Sglebius# Replace a leading = in PATH with a sysroot. Store the result into 1340290001Sglebius# func_resolve_sysroot_result 1341290001Sglebiusfunc_resolve_sysroot () 1342290001Sglebius{ 1343290001Sglebius func_resolve_sysroot_result=$1 1344290001Sglebius case $func_resolve_sysroot_result in 1345290001Sglebius =*) 1346290001Sglebius func_stripname '=' '' "$func_resolve_sysroot_result" 1347290001Sglebius func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 1348290001Sglebius ;; 1349290001Sglebius esac 1350290001Sglebius} 1351290001Sglebius 1352290001Sglebius# func_replace_sysroot PATH 1353290001Sglebius# If PATH begins with the sysroot, replace it with = and 1354290001Sglebius# store the result into func_replace_sysroot_result. 1355290001Sglebiusfunc_replace_sysroot () 1356290001Sglebius{ 1357290001Sglebius case "$lt_sysroot:$1" in 1358290001Sglebius ?*:"$lt_sysroot"*) 1359290001Sglebius func_stripname "$lt_sysroot" '' "$1" 1360290001Sglebius func_replace_sysroot_result="=$func_stripname_result" 1361290001Sglebius ;; 1362290001Sglebius *) 1363290001Sglebius # Including no sysroot. 1364290001Sglebius func_replace_sysroot_result=$1 1365290001Sglebius ;; 1366290001Sglebius esac 1367290001Sglebius} 1368290001Sglebius 1369290001Sglebius# func_infer_tag arg 1370290001Sglebius# Infer tagged configuration to use if any are available and 1371290001Sglebius# if one wasn't chosen via the "--tag" command line option. 1372290001Sglebius# Only attempt this if the compiler in the base compile 1373290001Sglebius# command doesn't match the default compiler. 1374290001Sglebius# arg is usually of the form 'gcc ...' 1375290001Sglebiusfunc_infer_tag () 1376290001Sglebius{ 1377290001Sglebius $opt_debug 1378290001Sglebius if test -n "$available_tags" && test -z "$tagname"; then 1379290001Sglebius CC_quoted= 1380290001Sglebius for arg in $CC; do 1381290001Sglebius func_append_quoted CC_quoted "$arg" 1382290001Sglebius done 1383290001Sglebius CC_expanded=`func_echo_all $CC` 1384290001Sglebius CC_quoted_expanded=`func_echo_all $CC_quoted` 1385290001Sglebius case $@ in 1386290001Sglebius # Blanks in the command may have been stripped by the calling shell, 1387290001Sglebius # but not from the CC environment variable when configure was run. 1388290001Sglebius " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1389290001Sglebius " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 1390290001Sglebius # Blanks at the start of $base_compile will cause this to fail 1391290001Sglebius # if we don't check for them as well. 1392290001Sglebius *) 1393290001Sglebius for z in $available_tags; do 1394290001Sglebius if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 1395290001Sglebius # Evaluate the configuration. 1396290001Sglebius eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 1397290001Sglebius CC_quoted= 1398290001Sglebius for arg in $CC; do 1399290001Sglebius # Double-quote args containing other shell metacharacters. 1400290001Sglebius func_append_quoted CC_quoted "$arg" 1401290001Sglebius done 1402290001Sglebius CC_expanded=`func_echo_all $CC` 1403290001Sglebius CC_quoted_expanded=`func_echo_all $CC_quoted` 1404290001Sglebius case "$@ " in 1405290001Sglebius " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1406290001Sglebius " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 1407290001Sglebius # The compiler in the base compile command matches 1408290001Sglebius # the one in the tagged configuration. 1409290001Sglebius # Assume this is the tagged configuration we want. 1410290001Sglebius tagname=$z 1411290001Sglebius break 1412290001Sglebius ;; 1413290001Sglebius esac 1414290001Sglebius fi 1415290001Sglebius done 1416290001Sglebius # If $tagname still isn't set, then no tagged configuration 1417290001Sglebius # was found and let the user know that the "--tag" command 1418290001Sglebius # line option must be used. 1419290001Sglebius if test -z "$tagname"; then 1420290001Sglebius func_echo "unable to infer tagged configuration" 1421290001Sglebius func_fatal_error "specify a tag with \`--tag'" 1422290001Sglebius# else 1423290001Sglebius# func_verbose "using $tagname tagged configuration" 1424290001Sglebius fi 1425290001Sglebius ;; 1426290001Sglebius esac 1427290001Sglebius fi 1428290001Sglebius} 1429290001Sglebius 1430290001Sglebius 1431290001Sglebius 1432290001Sglebius# func_write_libtool_object output_name pic_name nonpic_name 1433290001Sglebius# Create a libtool object file (analogous to a ".la" file), 1434290001Sglebius# but don't create it if we're doing a dry run. 1435290001Sglebiusfunc_write_libtool_object () 1436290001Sglebius{ 1437290001Sglebius write_libobj=${1} 1438290001Sglebius if test "$build_libtool_libs" = yes; then 1439290001Sglebius write_lobj=\'${2}\' 1440290001Sglebius else 1441290001Sglebius write_lobj=none 1442290001Sglebius fi 1443290001Sglebius 1444290001Sglebius if test "$build_old_libs" = yes; then 1445290001Sglebius write_oldobj=\'${3}\' 1446290001Sglebius else 1447290001Sglebius write_oldobj=none 1448290001Sglebius fi 1449290001Sglebius 1450290001Sglebius $opt_dry_run || { 1451290001Sglebius cat >${write_libobj}T <<EOF 1452290001Sglebius# $write_libobj - a libtool object file 1453290001Sglebius# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1454290001Sglebius# 1455290001Sglebius# Please DO NOT delete this file! 1456290001Sglebius# It is necessary for linking the library. 1457290001Sglebius 1458290001Sglebius# Name of the PIC object. 1459290001Sglebiuspic_object=$write_lobj 1460290001Sglebius 1461290001Sglebius# Name of the non-PIC object 1462290001Sglebiusnon_pic_object=$write_oldobj 1463290001Sglebius 1464290001SglebiusEOF 1465290001Sglebius $MV "${write_libobj}T" "${write_libobj}" 1466290001Sglebius } 1467290001Sglebius} 1468290001Sglebius 1469290001Sglebius 1470290001Sglebius################################################## 1471290001Sglebius# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 1472290001Sglebius################################################## 1473290001Sglebius 1474290001Sglebius# func_convert_core_file_wine_to_w32 ARG 1475290001Sglebius# Helper function used by file name conversion functions when $build is *nix, 1476290001Sglebius# and $host is mingw, cygwin, or some other w32 environment. Relies on a 1477290001Sglebius# correctly configured wine environment available, with the winepath program 1478290001Sglebius# in $build's $PATH. 1479290001Sglebius# 1480290001Sglebius# ARG is the $build file name to be converted to w32 format. 1481290001Sglebius# Result is available in $func_convert_core_file_wine_to_w32_result, and will 1482290001Sglebius# be empty on error (or when ARG is empty) 1483290001Sglebiusfunc_convert_core_file_wine_to_w32 () 1484290001Sglebius{ 1485290001Sglebius $opt_debug 1486290001Sglebius func_convert_core_file_wine_to_w32_result="$1" 1487290001Sglebius if test -n "$1"; then 1488290001Sglebius # Unfortunately, winepath does not exit with a non-zero error code, so we 1489290001Sglebius # are forced to check the contents of stdout. On the other hand, if the 1490290001Sglebius # command is not found, the shell will set an exit code of 127 and print 1491290001Sglebius # *an error message* to stdout. So we must check for both error code of 1492290001Sglebius # zero AND non-empty stdout, which explains the odd construction: 1493290001Sglebius func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 1494290001Sglebius if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then 1495290001Sglebius func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 1496290001Sglebius $SED -e "$lt_sed_naive_backslashify"` 1497290001Sglebius else 1498290001Sglebius func_convert_core_file_wine_to_w32_result= 1499290001Sglebius fi 1500290001Sglebius fi 1501290001Sglebius} 1502290001Sglebius# end: func_convert_core_file_wine_to_w32 1503290001Sglebius 1504290001Sglebius 1505290001Sglebius# func_convert_core_path_wine_to_w32 ARG 1506290001Sglebius# Helper function used by path conversion functions when $build is *nix, and 1507290001Sglebius# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 1508290001Sglebius# configured wine environment available, with the winepath program in $build's 1509290001Sglebius# $PATH. Assumes ARG has no leading or trailing path separator characters. 1510290001Sglebius# 1511290001Sglebius# ARG is path to be converted from $build format to win32. 1512290001Sglebius# Result is available in $func_convert_core_path_wine_to_w32_result. 1513290001Sglebius# Unconvertible file (directory) names in ARG are skipped; if no directory names 1514290001Sglebius# are convertible, then the result may be empty. 1515290001Sglebiusfunc_convert_core_path_wine_to_w32 () 1516290001Sglebius{ 1517290001Sglebius $opt_debug 1518290001Sglebius # unfortunately, winepath doesn't convert paths, only file names 1519290001Sglebius func_convert_core_path_wine_to_w32_result="" 1520290001Sglebius if test -n "$1"; then 1521290001Sglebius oldIFS=$IFS 1522290001Sglebius IFS=: 1523290001Sglebius for func_convert_core_path_wine_to_w32_f in $1; do 1524290001Sglebius IFS=$oldIFS 1525290001Sglebius func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 1526290001Sglebius if test -n "$func_convert_core_file_wine_to_w32_result" ; then 1527290001Sglebius if test -z "$func_convert_core_path_wine_to_w32_result"; then 1528290001Sglebius func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" 1529290001Sglebius else 1530290001Sglebius func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 1531290001Sglebius fi 1532290001Sglebius fi 1533290001Sglebius done 1534290001Sglebius IFS=$oldIFS 1535290001Sglebius fi 1536290001Sglebius} 1537290001Sglebius# end: func_convert_core_path_wine_to_w32 1538290001Sglebius 1539290001Sglebius 1540290001Sglebius# func_cygpath ARGS... 1541290001Sglebius# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 1542290001Sglebius# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 1543290001Sglebius# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 1544290001Sglebius# (2), returns the Cygwin file name or path in func_cygpath_result (input 1545290001Sglebius# file name or path is assumed to be in w32 format, as previously converted 1546290001Sglebius# from $build's *nix or MSYS format). In case (3), returns the w32 file name 1547290001Sglebius# or path in func_cygpath_result (input file name or path is assumed to be in 1548290001Sglebius# Cygwin format). Returns an empty string on error. 1549290001Sglebius# 1550290001Sglebius# ARGS are passed to cygpath, with the last one being the file name or path to 1551290001Sglebius# be converted. 1552290001Sglebius# 1553290001Sglebius# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 1554290001Sglebius# environment variable; do not put it in $PATH. 1555290001Sglebiusfunc_cygpath () 1556290001Sglebius{ 1557290001Sglebius $opt_debug 1558290001Sglebius if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 1559290001Sglebius func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 1560290001Sglebius if test "$?" -ne 0; then 1561290001Sglebius # on failure, ensure result is empty 1562290001Sglebius func_cygpath_result= 1563290001Sglebius fi 1564290001Sglebius else 1565290001Sglebius func_cygpath_result= 1566290001Sglebius func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" 1567290001Sglebius fi 1568290001Sglebius} 1569290001Sglebius#end: func_cygpath 1570290001Sglebius 1571290001Sglebius 1572290001Sglebius# func_convert_core_msys_to_w32 ARG 1573290001Sglebius# Convert file name or path ARG from MSYS format to w32 format. Return 1574290001Sglebius# result in func_convert_core_msys_to_w32_result. 1575290001Sglebiusfunc_convert_core_msys_to_w32 () 1576290001Sglebius{ 1577290001Sglebius $opt_debug 1578290001Sglebius # awkward: cmd appends spaces to result 1579290001Sglebius func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 1580290001Sglebius $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 1581290001Sglebius} 1582290001Sglebius#end: func_convert_core_msys_to_w32 1583290001Sglebius 1584290001Sglebius 1585290001Sglebius# func_convert_file_check ARG1 ARG2 1586290001Sglebius# Verify that ARG1 (a file name in $build format) was converted to $host 1587290001Sglebius# format in ARG2. Otherwise, emit an error message, but continue (resetting 1588290001Sglebius# func_to_host_file_result to ARG1). 1589290001Sglebiusfunc_convert_file_check () 1590290001Sglebius{ 1591290001Sglebius $opt_debug 1592290001Sglebius if test -z "$2" && test -n "$1" ; then 1593290001Sglebius func_error "Could not determine host file name corresponding to" 1594290001Sglebius func_error " \`$1'" 1595290001Sglebius func_error "Continuing, but uninstalled executables may not work." 1596290001Sglebius # Fallback: 1597290001Sglebius func_to_host_file_result="$1" 1598290001Sglebius fi 1599290001Sglebius} 1600290001Sglebius# end func_convert_file_check 1601290001Sglebius 1602290001Sglebius 1603290001Sglebius# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 1604290001Sglebius# Verify that FROM_PATH (a path in $build format) was converted to $host 1605290001Sglebius# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 1606290001Sglebius# func_to_host_file_result to a simplistic fallback value (see below). 1607290001Sglebiusfunc_convert_path_check () 1608290001Sglebius{ 1609290001Sglebius $opt_debug 1610290001Sglebius if test -z "$4" && test -n "$3"; then 1611290001Sglebius func_error "Could not determine the host path corresponding to" 1612290001Sglebius func_error " \`$3'" 1613290001Sglebius func_error "Continuing, but uninstalled executables may not work." 1614290001Sglebius # Fallback. This is a deliberately simplistic "conversion" and 1615290001Sglebius # should not be "improved". See libtool.info. 1616290001Sglebius if test "x$1" != "x$2"; then 1617290001Sglebius lt_replace_pathsep_chars="s|$1|$2|g" 1618290001Sglebius func_to_host_path_result=`echo "$3" | 1619290001Sglebius $SED -e "$lt_replace_pathsep_chars"` 1620290001Sglebius else 1621290001Sglebius func_to_host_path_result="$3" 1622290001Sglebius fi 1623290001Sglebius fi 1624290001Sglebius} 1625290001Sglebius# end func_convert_path_check 1626290001Sglebius 1627290001Sglebius 1628290001Sglebius# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 1629290001Sglebius# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 1630290001Sglebius# and appending REPL if ORIG matches BACKPAT. 1631290001Sglebiusfunc_convert_path_front_back_pathsep () 1632290001Sglebius{ 1633290001Sglebius $opt_debug 1634290001Sglebius case $4 in 1635290001Sglebius $1 ) func_to_host_path_result="$3$func_to_host_path_result" 1636290001Sglebius ;; 1637290001Sglebius esac 1638290001Sglebius case $4 in 1639290001Sglebius $2 ) func_append func_to_host_path_result "$3" 1640290001Sglebius ;; 1641290001Sglebius esac 1642290001Sglebius} 1643290001Sglebius# end func_convert_path_front_back_pathsep 1644290001Sglebius 1645290001Sglebius 1646290001Sglebius################################################## 1647290001Sglebius# $build to $host FILE NAME CONVERSION FUNCTIONS # 1648290001Sglebius################################################## 1649290001Sglebius# invoked via `$to_host_file_cmd ARG' 1650290001Sglebius# 1651290001Sglebius# In each case, ARG is the path to be converted from $build to $host format. 1652290001Sglebius# Result will be available in $func_to_host_file_result. 1653290001Sglebius 1654290001Sglebius 1655290001Sglebius# func_to_host_file ARG 1656290001Sglebius# Converts the file name ARG from $build format to $host format. Return result 1657290001Sglebius# in func_to_host_file_result. 1658290001Sglebiusfunc_to_host_file () 1659290001Sglebius{ 1660290001Sglebius $opt_debug 1661290001Sglebius $to_host_file_cmd "$1" 1662290001Sglebius} 1663290001Sglebius# end func_to_host_file 1664290001Sglebius 1665290001Sglebius 1666290001Sglebius# func_to_tool_file ARG LAZY 1667290001Sglebius# converts the file name ARG from $build format to toolchain format. Return 1668290001Sglebius# result in func_to_tool_file_result. If the conversion in use is listed 1669290001Sglebius# in (the comma separated) LAZY, no conversion takes place. 1670290001Sglebiusfunc_to_tool_file () 1671290001Sglebius{ 1672290001Sglebius $opt_debug 1673290001Sglebius case ,$2, in 1674290001Sglebius *,"$to_tool_file_cmd",*) 1675290001Sglebius func_to_tool_file_result=$1 1676290001Sglebius ;; 1677290001Sglebius *) 1678290001Sglebius $to_tool_file_cmd "$1" 1679290001Sglebius func_to_tool_file_result=$func_to_host_file_result 1680290001Sglebius ;; 1681290001Sglebius esac 1682290001Sglebius} 1683290001Sglebius# end func_to_tool_file 1684290001Sglebius 1685290001Sglebius 1686290001Sglebius# func_convert_file_noop ARG 1687290001Sglebius# Copy ARG to func_to_host_file_result. 1688290001Sglebiusfunc_convert_file_noop () 1689290001Sglebius{ 1690290001Sglebius func_to_host_file_result="$1" 1691290001Sglebius} 1692290001Sglebius# end func_convert_file_noop 1693290001Sglebius 1694290001Sglebius 1695290001Sglebius# func_convert_file_msys_to_w32 ARG 1696290001Sglebius# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 1697290001Sglebius# conversion to w32 is not available inside the cwrapper. Returns result in 1698290001Sglebius# func_to_host_file_result. 1699290001Sglebiusfunc_convert_file_msys_to_w32 () 1700290001Sglebius{ 1701290001Sglebius $opt_debug 1702290001Sglebius func_to_host_file_result="$1" 1703290001Sglebius if test -n "$1"; then 1704290001Sglebius func_convert_core_msys_to_w32 "$1" 1705290001Sglebius func_to_host_file_result="$func_convert_core_msys_to_w32_result" 1706290001Sglebius fi 1707290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1708290001Sglebius} 1709290001Sglebius# end func_convert_file_msys_to_w32 1710290001Sglebius 1711290001Sglebius 1712290001Sglebius# func_convert_file_cygwin_to_w32 ARG 1713290001Sglebius# Convert file name ARG from Cygwin to w32 format. Returns result in 1714290001Sglebius# func_to_host_file_result. 1715290001Sglebiusfunc_convert_file_cygwin_to_w32 () 1716290001Sglebius{ 1717290001Sglebius $opt_debug 1718290001Sglebius func_to_host_file_result="$1" 1719290001Sglebius if test -n "$1"; then 1720290001Sglebius # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 1721290001Sglebius # LT_CYGPATH in this case. 1722290001Sglebius func_to_host_file_result=`cygpath -m "$1"` 1723290001Sglebius fi 1724290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1725290001Sglebius} 1726290001Sglebius# end func_convert_file_cygwin_to_w32 1727290001Sglebius 1728290001Sglebius 1729290001Sglebius# func_convert_file_nix_to_w32 ARG 1730290001Sglebius# Convert file name ARG from *nix to w32 format. Requires a wine environment 1731290001Sglebius# and a working winepath. Returns result in func_to_host_file_result. 1732290001Sglebiusfunc_convert_file_nix_to_w32 () 1733290001Sglebius{ 1734290001Sglebius $opt_debug 1735290001Sglebius func_to_host_file_result="$1" 1736290001Sglebius if test -n "$1"; then 1737290001Sglebius func_convert_core_file_wine_to_w32 "$1" 1738290001Sglebius func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" 1739290001Sglebius fi 1740290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1741290001Sglebius} 1742290001Sglebius# end func_convert_file_nix_to_w32 1743290001Sglebius 1744290001Sglebius 1745290001Sglebius# func_convert_file_msys_to_cygwin ARG 1746290001Sglebius# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 1747290001Sglebius# Returns result in func_to_host_file_result. 1748290001Sglebiusfunc_convert_file_msys_to_cygwin () 1749290001Sglebius{ 1750290001Sglebius $opt_debug 1751290001Sglebius func_to_host_file_result="$1" 1752290001Sglebius if test -n "$1"; then 1753290001Sglebius func_convert_core_msys_to_w32 "$1" 1754290001Sglebius func_cygpath -u "$func_convert_core_msys_to_w32_result" 1755290001Sglebius func_to_host_file_result="$func_cygpath_result" 1756290001Sglebius fi 1757290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1758290001Sglebius} 1759290001Sglebius# end func_convert_file_msys_to_cygwin 1760290001Sglebius 1761290001Sglebius 1762290001Sglebius# func_convert_file_nix_to_cygwin ARG 1763290001Sglebius# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 1764290001Sglebius# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 1765290001Sglebius# in func_to_host_file_result. 1766290001Sglebiusfunc_convert_file_nix_to_cygwin () 1767290001Sglebius{ 1768290001Sglebius $opt_debug 1769290001Sglebius func_to_host_file_result="$1" 1770290001Sglebius if test -n "$1"; then 1771290001Sglebius # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 1772290001Sglebius func_convert_core_file_wine_to_w32 "$1" 1773290001Sglebius func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 1774290001Sglebius func_to_host_file_result="$func_cygpath_result" 1775290001Sglebius fi 1776290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1777290001Sglebius} 1778290001Sglebius# end func_convert_file_nix_to_cygwin 1779290001Sglebius 1780290001Sglebius 1781290001Sglebius############################################# 1782290001Sglebius# $build to $host PATH CONVERSION FUNCTIONS # 1783290001Sglebius############################################# 1784290001Sglebius# invoked via `$to_host_path_cmd ARG' 1785290001Sglebius# 1786290001Sglebius# In each case, ARG is the path to be converted from $build to $host format. 1787290001Sglebius# The result will be available in $func_to_host_path_result. 1788290001Sglebius# 1789290001Sglebius# Path separators are also converted from $build format to $host format. If 1790290001Sglebius# ARG begins or ends with a path separator character, it is preserved (but 1791290001Sglebius# converted to $host format) on output. 1792290001Sglebius# 1793290001Sglebius# All path conversion functions are named using the following convention: 1794290001Sglebius# file name conversion function : func_convert_file_X_to_Y () 1795290001Sglebius# path conversion function : func_convert_path_X_to_Y () 1796290001Sglebius# where, for any given $build/$host combination the 'X_to_Y' value is the 1797290001Sglebius# same. If conversion functions are added for new $build/$host combinations, 1798290001Sglebius# the two new functions must follow this pattern, or func_init_to_host_path_cmd 1799290001Sglebius# will break. 1800290001Sglebius 1801290001Sglebius 1802290001Sglebius# func_init_to_host_path_cmd 1803290001Sglebius# Ensures that function "pointer" variable $to_host_path_cmd is set to the 1804290001Sglebius# appropriate value, based on the value of $to_host_file_cmd. 1805290001Sglebiusto_host_path_cmd= 1806290001Sglebiusfunc_init_to_host_path_cmd () 1807290001Sglebius{ 1808290001Sglebius $opt_debug 1809290001Sglebius if test -z "$to_host_path_cmd"; then 1810290001Sglebius func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 1811290001Sglebius to_host_path_cmd="func_convert_path_${func_stripname_result}" 1812290001Sglebius fi 1813290001Sglebius} 1814290001Sglebius 1815290001Sglebius 1816290001Sglebius# func_to_host_path ARG 1817290001Sglebius# Converts the path ARG from $build format to $host format. Return result 1818290001Sglebius# in func_to_host_path_result. 1819290001Sglebiusfunc_to_host_path () 1820290001Sglebius{ 1821290001Sglebius $opt_debug 1822290001Sglebius func_init_to_host_path_cmd 1823290001Sglebius $to_host_path_cmd "$1" 1824290001Sglebius} 1825290001Sglebius# end func_to_host_path 1826290001Sglebius 1827290001Sglebius 1828290001Sglebius# func_convert_path_noop ARG 1829290001Sglebius# Copy ARG to func_to_host_path_result. 1830290001Sglebiusfunc_convert_path_noop () 1831290001Sglebius{ 1832290001Sglebius func_to_host_path_result="$1" 1833290001Sglebius} 1834290001Sglebius# end func_convert_path_noop 1835290001Sglebius 1836290001Sglebius 1837290001Sglebius# func_convert_path_msys_to_w32 ARG 1838290001Sglebius# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 1839290001Sglebius# conversion to w32 is not available inside the cwrapper. Returns result in 1840290001Sglebius# func_to_host_path_result. 1841290001Sglebiusfunc_convert_path_msys_to_w32 () 1842290001Sglebius{ 1843290001Sglebius $opt_debug 1844290001Sglebius func_to_host_path_result="$1" 1845290001Sglebius if test -n "$1"; then 1846290001Sglebius # Remove leading and trailing path separator characters from ARG. MSYS 1847290001Sglebius # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 1848290001Sglebius # and winepath ignores them completely. 1849290001Sglebius func_stripname : : "$1" 1850290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1851290001Sglebius func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 1852290001Sglebius func_to_host_path_result="$func_convert_core_msys_to_w32_result" 1853290001Sglebius func_convert_path_check : ";" \ 1854290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1855290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1856290001Sglebius fi 1857290001Sglebius} 1858290001Sglebius# end func_convert_path_msys_to_w32 1859290001Sglebius 1860290001Sglebius 1861290001Sglebius# func_convert_path_cygwin_to_w32 ARG 1862290001Sglebius# Convert path ARG from Cygwin to w32 format. Returns result in 1863290001Sglebius# func_to_host_file_result. 1864290001Sglebiusfunc_convert_path_cygwin_to_w32 () 1865290001Sglebius{ 1866290001Sglebius $opt_debug 1867290001Sglebius func_to_host_path_result="$1" 1868290001Sglebius if test -n "$1"; then 1869290001Sglebius # See func_convert_path_msys_to_w32: 1870290001Sglebius func_stripname : : "$1" 1871290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1872290001Sglebius func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 1873290001Sglebius func_convert_path_check : ";" \ 1874290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1875290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1876290001Sglebius fi 1877290001Sglebius} 1878290001Sglebius# end func_convert_path_cygwin_to_w32 1879290001Sglebius 1880290001Sglebius 1881290001Sglebius# func_convert_path_nix_to_w32 ARG 1882290001Sglebius# Convert path ARG from *nix to w32 format. Requires a wine environment and 1883290001Sglebius# a working winepath. Returns result in func_to_host_file_result. 1884290001Sglebiusfunc_convert_path_nix_to_w32 () 1885290001Sglebius{ 1886290001Sglebius $opt_debug 1887290001Sglebius func_to_host_path_result="$1" 1888290001Sglebius if test -n "$1"; then 1889290001Sglebius # See func_convert_path_msys_to_w32: 1890290001Sglebius func_stripname : : "$1" 1891290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1892290001Sglebius func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 1893290001Sglebius func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" 1894290001Sglebius func_convert_path_check : ";" \ 1895290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1896290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1897290001Sglebius fi 1898290001Sglebius} 1899290001Sglebius# end func_convert_path_nix_to_w32 1900290001Sglebius 1901290001Sglebius 1902290001Sglebius# func_convert_path_msys_to_cygwin ARG 1903290001Sglebius# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 1904290001Sglebius# Returns result in func_to_host_file_result. 1905290001Sglebiusfunc_convert_path_msys_to_cygwin () 1906290001Sglebius{ 1907290001Sglebius $opt_debug 1908290001Sglebius func_to_host_path_result="$1" 1909290001Sglebius if test -n "$1"; then 1910290001Sglebius # See func_convert_path_msys_to_w32: 1911290001Sglebius func_stripname : : "$1" 1912290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1913290001Sglebius func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 1914290001Sglebius func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 1915290001Sglebius func_to_host_path_result="$func_cygpath_result" 1916290001Sglebius func_convert_path_check : : \ 1917290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1918290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" : "$1" 1919290001Sglebius fi 1920290001Sglebius} 1921290001Sglebius# end func_convert_path_msys_to_cygwin 1922290001Sglebius 1923290001Sglebius 1924290001Sglebius# func_convert_path_nix_to_cygwin ARG 1925290001Sglebius# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 1926290001Sglebius# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 1927290001Sglebius# func_to_host_file_result. 1928290001Sglebiusfunc_convert_path_nix_to_cygwin () 1929290001Sglebius{ 1930290001Sglebius $opt_debug 1931290001Sglebius func_to_host_path_result="$1" 1932290001Sglebius if test -n "$1"; then 1933290001Sglebius # Remove leading and trailing path separator characters from 1934290001Sglebius # ARG. msys behavior is inconsistent here, cygpath turns them 1935290001Sglebius # into '.;' and ';.', and winepath ignores them completely. 1936290001Sglebius func_stripname : : "$1" 1937290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1938290001Sglebius func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 1939290001Sglebius func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 1940290001Sglebius func_to_host_path_result="$func_cygpath_result" 1941290001Sglebius func_convert_path_check : : \ 1942290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1943290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" : "$1" 1944290001Sglebius fi 1945290001Sglebius} 1946290001Sglebius# end func_convert_path_nix_to_cygwin 1947290001Sglebius 1948290001Sglebius 1949290001Sglebius# func_mode_compile arg... 1950290001Sglebiusfunc_mode_compile () 1951290001Sglebius{ 1952290001Sglebius $opt_debug 1953290001Sglebius # Get the compilation command and the source file. 1954290001Sglebius base_compile= 1955290001Sglebius srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1956290001Sglebius suppress_opt=yes 1957290001Sglebius suppress_output= 1958290001Sglebius arg_mode=normal 1959290001Sglebius libobj= 1960290001Sglebius later= 1961290001Sglebius pie_flag= 1962290001Sglebius 1963290001Sglebius for arg 1964290001Sglebius do 1965290001Sglebius case $arg_mode in 1966290001Sglebius arg ) 1967290001Sglebius # do not "continue". Instead, add this to base_compile 1968290001Sglebius lastarg="$arg" 1969290001Sglebius arg_mode=normal 1970290001Sglebius ;; 1971290001Sglebius 1972290001Sglebius target ) 1973290001Sglebius libobj="$arg" 1974290001Sglebius arg_mode=normal 1975290001Sglebius continue 1976290001Sglebius ;; 1977290001Sglebius 1978290001Sglebius normal ) 1979290001Sglebius # Accept any command-line options. 1980290001Sglebius case $arg in 1981290001Sglebius -o) 1982290001Sglebius test -n "$libobj" && \ 1983290001Sglebius func_fatal_error "you cannot specify \`-o' more than once" 1984290001Sglebius arg_mode=target 1985290001Sglebius continue 1986290001Sglebius ;; 1987290001Sglebius 1988290001Sglebius -pie | -fpie | -fPIE) 1989290001Sglebius func_append pie_flag " $arg" 1990290001Sglebius continue 1991290001Sglebius ;; 1992290001Sglebius 1993290001Sglebius -shared | -static | -prefer-pic | -prefer-non-pic) 1994290001Sglebius func_append later " $arg" 1995290001Sglebius continue 1996290001Sglebius ;; 1997290001Sglebius 1998290001Sglebius -no-suppress) 1999290001Sglebius suppress_opt=no 2000290001Sglebius continue 2001290001Sglebius ;; 2002290001Sglebius 2003290001Sglebius -Xcompiler) 2004290001Sglebius arg_mode=arg # the next one goes into the "base_compile" arg list 2005290001Sglebius continue # The current "srcfile" will either be retained or 2006290001Sglebius ;; # replaced later. I would guess that would be a bug. 2007290001Sglebius 2008290001Sglebius -Wc,*) 2009290001Sglebius func_stripname '-Wc,' '' "$arg" 2010290001Sglebius args=$func_stripname_result 2011290001Sglebius lastarg= 2012290001Sglebius save_ifs="$IFS"; IFS=',' 2013290001Sglebius for arg in $args; do 2014290001Sglebius IFS="$save_ifs" 2015290001Sglebius func_append_quoted lastarg "$arg" 2016290001Sglebius done 2017290001Sglebius IFS="$save_ifs" 2018290001Sglebius func_stripname ' ' '' "$lastarg" 2019290001Sglebius lastarg=$func_stripname_result 2020290001Sglebius 2021290001Sglebius # Add the arguments to base_compile. 2022290001Sglebius func_append base_compile " $lastarg" 2023290001Sglebius continue 2024290001Sglebius ;; 2025290001Sglebius 2026290001Sglebius *) 2027290001Sglebius # Accept the current argument as the source file. 2028290001Sglebius # The previous "srcfile" becomes the current argument. 2029290001Sglebius # 2030290001Sglebius lastarg="$srcfile" 2031290001Sglebius srcfile="$arg" 2032290001Sglebius ;; 2033290001Sglebius esac # case $arg 2034290001Sglebius ;; 2035290001Sglebius esac # case $arg_mode 2036290001Sglebius 2037290001Sglebius # Aesthetically quote the previous argument. 2038290001Sglebius func_append_quoted base_compile "$lastarg" 2039290001Sglebius done # for arg 2040290001Sglebius 2041290001Sglebius case $arg_mode in 2042290001Sglebius arg) 2043290001Sglebius func_fatal_error "you must specify an argument for -Xcompile" 2044290001Sglebius ;; 2045290001Sglebius target) 2046290001Sglebius func_fatal_error "you must specify a target with \`-o'" 2047290001Sglebius ;; 2048290001Sglebius *) 2049290001Sglebius # Get the name of the library object. 2050290001Sglebius test -z "$libobj" && { 2051290001Sglebius func_basename "$srcfile" 2052290001Sglebius libobj="$func_basename_result" 2053290001Sglebius } 2054290001Sglebius ;; 2055290001Sglebius esac 2056290001Sglebius 2057290001Sglebius # Recognize several different file suffixes. 2058290001Sglebius # If the user specifies -o file.o, it is replaced with file.lo 2059290001Sglebius case $libobj in 2060290001Sglebius *.[cCFSifmso] | \ 2061290001Sglebius *.ada | *.adb | *.ads | *.asm | \ 2062290001Sglebius *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 2063290001Sglebius *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) 2064290001Sglebius func_xform "$libobj" 2065290001Sglebius libobj=$func_xform_result 2066290001Sglebius ;; 2067290001Sglebius esac 2068290001Sglebius 2069290001Sglebius case $libobj in 2070290001Sglebius *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 2071290001Sglebius *) 2072290001Sglebius func_fatal_error "cannot determine name of library object from \`$libobj'" 2073290001Sglebius ;; 2074290001Sglebius esac 2075290001Sglebius 2076290001Sglebius func_infer_tag $base_compile 2077290001Sglebius 2078290001Sglebius for arg in $later; do 2079290001Sglebius case $arg in 2080290001Sglebius -shared) 2081290001Sglebius test "$build_libtool_libs" != yes && \ 2082290001Sglebius func_fatal_configuration "can not build a shared library" 2083290001Sglebius build_old_libs=no 2084290001Sglebius continue 2085290001Sglebius ;; 2086290001Sglebius 2087290001Sglebius -static) 2088290001Sglebius build_libtool_libs=no 2089290001Sglebius build_old_libs=yes 2090290001Sglebius continue 2091290001Sglebius ;; 2092290001Sglebius 2093290001Sglebius -prefer-pic) 2094290001Sglebius pic_mode=yes 2095290001Sglebius continue 2096290001Sglebius ;; 2097290001Sglebius 2098290001Sglebius -prefer-non-pic) 2099290001Sglebius pic_mode=no 2100290001Sglebius continue 2101290001Sglebius ;; 2102290001Sglebius esac 2103290001Sglebius done 2104290001Sglebius 2105290001Sglebius func_quote_for_eval "$libobj" 2106290001Sglebius test "X$libobj" != "X$func_quote_for_eval_result" \ 2107290001Sglebius && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 2108290001Sglebius && func_warning "libobj name \`$libobj' may not contain shell special characters." 2109290001Sglebius func_dirname_and_basename "$obj" "/" "" 2110290001Sglebius objname="$func_basename_result" 2111290001Sglebius xdir="$func_dirname_result" 2112290001Sglebius lobj=${xdir}$objdir/$objname 2113290001Sglebius 2114290001Sglebius test -z "$base_compile" && \ 2115290001Sglebius func_fatal_help "you must specify a compilation command" 2116290001Sglebius 2117290001Sglebius # Delete any leftover library objects. 2118290001Sglebius if test "$build_old_libs" = yes; then 2119290001Sglebius removelist="$obj $lobj $libobj ${libobj}T" 2120290001Sglebius else 2121290001Sglebius removelist="$lobj $libobj ${libobj}T" 2122290001Sglebius fi 2123290001Sglebius 2124290001Sglebius # On Cygwin there's no "real" PIC flag so we must build both object types 2125290001Sglebius case $host_os in 2126290001Sglebius cygwin* | mingw* | pw32* | os2* | cegcc*) 2127290001Sglebius pic_mode=default 2128290001Sglebius ;; 2129290001Sglebius esac 2130290001Sglebius if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 2131290001Sglebius # non-PIC code in shared libraries is not supported 2132290001Sglebius pic_mode=default 2133290001Sglebius fi 2134290001Sglebius 2135290001Sglebius # Calculate the filename of the output object if compiler does 2136290001Sglebius # not support -o with -c 2137290001Sglebius if test "$compiler_c_o" = no; then 2138290001Sglebius output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 2139290001Sglebius lockfile="$output_obj.lock" 2140290001Sglebius else 2141290001Sglebius output_obj= 2142290001Sglebius need_locks=no 2143290001Sglebius lockfile= 2144290001Sglebius fi 2145290001Sglebius 2146290001Sglebius # Lock this critical section if it is needed 2147290001Sglebius # We use this script file to make the link, it avoids creating a new file 2148290001Sglebius if test "$need_locks" = yes; then 2149290001Sglebius until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 2150290001Sglebius func_echo "Waiting for $lockfile to be removed" 2151290001Sglebius sleep 2 2152290001Sglebius done 2153290001Sglebius elif test "$need_locks" = warn; then 2154290001Sglebius if test -f "$lockfile"; then 2155290001Sglebius $ECHO "\ 2156290001Sglebius*** ERROR, $lockfile exists and contains: 2157290001Sglebius`cat $lockfile 2>/dev/null` 2158290001Sglebius 2159290001SglebiusThis indicates that another process is trying to use the same 2160290001Sglebiustemporary object file, and libtool could not work around it because 2161290001Sglebiusyour compiler does not support \`-c' and \`-o' together. If you 2162290001Sglebiusrepeat this compilation, it may succeed, by chance, but you had better 2163290001Sglebiusavoid parallel builds (make -j) in this platform, or get a better 2164290001Sglebiuscompiler." 2165290001Sglebius 2166290001Sglebius $opt_dry_run || $RM $removelist 2167290001Sglebius exit $EXIT_FAILURE 2168290001Sglebius fi 2169290001Sglebius func_append removelist " $output_obj" 2170290001Sglebius $ECHO "$srcfile" > "$lockfile" 2171290001Sglebius fi 2172290001Sglebius 2173290001Sglebius $opt_dry_run || $RM $removelist 2174290001Sglebius func_append removelist " $lockfile" 2175290001Sglebius trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 2176290001Sglebius 2177290001Sglebius func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 2178290001Sglebius srcfile=$func_to_tool_file_result 2179290001Sglebius func_quote_for_eval "$srcfile" 2180290001Sglebius qsrcfile=$func_quote_for_eval_result 2181290001Sglebius 2182290001Sglebius # Only build a PIC object if we are building libtool libraries. 2183290001Sglebius if test "$build_libtool_libs" = yes; then 2184290001Sglebius # Without this assignment, base_compile gets emptied. 2185290001Sglebius fbsd_hideous_sh_bug=$base_compile 2186290001Sglebius 2187290001Sglebius if test "$pic_mode" != no; then 2188290001Sglebius command="$base_compile $qsrcfile $pic_flag" 2189290001Sglebius else 2190290001Sglebius # Don't build PIC code 2191290001Sglebius command="$base_compile $qsrcfile" 2192290001Sglebius fi 2193290001Sglebius 2194290001Sglebius func_mkdir_p "$xdir$objdir" 2195290001Sglebius 2196290001Sglebius if test -z "$output_obj"; then 2197290001Sglebius # Place PIC objects in $objdir 2198290001Sglebius func_append command " -o $lobj" 2199290001Sglebius fi 2200290001Sglebius 2201290001Sglebius func_show_eval_locale "$command" \ 2202290001Sglebius 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 2203290001Sglebius 2204290001Sglebius if test "$need_locks" = warn && 2205290001Sglebius test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2206290001Sglebius $ECHO "\ 2207290001Sglebius*** ERROR, $lockfile contains: 2208290001Sglebius`cat $lockfile 2>/dev/null` 2209290001Sglebius 2210290001Sglebiusbut it should contain: 2211290001Sglebius$srcfile 2212290001Sglebius 2213290001SglebiusThis indicates that another process is trying to use the same 2214290001Sglebiustemporary object file, and libtool could not work around it because 2215290001Sglebiusyour compiler does not support \`-c' and \`-o' together. If you 2216290001Sglebiusrepeat this compilation, it may succeed, by chance, but you had better 2217290001Sglebiusavoid parallel builds (make -j) in this platform, or get a better 2218290001Sglebiuscompiler." 2219290001Sglebius 2220290001Sglebius $opt_dry_run || $RM $removelist 2221290001Sglebius exit $EXIT_FAILURE 2222290001Sglebius fi 2223290001Sglebius 2224290001Sglebius # Just move the object if needed, then go on to compile the next one 2225290001Sglebius if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 2226290001Sglebius func_show_eval '$MV "$output_obj" "$lobj"' \ 2227290001Sglebius 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2228290001Sglebius fi 2229290001Sglebius 2230290001Sglebius # Allow error messages only from the first compilation. 2231290001Sglebius if test "$suppress_opt" = yes; then 2232290001Sglebius suppress_output=' >/dev/null 2>&1' 2233290001Sglebius fi 2234290001Sglebius fi 2235290001Sglebius 2236290001Sglebius # Only build a position-dependent object if we build old libraries. 2237290001Sglebius if test "$build_old_libs" = yes; then 2238290001Sglebius if test "$pic_mode" != yes; then 2239290001Sglebius # Don't build PIC code 2240290001Sglebius command="$base_compile $qsrcfile$pie_flag" 2241290001Sglebius else 2242290001Sglebius command="$base_compile $qsrcfile $pic_flag" 2243290001Sglebius fi 2244290001Sglebius if test "$compiler_c_o" = yes; then 2245290001Sglebius func_append command " -o $obj" 2246290001Sglebius fi 2247290001Sglebius 2248290001Sglebius # Suppress compiler output if we already did a PIC compilation. 2249290001Sglebius func_append command "$suppress_output" 2250290001Sglebius func_show_eval_locale "$command" \ 2251290001Sglebius '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 2252290001Sglebius 2253290001Sglebius if test "$need_locks" = warn && 2254290001Sglebius test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2255290001Sglebius $ECHO "\ 2256290001Sglebius*** ERROR, $lockfile contains: 2257290001Sglebius`cat $lockfile 2>/dev/null` 2258290001Sglebius 2259290001Sglebiusbut it should contain: 2260290001Sglebius$srcfile 2261290001Sglebius 2262290001SglebiusThis indicates that another process is trying to use the same 2263290001Sglebiustemporary object file, and libtool could not work around it because 2264290001Sglebiusyour compiler does not support \`-c' and \`-o' together. If you 2265290001Sglebiusrepeat this compilation, it may succeed, by chance, but you had better 2266290001Sglebiusavoid parallel builds (make -j) in this platform, or get a better 2267290001Sglebiuscompiler." 2268290001Sglebius 2269290001Sglebius $opt_dry_run || $RM $removelist 2270290001Sglebius exit $EXIT_FAILURE 2271290001Sglebius fi 2272290001Sglebius 2273290001Sglebius # Just move the object if needed 2274290001Sglebius if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 2275290001Sglebius func_show_eval '$MV "$output_obj" "$obj"' \ 2276290001Sglebius 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2277290001Sglebius fi 2278290001Sglebius fi 2279290001Sglebius 2280290001Sglebius $opt_dry_run || { 2281290001Sglebius func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 2282290001Sglebius 2283290001Sglebius # Unlock the critical section if it was locked 2284290001Sglebius if test "$need_locks" != no; then 2285290001Sglebius removelist=$lockfile 2286290001Sglebius $RM "$lockfile" 2287290001Sglebius fi 2288290001Sglebius } 2289290001Sglebius 2290290001Sglebius exit $EXIT_SUCCESS 2291290001Sglebius} 2292290001Sglebius 2293290001Sglebius$opt_help || { 2294290001Sglebius test "$opt_mode" = compile && func_mode_compile ${1+"$@"} 2295290001Sglebius} 2296290001Sglebius 2297290001Sglebiusfunc_mode_help () 2298290001Sglebius{ 2299290001Sglebius # We need to display help for each of the modes. 2300290001Sglebius case $opt_mode in 2301290001Sglebius "") 2302290001Sglebius # Generic help is extracted from the usage comments 2303290001Sglebius # at the start of this file. 2304290001Sglebius func_help 2305290001Sglebius ;; 2306290001Sglebius 2307290001Sglebius clean) 2308290001Sglebius $ECHO \ 2309290001Sglebius"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 2310290001Sglebius 2311290001SglebiusRemove files from the build directory. 2312290001Sglebius 2313290001SglebiusRM is the name of the program to use to delete files associated with each FILE 2314290001Sglebius(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2315290001Sglebiusto RM. 2316290001Sglebius 2317290001SglebiusIf FILE is a libtool library, object or program, all the files associated 2318290001Sglebiuswith it are deleted. Otherwise, only FILE itself is deleted using RM." 2319290001Sglebius ;; 2320290001Sglebius 2321290001Sglebius compile) 2322290001Sglebius $ECHO \ 2323290001Sglebius"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 2324290001Sglebius 2325290001SglebiusCompile a source file into a libtool library object. 2326290001Sglebius 2327290001SglebiusThis mode accepts the following additional options: 2328290001Sglebius 2329290001Sglebius -o OUTPUT-FILE set the output file name to OUTPUT-FILE 2330290001Sglebius -no-suppress do not suppress compiler output for multiple passes 2331290001Sglebius -prefer-pic try to build PIC objects only 2332290001Sglebius -prefer-non-pic try to build non-PIC objects only 2333290001Sglebius -shared do not build a \`.o' file suitable for static linking 2334290001Sglebius -static only build a \`.o' file suitable for static linking 2335290001Sglebius -Wc,FLAG pass FLAG directly to the compiler 2336290001Sglebius 2337290001SglebiusCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 2338290001Sglebiusfrom the given SOURCEFILE. 2339290001Sglebius 2340290001SglebiusThe output file name is determined by removing the directory component from 2341290001SglebiusSOURCEFILE, then substituting the C source code suffix \`.c' with the 2342290001Sglebiuslibrary object suffix, \`.lo'." 2343290001Sglebius ;; 2344290001Sglebius 2345290001Sglebius execute) 2346290001Sglebius $ECHO \ 2347290001Sglebius"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 2348290001Sglebius 2349290001SglebiusAutomatically set library path, then run a program. 2350290001Sglebius 2351290001SglebiusThis mode accepts the following additional options: 2352290001Sglebius 2353290001Sglebius -dlopen FILE add the directory containing FILE to the library path 2354290001Sglebius 2355290001SglebiusThis mode sets the library path environment variable according to \`-dlopen' 2356290001Sglebiusflags. 2357290001Sglebius 2358290001SglebiusIf any of the ARGS are libtool executable wrappers, then they are translated 2359290001Sglebiusinto their corresponding uninstalled binary, and any of their required library 2360290001Sglebiusdirectories are added to the library path. 2361290001Sglebius 2362290001SglebiusThen, COMMAND is executed, with ARGS as arguments." 2363290001Sglebius ;; 2364290001Sglebius 2365290001Sglebius finish) 2366290001Sglebius $ECHO \ 2367290001Sglebius"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 2368290001Sglebius 2369290001SglebiusComplete the installation of libtool libraries. 2370290001Sglebius 2371290001SglebiusEach LIBDIR is a directory that contains libtool libraries. 2372290001Sglebius 2373290001SglebiusThe commands that this mode executes may require superuser privileges. Use 2374290001Sglebiusthe \`--dry-run' option if you just want to see what would be executed." 2375290001Sglebius ;; 2376290001Sglebius 2377290001Sglebius install) 2378290001Sglebius $ECHO \ 2379290001Sglebius"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 2380290001Sglebius 2381290001SglebiusInstall executables or libraries. 2382290001Sglebius 2383290001SglebiusINSTALL-COMMAND is the installation command. The first component should be 2384290001Sglebiuseither the \`install' or \`cp' program. 2385290001Sglebius 2386290001SglebiusThe following components of INSTALL-COMMAND are treated specially: 2387290001Sglebius 2388290001Sglebius -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 2389290001Sglebius 2390290001SglebiusThe rest of the components are interpreted as arguments to that command (only 2391290001SglebiusBSD-compatible install options are recognized)." 2392290001Sglebius ;; 2393290001Sglebius 2394290001Sglebius link) 2395290001Sglebius $ECHO \ 2396290001Sglebius"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 2397290001Sglebius 2398290001SglebiusLink object files or libraries together to form another library, or to 2399290001Sglebiuscreate an executable program. 2400290001Sglebius 2401290001SglebiusLINK-COMMAND is a command using the C compiler that you would use to create 2402290001Sglebiusa program from several object files. 2403290001Sglebius 2404290001SglebiusThe following components of LINK-COMMAND are treated specially: 2405290001Sglebius 2406290001Sglebius -all-static do not do any dynamic linking at all 2407290001Sglebius -avoid-version do not add a version suffix if possible 2408290001Sglebius -bindir BINDIR specify path to binaries directory (for systems where 2409290001Sglebius libraries must be found in the PATH setting at runtime) 2410290001Sglebius -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 2411290001Sglebius -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 2412290001Sglebius -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 2413290001Sglebius -export-symbols SYMFILE 2414290001Sglebius try to export only the symbols listed in SYMFILE 2415290001Sglebius -export-symbols-regex REGEX 2416290001Sglebius try to export only the symbols matching REGEX 2417290001Sglebius -LLIBDIR search LIBDIR for required installed libraries 2418290001Sglebius -lNAME OUTPUT-FILE requires the installed library libNAME 2419290001Sglebius -module build a library that can dlopened 2420290001Sglebius -no-fast-install disable the fast-install mode 2421290001Sglebius -no-install link a not-installable executable 2422290001Sglebius -no-undefined declare that a library does not refer to external symbols 2423290001Sglebius -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 2424290001Sglebius -objectlist FILE Use a list of object files found in FILE to specify objects 2425290001Sglebius -precious-files-regex REGEX 2426290001Sglebius don't remove output files matching REGEX 2427290001Sglebius -release RELEASE specify package release information 2428290001Sglebius -rpath LIBDIR the created library will eventually be installed in LIBDIR 2429290001Sglebius -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 2430290001Sglebius -shared only do dynamic linking of libtool libraries 2431290001Sglebius -shrext SUFFIX override the standard shared library file extension 2432290001Sglebius -static do not do any dynamic linking of uninstalled libtool libraries 2433290001Sglebius -static-libtool-libs 2434290001Sglebius do not do any dynamic linking of libtool libraries 2435290001Sglebius -version-info CURRENT[:REVISION[:AGE]] 2436290001Sglebius specify library version info [each variable defaults to 0] 2437290001Sglebius -weak LIBNAME declare that the target provides the LIBNAME interface 2438290001Sglebius -Wc,FLAG 2439290001Sglebius -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 2440290001Sglebius -Wl,FLAG 2441290001Sglebius -Xlinker FLAG pass linker-specific FLAG directly to the linker 2442290001Sglebius -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 2443290001Sglebius 2444290001SglebiusAll other options (arguments beginning with \`-') are ignored. 2445290001Sglebius 2446290001SglebiusEvery other argument is treated as a filename. Files ending in \`.la' are 2447290001Sglebiustreated as uninstalled libtool libraries, other files are standard or library 2448290001Sglebiusobject files. 2449290001Sglebius 2450290001SglebiusIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 2451290001Sglebiusonly library objects (\`.lo' files) may be specified, and \`-rpath' is 2452290001Sglebiusrequired, except when creating a convenience library. 2453290001Sglebius 2454290001SglebiusIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 2455290001Sglebiususing \`ar' and \`ranlib', or on Windows using \`lib'. 2456290001Sglebius 2457290001SglebiusIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 2458290001Sglebiusis created, otherwise an executable program is created." 2459290001Sglebius ;; 2460290001Sglebius 2461290001Sglebius uninstall) 2462290001Sglebius $ECHO \ 2463290001Sglebius"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 2464290001Sglebius 2465290001SglebiusRemove libraries from an installation directory. 2466290001Sglebius 2467290001SglebiusRM is the name of the program to use to delete files associated with each FILE 2468290001Sglebius(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2469290001Sglebiusto RM. 2470290001Sglebius 2471290001SglebiusIf FILE is a libtool library, all the files associated with it are deleted. 2472290001SglebiusOtherwise, only FILE itself is deleted using RM." 2473290001Sglebius ;; 2474290001Sglebius 2475290001Sglebius *) 2476290001Sglebius func_fatal_help "invalid operation mode \`$opt_mode'" 2477290001Sglebius ;; 2478290001Sglebius esac 2479290001Sglebius 2480290001Sglebius echo 2481290001Sglebius $ECHO "Try \`$progname --help' for more information about other modes." 2482290001Sglebius} 2483290001Sglebius 2484290001Sglebius# Now that we've collected a possible --mode arg, show help if necessary 2485290001Sglebiusif $opt_help; then 2486290001Sglebius if test "$opt_help" = :; then 2487290001Sglebius func_mode_help 2488290001Sglebius else 2489290001Sglebius { 2490290001Sglebius func_help noexit 2491290001Sglebius for opt_mode in compile link execute install finish uninstall clean; do 2492290001Sglebius func_mode_help 2493290001Sglebius done 2494290001Sglebius } | sed -n '1p; 2,$s/^Usage:/ or: /p' 2495290001Sglebius { 2496290001Sglebius func_help noexit 2497290001Sglebius for opt_mode in compile link execute install finish uninstall clean; do 2498290001Sglebius echo 2499290001Sglebius func_mode_help 2500290001Sglebius done 2501290001Sglebius } | 2502290001Sglebius sed '1d 2503290001Sglebius /^When reporting/,/^Report/{ 2504290001Sglebius H 2505290001Sglebius d 2506290001Sglebius } 2507290001Sglebius $x 2508290001Sglebius /information about other modes/d 2509290001Sglebius /more detailed .*MODE/d 2510290001Sglebius s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 2511290001Sglebius fi 2512290001Sglebius exit $? 2513290001Sglebiusfi 2514290001Sglebius 2515290001Sglebius 2516290001Sglebius# func_mode_execute arg... 2517290001Sglebiusfunc_mode_execute () 2518290001Sglebius{ 2519290001Sglebius $opt_debug 2520290001Sglebius # The first argument is the command name. 2521290001Sglebius cmd="$nonopt" 2522290001Sglebius test -z "$cmd" && \ 2523290001Sglebius func_fatal_help "you must specify a COMMAND" 2524290001Sglebius 2525290001Sglebius # Handle -dlopen flags immediately. 2526290001Sglebius for file in $opt_dlopen; do 2527290001Sglebius test -f "$file" \ 2528290001Sglebius || func_fatal_help "\`$file' is not a file" 2529290001Sglebius 2530290001Sglebius dir= 2531290001Sglebius case $file in 2532290001Sglebius *.la) 2533290001Sglebius func_resolve_sysroot "$file" 2534290001Sglebius file=$func_resolve_sysroot_result 2535290001Sglebius 2536290001Sglebius # Check to see that this really is a libtool archive. 2537290001Sglebius func_lalib_unsafe_p "$file" \ 2538290001Sglebius || func_fatal_help "\`$lib' is not a valid libtool archive" 2539290001Sglebius 2540290001Sglebius # Read the libtool library. 2541290001Sglebius dlname= 2542290001Sglebius library_names= 2543290001Sglebius func_source "$file" 2544290001Sglebius 2545290001Sglebius # Skip this library if it cannot be dlopened. 2546290001Sglebius if test -z "$dlname"; then 2547290001Sglebius # Warn if it was a shared library. 2548290001Sglebius test -n "$library_names" && \ 2549290001Sglebius func_warning "\`$file' was not linked with \`-export-dynamic'" 2550290001Sglebius continue 2551290001Sglebius fi 2552290001Sglebius 2553290001Sglebius func_dirname "$file" "" "." 2554290001Sglebius dir="$func_dirname_result" 2555290001Sglebius 2556290001Sglebius if test -f "$dir/$objdir/$dlname"; then 2557290001Sglebius func_append dir "/$objdir" 2558290001Sglebius else 2559290001Sglebius if test ! -f "$dir/$dlname"; then 2560290001Sglebius func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 2561290001Sglebius fi 2562290001Sglebius fi 2563290001Sglebius ;; 2564290001Sglebius 2565290001Sglebius *.lo) 2566290001Sglebius # Just add the directory containing the .lo file. 2567290001Sglebius func_dirname "$file" "" "." 2568290001Sglebius dir="$func_dirname_result" 2569290001Sglebius ;; 2570290001Sglebius 2571290001Sglebius *) 2572290001Sglebius func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 2573290001Sglebius continue 2574290001Sglebius ;; 2575290001Sglebius esac 2576290001Sglebius 2577290001Sglebius # Get the absolute pathname. 2578290001Sglebius absdir=`cd "$dir" && pwd` 2579290001Sglebius test -n "$absdir" && dir="$absdir" 2580290001Sglebius 2581290001Sglebius # Now add the directory to shlibpath_var. 2582290001Sglebius if eval "test -z \"\$$shlibpath_var\""; then 2583290001Sglebius eval "$shlibpath_var=\"\$dir\"" 2584290001Sglebius else 2585290001Sglebius eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 2586290001Sglebius fi 2587290001Sglebius done 2588290001Sglebius 2589290001Sglebius # This variable tells wrapper scripts just to set shlibpath_var 2590290001Sglebius # rather than running their programs. 2591290001Sglebius libtool_execute_magic="$magic" 2592290001Sglebius 2593290001Sglebius # Check if any of the arguments is a wrapper script. 2594290001Sglebius args= 2595290001Sglebius for file 2596290001Sglebius do 2597290001Sglebius case $file in 2598290001Sglebius -* | *.la | *.lo ) ;; 2599290001Sglebius *) 2600290001Sglebius # Do a test to see if this is really a libtool program. 2601290001Sglebius if func_ltwrapper_script_p "$file"; then 2602290001Sglebius func_source "$file" 2603290001Sglebius # Transform arg to wrapped name. 2604290001Sglebius file="$progdir/$program" 2605290001Sglebius elif func_ltwrapper_executable_p "$file"; then 2606290001Sglebius func_ltwrapper_scriptname "$file" 2607290001Sglebius func_source "$func_ltwrapper_scriptname_result" 2608290001Sglebius # Transform arg to wrapped name. 2609290001Sglebius file="$progdir/$program" 2610290001Sglebius fi 2611290001Sglebius ;; 2612290001Sglebius esac 2613290001Sglebius # Quote arguments (to preserve shell metacharacters). 2614290001Sglebius func_append_quoted args "$file" 2615290001Sglebius done 2616290001Sglebius 2617290001Sglebius if test "X$opt_dry_run" = Xfalse; then 2618290001Sglebius if test -n "$shlibpath_var"; then 2619290001Sglebius # Export the shlibpath_var. 2620290001Sglebius eval "export $shlibpath_var" 2621290001Sglebius fi 2622290001Sglebius 2623290001Sglebius # Restore saved environment variables 2624290001Sglebius for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 2625290001Sglebius do 2626290001Sglebius eval "if test \"\${save_$lt_var+set}\" = set; then 2627290001Sglebius $lt_var=\$save_$lt_var; export $lt_var 2628290001Sglebius else 2629290001Sglebius $lt_unset $lt_var 2630290001Sglebius fi" 2631290001Sglebius done 2632290001Sglebius 2633290001Sglebius # Now prepare to actually exec the command. 2634290001Sglebius exec_cmd="\$cmd$args" 2635290001Sglebius else 2636290001Sglebius # Display what would be done. 2637290001Sglebius if test -n "$shlibpath_var"; then 2638290001Sglebius eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 2639290001Sglebius echo "export $shlibpath_var" 2640290001Sglebius fi 2641290001Sglebius $ECHO "$cmd$args" 2642290001Sglebius exit $EXIT_SUCCESS 2643290001Sglebius fi 2644290001Sglebius} 2645290001Sglebius 2646290001Sglebiustest "$opt_mode" = execute && func_mode_execute ${1+"$@"} 2647290001Sglebius 2648290001Sglebius 2649290001Sglebius# func_mode_finish arg... 2650290001Sglebiusfunc_mode_finish () 2651290001Sglebius{ 2652290001Sglebius $opt_debug 2653290001Sglebius libs= 2654290001Sglebius libdirs= 2655290001Sglebius admincmds= 2656290001Sglebius 2657290001Sglebius for opt in "$nonopt" ${1+"$@"} 2658290001Sglebius do 2659290001Sglebius if test -d "$opt"; then 2660290001Sglebius func_append libdirs " $opt" 2661290001Sglebius 2662290001Sglebius elif test -f "$opt"; then 2663290001Sglebius if func_lalib_unsafe_p "$opt"; then 2664290001Sglebius func_append libs " $opt" 2665290001Sglebius else 2666290001Sglebius func_warning "\`$opt' is not a valid libtool archive" 2667290001Sglebius fi 2668290001Sglebius 2669290001Sglebius else 2670290001Sglebius func_fatal_error "invalid argument \`$opt'" 2671290001Sglebius fi 2672290001Sglebius done 2673290001Sglebius 2674290001Sglebius if test -n "$libs"; then 2675290001Sglebius if test -n "$lt_sysroot"; then 2676290001Sglebius sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 2677290001Sglebius sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 2678290001Sglebius else 2679290001Sglebius sysroot_cmd= 2680290001Sglebius fi 2681290001Sglebius 2682290001Sglebius # Remove sysroot references 2683290001Sglebius if $opt_dry_run; then 2684290001Sglebius for lib in $libs; do 2685290001Sglebius echo "removing references to $lt_sysroot and \`=' prefixes from $lib" 2686290001Sglebius done 2687290001Sglebius else 2688290001Sglebius tmpdir=`func_mktempdir` 2689290001Sglebius for lib in $libs; do 2690290001Sglebius sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 2691290001Sglebius > $tmpdir/tmp-la 2692290001Sglebius mv -f $tmpdir/tmp-la $lib 2693290001Sglebius done 2694290001Sglebius ${RM}r "$tmpdir" 2695290001Sglebius fi 2696290001Sglebius fi 2697290001Sglebius 2698290001Sglebius if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2699290001Sglebius for libdir in $libdirs; do 2700290001Sglebius if test -n "$finish_cmds"; then 2701290001Sglebius # Do each command in the finish commands. 2702290001Sglebius func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 2703290001Sglebius'"$cmd"'"' 2704290001Sglebius fi 2705290001Sglebius if test -n "$finish_eval"; then 2706290001Sglebius # Do the single finish_eval. 2707290001Sglebius eval cmds=\"$finish_eval\" 2708290001Sglebius $opt_dry_run || eval "$cmds" || func_append admincmds " 2709290001Sglebius $cmds" 2710290001Sglebius fi 2711290001Sglebius done 2712290001Sglebius fi 2713290001Sglebius 2714290001Sglebius # Exit here if they wanted silent mode. 2715290001Sglebius $opt_silent && exit $EXIT_SUCCESS 2716290001Sglebius 2717290001Sglebius if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2718290001Sglebius echo "----------------------------------------------------------------------" 2719290001Sglebius echo "Libraries have been installed in:" 2720290001Sglebius for libdir in $libdirs; do 2721290001Sglebius $ECHO " $libdir" 2722290001Sglebius done 2723290001Sglebius echo 2724290001Sglebius echo "If you ever happen to want to link against installed libraries" 2725290001Sglebius echo "in a given directory, LIBDIR, you must either use libtool, and" 2726290001Sglebius echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 2727290001Sglebius echo "flag during linking and do at least one of the following:" 2728290001Sglebius if test -n "$shlibpath_var"; then 2729290001Sglebius echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 2730290001Sglebius echo " during execution" 2731290001Sglebius fi 2732290001Sglebius if test -n "$runpath_var"; then 2733290001Sglebius echo " - add LIBDIR to the \`$runpath_var' environment variable" 2734290001Sglebius echo " during linking" 2735290001Sglebius fi 2736290001Sglebius if test -n "$hardcode_libdir_flag_spec"; then 2737290001Sglebius libdir=LIBDIR 2738290001Sglebius eval flag=\"$hardcode_libdir_flag_spec\" 2739290001Sglebius 2740290001Sglebius $ECHO " - use the \`$flag' linker flag" 2741290001Sglebius fi 2742290001Sglebius if test -n "$admincmds"; then 2743290001Sglebius $ECHO " - have your system administrator run these commands:$admincmds" 2744290001Sglebius fi 2745290001Sglebius if test -f /etc/ld.so.conf; then 2746290001Sglebius echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 2747290001Sglebius fi 2748290001Sglebius echo 2749290001Sglebius 2750290001Sglebius echo "See any operating system documentation about shared libraries for" 2751290001Sglebius case $host in 2752290001Sglebius solaris2.[6789]|solaris2.1[0-9]) 2753290001Sglebius echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 2754290001Sglebius echo "pages." 2755290001Sglebius ;; 2756290001Sglebius *) 2757290001Sglebius echo "more information, such as the ld(1) and ld.so(8) manual pages." 2758290001Sglebius ;; 2759290001Sglebius esac 2760290001Sglebius echo "----------------------------------------------------------------------" 2761290001Sglebius fi 2762290001Sglebius exit $EXIT_SUCCESS 2763290001Sglebius} 2764290001Sglebius 2765290001Sglebiustest "$opt_mode" = finish && func_mode_finish ${1+"$@"} 2766290001Sglebius 2767290001Sglebius 2768290001Sglebius# func_mode_install arg... 2769290001Sglebiusfunc_mode_install () 2770290001Sglebius{ 2771290001Sglebius $opt_debug 2772290001Sglebius # There may be an optional sh(1) argument at the beginning of 2773290001Sglebius # install_prog (especially on Windows NT). 2774290001Sglebius if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 2775290001Sglebius # Allow the use of GNU shtool's install command. 2776290001Sglebius case $nonopt in *shtool*) :;; *) false;; esac; then 2777290001Sglebius # Aesthetically quote it. 2778290001Sglebius func_quote_for_eval "$nonopt" 2779290001Sglebius install_prog="$func_quote_for_eval_result " 2780290001Sglebius arg=$1 2781290001Sglebius shift 2782290001Sglebius else 2783290001Sglebius install_prog= 2784290001Sglebius arg=$nonopt 2785290001Sglebius fi 2786290001Sglebius 2787290001Sglebius # The real first argument should be the name of the installation program. 2788290001Sglebius # Aesthetically quote it. 2789290001Sglebius func_quote_for_eval "$arg" 2790290001Sglebius func_append install_prog "$func_quote_for_eval_result" 2791290001Sglebius install_shared_prog=$install_prog 2792290001Sglebius case " $install_prog " in 2793290001Sglebius *[\\\ /]cp\ *) install_cp=: ;; 2794290001Sglebius *) install_cp=false ;; 2795290001Sglebius esac 2796290001Sglebius 2797290001Sglebius # We need to accept at least all the BSD install flags. 2798290001Sglebius dest= 2799290001Sglebius files= 2800290001Sglebius opts= 2801290001Sglebius prev= 2802290001Sglebius install_type= 2803290001Sglebius isdir=no 2804290001Sglebius stripme= 2805290001Sglebius no_mode=: 2806290001Sglebius for arg 2807290001Sglebius do 2808290001Sglebius arg2= 2809290001Sglebius if test -n "$dest"; then 2810290001Sglebius func_append files " $dest" 2811290001Sglebius dest=$arg 2812290001Sglebius continue 2813290001Sglebius fi 2814290001Sglebius 2815290001Sglebius case $arg in 2816290001Sglebius -d) isdir=yes ;; 2817290001Sglebius -f) 2818290001Sglebius if $install_cp; then :; else 2819290001Sglebius prev=$arg 2820290001Sglebius fi 2821290001Sglebius ;; 2822290001Sglebius -g | -m | -o) 2823290001Sglebius prev=$arg 2824290001Sglebius ;; 2825290001Sglebius -s) 2826290001Sglebius stripme=" -s" 2827290001Sglebius continue 2828290001Sglebius ;; 2829290001Sglebius -*) 2830290001Sglebius ;; 2831290001Sglebius *) 2832290001Sglebius # If the previous option needed an argument, then skip it. 2833290001Sglebius if test -n "$prev"; then 2834290001Sglebius if test "x$prev" = x-m && test -n "$install_override_mode"; then 2835290001Sglebius arg2=$install_override_mode 2836290001Sglebius no_mode=false 2837290001Sglebius fi 2838290001Sglebius prev= 2839290001Sglebius else 2840290001Sglebius dest=$arg 2841290001Sglebius continue 2842290001Sglebius fi 2843290001Sglebius ;; 2844290001Sglebius esac 2845290001Sglebius 2846290001Sglebius # Aesthetically quote the argument. 2847290001Sglebius func_quote_for_eval "$arg" 2848290001Sglebius func_append install_prog " $func_quote_for_eval_result" 2849290001Sglebius if test -n "$arg2"; then 2850290001Sglebius func_quote_for_eval "$arg2" 2851290001Sglebius fi 2852290001Sglebius func_append install_shared_prog " $func_quote_for_eval_result" 2853290001Sglebius done 2854290001Sglebius 2855290001Sglebius test -z "$install_prog" && \ 2856290001Sglebius func_fatal_help "you must specify an install program" 2857290001Sglebius 2858290001Sglebius test -n "$prev" && \ 2859290001Sglebius func_fatal_help "the \`$prev' option requires an argument" 2860290001Sglebius 2861290001Sglebius if test -n "$install_override_mode" && $no_mode; then 2862290001Sglebius if $install_cp; then :; else 2863290001Sglebius func_quote_for_eval "$install_override_mode" 2864290001Sglebius func_append install_shared_prog " -m $func_quote_for_eval_result" 2865290001Sglebius fi 2866290001Sglebius fi 2867290001Sglebius 2868290001Sglebius if test -z "$files"; then 2869290001Sglebius if test -z "$dest"; then 2870290001Sglebius func_fatal_help "no file or destination specified" 2871290001Sglebius else 2872290001Sglebius func_fatal_help "you must specify a destination" 2873290001Sglebius fi 2874290001Sglebius fi 2875290001Sglebius 2876290001Sglebius # Strip any trailing slash from the destination. 2877290001Sglebius func_stripname '' '/' "$dest" 2878290001Sglebius dest=$func_stripname_result 2879290001Sglebius 2880290001Sglebius # Check to see that the destination is a directory. 2881290001Sglebius test -d "$dest" && isdir=yes 2882290001Sglebius if test "$isdir" = yes; then 2883290001Sglebius destdir="$dest" 2884290001Sglebius destname= 2885290001Sglebius else 2886290001Sglebius func_dirname_and_basename "$dest" "" "." 2887290001Sglebius destdir="$func_dirname_result" 2888290001Sglebius destname="$func_basename_result" 2889290001Sglebius 2890290001Sglebius # Not a directory, so check to see that there is only one file specified. 2891290001Sglebius set dummy $files; shift 2892290001Sglebius test "$#" -gt 1 && \ 2893290001Sglebius func_fatal_help "\`$dest' is not a directory" 2894290001Sglebius fi 2895290001Sglebius case $destdir in 2896290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) ;; 2897290001Sglebius *) 2898290001Sglebius for file in $files; do 2899290001Sglebius case $file in 2900290001Sglebius *.lo) ;; 2901290001Sglebius *) 2902290001Sglebius func_fatal_help "\`$destdir' must be an absolute directory name" 2903290001Sglebius ;; 2904290001Sglebius esac 2905290001Sglebius done 2906290001Sglebius ;; 2907290001Sglebius esac 2908290001Sglebius 2909290001Sglebius # This variable tells wrapper scripts just to set variables rather 2910290001Sglebius # than running their programs. 2911290001Sglebius libtool_install_magic="$magic" 2912290001Sglebius 2913290001Sglebius staticlibs= 2914290001Sglebius future_libdirs= 2915290001Sglebius current_libdirs= 2916290001Sglebius for file in $files; do 2917290001Sglebius 2918290001Sglebius # Do each installation. 2919290001Sglebius case $file in 2920290001Sglebius *.$libext) 2921290001Sglebius # Do the static libraries later. 2922290001Sglebius func_append staticlibs " $file" 2923290001Sglebius ;; 2924290001Sglebius 2925290001Sglebius *.la) 2926290001Sglebius func_resolve_sysroot "$file" 2927290001Sglebius file=$func_resolve_sysroot_result 2928290001Sglebius 2929290001Sglebius # Check to see that this really is a libtool archive. 2930290001Sglebius func_lalib_unsafe_p "$file" \ 2931290001Sglebius || func_fatal_help "\`$file' is not a valid libtool archive" 2932290001Sglebius 2933290001Sglebius library_names= 2934290001Sglebius old_library= 2935290001Sglebius relink_command= 2936290001Sglebius func_source "$file" 2937290001Sglebius 2938290001Sglebius # Add the libdir to current_libdirs if it is the destination. 2939290001Sglebius if test "X$destdir" = "X$libdir"; then 2940290001Sglebius case "$current_libdirs " in 2941290001Sglebius *" $libdir "*) ;; 2942290001Sglebius *) func_append current_libdirs " $libdir" ;; 2943290001Sglebius esac 2944290001Sglebius else 2945290001Sglebius # Note the libdir as a future libdir. 2946290001Sglebius case "$future_libdirs " in 2947290001Sglebius *" $libdir "*) ;; 2948290001Sglebius *) func_append future_libdirs " $libdir" ;; 2949290001Sglebius esac 2950290001Sglebius fi 2951290001Sglebius 2952290001Sglebius func_dirname "$file" "/" "" 2953290001Sglebius dir="$func_dirname_result" 2954290001Sglebius func_append dir "$objdir" 2955290001Sglebius 2956290001Sglebius if test -n "$relink_command"; then 2957290001Sglebius # Determine the prefix the user has applied to our future dir. 2958290001Sglebius inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 2959290001Sglebius 2960290001Sglebius # Don't allow the user to place us outside of our expected 2961290001Sglebius # location b/c this prevents finding dependent libraries that 2962290001Sglebius # are installed to the same prefix. 2963290001Sglebius # At present, this check doesn't affect windows .dll's that 2964290001Sglebius # are installed into $libdir/../bin (currently, that works fine) 2965290001Sglebius # but it's something to keep an eye on. 2966290001Sglebius test "$inst_prefix_dir" = "$destdir" && \ 2967290001Sglebius func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2968290001Sglebius 2969290001Sglebius if test -n "$inst_prefix_dir"; then 2970290001Sglebius # Stick the inst_prefix_dir data into the link command. 2971290001Sglebius relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2972290001Sglebius else 2973290001Sglebius relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 2974290001Sglebius fi 2975290001Sglebius 2976290001Sglebius func_warning "relinking \`$file'" 2977290001Sglebius func_show_eval "$relink_command" \ 2978290001Sglebius 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2979290001Sglebius fi 2980290001Sglebius 2981290001Sglebius # See the names of the shared library. 2982290001Sglebius set dummy $library_names; shift 2983290001Sglebius if test -n "$1"; then 2984290001Sglebius realname="$1" 2985290001Sglebius shift 2986290001Sglebius 2987290001Sglebius srcname="$realname" 2988290001Sglebius test -n "$relink_command" && srcname="$realname"T 2989290001Sglebius 2990290001Sglebius # Install the shared library and build the symlinks. 2991290001Sglebius func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 2992290001Sglebius 'exit $?' 2993290001Sglebius tstripme="$stripme" 2994290001Sglebius case $host_os in 2995290001Sglebius cygwin* | mingw* | pw32* | cegcc*) 2996290001Sglebius case $realname in 2997290001Sglebius *.dll.a) 2998290001Sglebius tstripme="" 2999290001Sglebius ;; 3000290001Sglebius esac 3001290001Sglebius ;; 3002290001Sglebius esac 3003290001Sglebius if test -n "$tstripme" && test -n "$striplib"; then 3004290001Sglebius func_show_eval "$striplib $destdir/$realname" 'exit $?' 3005290001Sglebius fi 3006290001Sglebius 3007290001Sglebius if test "$#" -gt 0; then 3008290001Sglebius # Delete the old symlinks, and create new ones. 3009290001Sglebius # Try `ln -sf' first, because the `ln' binary might depend on 3010290001Sglebius # the symlink we replace! Solaris /bin/ln does not understand -f, 3011290001Sglebius # so we also need to try rm && ln -s. 3012290001Sglebius for linkname 3013290001Sglebius do 3014290001Sglebius test "$linkname" != "$realname" \ 3015290001Sglebius && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 3016290001Sglebius done 3017290001Sglebius fi 3018290001Sglebius 3019290001Sglebius # Do each command in the postinstall commands. 3020290001Sglebius lib="$destdir/$realname" 3021290001Sglebius func_execute_cmds "$postinstall_cmds" 'exit $?' 3022290001Sglebius fi 3023290001Sglebius 3024290001Sglebius # Install the pseudo-library for information purposes. 3025290001Sglebius func_basename "$file" 3026290001Sglebius name="$func_basename_result" 3027290001Sglebius instname="$dir/$name"i 3028290001Sglebius func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 3029290001Sglebius 3030290001Sglebius # Maybe install the static library, too. 3031290001Sglebius test -n "$old_library" && func_append staticlibs " $dir/$old_library" 3032290001Sglebius ;; 3033290001Sglebius 3034290001Sglebius *.lo) 3035290001Sglebius # Install (i.e. copy) a libtool object. 3036290001Sglebius 3037290001Sglebius # Figure out destination file name, if it wasn't already specified. 3038290001Sglebius if test -n "$destname"; then 3039290001Sglebius destfile="$destdir/$destname" 3040290001Sglebius else 3041290001Sglebius func_basename "$file" 3042290001Sglebius destfile="$func_basename_result" 3043290001Sglebius destfile="$destdir/$destfile" 3044290001Sglebius fi 3045290001Sglebius 3046290001Sglebius # Deduce the name of the destination old-style object file. 3047290001Sglebius case $destfile in 3048290001Sglebius *.lo) 3049290001Sglebius func_lo2o "$destfile" 3050290001Sglebius staticdest=$func_lo2o_result 3051290001Sglebius ;; 3052290001Sglebius *.$objext) 3053290001Sglebius staticdest="$destfile" 3054290001Sglebius destfile= 3055290001Sglebius ;; 3056290001Sglebius *) 3057290001Sglebius func_fatal_help "cannot copy a libtool object to \`$destfile'" 3058290001Sglebius ;; 3059290001Sglebius esac 3060290001Sglebius 3061290001Sglebius # Install the libtool object if requested. 3062290001Sglebius test -n "$destfile" && \ 3063290001Sglebius func_show_eval "$install_prog $file $destfile" 'exit $?' 3064290001Sglebius 3065290001Sglebius # Install the old object if enabled. 3066290001Sglebius if test "$build_old_libs" = yes; then 3067290001Sglebius # Deduce the name of the old-style object file. 3068290001Sglebius func_lo2o "$file" 3069290001Sglebius staticobj=$func_lo2o_result 3070290001Sglebius func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 3071290001Sglebius fi 3072290001Sglebius exit $EXIT_SUCCESS 3073290001Sglebius ;; 3074290001Sglebius 3075290001Sglebius *) 3076290001Sglebius # Figure out destination file name, if it wasn't already specified. 3077290001Sglebius if test -n "$destname"; then 3078290001Sglebius destfile="$destdir/$destname" 3079290001Sglebius else 3080290001Sglebius func_basename "$file" 3081290001Sglebius destfile="$func_basename_result" 3082290001Sglebius destfile="$destdir/$destfile" 3083290001Sglebius fi 3084290001Sglebius 3085290001Sglebius # If the file is missing, and there is a .exe on the end, strip it 3086290001Sglebius # because it is most likely a libtool script we actually want to 3087290001Sglebius # install 3088290001Sglebius stripped_ext="" 3089290001Sglebius case $file in 3090290001Sglebius *.exe) 3091290001Sglebius if test ! -f "$file"; then 3092290001Sglebius func_stripname '' '.exe' "$file" 3093290001Sglebius file=$func_stripname_result 3094290001Sglebius stripped_ext=".exe" 3095290001Sglebius fi 3096290001Sglebius ;; 3097290001Sglebius esac 3098290001Sglebius 3099290001Sglebius # Do a test to see if this is really a libtool program. 3100290001Sglebius case $host in 3101290001Sglebius *cygwin* | *mingw*) 3102290001Sglebius if func_ltwrapper_executable_p "$file"; then 3103290001Sglebius func_ltwrapper_scriptname "$file" 3104290001Sglebius wrapper=$func_ltwrapper_scriptname_result 3105290001Sglebius else 3106290001Sglebius func_stripname '' '.exe' "$file" 3107290001Sglebius wrapper=$func_stripname_result 3108290001Sglebius fi 3109290001Sglebius ;; 3110290001Sglebius *) 3111290001Sglebius wrapper=$file 3112290001Sglebius ;; 3113290001Sglebius esac 3114290001Sglebius if func_ltwrapper_script_p "$wrapper"; then 3115290001Sglebius notinst_deplibs= 3116290001Sglebius relink_command= 3117290001Sglebius 3118290001Sglebius func_source "$wrapper" 3119290001Sglebius 3120290001Sglebius # Check the variables that should have been set. 3121290001Sglebius test -z "$generated_by_libtool_version" && \ 3122290001Sglebius func_fatal_error "invalid libtool wrapper script \`$wrapper'" 3123290001Sglebius 3124290001Sglebius finalize=yes 3125290001Sglebius for lib in $notinst_deplibs; do 3126290001Sglebius # Check to see that each library is installed. 3127290001Sglebius libdir= 3128290001Sglebius if test -f "$lib"; then 3129290001Sglebius func_source "$lib" 3130290001Sglebius fi 3131290001Sglebius libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 3132290001Sglebius if test -n "$libdir" && test ! -f "$libfile"; then 3133290001Sglebius func_warning "\`$lib' has not been installed in \`$libdir'" 3134290001Sglebius finalize=no 3135290001Sglebius fi 3136290001Sglebius done 3137290001Sglebius 3138290001Sglebius relink_command= 3139290001Sglebius func_source "$wrapper" 3140290001Sglebius 3141290001Sglebius outputname= 3142290001Sglebius if test "$fast_install" = no && test -n "$relink_command"; then 3143290001Sglebius $opt_dry_run || { 3144290001Sglebius if test "$finalize" = yes; then 3145290001Sglebius tmpdir=`func_mktempdir` 3146290001Sglebius func_basename "$file$stripped_ext" 3147290001Sglebius file="$func_basename_result" 3148290001Sglebius outputname="$tmpdir/$file" 3149290001Sglebius # Replace the output file specification. 3150290001Sglebius relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 3151290001Sglebius 3152290001Sglebius $opt_silent || { 3153290001Sglebius func_quote_for_expand "$relink_command" 3154290001Sglebius eval "func_echo $func_quote_for_expand_result" 3155290001Sglebius } 3156290001Sglebius if eval "$relink_command"; then : 3157290001Sglebius else 3158290001Sglebius func_error "error: relink \`$file' with the above command before installing it" 3159290001Sglebius $opt_dry_run || ${RM}r "$tmpdir" 3160290001Sglebius continue 3161290001Sglebius fi 3162290001Sglebius file="$outputname" 3163290001Sglebius else 3164290001Sglebius func_warning "cannot relink \`$file'" 3165290001Sglebius fi 3166290001Sglebius } 3167290001Sglebius else 3168290001Sglebius # Install the binary that we compiled earlier. 3169290001Sglebius file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 3170290001Sglebius fi 3171290001Sglebius fi 3172290001Sglebius 3173290001Sglebius # remove .exe since cygwin /usr/bin/install will append another 3174290001Sglebius # one anyway 3175290001Sglebius case $install_prog,$host in 3176290001Sglebius */usr/bin/install*,*cygwin*) 3177290001Sglebius case $file:$destfile in 3178290001Sglebius *.exe:*.exe) 3179290001Sglebius # this is ok 3180290001Sglebius ;; 3181290001Sglebius *.exe:*) 3182290001Sglebius destfile=$destfile.exe 3183290001Sglebius ;; 3184290001Sglebius *:*.exe) 3185290001Sglebius func_stripname '' '.exe' "$destfile" 3186290001Sglebius destfile=$func_stripname_result 3187290001Sglebius ;; 3188290001Sglebius esac 3189290001Sglebius ;; 3190290001Sglebius esac 3191290001Sglebius func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 3192290001Sglebius $opt_dry_run || if test -n "$outputname"; then 3193290001Sglebius ${RM}r "$tmpdir" 3194290001Sglebius fi 3195290001Sglebius ;; 3196290001Sglebius esac 3197290001Sglebius done 3198290001Sglebius 3199290001Sglebius for file in $staticlibs; do 3200290001Sglebius func_basename "$file" 3201290001Sglebius name="$func_basename_result" 3202290001Sglebius 3203290001Sglebius # Set up the ranlib parameters. 3204290001Sglebius oldlib="$destdir/$name" 3205290001Sglebius func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 3206290001Sglebius tool_oldlib=$func_to_tool_file_result 3207290001Sglebius 3208290001Sglebius func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 3209290001Sglebius 3210290001Sglebius if test -n "$stripme" && test -n "$old_striplib"; then 3211290001Sglebius func_show_eval "$old_striplib $tool_oldlib" 'exit $?' 3212290001Sglebius fi 3213290001Sglebius 3214290001Sglebius # Do each command in the postinstall commands. 3215290001Sglebius func_execute_cmds "$old_postinstall_cmds" 'exit $?' 3216290001Sglebius done 3217290001Sglebius 3218290001Sglebius test -n "$future_libdirs" && \ 3219290001Sglebius func_warning "remember to run \`$progname --finish$future_libdirs'" 3220290001Sglebius 3221290001Sglebius if test -n "$current_libdirs"; then 3222290001Sglebius # Maybe just do a dry run. 3223290001Sglebius $opt_dry_run && current_libdirs=" -n$current_libdirs" 3224290001Sglebius exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 3225290001Sglebius else 3226290001Sglebius exit $EXIT_SUCCESS 3227290001Sglebius fi 3228290001Sglebius} 3229290001Sglebius 3230290001Sglebiustest "$opt_mode" = install && func_mode_install ${1+"$@"} 3231290001Sglebius 3232290001Sglebius 3233290001Sglebius# func_generate_dlsyms outputname originator pic_p 3234290001Sglebius# Extract symbols from dlprefiles and create ${outputname}S.o with 3235290001Sglebius# a dlpreopen symbol table. 3236290001Sglebiusfunc_generate_dlsyms () 3237290001Sglebius{ 3238290001Sglebius $opt_debug 3239290001Sglebius my_outputname="$1" 3240290001Sglebius my_originator="$2" 3241290001Sglebius my_pic_p="${3-no}" 3242290001Sglebius my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 3243290001Sglebius my_dlsyms= 3244290001Sglebius 3245290001Sglebius if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3246290001Sglebius if test -n "$NM" && test -n "$global_symbol_pipe"; then 3247290001Sglebius my_dlsyms="${my_outputname}S.c" 3248290001Sglebius else 3249290001Sglebius func_error "not configured to extract global symbols from dlpreopened files" 3250290001Sglebius fi 3251290001Sglebius fi 3252290001Sglebius 3253290001Sglebius if test -n "$my_dlsyms"; then 3254290001Sglebius case $my_dlsyms in 3255290001Sglebius "") ;; 3256290001Sglebius *.c) 3257290001Sglebius # Discover the nlist of each of the dlfiles. 3258290001Sglebius nlist="$output_objdir/${my_outputname}.nm" 3259290001Sglebius 3260290001Sglebius func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 3261290001Sglebius 3262290001Sglebius # Parse the name list into a source file. 3263290001Sglebius func_verbose "creating $output_objdir/$my_dlsyms" 3264290001Sglebius 3265290001Sglebius $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 3266290001Sglebius/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 3267290001Sglebius/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 3268290001Sglebius 3269290001Sglebius#ifdef __cplusplus 3270290001Sglebiusextern \"C\" { 3271290001Sglebius#endif 3272290001Sglebius 3273290001Sglebius#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 3274290001Sglebius#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 3275290001Sglebius#endif 3276290001Sglebius 3277290001Sglebius/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 3278290001Sglebius#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 3279290001Sglebius/* DATA imports from DLLs on WIN32 con't be const, because runtime 3280290001Sglebius relocations are performed -- see ld's documentation on pseudo-relocs. */ 3281290001Sglebius# define LT_DLSYM_CONST 3282290001Sglebius#elif defined(__osf__) 3283290001Sglebius/* This system does not cope well with relocations in const data. */ 3284290001Sglebius# define LT_DLSYM_CONST 3285290001Sglebius#else 3286290001Sglebius# define LT_DLSYM_CONST const 3287290001Sglebius#endif 3288290001Sglebius 3289290001Sglebius/* External symbol declarations for the compiler. */\ 3290290001Sglebius" 3291290001Sglebius 3292290001Sglebius if test "$dlself" = yes; then 3293290001Sglebius func_verbose "generating symbol list for \`$output'" 3294290001Sglebius 3295290001Sglebius $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 3296290001Sglebius 3297290001Sglebius # Add our own program objects to the symbol list. 3298290001Sglebius progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 3299290001Sglebius for progfile in $progfiles; do 3300290001Sglebius func_to_tool_file "$progfile" func_convert_file_msys_to_w32 3301290001Sglebius func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" 3302290001Sglebius $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 3303290001Sglebius done 3304290001Sglebius 3305290001Sglebius if test -n "$exclude_expsyms"; then 3306290001Sglebius $opt_dry_run || { 3307290001Sglebius eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 3308290001Sglebius eval '$MV "$nlist"T "$nlist"' 3309290001Sglebius } 3310290001Sglebius fi 3311290001Sglebius 3312290001Sglebius if test -n "$export_symbols_regex"; then 3313290001Sglebius $opt_dry_run || { 3314290001Sglebius eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 3315290001Sglebius eval '$MV "$nlist"T "$nlist"' 3316290001Sglebius } 3317290001Sglebius fi 3318290001Sglebius 3319290001Sglebius # Prepare the list of exported symbols 3320290001Sglebius if test -z "$export_symbols"; then 3321290001Sglebius export_symbols="$output_objdir/$outputname.exp" 3322290001Sglebius $opt_dry_run || { 3323290001Sglebius $RM $export_symbols 3324290001Sglebius eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 3325290001Sglebius case $host in 3326290001Sglebius *cygwin* | *mingw* | *cegcc* ) 3327290001Sglebius eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3328290001Sglebius eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 3329290001Sglebius ;; 3330290001Sglebius esac 3331290001Sglebius } 3332290001Sglebius else 3333290001Sglebius $opt_dry_run || { 3334290001Sglebius eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 3335290001Sglebius eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 3336290001Sglebius eval '$MV "$nlist"T "$nlist"' 3337290001Sglebius case $host in 3338290001Sglebius *cygwin* | *mingw* | *cegcc* ) 3339290001Sglebius eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3340290001Sglebius eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 3341290001Sglebius ;; 3342290001Sglebius esac 3343290001Sglebius } 3344290001Sglebius fi 3345290001Sglebius fi 3346290001Sglebius 3347290001Sglebius for dlprefile in $dlprefiles; do 3348290001Sglebius func_verbose "extracting global C symbols from \`$dlprefile'" 3349290001Sglebius func_basename "$dlprefile" 3350290001Sglebius name="$func_basename_result" 3351290001Sglebius case $host in 3352290001Sglebius *cygwin* | *mingw* | *cegcc* ) 3353290001Sglebius # if an import library, we need to obtain dlname 3354290001Sglebius if func_win32_import_lib_p "$dlprefile"; then 3355290001Sglebius func_tr_sh "$dlprefile" 3356290001Sglebius eval "curr_lafile=\$libfile_$func_tr_sh_result" 3357290001Sglebius dlprefile_dlbasename="" 3358290001Sglebius if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 3359290001Sglebius # Use subshell, to avoid clobbering current variable values 3360290001Sglebius dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 3361290001Sglebius if test -n "$dlprefile_dlname" ; then 3362290001Sglebius func_basename "$dlprefile_dlname" 3363290001Sglebius dlprefile_dlbasename="$func_basename_result" 3364290001Sglebius else 3365290001Sglebius # no lafile. user explicitly requested -dlpreopen <import library>. 3366290001Sglebius $sharedlib_from_linklib_cmd "$dlprefile" 3367290001Sglebius dlprefile_dlbasename=$sharedlib_from_linklib_result 3368290001Sglebius fi 3369290001Sglebius fi 3370290001Sglebius $opt_dry_run || { 3371290001Sglebius if test -n "$dlprefile_dlbasename" ; then 3372290001Sglebius eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 3373290001Sglebius else 3374290001Sglebius func_warning "Could not compute DLL name from $name" 3375290001Sglebius eval '$ECHO ": $name " >> "$nlist"' 3376290001Sglebius fi 3377290001Sglebius func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3378290001Sglebius eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 3379290001Sglebius $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 3380290001Sglebius } 3381290001Sglebius else # not an import lib 3382290001Sglebius $opt_dry_run || { 3383290001Sglebius eval '$ECHO ": $name " >> "$nlist"' 3384290001Sglebius func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3385290001Sglebius eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 3386290001Sglebius } 3387290001Sglebius fi 3388290001Sglebius ;; 3389290001Sglebius *) 3390290001Sglebius $opt_dry_run || { 3391290001Sglebius eval '$ECHO ": $name " >> "$nlist"' 3392290001Sglebius func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3393290001Sglebius eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 3394290001Sglebius } 3395290001Sglebius ;; 3396290001Sglebius esac 3397290001Sglebius done 3398290001Sglebius 3399290001Sglebius $opt_dry_run || { 3400290001Sglebius # Make sure we have at least an empty file. 3401290001Sglebius test -f "$nlist" || : > "$nlist" 3402290001Sglebius 3403290001Sglebius if test -n "$exclude_expsyms"; then 3404290001Sglebius $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 3405290001Sglebius $MV "$nlist"T "$nlist" 3406290001Sglebius fi 3407290001Sglebius 3408290001Sglebius # Try sorting and uniquifying the output. 3409290001Sglebius if $GREP -v "^: " < "$nlist" | 3410290001Sglebius if sort -k 3 </dev/null >/dev/null 2>&1; then 3411290001Sglebius sort -k 3 3412290001Sglebius else 3413290001Sglebius sort +2 3414290001Sglebius fi | 3415290001Sglebius uniq > "$nlist"S; then 3416290001Sglebius : 3417290001Sglebius else 3418290001Sglebius $GREP -v "^: " < "$nlist" > "$nlist"S 3419290001Sglebius fi 3420290001Sglebius 3421290001Sglebius if test -f "$nlist"S; then 3422290001Sglebius eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 3423290001Sglebius else 3424290001Sglebius echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 3425290001Sglebius fi 3426290001Sglebius 3427290001Sglebius echo >> "$output_objdir/$my_dlsyms" "\ 3428290001Sglebius 3429290001Sglebius/* The mapping between symbol names and symbols. */ 3430290001Sglebiustypedef struct { 3431290001Sglebius const char *name; 3432290001Sglebius void *address; 3433290001Sglebius} lt_dlsymlist; 3434290001Sglebiusextern LT_DLSYM_CONST lt_dlsymlist 3435290001Sglebiuslt_${my_prefix}_LTX_preloaded_symbols[]; 3436290001SglebiusLT_DLSYM_CONST lt_dlsymlist 3437290001Sglebiuslt_${my_prefix}_LTX_preloaded_symbols[] = 3438290001Sglebius{\ 3439290001Sglebius { \"$my_originator\", (void *) 0 }," 3440290001Sglebius 3441290001Sglebius case $need_lib_prefix in 3442290001Sglebius no) 3443290001Sglebius eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 3444290001Sglebius ;; 3445290001Sglebius *) 3446290001Sglebius eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 3447290001Sglebius ;; 3448290001Sglebius esac 3449290001Sglebius echo >> "$output_objdir/$my_dlsyms" "\ 3450290001Sglebius {0, (void *) 0} 3451290001Sglebius}; 3452290001Sglebius 3453290001Sglebius/* This works around a problem in FreeBSD linker */ 3454290001Sglebius#ifdef FREEBSD_WORKAROUND 3455290001Sglebiusstatic const void *lt_preloaded_setup() { 3456290001Sglebius return lt_${my_prefix}_LTX_preloaded_symbols; 3457290001Sglebius} 3458290001Sglebius#endif 3459290001Sglebius 3460290001Sglebius#ifdef __cplusplus 3461290001Sglebius} 3462290001Sglebius#endif\ 3463290001Sglebius" 3464290001Sglebius } # !$opt_dry_run 3465290001Sglebius 3466290001Sglebius pic_flag_for_symtable= 3467290001Sglebius case "$compile_command " in 3468290001Sglebius *" -static "*) ;; 3469290001Sglebius *) 3470290001Sglebius case $host in 3471290001Sglebius # compiling the symbol table file with pic_flag works around 3472290001Sglebius # a FreeBSD bug that causes programs to crash when -lm is 3473290001Sglebius # linked before any other PIC object. But we must not use 3474290001Sglebius # pic_flag when linking with -static. The problem exists in 3475290001Sglebius # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 3476290001Sglebius *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 3477290001Sglebius pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 3478290001Sglebius *-*-hpux*) 3479290001Sglebius pic_flag_for_symtable=" $pic_flag" ;; 3480290001Sglebius *) 3481290001Sglebius if test "X$my_pic_p" != Xno; then 3482290001Sglebius pic_flag_for_symtable=" $pic_flag" 3483290001Sglebius fi 3484290001Sglebius ;; 3485290001Sglebius esac 3486290001Sglebius ;; 3487290001Sglebius esac 3488290001Sglebius symtab_cflags= 3489290001Sglebius for arg in $LTCFLAGS; do 3490290001Sglebius case $arg in 3491290001Sglebius -pie | -fpie | -fPIE) ;; 3492290001Sglebius *) func_append symtab_cflags " $arg" ;; 3493290001Sglebius esac 3494290001Sglebius done 3495290001Sglebius 3496290001Sglebius # Now compile the dynamic symbol file. 3497290001Sglebius func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 3498290001Sglebius 3499290001Sglebius # Clean up the generated files. 3500290001Sglebius func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 3501290001Sglebius 3502290001Sglebius # Transform the symbol file into the correct name. 3503290001Sglebius symfileobj="$output_objdir/${my_outputname}S.$objext" 3504290001Sglebius case $host in 3505290001Sglebius *cygwin* | *mingw* | *cegcc* ) 3506290001Sglebius if test -f "$output_objdir/$my_outputname.def"; then 3507290001Sglebius compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3508290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3509290001Sglebius else 3510290001Sglebius compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3511290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3512290001Sglebius fi 3513290001Sglebius ;; 3514290001Sglebius *) 3515290001Sglebius compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3516290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3517290001Sglebius ;; 3518290001Sglebius esac 3519290001Sglebius ;; 3520290001Sglebius *) 3521290001Sglebius func_fatal_error "unknown suffix for \`$my_dlsyms'" 3522290001Sglebius ;; 3523290001Sglebius esac 3524290001Sglebius else 3525290001Sglebius # We keep going just in case the user didn't refer to 3526290001Sglebius # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 3527290001Sglebius # really was required. 3528290001Sglebius 3529290001Sglebius # Nullify the symbol file. 3530290001Sglebius compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 3531290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 3532290001Sglebius fi 3533290001Sglebius} 3534290001Sglebius 3535290001Sglebius# func_win32_libid arg 3536290001Sglebius# return the library type of file 'arg' 3537290001Sglebius# 3538290001Sglebius# Need a lot of goo to handle *both* DLLs and import libs 3539290001Sglebius# Has to be a shell function in order to 'eat' the argument 3540290001Sglebius# that is supplied when $file_magic_command is called. 3541290001Sglebius# Despite the name, also deal with 64 bit binaries. 3542290001Sglebiusfunc_win32_libid () 3543290001Sglebius{ 3544290001Sglebius $opt_debug 3545290001Sglebius win32_libid_type="unknown" 3546290001Sglebius win32_fileres=`file -L $1 2>/dev/null` 3547290001Sglebius case $win32_fileres in 3548290001Sglebius *ar\ archive\ import\ library*) # definitely import 3549290001Sglebius win32_libid_type="x86 archive import" 3550290001Sglebius ;; 3551290001Sglebius *ar\ archive*) # could be an import, or static 3552290001Sglebius # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 3553290001Sglebius if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 3554290001Sglebius $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 3555290001Sglebius func_to_tool_file "$1" func_convert_file_msys_to_w32 3556290001Sglebius win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 3557290001Sglebius $SED -n -e ' 3558290001Sglebius 1,100{ 3559290001Sglebius / I /{ 3560290001Sglebius s,.*,import, 3561290001Sglebius p 3562290001Sglebius q 3563290001Sglebius } 3564290001Sglebius }'` 3565290001Sglebius case $win32_nmres in 3566290001Sglebius import*) win32_libid_type="x86 archive import";; 3567290001Sglebius *) win32_libid_type="x86 archive static";; 3568290001Sglebius esac 3569290001Sglebius fi 3570290001Sglebius ;; 3571290001Sglebius *DLL*) 3572290001Sglebius win32_libid_type="x86 DLL" 3573290001Sglebius ;; 3574290001Sglebius *executable*) # but shell scripts are "executable" too... 3575290001Sglebius case $win32_fileres in 3576290001Sglebius *MS\ Windows\ PE\ Intel*) 3577290001Sglebius win32_libid_type="x86 DLL" 3578290001Sglebius ;; 3579290001Sglebius esac 3580290001Sglebius ;; 3581290001Sglebius esac 3582290001Sglebius $ECHO "$win32_libid_type" 3583290001Sglebius} 3584290001Sglebius 3585290001Sglebius# func_cygming_dll_for_implib ARG 3586290001Sglebius# 3587290001Sglebius# Platform-specific function to extract the 3588290001Sglebius# name of the DLL associated with the specified 3589290001Sglebius# import library ARG. 3590290001Sglebius# Invoked by eval'ing the libtool variable 3591290001Sglebius# $sharedlib_from_linklib_cmd 3592290001Sglebius# Result is available in the variable 3593290001Sglebius# $sharedlib_from_linklib_result 3594290001Sglebiusfunc_cygming_dll_for_implib () 3595290001Sglebius{ 3596290001Sglebius $opt_debug 3597290001Sglebius sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 3598290001Sglebius} 3599290001Sglebius 3600290001Sglebius# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 3601290001Sglebius# 3602290001Sglebius# The is the core of a fallback implementation of a 3603290001Sglebius# platform-specific function to extract the name of the 3604290001Sglebius# DLL associated with the specified import library LIBNAME. 3605290001Sglebius# 3606290001Sglebius# SECTION_NAME is either .idata$6 or .idata$7, depending 3607290001Sglebius# on the platform and compiler that created the implib. 3608290001Sglebius# 3609290001Sglebius# Echos the name of the DLL associated with the 3610290001Sglebius# specified import library. 3611290001Sglebiusfunc_cygming_dll_for_implib_fallback_core () 3612290001Sglebius{ 3613290001Sglebius $opt_debug 3614290001Sglebius match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 3615290001Sglebius $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 3616290001Sglebius $SED '/^Contents of section '"$match_literal"':/{ 3617290001Sglebius # Place marker at beginning of archive member dllname section 3618290001Sglebius s/.*/====MARK====/ 3619290001Sglebius p 3620290001Sglebius d 3621290001Sglebius } 3622290001Sglebius # These lines can sometimes be longer than 43 characters, but 3623290001Sglebius # are always uninteresting 3624290001Sglebius /:[ ]*file format pe[i]\{,1\}-/d 3625290001Sglebius /^In archive [^:]*:/d 3626290001Sglebius # Ensure marker is printed 3627290001Sglebius /^====MARK====/p 3628290001Sglebius # Remove all lines with less than 43 characters 3629290001Sglebius /^.\{43\}/!d 3630290001Sglebius # From remaining lines, remove first 43 characters 3631290001Sglebius s/^.\{43\}//' | 3632290001Sglebius $SED -n ' 3633290001Sglebius # Join marker and all lines until next marker into a single line 3634290001Sglebius /^====MARK====/ b para 3635290001Sglebius H 3636290001Sglebius $ b para 3637290001Sglebius b 3638290001Sglebius :para 3639290001Sglebius x 3640290001Sglebius s/\n//g 3641290001Sglebius # Remove the marker 3642290001Sglebius s/^====MARK====// 3643290001Sglebius # Remove trailing dots and whitespace 3644290001Sglebius s/[\. \t]*$// 3645290001Sglebius # Print 3646290001Sglebius /./p' | 3647290001Sglebius # we now have a list, one entry per line, of the stringified 3648290001Sglebius # contents of the appropriate section of all members of the 3649290001Sglebius # archive which possess that section. Heuristic: eliminate 3650290001Sglebius # all those which have a first or second character that is 3651290001Sglebius # a '.' (that is, objdump's representation of an unprintable 3652290001Sglebius # character.) This should work for all archives with less than 3653290001Sglebius # 0x302f exports -- but will fail for DLLs whose name actually 3654290001Sglebius # begins with a literal '.' or a single character followed by 3655290001Sglebius # a '.'. 3656290001Sglebius # 3657290001Sglebius # Of those that remain, print the first one. 3658290001Sglebius $SED -e '/^\./d;/^.\./d;q' 3659290001Sglebius} 3660290001Sglebius 3661290001Sglebius# func_cygming_gnu_implib_p ARG 3662290001Sglebius# This predicate returns with zero status (TRUE) if 3663290001Sglebius# ARG is a GNU/binutils-style import library. Returns 3664290001Sglebius# with nonzero status (FALSE) otherwise. 3665290001Sglebiusfunc_cygming_gnu_implib_p () 3666290001Sglebius{ 3667290001Sglebius $opt_debug 3668290001Sglebius func_to_tool_file "$1" func_convert_file_msys_to_w32 3669290001Sglebius 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)$'` 3670290001Sglebius test -n "$func_cygming_gnu_implib_tmp" 3671290001Sglebius} 3672290001Sglebius 3673290001Sglebius# func_cygming_ms_implib_p ARG 3674290001Sglebius# This predicate returns with zero status (TRUE) if 3675290001Sglebius# ARG is an MS-style import library. Returns 3676290001Sglebius# with nonzero status (FALSE) otherwise. 3677290001Sglebiusfunc_cygming_ms_implib_p () 3678290001Sglebius{ 3679290001Sglebius $opt_debug 3680290001Sglebius func_to_tool_file "$1" func_convert_file_msys_to_w32 3681290001Sglebius func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 3682290001Sglebius test -n "$func_cygming_ms_implib_tmp" 3683290001Sglebius} 3684290001Sglebius 3685290001Sglebius# func_cygming_dll_for_implib_fallback ARG 3686290001Sglebius# Platform-specific function to extract the 3687290001Sglebius# name of the DLL associated with the specified 3688290001Sglebius# import library ARG. 3689290001Sglebius# 3690290001Sglebius# This fallback implementation is for use when $DLLTOOL 3691290001Sglebius# does not support the --identify-strict option. 3692290001Sglebius# Invoked by eval'ing the libtool variable 3693290001Sglebius# $sharedlib_from_linklib_cmd 3694290001Sglebius# Result is available in the variable 3695290001Sglebius# $sharedlib_from_linklib_result 3696290001Sglebiusfunc_cygming_dll_for_implib_fallback () 3697290001Sglebius{ 3698290001Sglebius $opt_debug 3699290001Sglebius if func_cygming_gnu_implib_p "$1" ; then 3700290001Sglebius # binutils import library 3701290001Sglebius sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 3702290001Sglebius elif func_cygming_ms_implib_p "$1" ; then 3703290001Sglebius # ms-generated import library 3704290001Sglebius sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 3705290001Sglebius else 3706290001Sglebius # unknown 3707290001Sglebius sharedlib_from_linklib_result="" 3708290001Sglebius fi 3709290001Sglebius} 3710290001Sglebius 3711290001Sglebius 3712290001Sglebius# func_extract_an_archive dir oldlib 3713290001Sglebiusfunc_extract_an_archive () 3714290001Sglebius{ 3715290001Sglebius $opt_debug 3716290001Sglebius f_ex_an_ar_dir="$1"; shift 3717290001Sglebius f_ex_an_ar_oldlib="$1" 3718290001Sglebius if test "$lock_old_archive_extraction" = yes; then 3719290001Sglebius lockfile=$f_ex_an_ar_oldlib.lock 3720290001Sglebius until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 3721290001Sglebius func_echo "Waiting for $lockfile to be removed" 3722290001Sglebius sleep 2 3723290001Sglebius done 3724290001Sglebius fi 3725290001Sglebius func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 3726290001Sglebius 'stat=$?; rm -f "$lockfile"; exit $stat' 3727290001Sglebius if test "$lock_old_archive_extraction" = yes; then 3728290001Sglebius $opt_dry_run || rm -f "$lockfile" 3729290001Sglebius fi 3730290001Sglebius if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3731290001Sglebius : 3732290001Sglebius else 3733290001Sglebius func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 3734290001Sglebius fi 3735290001Sglebius} 3736290001Sglebius 3737290001Sglebius 3738290001Sglebius# func_extract_archives gentop oldlib ... 3739290001Sglebiusfunc_extract_archives () 3740290001Sglebius{ 3741290001Sglebius $opt_debug 3742290001Sglebius my_gentop="$1"; shift 3743290001Sglebius my_oldlibs=${1+"$@"} 3744290001Sglebius my_oldobjs="" 3745290001Sglebius my_xlib="" 3746290001Sglebius my_xabs="" 3747290001Sglebius my_xdir="" 3748290001Sglebius 3749290001Sglebius for my_xlib in $my_oldlibs; do 3750290001Sglebius # Extract the objects. 3751290001Sglebius case $my_xlib in 3752290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3753290001Sglebius *) my_xabs=`pwd`"/$my_xlib" ;; 3754290001Sglebius esac 3755290001Sglebius func_basename "$my_xlib" 3756290001Sglebius my_xlib="$func_basename_result" 3757290001Sglebius my_xlib_u=$my_xlib 3758290001Sglebius while :; do 3759290001Sglebius case " $extracted_archives " in 3760290001Sglebius *" $my_xlib_u "*) 3761290001Sglebius func_arith $extracted_serial + 1 3762290001Sglebius extracted_serial=$func_arith_result 3763290001Sglebius my_xlib_u=lt$extracted_serial-$my_xlib ;; 3764290001Sglebius *) break ;; 3765290001Sglebius esac 3766290001Sglebius done 3767290001Sglebius extracted_archives="$extracted_archives $my_xlib_u" 3768290001Sglebius my_xdir="$my_gentop/$my_xlib_u" 3769290001Sglebius 3770290001Sglebius func_mkdir_p "$my_xdir" 3771290001Sglebius 3772290001Sglebius case $host in 3773290001Sglebius *-darwin*) 3774290001Sglebius func_verbose "Extracting $my_xabs" 3775290001Sglebius # Do not bother doing anything if just a dry run 3776290001Sglebius $opt_dry_run || { 3777290001Sglebius darwin_orig_dir=`pwd` 3778290001Sglebius cd $my_xdir || exit $? 3779290001Sglebius darwin_archive=$my_xabs 3780290001Sglebius darwin_curdir=`pwd` 3781290001Sglebius darwin_base_archive=`basename "$darwin_archive"` 3782290001Sglebius darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 3783290001Sglebius if test -n "$darwin_arches"; then 3784290001Sglebius darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 3785290001Sglebius darwin_arch= 3786290001Sglebius func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 3787290001Sglebius for darwin_arch in $darwin_arches ; do 3788290001Sglebius func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3789290001Sglebius $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3790290001Sglebius cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3791290001Sglebius func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3792290001Sglebius cd "$darwin_curdir" 3793290001Sglebius $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3794290001Sglebius done # $darwin_arches 3795290001Sglebius ## Okay now we've a bunch of thin objects, gotta fatten them up :) 3796290001Sglebius darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 3797290001Sglebius darwin_file= 3798290001Sglebius darwin_files= 3799290001Sglebius for darwin_file in $darwin_filelist; do 3800290001Sglebius darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 3801290001Sglebius $LIPO -create -output "$darwin_file" $darwin_files 3802290001Sglebius done # $darwin_filelist 3803290001Sglebius $RM -rf unfat-$$ 3804290001Sglebius cd "$darwin_orig_dir" 3805290001Sglebius else 3806290001Sglebius cd $darwin_orig_dir 3807290001Sglebius func_extract_an_archive "$my_xdir" "$my_xabs" 3808290001Sglebius fi # $darwin_arches 3809290001Sglebius } # !$opt_dry_run 3810290001Sglebius ;; 3811290001Sglebius *) 3812290001Sglebius func_extract_an_archive "$my_xdir" "$my_xabs" 3813290001Sglebius ;; 3814290001Sglebius esac 3815290001Sglebius my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 3816290001Sglebius done 3817290001Sglebius 3818290001Sglebius func_extract_archives_result="$my_oldobjs" 3819290001Sglebius} 3820290001Sglebius 3821290001Sglebius 3822290001Sglebius# func_emit_wrapper [arg=no] 3823290001Sglebius# 3824290001Sglebius# Emit a libtool wrapper script on stdout. 3825290001Sglebius# Don't directly open a file because we may want to 3826290001Sglebius# incorporate the script contents within a cygwin/mingw 3827290001Sglebius# wrapper executable. Must ONLY be called from within 3828290001Sglebius# func_mode_link because it depends on a number of variables 3829290001Sglebius# set therein. 3830290001Sglebius# 3831290001Sglebius# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 3832290001Sglebius# variable will take. If 'yes', then the emitted script 3833290001Sglebius# will assume that the directory in which it is stored is 3834290001Sglebius# the $objdir directory. This is a cygwin/mingw-specific 3835290001Sglebius# behavior. 3836290001Sglebiusfunc_emit_wrapper () 3837290001Sglebius{ 3838290001Sglebius func_emit_wrapper_arg1=${1-no} 3839290001Sglebius 3840290001Sglebius $ECHO "\ 3841290001Sglebius#! $SHELL 3842290001Sglebius 3843290001Sglebius# $output - temporary wrapper script for $objdir/$outputname 3844290001Sglebius# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3845290001Sglebius# 3846290001Sglebius# The $output program cannot be directly executed until all the libtool 3847290001Sglebius# libraries that it depends on are installed. 3848290001Sglebius# 3849290001Sglebius# This wrapper script should never be moved out of the build directory. 3850290001Sglebius# If it is, it will not operate correctly. 3851290001Sglebius 3852290001Sglebius# Sed substitution that helps us do robust quoting. It backslashifies 3853290001Sglebius# metacharacters that are still active within double-quoted strings. 3854290001Sglebiussed_quote_subst='$sed_quote_subst' 3855290001Sglebius 3856290001Sglebius# Be Bourne compatible 3857290001Sglebiusif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 3858290001Sglebius emulate sh 3859290001Sglebius NULLCMD=: 3860290001Sglebius # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 3861290001Sglebius # is contrary to our usage. Disable this feature. 3862290001Sglebius alias -g '\${1+\"\$@\"}'='\"\$@\"' 3863290001Sglebius setopt NO_GLOB_SUBST 3864290001Sglebiuselse 3865290001Sglebius case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 3866290001Sglebiusfi 3867290001SglebiusBIN_SH=xpg4; export BIN_SH # for Tru64 3868290001SglebiusDUALCASE=1; export DUALCASE # for MKS sh 3869290001Sglebius 3870290001Sglebius# The HP-UX ksh and POSIX shell print the target directory to stdout 3871290001Sglebius# if CDPATH is set. 3872290001Sglebius(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 3873290001Sglebius 3874290001Sglebiusrelink_command=\"$relink_command\" 3875290001Sglebius 3876290001Sglebius# This environment variable determines our operation mode. 3877290001Sglebiusif test \"\$libtool_install_magic\" = \"$magic\"; then 3878290001Sglebius # install mode needs the following variables: 3879290001Sglebius generated_by_libtool_version='$macro_version' 3880290001Sglebius notinst_deplibs='$notinst_deplibs' 3881290001Sglebiuselse 3882290001Sglebius # When we are sourced in execute mode, \$file and \$ECHO are already set. 3883290001Sglebius if test \"\$libtool_execute_magic\" != \"$magic\"; then 3884290001Sglebius file=\"\$0\"" 3885290001Sglebius 3886290001Sglebius qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 3887290001Sglebius $ECHO "\ 3888290001Sglebius 3889290001Sglebius# A function that is used when there is no print builtin or printf. 3890290001Sglebiusfunc_fallback_echo () 3891290001Sglebius{ 3892290001Sglebius eval 'cat <<_LTECHO_EOF 3893290001Sglebius\$1 3894290001Sglebius_LTECHO_EOF' 3895290001Sglebius} 3896290001Sglebius ECHO=\"$qECHO\" 3897290001Sglebius fi 3898290001Sglebius 3899290001Sglebius# Very basic option parsing. These options are (a) specific to 3900290001Sglebius# the libtool wrapper, (b) are identical between the wrapper 3901290001Sglebius# /script/ and the wrapper /executable/ which is used only on 3902290001Sglebius# windows platforms, and (c) all begin with the string "--lt-" 3903290001Sglebius# (application programs are unlikely to have options which match 3904290001Sglebius# this pattern). 3905290001Sglebius# 3906290001Sglebius# There are only two supported options: --lt-debug and 3907290001Sglebius# --lt-dump-script. There is, deliberately, no --lt-help. 3908290001Sglebius# 3909290001Sglebius# The first argument to this parsing function should be the 3910290001Sglebius# script's $0 value, followed by "$@". 3911290001Sglebiuslt_option_debug= 3912290001Sglebiusfunc_parse_lt_options () 3913290001Sglebius{ 3914290001Sglebius lt_script_arg0=\$0 3915290001Sglebius shift 3916290001Sglebius for lt_opt 3917290001Sglebius do 3918290001Sglebius case \"\$lt_opt\" in 3919290001Sglebius --lt-debug) lt_option_debug=1 ;; 3920290001Sglebius --lt-dump-script) 3921290001Sglebius lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 3922290001Sglebius test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 3923290001Sglebius lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 3924290001Sglebius cat \"\$lt_dump_D/\$lt_dump_F\" 3925290001Sglebius exit 0 3926290001Sglebius ;; 3927290001Sglebius --lt-*) 3928290001Sglebius \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 3929290001Sglebius exit 1 3930290001Sglebius ;; 3931290001Sglebius esac 3932290001Sglebius done 3933290001Sglebius 3934290001Sglebius # Print the debug banner immediately: 3935290001Sglebius if test -n \"\$lt_option_debug\"; then 3936290001Sglebius echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 3937290001Sglebius fi 3938290001Sglebius} 3939290001Sglebius 3940290001Sglebius# Used when --lt-debug. Prints its arguments to stdout 3941290001Sglebius# (redirection is the responsibility of the caller) 3942290001Sglebiusfunc_lt_dump_args () 3943290001Sglebius{ 3944290001Sglebius lt_dump_args_N=1; 3945290001Sglebius for lt_arg 3946290001Sglebius do 3947290001Sglebius \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 3948290001Sglebius lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 3949290001Sglebius done 3950290001Sglebius} 3951290001Sglebius 3952290001Sglebius# Core function for launching the target application 3953290001Sglebiusfunc_exec_program_core () 3954290001Sglebius{ 3955290001Sglebius" 3956290001Sglebius case $host in 3957290001Sglebius # Backslashes separate directories on plain windows 3958290001Sglebius *-*-mingw | *-*-os2* | *-cegcc*) 3959290001Sglebius $ECHO "\ 3960290001Sglebius if test -n \"\$lt_option_debug\"; then 3961290001Sglebius \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 3962290001Sglebius func_lt_dump_args \${1+\"\$@\"} 1>&2 3963290001Sglebius fi 3964290001Sglebius exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 3965290001Sglebius" 3966290001Sglebius ;; 3967290001Sglebius 3968290001Sglebius *) 3969290001Sglebius $ECHO "\ 3970290001Sglebius if test -n \"\$lt_option_debug\"; then 3971290001Sglebius \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 3972290001Sglebius func_lt_dump_args \${1+\"\$@\"} 1>&2 3973290001Sglebius fi 3974290001Sglebius exec \"\$progdir/\$program\" \${1+\"\$@\"} 3975290001Sglebius" 3976290001Sglebius ;; 3977290001Sglebius esac 3978290001Sglebius $ECHO "\ 3979290001Sglebius \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 3980290001Sglebius exit 1 3981290001Sglebius} 3982290001Sglebius 3983290001Sglebius# A function to encapsulate launching the target application 3984290001Sglebius# Strips options in the --lt-* namespace from \$@ and 3985290001Sglebius# launches target application with the remaining arguments. 3986290001Sglebiusfunc_exec_program () 3987290001Sglebius{ 3988290001Sglebius case \" \$* \" in 3989290001Sglebius *\\ --lt-*) 3990290001Sglebius for lt_wr_arg 3991290001Sglebius do 3992290001Sglebius case \$lt_wr_arg in 3993290001Sglebius --lt-*) ;; 3994290001Sglebius *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 3995290001Sglebius esac 3996290001Sglebius shift 3997290001Sglebius done ;; 3998290001Sglebius esac 3999290001Sglebius func_exec_program_core \${1+\"\$@\"} 4000290001Sglebius} 4001290001Sglebius 4002290001Sglebius # Parse options 4003290001Sglebius func_parse_lt_options \"\$0\" \${1+\"\$@\"} 4004290001Sglebius 4005290001Sglebius # Find the directory that this script lives in. 4006290001Sglebius thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 4007290001Sglebius test \"x\$thisdir\" = \"x\$file\" && thisdir=. 4008290001Sglebius 4009290001Sglebius # Follow symbolic links until we get to the real thisdir. 4010290001Sglebius file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 4011290001Sglebius while test -n \"\$file\"; do 4012290001Sglebius destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 4013290001Sglebius 4014290001Sglebius # If there was a directory component, then change thisdir. 4015290001Sglebius if test \"x\$destdir\" != \"x\$file\"; then 4016290001Sglebius case \"\$destdir\" in 4017290001Sglebius [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 4018290001Sglebius *) thisdir=\"\$thisdir/\$destdir\" ;; 4019290001Sglebius esac 4020290001Sglebius fi 4021290001Sglebius 4022290001Sglebius file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 4023290001Sglebius file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 4024290001Sglebius done 4025290001Sglebius 4026290001Sglebius # Usually 'no', except on cygwin/mingw when embedded into 4027290001Sglebius # the cwrapper. 4028290001Sglebius WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 4029290001Sglebius if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 4030290001Sglebius # special case for '.' 4031290001Sglebius if test \"\$thisdir\" = \".\"; then 4032290001Sglebius thisdir=\`pwd\` 4033290001Sglebius fi 4034290001Sglebius # remove .libs from thisdir 4035290001Sglebius case \"\$thisdir\" in 4036290001Sglebius *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 4037290001Sglebius $objdir ) thisdir=. ;; 4038290001Sglebius esac 4039290001Sglebius fi 4040290001Sglebius 4041290001Sglebius # Try to get the absolute directory name. 4042290001Sglebius absdir=\`cd \"\$thisdir\" && pwd\` 4043290001Sglebius test -n \"\$absdir\" && thisdir=\"\$absdir\" 4044290001Sglebius" 4045290001Sglebius 4046290001Sglebius if test "$fast_install" = yes; then 4047290001Sglebius $ECHO "\ 4048290001Sglebius program=lt-'$outputname'$exeext 4049290001Sglebius progdir=\"\$thisdir/$objdir\" 4050290001Sglebius 4051290001Sglebius if test ! -f \"\$progdir/\$program\" || 4052290001Sglebius { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 4053290001Sglebius test \"X\$file\" != \"X\$progdir/\$program\"; }; then 4054290001Sglebius 4055290001Sglebius file=\"\$\$-\$program\" 4056290001Sglebius 4057290001Sglebius if test ! -d \"\$progdir\"; then 4058290001Sglebius $MKDIR \"\$progdir\" 4059290001Sglebius else 4060290001Sglebius $RM \"\$progdir/\$file\" 4061290001Sglebius fi" 4062290001Sglebius 4063290001Sglebius $ECHO "\ 4064290001Sglebius 4065290001Sglebius # relink executable if necessary 4066290001Sglebius if test -n \"\$relink_command\"; then 4067290001Sglebius if relink_command_output=\`eval \$relink_command 2>&1\`; then : 4068290001Sglebius else 4069290001Sglebius $ECHO \"\$relink_command_output\" >&2 4070290001Sglebius $RM \"\$progdir/\$file\" 4071290001Sglebius exit 1 4072290001Sglebius fi 4073290001Sglebius fi 4074290001Sglebius 4075290001Sglebius $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 4076290001Sglebius { $RM \"\$progdir/\$program\"; 4077290001Sglebius $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 4078290001Sglebius $RM \"\$progdir/\$file\" 4079290001Sglebius fi" 4080290001Sglebius else 4081290001Sglebius $ECHO "\ 4082290001Sglebius program='$outputname' 4083290001Sglebius progdir=\"\$thisdir/$objdir\" 4084290001Sglebius" 4085290001Sglebius fi 4086290001Sglebius 4087290001Sglebius $ECHO "\ 4088290001Sglebius 4089290001Sglebius if test -f \"\$progdir/\$program\"; then" 4090290001Sglebius 4091290001Sglebius # fixup the dll searchpath if we need to. 4092290001Sglebius # 4093290001Sglebius # Fix the DLL searchpath if we need to. Do this before prepending 4094290001Sglebius # to shlibpath, because on Windows, both are PATH and uninstalled 4095290001Sglebius # libraries must come first. 4096290001Sglebius if test -n "$dllsearchpath"; then 4097290001Sglebius $ECHO "\ 4098290001Sglebius # Add the dll search path components to the executable PATH 4099290001Sglebius PATH=$dllsearchpath:\$PATH 4100290001Sglebius" 4101290001Sglebius fi 4102290001Sglebius 4103290001Sglebius # Export our shlibpath_var if we have one. 4104290001Sglebius if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4105290001Sglebius $ECHO "\ 4106290001Sglebius # Add our own library path to $shlibpath_var 4107290001Sglebius $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 4108290001Sglebius 4109290001Sglebius # Some systems cannot cope with colon-terminated $shlibpath_var 4110290001Sglebius # The second colon is a workaround for a bug in BeOS R4 sed 4111290001Sglebius $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 4112290001Sglebius 4113290001Sglebius export $shlibpath_var 4114290001Sglebius" 4115290001Sglebius fi 4116290001Sglebius 4117290001Sglebius $ECHO "\ 4118290001Sglebius if test \"\$libtool_execute_magic\" != \"$magic\"; then 4119290001Sglebius # Run the actual program with our arguments. 4120290001Sglebius func_exec_program \${1+\"\$@\"} 4121290001Sglebius fi 4122290001Sglebius else 4123290001Sglebius # The program doesn't exist. 4124290001Sglebius \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 4125290001Sglebius \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 4126290001Sglebius \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 4127290001Sglebius exit 1 4128290001Sglebius fi 4129290001Sglebiusfi\ 4130290001Sglebius" 4131290001Sglebius} 4132290001Sglebius 4133290001Sglebius 4134290001Sglebius# func_emit_cwrapperexe_src 4135290001Sglebius# emit the source code for a wrapper executable on stdout 4136290001Sglebius# Must ONLY be called from within func_mode_link because 4137290001Sglebius# it depends on a number of variable set therein. 4138290001Sglebiusfunc_emit_cwrapperexe_src () 4139290001Sglebius{ 4140290001Sglebius cat <<EOF 4141290001Sglebius 4142290001Sglebius/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4143290001Sglebius Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 4144290001Sglebius 4145290001Sglebius The $output program cannot be directly executed until all the libtool 4146290001Sglebius libraries that it depends on are installed. 4147290001Sglebius 4148290001Sglebius This wrapper executable should never be moved out of the build directory. 4149290001Sglebius If it is, it will not operate correctly. 4150290001Sglebius*/ 4151290001SglebiusEOF 4152290001Sglebius cat <<"EOF" 4153290001Sglebius#ifdef _MSC_VER 4154290001Sglebius# define _CRT_SECURE_NO_DEPRECATE 1 4155290001Sglebius#endif 4156290001Sglebius#include <stdio.h> 4157290001Sglebius#include <stdlib.h> 4158290001Sglebius#ifdef _MSC_VER 4159290001Sglebius# include <direct.h> 4160290001Sglebius# include <process.h> 4161290001Sglebius# include <io.h> 4162290001Sglebius#else 4163290001Sglebius# include <unistd.h> 4164290001Sglebius# include <stdint.h> 4165290001Sglebius# ifdef __CYGWIN__ 4166290001Sglebius# include <io.h> 4167290001Sglebius# endif 4168290001Sglebius#endif 4169290001Sglebius#include <malloc.h> 4170290001Sglebius#include <stdarg.h> 4171290001Sglebius#include <assert.h> 4172290001Sglebius#include <string.h> 4173290001Sglebius#include <ctype.h> 4174290001Sglebius#include <errno.h> 4175290001Sglebius#include <fcntl.h> 4176290001Sglebius#include <sys/stat.h> 4177290001Sglebius 4178290001Sglebius/* declarations of non-ANSI functions */ 4179290001Sglebius#if defined(__MINGW32__) 4180290001Sglebius# ifdef __STRICT_ANSI__ 4181290001Sglebiusint _putenv (const char *); 4182290001Sglebius# endif 4183290001Sglebius#elif defined(__CYGWIN__) 4184290001Sglebius# ifdef __STRICT_ANSI__ 4185290001Sglebiuschar *realpath (const char *, char *); 4186290001Sglebiusint putenv (char *); 4187290001Sglebiusint setenv (const char *, const char *, int); 4188290001Sglebius# endif 4189290001Sglebius/* #elif defined (other platforms) ... */ 4190290001Sglebius#endif 4191290001Sglebius 4192290001Sglebius/* portability defines, excluding path handling macros */ 4193290001Sglebius#if defined(_MSC_VER) 4194290001Sglebius# define setmode _setmode 4195290001Sglebius# define stat _stat 4196290001Sglebius# define chmod _chmod 4197290001Sglebius# define getcwd _getcwd 4198290001Sglebius# define putenv _putenv 4199290001Sglebius# define S_IXUSR _S_IEXEC 4200290001Sglebius# ifndef _INTPTR_T_DEFINED 4201290001Sglebius# define _INTPTR_T_DEFINED 4202290001Sglebius# define intptr_t int 4203290001Sglebius# endif 4204290001Sglebius#elif defined(__MINGW32__) 4205290001Sglebius# define setmode _setmode 4206290001Sglebius# define stat _stat 4207290001Sglebius# define chmod _chmod 4208290001Sglebius# define getcwd _getcwd 4209290001Sglebius# define putenv _putenv 4210290001Sglebius#elif defined(__CYGWIN__) 4211290001Sglebius# define HAVE_SETENV 4212290001Sglebius# define FOPEN_WB "wb" 4213290001Sglebius/* #elif defined (other platforms) ... */ 4214290001Sglebius#endif 4215290001Sglebius 4216290001Sglebius#if defined(PATH_MAX) 4217290001Sglebius# define LT_PATHMAX PATH_MAX 4218290001Sglebius#elif defined(MAXPATHLEN) 4219290001Sglebius# define LT_PATHMAX MAXPATHLEN 4220290001Sglebius#else 4221290001Sglebius# define LT_PATHMAX 1024 4222290001Sglebius#endif 4223290001Sglebius 4224290001Sglebius#ifndef S_IXOTH 4225290001Sglebius# define S_IXOTH 0 4226290001Sglebius#endif 4227290001Sglebius#ifndef S_IXGRP 4228290001Sglebius# define S_IXGRP 0 4229290001Sglebius#endif 4230290001Sglebius 4231290001Sglebius/* path handling portability macros */ 4232290001Sglebius#ifndef DIR_SEPARATOR 4233290001Sglebius# define DIR_SEPARATOR '/' 4234290001Sglebius# define PATH_SEPARATOR ':' 4235290001Sglebius#endif 4236290001Sglebius 4237290001Sglebius#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4238290001Sglebius defined (__OS2__) 4239290001Sglebius# define HAVE_DOS_BASED_FILE_SYSTEM 4240290001Sglebius# define FOPEN_WB "wb" 4241290001Sglebius# ifndef DIR_SEPARATOR_2 4242290001Sglebius# define DIR_SEPARATOR_2 '\\' 4243290001Sglebius# endif 4244290001Sglebius# ifndef PATH_SEPARATOR_2 4245290001Sglebius# define PATH_SEPARATOR_2 ';' 4246290001Sglebius# endif 4247290001Sglebius#endif 4248290001Sglebius 4249290001Sglebius#ifndef DIR_SEPARATOR_2 4250290001Sglebius# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4251290001Sglebius#else /* DIR_SEPARATOR_2 */ 4252290001Sglebius# define IS_DIR_SEPARATOR(ch) \ 4253290001Sglebius (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4254290001Sglebius#endif /* DIR_SEPARATOR_2 */ 4255290001Sglebius 4256290001Sglebius#ifndef PATH_SEPARATOR_2 4257290001Sglebius# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 4258290001Sglebius#else /* PATH_SEPARATOR_2 */ 4259290001Sglebius# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 4260290001Sglebius#endif /* PATH_SEPARATOR_2 */ 4261290001Sglebius 4262290001Sglebius#ifndef FOPEN_WB 4263290001Sglebius# define FOPEN_WB "w" 4264290001Sglebius#endif 4265290001Sglebius#ifndef _O_BINARY 4266290001Sglebius# define _O_BINARY 0 4267290001Sglebius#endif 4268290001Sglebius 4269290001Sglebius#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4270290001Sglebius#define XFREE(stale) do { \ 4271290001Sglebius if (stale) { free ((void *) stale); stale = 0; } \ 4272290001Sglebius} while (0) 4273290001Sglebius 4274290001Sglebius#if defined(LT_DEBUGWRAPPER) 4275290001Sglebiusstatic int lt_debug = 1; 4276290001Sglebius#else 4277290001Sglebiusstatic int lt_debug = 0; 4278290001Sglebius#endif 4279290001Sglebius 4280290001Sglebiusconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 4281290001Sglebius 4282290001Sglebiusvoid *xmalloc (size_t num); 4283290001Sglebiuschar *xstrdup (const char *string); 4284290001Sglebiusconst char *base_name (const char *name); 4285290001Sglebiuschar *find_executable (const char *wrapper); 4286290001Sglebiuschar *chase_symlinks (const char *pathspec); 4287290001Sglebiusint make_executable (const char *path); 4288290001Sglebiusint check_executable (const char *path); 4289290001Sglebiuschar *strendzap (char *str, const char *pat); 4290290001Sglebiusvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 4291290001Sglebiusvoid lt_fatal (const char *file, int line, const char *message, ...); 4292290001Sglebiusstatic const char *nonnull (const char *s); 4293290001Sglebiusstatic const char *nonempty (const char *s); 4294290001Sglebiusvoid lt_setenv (const char *name, const char *value); 4295290001Sglebiuschar *lt_extend_str (const char *orig_value, const char *add, int to_end); 4296290001Sglebiusvoid lt_update_exe_path (const char *name, const char *value); 4297290001Sglebiusvoid lt_update_lib_path (const char *name, const char *value); 4298290001Sglebiuschar **prepare_spawn (char **argv); 4299290001Sglebiusvoid lt_dump_script (FILE *f); 4300290001SglebiusEOF 4301290001Sglebius 4302290001Sglebius cat <<EOF 4303290001Sglebiusvolatile const char * MAGIC_EXE = "$magic_exe"; 4304290001Sglebiusconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 4305290001SglebiusEOF 4306290001Sglebius 4307290001Sglebius if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4308290001Sglebius func_to_host_path "$temp_rpath" 4309290001Sglebius cat <<EOF 4310290001Sglebiusconst char * LIB_PATH_VALUE = "$func_to_host_path_result"; 4311290001SglebiusEOF 4312290001Sglebius else 4313290001Sglebius cat <<"EOF" 4314290001Sglebiusconst char * LIB_PATH_VALUE = ""; 4315290001SglebiusEOF 4316290001Sglebius fi 4317290001Sglebius 4318290001Sglebius if test -n "$dllsearchpath"; then 4319290001Sglebius func_to_host_path "$dllsearchpath:" 4320290001Sglebius cat <<EOF 4321290001Sglebiusconst char * EXE_PATH_VARNAME = "PATH"; 4322290001Sglebiusconst char * EXE_PATH_VALUE = "$func_to_host_path_result"; 4323290001SglebiusEOF 4324290001Sglebius else 4325290001Sglebius cat <<"EOF" 4326290001Sglebiusconst char * EXE_PATH_VARNAME = ""; 4327290001Sglebiusconst char * EXE_PATH_VALUE = ""; 4328290001SglebiusEOF 4329290001Sglebius fi 4330290001Sglebius 4331290001Sglebius if test "$fast_install" = yes; then 4332290001Sglebius cat <<EOF 4333290001Sglebiusconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 4334290001SglebiusEOF 4335290001Sglebius else 4336290001Sglebius cat <<EOF 4337290001Sglebiusconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 4338290001SglebiusEOF 4339290001Sglebius fi 4340290001Sglebius 4341290001Sglebius 4342290001Sglebius cat <<"EOF" 4343290001Sglebius 4344290001Sglebius#define LTWRAPPER_OPTION_PREFIX "--lt-" 4345290001Sglebius 4346290001Sglebiusstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 4347290001Sglebiusstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 4348290001Sglebiusstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 4349290001Sglebius 4350290001Sglebiusint 4351290001Sglebiusmain (int argc, char *argv[]) 4352290001Sglebius{ 4353290001Sglebius char **newargz; 4354290001Sglebius int newargc; 4355290001Sglebius char *tmp_pathspec; 4356290001Sglebius char *actual_cwrapper_path; 4357290001Sglebius char *actual_cwrapper_name; 4358290001Sglebius char *target_name; 4359290001Sglebius char *lt_argv_zero; 4360290001Sglebius intptr_t rval = 127; 4361290001Sglebius 4362290001Sglebius int i; 4363290001Sglebius 4364290001Sglebius program_name = (char *) xstrdup (base_name (argv[0])); 4365290001Sglebius newargz = XMALLOC (char *, argc + 1); 4366290001Sglebius 4367290001Sglebius /* very simple arg parsing; don't want to rely on getopt 4368290001Sglebius * also, copy all non cwrapper options to newargz, except 4369290001Sglebius * argz[0], which is handled differently 4370290001Sglebius */ 4371290001Sglebius newargc=0; 4372290001Sglebius for (i = 1; i < argc; i++) 4373290001Sglebius { 4374290001Sglebius if (strcmp (argv[i], dumpscript_opt) == 0) 4375290001Sglebius { 4376290001SglebiusEOF 4377290001Sglebius case "$host" in 4378290001Sglebius *mingw* | *cygwin* ) 4379290001Sglebius # make stdout use "unix" line endings 4380290001Sglebius echo " setmode(1,_O_BINARY);" 4381290001Sglebius ;; 4382290001Sglebius esac 4383290001Sglebius 4384290001Sglebius cat <<"EOF" 4385290001Sglebius lt_dump_script (stdout); 4386290001Sglebius return 0; 4387290001Sglebius } 4388290001Sglebius if (strcmp (argv[i], debug_opt) == 0) 4389290001Sglebius { 4390290001Sglebius lt_debug = 1; 4391290001Sglebius continue; 4392290001Sglebius } 4393290001Sglebius if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 4394290001Sglebius { 4395290001Sglebius /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 4396290001Sglebius namespace, but it is not one of the ones we know about and 4397290001Sglebius have already dealt with, above (inluding dump-script), then 4398290001Sglebius report an error. Otherwise, targets might begin to believe 4399290001Sglebius they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 4400290001Sglebius namespace. The first time any user complains about this, we'll 4401290001Sglebius need to make LTWRAPPER_OPTION_PREFIX a configure-time option 4402290001Sglebius or a configure.ac-settable value. 4403290001Sglebius */ 4404290001Sglebius lt_fatal (__FILE__, __LINE__, 4405290001Sglebius "unrecognized %s option: '%s'", 4406290001Sglebius ltwrapper_option_prefix, argv[i]); 4407290001Sglebius } 4408290001Sglebius /* otherwise ... */ 4409290001Sglebius newargz[++newargc] = xstrdup (argv[i]); 4410290001Sglebius } 4411290001Sglebius newargz[++newargc] = NULL; 4412290001Sglebius 4413290001SglebiusEOF 4414290001Sglebius cat <<EOF 4415290001Sglebius /* The GNU banner must be the first non-error debug message */ 4416290001Sglebius lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 4417290001SglebiusEOF 4418290001Sglebius cat <<"EOF" 4419290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 4420290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 4421290001Sglebius 4422290001Sglebius tmp_pathspec = find_executable (argv[0]); 4423290001Sglebius if (tmp_pathspec == NULL) 4424290001Sglebius lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 4425290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4426290001Sglebius "(main) found exe (before symlink chase) at: %s\n", 4427290001Sglebius tmp_pathspec); 4428290001Sglebius 4429290001Sglebius actual_cwrapper_path = chase_symlinks (tmp_pathspec); 4430290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4431290001Sglebius "(main) found exe (after symlink chase) at: %s\n", 4432290001Sglebius actual_cwrapper_path); 4433290001Sglebius XFREE (tmp_pathspec); 4434290001Sglebius 4435290001Sglebius actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 4436290001Sglebius strendzap (actual_cwrapper_path, actual_cwrapper_name); 4437290001Sglebius 4438290001Sglebius /* wrapper name transforms */ 4439290001Sglebius strendzap (actual_cwrapper_name, ".exe"); 4440290001Sglebius tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 4441290001Sglebius XFREE (actual_cwrapper_name); 4442290001Sglebius actual_cwrapper_name = tmp_pathspec; 4443290001Sglebius tmp_pathspec = 0; 4444290001Sglebius 4445290001Sglebius /* target_name transforms -- use actual target program name; might have lt- prefix */ 4446290001Sglebius target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 4447290001Sglebius strendzap (target_name, ".exe"); 4448290001Sglebius tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 4449290001Sglebius XFREE (target_name); 4450290001Sglebius target_name = tmp_pathspec; 4451290001Sglebius tmp_pathspec = 0; 4452290001Sglebius 4453290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4454290001Sglebius "(main) libtool target name: %s\n", 4455290001Sglebius target_name); 4456290001SglebiusEOF 4457290001Sglebius 4458290001Sglebius cat <<EOF 4459290001Sglebius newargz[0] = 4460290001Sglebius XMALLOC (char, (strlen (actual_cwrapper_path) + 4461290001Sglebius strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 4462290001Sglebius strcpy (newargz[0], actual_cwrapper_path); 4463290001Sglebius strcat (newargz[0], "$objdir"); 4464290001Sglebius strcat (newargz[0], "/"); 4465290001SglebiusEOF 4466290001Sglebius 4467290001Sglebius cat <<"EOF" 4468290001Sglebius /* stop here, and copy so we don't have to do this twice */ 4469290001Sglebius tmp_pathspec = xstrdup (newargz[0]); 4470290001Sglebius 4471290001Sglebius /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 4472290001Sglebius strcat (newargz[0], actual_cwrapper_name); 4473290001Sglebius 4474290001Sglebius /* DO want the lt- prefix here if it exists, so use target_name */ 4475290001Sglebius lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 4476290001Sglebius XFREE (tmp_pathspec); 4477290001Sglebius tmp_pathspec = NULL; 4478290001SglebiusEOF 4479290001Sglebius 4480290001Sglebius case $host_os in 4481290001Sglebius mingw*) 4482290001Sglebius cat <<"EOF" 4483290001Sglebius { 4484290001Sglebius char* p; 4485290001Sglebius while ((p = strchr (newargz[0], '\\')) != NULL) 4486290001Sglebius { 4487290001Sglebius *p = '/'; 4488290001Sglebius } 4489290001Sglebius while ((p = strchr (lt_argv_zero, '\\')) != NULL) 4490290001Sglebius { 4491290001Sglebius *p = '/'; 4492290001Sglebius } 4493290001Sglebius } 4494290001SglebiusEOF 4495290001Sglebius ;; 4496290001Sglebius esac 4497290001Sglebius 4498290001Sglebius cat <<"EOF" 4499290001Sglebius XFREE (target_name); 4500290001Sglebius XFREE (actual_cwrapper_path); 4501290001Sglebius XFREE (actual_cwrapper_name); 4502290001Sglebius 4503290001Sglebius lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 4504290001Sglebius lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 4505290001Sglebius /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 4506290001Sglebius be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 4507290001Sglebius because on Windows, both *_VARNAMEs are PATH but uninstalled 4508290001Sglebius libraries must come first. */ 4509290001Sglebius lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 4510290001Sglebius lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 4511290001Sglebius 4512290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 4513290001Sglebius nonnull (lt_argv_zero)); 4514290001Sglebius for (i = 0; i < newargc; i++) 4515290001Sglebius { 4516290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 4517290001Sglebius i, nonnull (newargz[i])); 4518290001Sglebius } 4519290001Sglebius 4520290001SglebiusEOF 4521290001Sglebius 4522290001Sglebius case $host_os in 4523290001Sglebius mingw*) 4524290001Sglebius cat <<"EOF" 4525290001Sglebius /* execv doesn't actually work on mingw as expected on unix */ 4526290001Sglebius newargz = prepare_spawn (newargz); 4527290001Sglebius rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 4528290001Sglebius if (rval == -1) 4529290001Sglebius { 4530290001Sglebius /* failed to start process */ 4531290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4532290001Sglebius "(main) failed to launch target \"%s\": %s\n", 4533290001Sglebius lt_argv_zero, nonnull (strerror (errno))); 4534290001Sglebius return 127; 4535290001Sglebius } 4536290001Sglebius return rval; 4537290001SglebiusEOF 4538290001Sglebius ;; 4539290001Sglebius *) 4540290001Sglebius cat <<"EOF" 4541290001Sglebius execv (lt_argv_zero, newargz); 4542290001Sglebius return rval; /* =127, but avoids unused variable warning */ 4543290001SglebiusEOF 4544290001Sglebius ;; 4545290001Sglebius esac 4546290001Sglebius 4547290001Sglebius cat <<"EOF" 4548290001Sglebius} 4549290001Sglebius 4550290001Sglebiusvoid * 4551290001Sglebiusxmalloc (size_t num) 4552290001Sglebius{ 4553290001Sglebius void *p = (void *) malloc (num); 4554290001Sglebius if (!p) 4555290001Sglebius lt_fatal (__FILE__, __LINE__, "memory exhausted"); 4556290001Sglebius 4557290001Sglebius return p; 4558290001Sglebius} 4559290001Sglebius 4560290001Sglebiuschar * 4561290001Sglebiusxstrdup (const char *string) 4562290001Sglebius{ 4563290001Sglebius return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 4564290001Sglebius string) : NULL; 4565290001Sglebius} 4566290001Sglebius 4567290001Sglebiusconst char * 4568290001Sglebiusbase_name (const char *name) 4569290001Sglebius{ 4570290001Sglebius const char *base; 4571290001Sglebius 4572290001Sglebius#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4573290001Sglebius /* Skip over the disk name in MSDOS pathnames. */ 4574290001Sglebius if (isalpha ((unsigned char) name[0]) && name[1] == ':') 4575290001Sglebius name += 2; 4576290001Sglebius#endif 4577290001Sglebius 4578290001Sglebius for (base = name; *name; name++) 4579290001Sglebius if (IS_DIR_SEPARATOR (*name)) 4580290001Sglebius base = name + 1; 4581290001Sglebius return base; 4582290001Sglebius} 4583290001Sglebius 4584290001Sglebiusint 4585290001Sglebiuscheck_executable (const char *path) 4586290001Sglebius{ 4587290001Sglebius struct stat st; 4588290001Sglebius 4589290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 4590290001Sglebius nonempty (path)); 4591290001Sglebius if ((!path) || (!*path)) 4592290001Sglebius return 0; 4593290001Sglebius 4594290001Sglebius if ((stat (path, &st) >= 0) 4595290001Sglebius && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 4596290001Sglebius return 1; 4597290001Sglebius else 4598290001Sglebius return 0; 4599290001Sglebius} 4600290001Sglebius 4601290001Sglebiusint 4602290001Sglebiusmake_executable (const char *path) 4603290001Sglebius{ 4604290001Sglebius int rval = 0; 4605290001Sglebius struct stat st; 4606290001Sglebius 4607290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 4608290001Sglebius nonempty (path)); 4609290001Sglebius if ((!path) || (!*path)) 4610290001Sglebius return 0; 4611290001Sglebius 4612290001Sglebius if (stat (path, &st) >= 0) 4613290001Sglebius { 4614290001Sglebius rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 4615290001Sglebius } 4616290001Sglebius return rval; 4617290001Sglebius} 4618290001Sglebius 4619290001Sglebius/* Searches for the full path of the wrapper. Returns 4620290001Sglebius newly allocated full path name if found, NULL otherwise 4621290001Sglebius Does not chase symlinks, even on platforms that support them. 4622290001Sglebius*/ 4623290001Sglebiuschar * 4624290001Sglebiusfind_executable (const char *wrapper) 4625290001Sglebius{ 4626290001Sglebius int has_slash = 0; 4627290001Sglebius const char *p; 4628290001Sglebius const char *p_next; 4629290001Sglebius /* static buffer for getcwd */ 4630290001Sglebius char tmp[LT_PATHMAX + 1]; 4631290001Sglebius int tmp_len; 4632290001Sglebius char *concat_name; 4633290001Sglebius 4634290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 4635290001Sglebius nonempty (wrapper)); 4636290001Sglebius 4637290001Sglebius if ((wrapper == NULL) || (*wrapper == '\0')) 4638290001Sglebius return NULL; 4639290001Sglebius 4640290001Sglebius /* Absolute path? */ 4641290001Sglebius#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4642290001Sglebius if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 4643290001Sglebius { 4644290001Sglebius concat_name = xstrdup (wrapper); 4645290001Sglebius if (check_executable (concat_name)) 4646290001Sglebius return concat_name; 4647290001Sglebius XFREE (concat_name); 4648290001Sglebius } 4649290001Sglebius else 4650290001Sglebius { 4651290001Sglebius#endif 4652290001Sglebius if (IS_DIR_SEPARATOR (wrapper[0])) 4653290001Sglebius { 4654290001Sglebius concat_name = xstrdup (wrapper); 4655290001Sglebius if (check_executable (concat_name)) 4656290001Sglebius return concat_name; 4657290001Sglebius XFREE (concat_name); 4658290001Sglebius } 4659290001Sglebius#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4660290001Sglebius } 4661290001Sglebius#endif 4662290001Sglebius 4663290001Sglebius for (p = wrapper; *p; p++) 4664290001Sglebius if (*p == '/') 4665290001Sglebius { 4666290001Sglebius has_slash = 1; 4667290001Sglebius break; 4668290001Sglebius } 4669290001Sglebius if (!has_slash) 4670290001Sglebius { 4671290001Sglebius /* no slashes; search PATH */ 4672290001Sglebius const char *path = getenv ("PATH"); 4673290001Sglebius if (path != NULL) 4674290001Sglebius { 4675290001Sglebius for (p = path; *p; p = p_next) 4676290001Sglebius { 4677290001Sglebius const char *q; 4678290001Sglebius size_t p_len; 4679290001Sglebius for (q = p; *q; q++) 4680290001Sglebius if (IS_PATH_SEPARATOR (*q)) 4681290001Sglebius break; 4682290001Sglebius p_len = q - p; 4683290001Sglebius p_next = (*q == '\0' ? q : q + 1); 4684290001Sglebius if (p_len == 0) 4685290001Sglebius { 4686290001Sglebius /* empty path: current directory */ 4687290001Sglebius if (getcwd (tmp, LT_PATHMAX) == NULL) 4688290001Sglebius lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4689290001Sglebius nonnull (strerror (errno))); 4690290001Sglebius tmp_len = strlen (tmp); 4691290001Sglebius concat_name = 4692290001Sglebius XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4693290001Sglebius memcpy (concat_name, tmp, tmp_len); 4694290001Sglebius concat_name[tmp_len] = '/'; 4695290001Sglebius strcpy (concat_name + tmp_len + 1, wrapper); 4696290001Sglebius } 4697290001Sglebius else 4698290001Sglebius { 4699290001Sglebius concat_name = 4700290001Sglebius XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 4701290001Sglebius memcpy (concat_name, p, p_len); 4702290001Sglebius concat_name[p_len] = '/'; 4703290001Sglebius strcpy (concat_name + p_len + 1, wrapper); 4704290001Sglebius } 4705290001Sglebius if (check_executable (concat_name)) 4706290001Sglebius return concat_name; 4707290001Sglebius XFREE (concat_name); 4708290001Sglebius } 4709290001Sglebius } 4710290001Sglebius /* not found in PATH; assume curdir */ 4711290001Sglebius } 4712290001Sglebius /* Relative path | not found in path: prepend cwd */ 4713290001Sglebius if (getcwd (tmp, LT_PATHMAX) == NULL) 4714290001Sglebius lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4715290001Sglebius nonnull (strerror (errno))); 4716290001Sglebius tmp_len = strlen (tmp); 4717290001Sglebius concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4718290001Sglebius memcpy (concat_name, tmp, tmp_len); 4719290001Sglebius concat_name[tmp_len] = '/'; 4720290001Sglebius strcpy (concat_name + tmp_len + 1, wrapper); 4721290001Sglebius 4722290001Sglebius if (check_executable (concat_name)) 4723290001Sglebius return concat_name; 4724290001Sglebius XFREE (concat_name); 4725290001Sglebius return NULL; 4726290001Sglebius} 4727290001Sglebius 4728290001Sglebiuschar * 4729290001Sglebiuschase_symlinks (const char *pathspec) 4730290001Sglebius{ 4731290001Sglebius#ifndef S_ISLNK 4732290001Sglebius return xstrdup (pathspec); 4733290001Sglebius#else 4734290001Sglebius char buf[LT_PATHMAX]; 4735290001Sglebius struct stat s; 4736290001Sglebius char *tmp_pathspec = xstrdup (pathspec); 4737290001Sglebius char *p; 4738290001Sglebius int has_symlinks = 0; 4739290001Sglebius while (strlen (tmp_pathspec) && !has_symlinks) 4740290001Sglebius { 4741290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4742290001Sglebius "checking path component for symlinks: %s\n", 4743290001Sglebius tmp_pathspec); 4744290001Sglebius if (lstat (tmp_pathspec, &s) == 0) 4745290001Sglebius { 4746290001Sglebius if (S_ISLNK (s.st_mode) != 0) 4747290001Sglebius { 4748290001Sglebius has_symlinks = 1; 4749290001Sglebius break; 4750290001Sglebius } 4751290001Sglebius 4752290001Sglebius /* search backwards for last DIR_SEPARATOR */ 4753290001Sglebius p = tmp_pathspec + strlen (tmp_pathspec) - 1; 4754290001Sglebius while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4755290001Sglebius p--; 4756290001Sglebius if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4757290001Sglebius { 4758290001Sglebius /* no more DIR_SEPARATORS left */ 4759290001Sglebius break; 4760290001Sglebius } 4761290001Sglebius *p = '\0'; 4762290001Sglebius } 4763290001Sglebius else 4764290001Sglebius { 4765290001Sglebius lt_fatal (__FILE__, __LINE__, 4766290001Sglebius "error accessing file \"%s\": %s", 4767290001Sglebius tmp_pathspec, nonnull (strerror (errno))); 4768290001Sglebius } 4769290001Sglebius } 4770290001Sglebius XFREE (tmp_pathspec); 4771290001Sglebius 4772290001Sglebius if (!has_symlinks) 4773290001Sglebius { 4774290001Sglebius return xstrdup (pathspec); 4775290001Sglebius } 4776290001Sglebius 4777290001Sglebius tmp_pathspec = realpath (pathspec, buf); 4778290001Sglebius if (tmp_pathspec == 0) 4779290001Sglebius { 4780290001Sglebius lt_fatal (__FILE__, __LINE__, 4781290001Sglebius "could not follow symlinks for %s", pathspec); 4782290001Sglebius } 4783290001Sglebius return xstrdup (tmp_pathspec); 4784290001Sglebius#endif 4785290001Sglebius} 4786290001Sglebius 4787290001Sglebiuschar * 4788290001Sglebiusstrendzap (char *str, const char *pat) 4789290001Sglebius{ 4790290001Sglebius size_t len, patlen; 4791290001Sglebius 4792290001Sglebius assert (str != NULL); 4793290001Sglebius assert (pat != NULL); 4794290001Sglebius 4795290001Sglebius len = strlen (str); 4796290001Sglebius patlen = strlen (pat); 4797290001Sglebius 4798290001Sglebius if (patlen <= len) 4799290001Sglebius { 4800290001Sglebius str += len - patlen; 4801290001Sglebius if (strcmp (str, pat) == 0) 4802290001Sglebius *str = '\0'; 4803290001Sglebius } 4804290001Sglebius return str; 4805290001Sglebius} 4806290001Sglebius 4807290001Sglebiusvoid 4808290001Sglebiuslt_debugprintf (const char *file, int line, const char *fmt, ...) 4809290001Sglebius{ 4810290001Sglebius va_list args; 4811290001Sglebius if (lt_debug) 4812290001Sglebius { 4813290001Sglebius (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 4814290001Sglebius va_start (args, fmt); 4815290001Sglebius (void) vfprintf (stderr, fmt, args); 4816290001Sglebius va_end (args); 4817290001Sglebius } 4818290001Sglebius} 4819290001Sglebius 4820290001Sglebiusstatic void 4821290001Sglebiuslt_error_core (int exit_status, const char *file, 4822290001Sglebius int line, const char *mode, 4823290001Sglebius const char *message, va_list ap) 4824290001Sglebius{ 4825290001Sglebius fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 4826290001Sglebius vfprintf (stderr, message, ap); 4827290001Sglebius fprintf (stderr, ".\n"); 4828290001Sglebius 4829290001Sglebius if (exit_status >= 0) 4830290001Sglebius exit (exit_status); 4831290001Sglebius} 4832290001Sglebius 4833290001Sglebiusvoid 4834290001Sglebiuslt_fatal (const char *file, int line, const char *message, ...) 4835290001Sglebius{ 4836290001Sglebius va_list ap; 4837290001Sglebius va_start (ap, message); 4838290001Sglebius lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 4839290001Sglebius va_end (ap); 4840290001Sglebius} 4841290001Sglebius 4842290001Sglebiusstatic const char * 4843290001Sglebiusnonnull (const char *s) 4844290001Sglebius{ 4845290001Sglebius return s ? s : "(null)"; 4846290001Sglebius} 4847290001Sglebius 4848290001Sglebiusstatic const char * 4849290001Sglebiusnonempty (const char *s) 4850290001Sglebius{ 4851290001Sglebius return (s && !*s) ? "(empty)" : nonnull (s); 4852290001Sglebius} 4853290001Sglebius 4854290001Sglebiusvoid 4855290001Sglebiuslt_setenv (const char *name, const char *value) 4856290001Sglebius{ 4857290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4858290001Sglebius "(lt_setenv) setting '%s' to '%s'\n", 4859290001Sglebius nonnull (name), nonnull (value)); 4860290001Sglebius { 4861290001Sglebius#ifdef HAVE_SETENV 4862290001Sglebius /* always make a copy, for consistency with !HAVE_SETENV */ 4863290001Sglebius char *str = xstrdup (value); 4864290001Sglebius setenv (name, str, 1); 4865290001Sglebius#else 4866290001Sglebius int len = strlen (name) + 1 + strlen (value) + 1; 4867290001Sglebius char *str = XMALLOC (char, len); 4868290001Sglebius sprintf (str, "%s=%s", name, value); 4869290001Sglebius if (putenv (str) != EXIT_SUCCESS) 4870290001Sglebius { 4871290001Sglebius XFREE (str); 4872290001Sglebius } 4873290001Sglebius#endif 4874290001Sglebius } 4875290001Sglebius} 4876290001Sglebius 4877290001Sglebiuschar * 4878290001Sglebiuslt_extend_str (const char *orig_value, const char *add, int to_end) 4879290001Sglebius{ 4880290001Sglebius char *new_value; 4881290001Sglebius if (orig_value && *orig_value) 4882290001Sglebius { 4883290001Sglebius int orig_value_len = strlen (orig_value); 4884290001Sglebius int add_len = strlen (add); 4885290001Sglebius new_value = XMALLOC (char, add_len + orig_value_len + 1); 4886290001Sglebius if (to_end) 4887290001Sglebius { 4888290001Sglebius strcpy (new_value, orig_value); 4889290001Sglebius strcpy (new_value + orig_value_len, add); 4890290001Sglebius } 4891290001Sglebius else 4892290001Sglebius { 4893290001Sglebius strcpy (new_value, add); 4894290001Sglebius strcpy (new_value + add_len, orig_value); 4895290001Sglebius } 4896290001Sglebius } 4897290001Sglebius else 4898290001Sglebius { 4899290001Sglebius new_value = xstrdup (add); 4900290001Sglebius } 4901290001Sglebius return new_value; 4902290001Sglebius} 4903290001Sglebius 4904290001Sglebiusvoid 4905290001Sglebiuslt_update_exe_path (const char *name, const char *value) 4906290001Sglebius{ 4907290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4908290001Sglebius "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 4909290001Sglebius nonnull (name), nonnull (value)); 4910290001Sglebius 4911290001Sglebius if (name && *name && value && *value) 4912290001Sglebius { 4913290001Sglebius char *new_value = lt_extend_str (getenv (name), value, 0); 4914290001Sglebius /* some systems can't cope with a ':'-terminated path #' */ 4915290001Sglebius int len = strlen (new_value); 4916290001Sglebius while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 4917290001Sglebius { 4918290001Sglebius new_value[len-1] = '\0'; 4919290001Sglebius } 4920290001Sglebius lt_setenv (name, new_value); 4921290001Sglebius XFREE (new_value); 4922290001Sglebius } 4923290001Sglebius} 4924290001Sglebius 4925290001Sglebiusvoid 4926290001Sglebiuslt_update_lib_path (const char *name, const char *value) 4927290001Sglebius{ 4928290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4929290001Sglebius "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 4930290001Sglebius nonnull (name), nonnull (value)); 4931290001Sglebius 4932290001Sglebius if (name && *name && value && *value) 4933290001Sglebius { 4934290001Sglebius char *new_value = lt_extend_str (getenv (name), value, 0); 4935290001Sglebius lt_setenv (name, new_value); 4936290001Sglebius XFREE (new_value); 4937290001Sglebius } 4938290001Sglebius} 4939290001Sglebius 4940290001SglebiusEOF 4941290001Sglebius case $host_os in 4942290001Sglebius mingw*) 4943290001Sglebius cat <<"EOF" 4944290001Sglebius 4945290001Sglebius/* Prepares an argument vector before calling spawn(). 4946290001Sglebius Note that spawn() does not by itself call the command interpreter 4947290001Sglebius (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 4948290001Sglebius ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 4949290001Sglebius GetVersionEx(&v); 4950290001Sglebius v.dwPlatformId == VER_PLATFORM_WIN32_NT; 4951290001Sglebius }) ? "cmd.exe" : "command.com"). 4952290001Sglebius Instead it simply concatenates the arguments, separated by ' ', and calls 4953290001Sglebius CreateProcess(). We must quote the arguments since Win32 CreateProcess() 4954290001Sglebius interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 4955290001Sglebius special way: 4956290001Sglebius - Space and tab are interpreted as delimiters. They are not treated as 4957290001Sglebius delimiters if they are surrounded by double quotes: "...". 4958290001Sglebius - Unescaped double quotes are removed from the input. Their only effect is 4959290001Sglebius that within double quotes, space and tab are treated like normal 4960290001Sglebius characters. 4961290001Sglebius - Backslashes not followed by double quotes are not special. 4962290001Sglebius - But 2*n+1 backslashes followed by a double quote become 4963290001Sglebius n backslashes followed by a double quote (n >= 0): 4964290001Sglebius \" -> " 4965290001Sglebius \\\" -> \" 4966290001Sglebius \\\\\" -> \\" 4967290001Sglebius */ 4968290001Sglebius#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" 4969290001Sglebius#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" 4970290001Sglebiuschar ** 4971290001Sglebiusprepare_spawn (char **argv) 4972290001Sglebius{ 4973290001Sglebius size_t argc; 4974290001Sglebius char **new_argv; 4975290001Sglebius size_t i; 4976290001Sglebius 4977290001Sglebius /* Count number of arguments. */ 4978290001Sglebius for (argc = 0; argv[argc] != NULL; argc++) 4979290001Sglebius ; 4980290001Sglebius 4981290001Sglebius /* Allocate new argument vector. */ 4982290001Sglebius new_argv = XMALLOC (char *, argc + 1); 4983290001Sglebius 4984290001Sglebius /* Put quoted arguments into the new argument vector. */ 4985290001Sglebius for (i = 0; i < argc; i++) 4986290001Sglebius { 4987290001Sglebius const char *string = argv[i]; 4988290001Sglebius 4989290001Sglebius if (string[0] == '\0') 4990290001Sglebius new_argv[i] = xstrdup ("\"\""); 4991290001Sglebius else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 4992290001Sglebius { 4993290001Sglebius int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 4994290001Sglebius size_t length; 4995290001Sglebius unsigned int backslashes; 4996290001Sglebius const char *s; 4997290001Sglebius char *quoted_string; 4998290001Sglebius char *p; 4999290001Sglebius 5000290001Sglebius length = 0; 5001290001Sglebius backslashes = 0; 5002290001Sglebius if (quote_around) 5003290001Sglebius length++; 5004290001Sglebius for (s = string; *s != '\0'; s++) 5005290001Sglebius { 5006290001Sglebius char c = *s; 5007290001Sglebius if (c == '"') 5008290001Sglebius length += backslashes + 1; 5009290001Sglebius length++; 5010290001Sglebius if (c == '\\') 5011290001Sglebius backslashes++; 5012290001Sglebius else 5013290001Sglebius backslashes = 0; 5014290001Sglebius } 5015290001Sglebius if (quote_around) 5016290001Sglebius length += backslashes + 1; 5017290001Sglebius 5018290001Sglebius quoted_string = XMALLOC (char, length + 1); 5019290001Sglebius 5020290001Sglebius p = quoted_string; 5021290001Sglebius backslashes = 0; 5022290001Sglebius if (quote_around) 5023290001Sglebius *p++ = '"'; 5024290001Sglebius for (s = string; *s != '\0'; s++) 5025290001Sglebius { 5026290001Sglebius char c = *s; 5027290001Sglebius if (c == '"') 5028290001Sglebius { 5029290001Sglebius unsigned int j; 5030290001Sglebius for (j = backslashes + 1; j > 0; j--) 5031290001Sglebius *p++ = '\\'; 5032290001Sglebius } 5033290001Sglebius *p++ = c; 5034290001Sglebius if (c == '\\') 5035290001Sglebius backslashes++; 5036290001Sglebius else 5037290001Sglebius backslashes = 0; 5038290001Sglebius } 5039290001Sglebius if (quote_around) 5040290001Sglebius { 5041290001Sglebius unsigned int j; 5042290001Sglebius for (j = backslashes; j > 0; j--) 5043290001Sglebius *p++ = '\\'; 5044290001Sglebius *p++ = '"'; 5045290001Sglebius } 5046290001Sglebius *p = '\0'; 5047290001Sglebius 5048290001Sglebius new_argv[i] = quoted_string; 5049290001Sglebius } 5050290001Sglebius else 5051290001Sglebius new_argv[i] = (char *) string; 5052290001Sglebius } 5053290001Sglebius new_argv[argc] = NULL; 5054290001Sglebius 5055290001Sglebius return new_argv; 5056290001Sglebius} 5057290001SglebiusEOF 5058290001Sglebius ;; 5059290001Sglebius esac 5060290001Sglebius 5061290001Sglebius cat <<"EOF" 5062290001Sglebiusvoid lt_dump_script (FILE* f) 5063290001Sglebius{ 5064290001SglebiusEOF 5065290001Sglebius func_emit_wrapper yes | 5066290001Sglebius $SED -n -e ' 5067290001Sglebiuss/^\(.\{79\}\)\(..*\)/\1\ 5068290001Sglebius\2/ 5069290001Sglebiush 5070290001Sglebiuss/\([\\"]\)/\\\1/g 5071290001Sglebiuss/$/\\n/ 5072290001Sglebiuss/\([^\n]*\).*/ fputs ("\1", f);/p 5073290001Sglebiusg 5074290001SglebiusD' 5075290001Sglebius cat <<"EOF" 5076290001Sglebius} 5077290001SglebiusEOF 5078290001Sglebius} 5079290001Sglebius# end: func_emit_cwrapperexe_src 5080290001Sglebius 5081290001Sglebius# func_win32_import_lib_p ARG 5082290001Sglebius# True if ARG is an import lib, as indicated by $file_magic_cmd 5083290001Sglebiusfunc_win32_import_lib_p () 5084290001Sglebius{ 5085290001Sglebius $opt_debug 5086290001Sglebius case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 5087290001Sglebius *import*) : ;; 5088290001Sglebius *) false ;; 5089290001Sglebius esac 5090290001Sglebius} 5091290001Sglebius 5092290001Sglebius# func_mode_link arg... 5093290001Sglebiusfunc_mode_link () 5094290001Sglebius{ 5095290001Sglebius $opt_debug 5096290001Sglebius case $host in 5097290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5098290001Sglebius # It is impossible to link a dll without this setting, and 5099290001Sglebius # we shouldn't force the makefile maintainer to figure out 5100290001Sglebius # which system we are compiling for in order to pass an extra 5101290001Sglebius # flag for every libtool invocation. 5102290001Sglebius # allow_undefined=no 5103290001Sglebius 5104290001Sglebius # FIXME: Unfortunately, there are problems with the above when trying 5105290001Sglebius # to make a dll which has undefined symbols, in which case not 5106290001Sglebius # even a static library is built. For now, we need to specify 5107290001Sglebius # -no-undefined on the libtool link line when we can be certain 5108290001Sglebius # that all symbols are satisfied, otherwise we get a static library. 5109290001Sglebius allow_undefined=yes 5110290001Sglebius ;; 5111290001Sglebius *) 5112290001Sglebius allow_undefined=yes 5113290001Sglebius ;; 5114290001Sglebius esac 5115290001Sglebius libtool_args=$nonopt 5116290001Sglebius base_compile="$nonopt $@" 5117290001Sglebius compile_command=$nonopt 5118290001Sglebius finalize_command=$nonopt 5119290001Sglebius 5120290001Sglebius compile_rpath= 5121290001Sglebius finalize_rpath= 5122290001Sglebius compile_shlibpath= 5123290001Sglebius finalize_shlibpath= 5124290001Sglebius convenience= 5125290001Sglebius old_convenience= 5126290001Sglebius deplibs= 5127290001Sglebius old_deplibs= 5128290001Sglebius compiler_flags= 5129290001Sglebius linker_flags= 5130290001Sglebius dllsearchpath= 5131290001Sglebius lib_search_path=`pwd` 5132290001Sglebius inst_prefix_dir= 5133290001Sglebius new_inherited_linker_flags= 5134290001Sglebius 5135290001Sglebius avoid_version=no 5136290001Sglebius bindir= 5137290001Sglebius dlfiles= 5138290001Sglebius dlprefiles= 5139290001Sglebius dlself=no 5140290001Sglebius export_dynamic=no 5141290001Sglebius export_symbols= 5142290001Sglebius export_symbols_regex= 5143290001Sglebius generated= 5144290001Sglebius libobjs= 5145290001Sglebius ltlibs= 5146290001Sglebius module=no 5147290001Sglebius no_install=no 5148290001Sglebius objs= 5149290001Sglebius non_pic_objects= 5150290001Sglebius precious_files_regex= 5151290001Sglebius prefer_static_libs=no 5152290001Sglebius preload=no 5153290001Sglebius prev= 5154290001Sglebius prevarg= 5155290001Sglebius release= 5156290001Sglebius rpath= 5157290001Sglebius xrpath= 5158290001Sglebius perm_rpath= 5159290001Sglebius temp_rpath= 5160290001Sglebius thread_safe=no 5161290001Sglebius vinfo= 5162290001Sglebius vinfo_number=no 5163290001Sglebius weak_libs= 5164290001Sglebius single_module="${wl}-single_module" 5165290001Sglebius func_infer_tag $base_compile 5166290001Sglebius 5167290001Sglebius # We need to know -static, to get the right output filenames. 5168290001Sglebius for arg 5169290001Sglebius do 5170290001Sglebius case $arg in 5171290001Sglebius -shared) 5172290001Sglebius test "$build_libtool_libs" != yes && \ 5173290001Sglebius func_fatal_configuration "can not build a shared library" 5174290001Sglebius build_old_libs=no 5175290001Sglebius break 5176290001Sglebius ;; 5177290001Sglebius -all-static | -static | -static-libtool-libs) 5178290001Sglebius case $arg in 5179290001Sglebius -all-static) 5180290001Sglebius if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 5181290001Sglebius func_warning "complete static linking is impossible in this configuration" 5182290001Sglebius fi 5183290001Sglebius if test -n "$link_static_flag"; then 5184290001Sglebius dlopen_self=$dlopen_self_static 5185290001Sglebius fi 5186290001Sglebius prefer_static_libs=yes 5187290001Sglebius ;; 5188290001Sglebius -static) 5189290001Sglebius if test -z "$pic_flag" && test -n "$link_static_flag"; then 5190290001Sglebius dlopen_self=$dlopen_self_static 5191290001Sglebius fi 5192290001Sglebius prefer_static_libs=built 5193290001Sglebius ;; 5194290001Sglebius -static-libtool-libs) 5195290001Sglebius if test -z "$pic_flag" && test -n "$link_static_flag"; then 5196290001Sglebius dlopen_self=$dlopen_self_static 5197290001Sglebius fi 5198290001Sglebius prefer_static_libs=yes 5199290001Sglebius ;; 5200290001Sglebius esac 5201290001Sglebius build_libtool_libs=no 5202290001Sglebius build_old_libs=yes 5203290001Sglebius break 5204290001Sglebius ;; 5205290001Sglebius esac 5206290001Sglebius done 5207290001Sglebius 5208290001Sglebius # See if our shared archives depend on static archives. 5209290001Sglebius test -n "$old_archive_from_new_cmds" && build_old_libs=yes 5210290001Sglebius 5211290001Sglebius # Go through the arguments, transforming them on the way. 5212290001Sglebius while test "$#" -gt 0; do 5213290001Sglebius arg="$1" 5214290001Sglebius shift 5215290001Sglebius func_quote_for_eval "$arg" 5216290001Sglebius qarg=$func_quote_for_eval_unquoted_result 5217290001Sglebius func_append libtool_args " $func_quote_for_eval_result" 5218290001Sglebius 5219290001Sglebius # If the previous option needs an argument, assign it. 5220290001Sglebius if test -n "$prev"; then 5221290001Sglebius case $prev in 5222290001Sglebius output) 5223290001Sglebius func_append compile_command " @OUTPUT@" 5224290001Sglebius func_append finalize_command " @OUTPUT@" 5225290001Sglebius ;; 5226290001Sglebius esac 5227290001Sglebius 5228290001Sglebius case $prev in 5229290001Sglebius bindir) 5230290001Sglebius bindir="$arg" 5231290001Sglebius prev= 5232290001Sglebius continue 5233290001Sglebius ;; 5234290001Sglebius dlfiles|dlprefiles) 5235290001Sglebius if test "$preload" = no; then 5236290001Sglebius # Add the symbol object into the linking commands. 5237290001Sglebius func_append compile_command " @SYMFILE@" 5238290001Sglebius func_append finalize_command " @SYMFILE@" 5239290001Sglebius preload=yes 5240290001Sglebius fi 5241290001Sglebius case $arg in 5242290001Sglebius *.la | *.lo) ;; # We handle these cases below. 5243290001Sglebius force) 5244290001Sglebius if test "$dlself" = no; then 5245290001Sglebius dlself=needless 5246290001Sglebius export_dynamic=yes 5247290001Sglebius fi 5248290001Sglebius prev= 5249290001Sglebius continue 5250290001Sglebius ;; 5251290001Sglebius self) 5252290001Sglebius if test "$prev" = dlprefiles; then 5253290001Sglebius dlself=yes 5254290001Sglebius elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 5255290001Sglebius dlself=yes 5256290001Sglebius else 5257290001Sglebius dlself=needless 5258290001Sglebius export_dynamic=yes 5259290001Sglebius fi 5260290001Sglebius prev= 5261290001Sglebius continue 5262290001Sglebius ;; 5263290001Sglebius *) 5264290001Sglebius if test "$prev" = dlfiles; then 5265290001Sglebius func_append dlfiles " $arg" 5266290001Sglebius else 5267290001Sglebius func_append dlprefiles " $arg" 5268290001Sglebius fi 5269290001Sglebius prev= 5270290001Sglebius continue 5271290001Sglebius ;; 5272290001Sglebius esac 5273290001Sglebius ;; 5274290001Sglebius expsyms) 5275290001Sglebius export_symbols="$arg" 5276290001Sglebius test -f "$arg" \ 5277290001Sglebius || func_fatal_error "symbol file \`$arg' does not exist" 5278290001Sglebius prev= 5279290001Sglebius continue 5280290001Sglebius ;; 5281290001Sglebius expsyms_regex) 5282290001Sglebius export_symbols_regex="$arg" 5283290001Sglebius prev= 5284290001Sglebius continue 5285290001Sglebius ;; 5286290001Sglebius framework) 5287290001Sglebius case $host in 5288290001Sglebius *-*-darwin*) 5289290001Sglebius case "$deplibs " in 5290290001Sglebius *" $qarg.ltframework "*) ;; 5291290001Sglebius *) func_append deplibs " $qarg.ltframework" # this is fixed later 5292290001Sglebius ;; 5293290001Sglebius esac 5294290001Sglebius ;; 5295290001Sglebius esac 5296290001Sglebius prev= 5297290001Sglebius continue 5298290001Sglebius ;; 5299290001Sglebius inst_prefix) 5300290001Sglebius inst_prefix_dir="$arg" 5301290001Sglebius prev= 5302290001Sglebius continue 5303290001Sglebius ;; 5304290001Sglebius objectlist) 5305290001Sglebius if test -f "$arg"; then 5306290001Sglebius save_arg=$arg 5307290001Sglebius moreargs= 5308290001Sglebius for fil in `cat "$save_arg"` 5309290001Sglebius do 5310290001Sglebius# func_append moreargs " $fil" 5311290001Sglebius arg=$fil 5312290001Sglebius # A libtool-controlled object. 5313290001Sglebius 5314290001Sglebius # Check to see that this really is a libtool object. 5315290001Sglebius if func_lalib_unsafe_p "$arg"; then 5316290001Sglebius pic_object= 5317290001Sglebius non_pic_object= 5318290001Sglebius 5319290001Sglebius # Read the .lo file 5320290001Sglebius func_source "$arg" 5321290001Sglebius 5322290001Sglebius if test -z "$pic_object" || 5323290001Sglebius test -z "$non_pic_object" || 5324290001Sglebius test "$pic_object" = none && 5325290001Sglebius test "$non_pic_object" = none; then 5326290001Sglebius func_fatal_error "cannot find name of object for \`$arg'" 5327290001Sglebius fi 5328290001Sglebius 5329290001Sglebius # Extract subdirectory from the argument. 5330290001Sglebius func_dirname "$arg" "/" "" 5331290001Sglebius xdir="$func_dirname_result" 5332290001Sglebius 5333290001Sglebius if test "$pic_object" != none; then 5334290001Sglebius # Prepend the subdirectory the object is found in. 5335290001Sglebius pic_object="$xdir$pic_object" 5336290001Sglebius 5337290001Sglebius if test "$prev" = dlfiles; then 5338290001Sglebius if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 5339290001Sglebius func_append dlfiles " $pic_object" 5340290001Sglebius prev= 5341290001Sglebius continue 5342290001Sglebius else 5343290001Sglebius # If libtool objects are unsupported, then we need to preload. 5344290001Sglebius prev=dlprefiles 5345290001Sglebius fi 5346290001Sglebius fi 5347290001Sglebius 5348290001Sglebius # CHECK ME: I think I busted this. -Ossama 5349290001Sglebius if test "$prev" = dlprefiles; then 5350290001Sglebius # Preload the old-style object. 5351290001Sglebius func_append dlprefiles " $pic_object" 5352290001Sglebius prev= 5353290001Sglebius fi 5354290001Sglebius 5355290001Sglebius # A PIC object. 5356290001Sglebius func_append libobjs " $pic_object" 5357290001Sglebius arg="$pic_object" 5358290001Sglebius fi 5359290001Sglebius 5360290001Sglebius # Non-PIC object. 5361290001Sglebius if test "$non_pic_object" != none; then 5362290001Sglebius # Prepend the subdirectory the object is found in. 5363290001Sglebius non_pic_object="$xdir$non_pic_object" 5364290001Sglebius 5365290001Sglebius # A standard non-PIC object 5366290001Sglebius func_append non_pic_objects " $non_pic_object" 5367290001Sglebius if test -z "$pic_object" || test "$pic_object" = none ; then 5368290001Sglebius arg="$non_pic_object" 5369290001Sglebius fi 5370290001Sglebius else 5371290001Sglebius # If the PIC object exists, use it instead. 5372290001Sglebius # $xdir was prepended to $pic_object above. 5373290001Sglebius non_pic_object="$pic_object" 5374290001Sglebius func_append non_pic_objects " $non_pic_object" 5375290001Sglebius fi 5376290001Sglebius else 5377290001Sglebius # Only an error if not doing a dry-run. 5378290001Sglebius if $opt_dry_run; then 5379290001Sglebius # Extract subdirectory from the argument. 5380290001Sglebius func_dirname "$arg" "/" "" 5381290001Sglebius xdir="$func_dirname_result" 5382290001Sglebius 5383290001Sglebius func_lo2o "$arg" 5384290001Sglebius pic_object=$xdir$objdir/$func_lo2o_result 5385290001Sglebius non_pic_object=$xdir$func_lo2o_result 5386290001Sglebius func_append libobjs " $pic_object" 5387290001Sglebius func_append non_pic_objects " $non_pic_object" 5388290001Sglebius else 5389290001Sglebius func_fatal_error "\`$arg' is not a valid libtool object" 5390290001Sglebius fi 5391290001Sglebius fi 5392290001Sglebius done 5393290001Sglebius else 5394290001Sglebius func_fatal_error "link input file \`$arg' does not exist" 5395290001Sglebius fi 5396290001Sglebius arg=$save_arg 5397290001Sglebius prev= 5398290001Sglebius continue 5399290001Sglebius ;; 5400290001Sglebius precious_regex) 5401290001Sglebius precious_files_regex="$arg" 5402290001Sglebius prev= 5403290001Sglebius continue 5404290001Sglebius ;; 5405290001Sglebius release) 5406290001Sglebius release="-$arg" 5407290001Sglebius prev= 5408290001Sglebius continue 5409290001Sglebius ;; 5410290001Sglebius rpath | xrpath) 5411290001Sglebius # We need an absolute path. 5412290001Sglebius case $arg in 5413290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) ;; 5414290001Sglebius *) 5415290001Sglebius func_fatal_error "only absolute run-paths are allowed" 5416290001Sglebius ;; 5417290001Sglebius esac 5418290001Sglebius if test "$prev" = rpath; then 5419290001Sglebius case "$rpath " in 5420290001Sglebius *" $arg "*) ;; 5421290001Sglebius *) func_append rpath " $arg" ;; 5422290001Sglebius esac 5423290001Sglebius else 5424290001Sglebius case "$xrpath " in 5425290001Sglebius *" $arg "*) ;; 5426290001Sglebius *) func_append xrpath " $arg" ;; 5427290001Sglebius esac 5428290001Sglebius fi 5429290001Sglebius prev= 5430290001Sglebius continue 5431290001Sglebius ;; 5432290001Sglebius shrext) 5433290001Sglebius shrext_cmds="$arg" 5434290001Sglebius prev= 5435290001Sglebius continue 5436290001Sglebius ;; 5437290001Sglebius weak) 5438290001Sglebius func_append weak_libs " $arg" 5439290001Sglebius prev= 5440290001Sglebius continue 5441290001Sglebius ;; 5442290001Sglebius xcclinker) 5443290001Sglebius func_append linker_flags " $qarg" 5444290001Sglebius func_append compiler_flags " $qarg" 5445290001Sglebius prev= 5446290001Sglebius func_append compile_command " $qarg" 5447290001Sglebius func_append finalize_command " $qarg" 5448290001Sglebius continue 5449290001Sglebius ;; 5450290001Sglebius xcompiler) 5451290001Sglebius func_append compiler_flags " $qarg" 5452290001Sglebius prev= 5453290001Sglebius func_append compile_command " $qarg" 5454290001Sglebius func_append finalize_command " $qarg" 5455290001Sglebius continue 5456290001Sglebius ;; 5457290001Sglebius xlinker) 5458290001Sglebius func_append linker_flags " $qarg" 5459290001Sglebius func_append compiler_flags " $wl$qarg" 5460290001Sglebius prev= 5461290001Sglebius func_append compile_command " $wl$qarg" 5462290001Sglebius func_append finalize_command " $wl$qarg" 5463290001Sglebius continue 5464290001Sglebius ;; 5465290001Sglebius *) 5466290001Sglebius eval "$prev=\"\$arg\"" 5467290001Sglebius prev= 5468290001Sglebius continue 5469290001Sglebius ;; 5470290001Sglebius esac 5471290001Sglebius fi # test -n "$prev" 5472290001Sglebius 5473290001Sglebius prevarg="$arg" 5474290001Sglebius 5475290001Sglebius case $arg in 5476290001Sglebius -all-static) 5477290001Sglebius if test -n "$link_static_flag"; then 5478290001Sglebius # See comment for -static flag below, for more details. 5479290001Sglebius func_append compile_command " $link_static_flag" 5480290001Sglebius func_append finalize_command " $link_static_flag" 5481290001Sglebius fi 5482290001Sglebius continue 5483290001Sglebius ;; 5484290001Sglebius 5485290001Sglebius -allow-undefined) 5486290001Sglebius # FIXME: remove this flag sometime in the future. 5487290001Sglebius func_fatal_error "\`-allow-undefined' must not be used because it is the default" 5488290001Sglebius ;; 5489290001Sglebius 5490290001Sglebius -avoid-version) 5491290001Sglebius avoid_version=yes 5492290001Sglebius continue 5493290001Sglebius ;; 5494290001Sglebius 5495290001Sglebius -bindir) 5496290001Sglebius prev=bindir 5497290001Sglebius continue 5498290001Sglebius ;; 5499290001Sglebius 5500290001Sglebius -dlopen) 5501290001Sglebius prev=dlfiles 5502290001Sglebius continue 5503290001Sglebius ;; 5504290001Sglebius 5505290001Sglebius -dlpreopen) 5506290001Sglebius prev=dlprefiles 5507290001Sglebius continue 5508290001Sglebius ;; 5509290001Sglebius 5510290001Sglebius -export-dynamic) 5511290001Sglebius export_dynamic=yes 5512290001Sglebius continue 5513290001Sglebius ;; 5514290001Sglebius 5515290001Sglebius -export-symbols | -export-symbols-regex) 5516290001Sglebius if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 5517290001Sglebius func_fatal_error "more than one -exported-symbols argument is not allowed" 5518290001Sglebius fi 5519290001Sglebius if test "X$arg" = "X-export-symbols"; then 5520290001Sglebius prev=expsyms 5521290001Sglebius else 5522290001Sglebius prev=expsyms_regex 5523290001Sglebius fi 5524290001Sglebius continue 5525290001Sglebius ;; 5526290001Sglebius 5527290001Sglebius -framework) 5528290001Sglebius prev=framework 5529290001Sglebius continue 5530290001Sglebius ;; 5531290001Sglebius 5532290001Sglebius -inst-prefix-dir) 5533290001Sglebius prev=inst_prefix 5534290001Sglebius continue 5535290001Sglebius ;; 5536290001Sglebius 5537290001Sglebius # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 5538290001Sglebius # so, if we see these flags be careful not to treat them like -L 5539290001Sglebius -L[A-Z][A-Z]*:*) 5540290001Sglebius case $with_gcc/$host in 5541290001Sglebius no/*-*-irix* | /*-*-irix*) 5542290001Sglebius func_append compile_command " $arg" 5543290001Sglebius func_append finalize_command " $arg" 5544290001Sglebius ;; 5545290001Sglebius esac 5546290001Sglebius continue 5547290001Sglebius ;; 5548290001Sglebius 5549290001Sglebius -L*) 5550290001Sglebius func_stripname "-L" '' "$arg" 5551290001Sglebius if test -z "$func_stripname_result"; then 5552290001Sglebius if test "$#" -gt 0; then 5553290001Sglebius func_fatal_error "require no space between \`-L' and \`$1'" 5554290001Sglebius else 5555290001Sglebius func_fatal_error "need path for \`-L' option" 5556290001Sglebius fi 5557290001Sglebius fi 5558290001Sglebius func_resolve_sysroot "$func_stripname_result" 5559290001Sglebius dir=$func_resolve_sysroot_result 5560290001Sglebius # We need an absolute path. 5561290001Sglebius case $dir in 5562290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) ;; 5563290001Sglebius *) 5564290001Sglebius absdir=`cd "$dir" && pwd` 5565290001Sglebius test -z "$absdir" && \ 5566290001Sglebius func_fatal_error "cannot determine absolute directory name of \`$dir'" 5567290001Sglebius dir="$absdir" 5568290001Sglebius ;; 5569290001Sglebius esac 5570290001Sglebius case "$deplibs " in 5571290001Sglebius *" -L$dir "* | *" $arg "*) 5572290001Sglebius # Will only happen for absolute or sysroot arguments 5573290001Sglebius ;; 5574290001Sglebius *) 5575290001Sglebius # Preserve sysroot, but never include relative directories 5576290001Sglebius case $dir in 5577290001Sglebius [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 5578290001Sglebius *) func_append deplibs " -L$dir" ;; 5579290001Sglebius esac 5580290001Sglebius func_append lib_search_path " $dir" 5581290001Sglebius ;; 5582290001Sglebius esac 5583290001Sglebius case $host in 5584290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5585290001Sglebius testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 5586290001Sglebius case :$dllsearchpath: in 5587290001Sglebius *":$dir:"*) ;; 5588290001Sglebius ::) dllsearchpath=$dir;; 5589290001Sglebius *) func_append dllsearchpath ":$dir";; 5590290001Sglebius esac 5591290001Sglebius case :$dllsearchpath: in 5592290001Sglebius *":$testbindir:"*) ;; 5593290001Sglebius ::) dllsearchpath=$testbindir;; 5594290001Sglebius *) func_append dllsearchpath ":$testbindir";; 5595290001Sglebius esac 5596290001Sglebius ;; 5597290001Sglebius esac 5598290001Sglebius continue 5599290001Sglebius ;; 5600290001Sglebius 5601290001Sglebius -l*) 5602290001Sglebius if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 5603290001Sglebius case $host in 5604290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 5605290001Sglebius # These systems don't actually have a C or math library (as such) 5606290001Sglebius continue 5607290001Sglebius ;; 5608290001Sglebius *-*-os2*) 5609290001Sglebius # These systems don't actually have a C library (as such) 5610290001Sglebius test "X$arg" = "X-lc" && continue 5611290001Sglebius ;; 5612290001Sglebius *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5613290001Sglebius # Do not include libc due to us having libc/libc_r. 5614290001Sglebius test "X$arg" = "X-lc" && continue 5615290001Sglebius ;; 5616290001Sglebius *-*-rhapsody* | *-*-darwin1.[012]) 5617290001Sglebius # Rhapsody C and math libraries are in the System framework 5618290001Sglebius func_append deplibs " System.ltframework" 5619290001Sglebius continue 5620290001Sglebius ;; 5621290001Sglebius *-*-sco3.2v5* | *-*-sco5v6*) 5622290001Sglebius # Causes problems with __ctype 5623290001Sglebius test "X$arg" = "X-lc" && continue 5624290001Sglebius ;; 5625290001Sglebius *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 5626290001Sglebius # Compiler inserts libc in the correct place for threads to work 5627290001Sglebius test "X$arg" = "X-lc" && continue 5628290001Sglebius ;; 5629290001Sglebius esac 5630290001Sglebius elif test "X$arg" = "X-lc_r"; then 5631290001Sglebius case $host in 5632290001Sglebius *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5633290001Sglebius # Do not include libc_r directly, use -pthread flag. 5634290001Sglebius continue 5635290001Sglebius ;; 5636290001Sglebius esac 5637290001Sglebius fi 5638290001Sglebius func_append deplibs " $arg" 5639290001Sglebius continue 5640290001Sglebius ;; 5641290001Sglebius 5642290001Sglebius -module) 5643290001Sglebius module=yes 5644290001Sglebius continue 5645290001Sglebius ;; 5646290001Sglebius 5647290001Sglebius # Tru64 UNIX uses -model [arg] to determine the layout of C++ 5648290001Sglebius # classes, name mangling, and exception handling. 5649290001Sglebius # Darwin uses the -arch flag to determine output architecture. 5650290001Sglebius -model|-arch|-isysroot|--sysroot) 5651290001Sglebius func_append compiler_flags " $arg" 5652290001Sglebius func_append compile_command " $arg" 5653290001Sglebius func_append finalize_command " $arg" 5654290001Sglebius prev=xcompiler 5655290001Sglebius continue 5656290001Sglebius ;; 5657290001Sglebius 5658290001Sglebius -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ 5659290001Sglebius |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 5660290001Sglebius func_append compiler_flags " $arg" 5661290001Sglebius func_append compile_command " $arg" 5662290001Sglebius func_append finalize_command " $arg" 5663290001Sglebius case "$new_inherited_linker_flags " in 5664290001Sglebius *" $arg "*) ;; 5665290001Sglebius * ) func_append new_inherited_linker_flags " $arg" ;; 5666290001Sglebius esac 5667290001Sglebius continue 5668290001Sglebius ;; 5669290001Sglebius 5670290001Sglebius -multi_module) 5671290001Sglebius single_module="${wl}-multi_module" 5672290001Sglebius continue 5673290001Sglebius ;; 5674290001Sglebius 5675290001Sglebius -no-fast-install) 5676290001Sglebius fast_install=no 5677290001Sglebius continue 5678290001Sglebius ;; 5679290001Sglebius 5680290001Sglebius -no-install) 5681290001Sglebius case $host in 5682290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 5683290001Sglebius # The PATH hackery in wrapper scripts is required on Windows 5684290001Sglebius # and Darwin in order for the loader to find any dlls it needs. 5685290001Sglebius func_warning "\`-no-install' is ignored for $host" 5686290001Sglebius func_warning "assuming \`-no-fast-install' instead" 5687290001Sglebius fast_install=no 5688290001Sglebius ;; 5689290001Sglebius *) no_install=yes ;; 5690290001Sglebius esac 5691290001Sglebius continue 5692290001Sglebius ;; 5693290001Sglebius 5694290001Sglebius -no-undefined) 5695290001Sglebius allow_undefined=no 5696290001Sglebius continue 5697290001Sglebius ;; 5698290001Sglebius 5699290001Sglebius -objectlist) 5700290001Sglebius prev=objectlist 5701290001Sglebius continue 5702290001Sglebius ;; 5703290001Sglebius 5704290001Sglebius -o) prev=output ;; 5705290001Sglebius 5706290001Sglebius -precious-files-regex) 5707290001Sglebius prev=precious_regex 5708290001Sglebius continue 5709290001Sglebius ;; 5710290001Sglebius 5711290001Sglebius -release) 5712290001Sglebius prev=release 5713290001Sglebius continue 5714290001Sglebius ;; 5715290001Sglebius 5716290001Sglebius -rpath) 5717290001Sglebius prev=rpath 5718290001Sglebius continue 5719290001Sglebius ;; 5720290001Sglebius 5721290001Sglebius -R) 5722290001Sglebius prev=xrpath 5723290001Sglebius continue 5724290001Sglebius ;; 5725290001Sglebius 5726290001Sglebius -R*) 5727290001Sglebius func_stripname '-R' '' "$arg" 5728290001Sglebius dir=$func_stripname_result 5729290001Sglebius # We need an absolute path. 5730290001Sglebius case $dir in 5731290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) ;; 5732290001Sglebius =*) 5733290001Sglebius func_stripname '=' '' "$dir" 5734290001Sglebius dir=$lt_sysroot$func_stripname_result 5735290001Sglebius ;; 5736290001Sglebius *) 5737290001Sglebius func_fatal_error "only absolute run-paths are allowed" 5738290001Sglebius ;; 5739290001Sglebius esac 5740290001Sglebius case "$xrpath " in 5741290001Sglebius *" $dir "*) ;; 5742290001Sglebius *) func_append xrpath " $dir" ;; 5743290001Sglebius esac 5744290001Sglebius continue 5745290001Sglebius ;; 5746290001Sglebius 5747290001Sglebius -shared) 5748290001Sglebius # The effects of -shared are defined in a previous loop. 5749290001Sglebius continue 5750290001Sglebius ;; 5751290001Sglebius 5752290001Sglebius -shrext) 5753290001Sglebius prev=shrext 5754290001Sglebius continue 5755290001Sglebius ;; 5756290001Sglebius 5757290001Sglebius -static | -static-libtool-libs) 5758290001Sglebius # The effects of -static are defined in a previous loop. 5759290001Sglebius # We used to do the same as -all-static on platforms that 5760290001Sglebius # didn't have a PIC flag, but the assumption that the effects 5761290001Sglebius # would be equivalent was wrong. It would break on at least 5762290001Sglebius # Digital Unix and AIX. 5763290001Sglebius continue 5764290001Sglebius ;; 5765290001Sglebius 5766290001Sglebius -thread-safe) 5767290001Sglebius thread_safe=yes 5768290001Sglebius continue 5769290001Sglebius ;; 5770290001Sglebius 5771290001Sglebius -version-info) 5772290001Sglebius prev=vinfo 5773290001Sglebius continue 5774290001Sglebius ;; 5775290001Sglebius 5776290001Sglebius -version-number) 5777290001Sglebius prev=vinfo 5778290001Sglebius vinfo_number=yes 5779290001Sglebius continue 5780290001Sglebius ;; 5781290001Sglebius 5782290001Sglebius -weak) 5783290001Sglebius prev=weak 5784290001Sglebius continue 5785290001Sglebius ;; 5786290001Sglebius 5787290001Sglebius -Wc,*) 5788290001Sglebius func_stripname '-Wc,' '' "$arg" 5789290001Sglebius args=$func_stripname_result 5790290001Sglebius arg= 5791290001Sglebius save_ifs="$IFS"; IFS=',' 5792290001Sglebius for flag in $args; do 5793290001Sglebius IFS="$save_ifs" 5794290001Sglebius func_quote_for_eval "$flag" 5795290001Sglebius func_append arg " $func_quote_for_eval_result" 5796290001Sglebius func_append compiler_flags " $func_quote_for_eval_result" 5797290001Sglebius done 5798290001Sglebius IFS="$save_ifs" 5799290001Sglebius func_stripname ' ' '' "$arg" 5800290001Sglebius arg=$func_stripname_result 5801290001Sglebius ;; 5802290001Sglebius 5803290001Sglebius -Wl,*) 5804290001Sglebius func_stripname '-Wl,' '' "$arg" 5805290001Sglebius args=$func_stripname_result 5806290001Sglebius arg= 5807290001Sglebius save_ifs="$IFS"; IFS=',' 5808290001Sglebius for flag in $args; do 5809290001Sglebius IFS="$save_ifs" 5810290001Sglebius func_quote_for_eval "$flag" 5811290001Sglebius func_append arg " $wl$func_quote_for_eval_result" 5812290001Sglebius func_append compiler_flags " $wl$func_quote_for_eval_result" 5813290001Sglebius func_append linker_flags " $func_quote_for_eval_result" 5814290001Sglebius done 5815290001Sglebius IFS="$save_ifs" 5816290001Sglebius func_stripname ' ' '' "$arg" 5817290001Sglebius arg=$func_stripname_result 5818290001Sglebius ;; 5819290001Sglebius 5820290001Sglebius -Xcompiler) 5821290001Sglebius prev=xcompiler 5822290001Sglebius continue 5823290001Sglebius ;; 5824290001Sglebius 5825290001Sglebius -Xlinker) 5826290001Sglebius prev=xlinker 5827290001Sglebius continue 5828290001Sglebius ;; 5829290001Sglebius 5830290001Sglebius -XCClinker) 5831290001Sglebius prev=xcclinker 5832290001Sglebius continue 5833290001Sglebius ;; 5834290001Sglebius 5835290001Sglebius # -msg_* for osf cc 5836290001Sglebius -msg_*) 5837290001Sglebius func_quote_for_eval "$arg" 5838290001Sglebius arg="$func_quote_for_eval_result" 5839290001Sglebius ;; 5840290001Sglebius 5841290001Sglebius # Flags to be passed through unchanged, with rationale: 5842290001Sglebius # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 5843290001Sglebius # -r[0-9][0-9]* specify processor for the SGI compiler 5844290001Sglebius # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 5845290001Sglebius # +DA*, +DD* enable 64-bit mode for the HP compiler 5846290001Sglebius # -q* compiler args for the IBM compiler 5847290001Sglebius # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 5848290001Sglebius # -F/path path to uninstalled frameworks, gcc on darwin 5849290001Sglebius # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 5850290001Sglebius # @file GCC response files 5851290001Sglebius # -tp=* Portland pgcc target processor selection 5852290001Sglebius # --sysroot=* for sysroot support 5853290001Sglebius # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 5854290001Sglebius -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 5855290001Sglebius -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 5856290001Sglebius -O*|-flto*|-fwhopr*|-fuse-linker-plugin) 5857290001Sglebius func_quote_for_eval "$arg" 5858290001Sglebius arg="$func_quote_for_eval_result" 5859290001Sglebius func_append compile_command " $arg" 5860290001Sglebius func_append finalize_command " $arg" 5861290001Sglebius func_append compiler_flags " $arg" 5862290001Sglebius continue 5863290001Sglebius ;; 5864290001Sglebius 5865290001Sglebius # Some other compiler flag. 5866290001Sglebius -* | +*) 5867290001Sglebius func_quote_for_eval "$arg" 5868290001Sglebius arg="$func_quote_for_eval_result" 5869290001Sglebius ;; 5870290001Sglebius 5871290001Sglebius *.$objext) 5872290001Sglebius # A standard object. 5873290001Sglebius func_append objs " $arg" 5874290001Sglebius ;; 5875290001Sglebius 5876290001Sglebius *.lo) 5877290001Sglebius # A libtool-controlled object. 5878290001Sglebius 5879290001Sglebius # Check to see that this really is a libtool object. 5880290001Sglebius if func_lalib_unsafe_p "$arg"; then 5881290001Sglebius pic_object= 5882290001Sglebius non_pic_object= 5883290001Sglebius 5884290001Sglebius # Read the .lo file 5885290001Sglebius func_source "$arg" 5886290001Sglebius 5887290001Sglebius if test -z "$pic_object" || 5888290001Sglebius test -z "$non_pic_object" || 5889290001Sglebius test "$pic_object" = none && 5890290001Sglebius test "$non_pic_object" = none; then 5891290001Sglebius func_fatal_error "cannot find name of object for \`$arg'" 5892290001Sglebius fi 5893290001Sglebius 5894290001Sglebius # Extract subdirectory from the argument. 5895290001Sglebius func_dirname "$arg" "/" "" 5896290001Sglebius xdir="$func_dirname_result" 5897290001Sglebius 5898290001Sglebius if test "$pic_object" != none; then 5899290001Sglebius # Prepend the subdirectory the object is found in. 5900290001Sglebius pic_object="$xdir$pic_object" 5901290001Sglebius 5902290001Sglebius if test "$prev" = dlfiles; then 5903290001Sglebius if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 5904290001Sglebius func_append dlfiles " $pic_object" 5905290001Sglebius prev= 5906290001Sglebius continue 5907290001Sglebius else 5908290001Sglebius # If libtool objects are unsupported, then we need to preload. 5909290001Sglebius prev=dlprefiles 5910290001Sglebius fi 5911290001Sglebius fi 5912290001Sglebius 5913290001Sglebius # CHECK ME: I think I busted this. -Ossama 5914290001Sglebius if test "$prev" = dlprefiles; then 5915290001Sglebius # Preload the old-style object. 5916290001Sglebius func_append dlprefiles " $pic_object" 5917290001Sglebius prev= 5918290001Sglebius fi 5919290001Sglebius 5920290001Sglebius # A PIC object. 5921290001Sglebius func_append libobjs " $pic_object" 5922290001Sglebius arg="$pic_object" 5923290001Sglebius fi 5924290001Sglebius 5925290001Sglebius # Non-PIC object. 5926290001Sglebius if test "$non_pic_object" != none; then 5927290001Sglebius # Prepend the subdirectory the object is found in. 5928290001Sglebius non_pic_object="$xdir$non_pic_object" 5929290001Sglebius 5930290001Sglebius # A standard non-PIC object 5931290001Sglebius func_append non_pic_objects " $non_pic_object" 5932290001Sglebius if test -z "$pic_object" || test "$pic_object" = none ; then 5933290001Sglebius arg="$non_pic_object" 5934290001Sglebius fi 5935290001Sglebius else 5936290001Sglebius # If the PIC object exists, use it instead. 5937290001Sglebius # $xdir was prepended to $pic_object above. 5938290001Sglebius non_pic_object="$pic_object" 5939290001Sglebius func_append non_pic_objects " $non_pic_object" 5940290001Sglebius fi 5941290001Sglebius else 5942290001Sglebius # Only an error if not doing a dry-run. 5943290001Sglebius if $opt_dry_run; then 5944290001Sglebius # Extract subdirectory from the argument. 5945290001Sglebius func_dirname "$arg" "/" "" 5946290001Sglebius xdir="$func_dirname_result" 5947290001Sglebius 5948290001Sglebius func_lo2o "$arg" 5949290001Sglebius pic_object=$xdir$objdir/$func_lo2o_result 5950290001Sglebius non_pic_object=$xdir$func_lo2o_result 5951290001Sglebius func_append libobjs " $pic_object" 5952290001Sglebius func_append non_pic_objects " $non_pic_object" 5953290001Sglebius else 5954290001Sglebius func_fatal_error "\`$arg' is not a valid libtool object" 5955290001Sglebius fi 5956290001Sglebius fi 5957290001Sglebius ;; 5958290001Sglebius 5959290001Sglebius *.$libext) 5960290001Sglebius # An archive. 5961290001Sglebius func_append deplibs " $arg" 5962290001Sglebius func_append old_deplibs " $arg" 5963290001Sglebius continue 5964290001Sglebius ;; 5965290001Sglebius 5966290001Sglebius *.la) 5967290001Sglebius # A libtool-controlled library. 5968290001Sglebius 5969290001Sglebius func_resolve_sysroot "$arg" 5970290001Sglebius if test "$prev" = dlfiles; then 5971290001Sglebius # This library was specified with -dlopen. 5972290001Sglebius func_append dlfiles " $func_resolve_sysroot_result" 5973290001Sglebius prev= 5974290001Sglebius elif test "$prev" = dlprefiles; then 5975290001Sglebius # The library was specified with -dlpreopen. 5976290001Sglebius func_append dlprefiles " $func_resolve_sysroot_result" 5977290001Sglebius prev= 5978290001Sglebius else 5979290001Sglebius func_append deplibs " $func_resolve_sysroot_result" 5980290001Sglebius fi 5981290001Sglebius continue 5982290001Sglebius ;; 5983290001Sglebius 5984290001Sglebius # Some other compiler argument. 5985290001Sglebius *) 5986290001Sglebius # Unknown arguments in both finalize_command and compile_command need 5987290001Sglebius # to be aesthetically quoted because they are evaled later. 5988290001Sglebius func_quote_for_eval "$arg" 5989290001Sglebius arg="$func_quote_for_eval_result" 5990290001Sglebius ;; 5991290001Sglebius esac # arg 5992290001Sglebius 5993290001Sglebius # Now actually substitute the argument into the commands. 5994290001Sglebius if test -n "$arg"; then 5995290001Sglebius func_append compile_command " $arg" 5996290001Sglebius func_append finalize_command " $arg" 5997290001Sglebius fi 5998290001Sglebius done # argument parsing loop 5999290001Sglebius 6000290001Sglebius test -n "$prev" && \ 6001290001Sglebius func_fatal_help "the \`$prevarg' option requires an argument" 6002290001Sglebius 6003290001Sglebius if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 6004290001Sglebius eval arg=\"$export_dynamic_flag_spec\" 6005290001Sglebius func_append compile_command " $arg" 6006290001Sglebius func_append finalize_command " $arg" 6007290001Sglebius fi 6008290001Sglebius 6009290001Sglebius oldlibs= 6010290001Sglebius # calculate the name of the file, without its directory 6011290001Sglebius func_basename "$output" 6012290001Sglebius outputname="$func_basename_result" 6013290001Sglebius libobjs_save="$libobjs" 6014290001Sglebius 6015290001Sglebius if test -n "$shlibpath_var"; then 6016290001Sglebius # get the directories listed in $shlibpath_var 6017290001Sglebius eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 6018290001Sglebius else 6019290001Sglebius shlib_search_path= 6020290001Sglebius fi 6021290001Sglebius eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 6022290001Sglebius eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 6023290001Sglebius 6024290001Sglebius func_dirname "$output" "/" "" 6025290001Sglebius output_objdir="$func_dirname_result$objdir" 6026290001Sglebius func_to_tool_file "$output_objdir/" 6027290001Sglebius tool_output_objdir=$func_to_tool_file_result 6028290001Sglebius # Create the object directory. 6029290001Sglebius func_mkdir_p "$output_objdir" 6030290001Sglebius 6031290001Sglebius # Determine the type of output 6032290001Sglebius case $output in 6033290001Sglebius "") 6034290001Sglebius func_fatal_help "you must specify an output file" 6035290001Sglebius ;; 6036290001Sglebius *.$libext) linkmode=oldlib ;; 6037290001Sglebius *.lo | *.$objext) linkmode=obj ;; 6038290001Sglebius *.la) linkmode=lib ;; 6039290001Sglebius *) linkmode=prog ;; # Anything else should be a program. 6040290001Sglebius esac 6041290001Sglebius 6042290001Sglebius specialdeplibs= 6043290001Sglebius 6044290001Sglebius libs= 6045290001Sglebius # Find all interdependent deplibs by searching for libraries 6046290001Sglebius # that are linked more than once (e.g. -la -lb -la) 6047290001Sglebius for deplib in $deplibs; do 6048290001Sglebius if $opt_preserve_dup_deps ; then 6049290001Sglebius case "$libs " in 6050290001Sglebius *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6051290001Sglebius esac 6052290001Sglebius fi 6053290001Sglebius func_append libs " $deplib" 6054290001Sglebius done 6055290001Sglebius 6056290001Sglebius if test "$linkmode" = lib; then 6057290001Sglebius libs="$predeps $libs $compiler_lib_search_path $postdeps" 6058290001Sglebius 6059290001Sglebius # Compute libraries that are listed more than once in $predeps 6060290001Sglebius # $postdeps and mark them as special (i.e., whose duplicates are 6061290001Sglebius # not to be eliminated). 6062290001Sglebius pre_post_deps= 6063290001Sglebius if $opt_duplicate_compiler_generated_deps; then 6064290001Sglebius for pre_post_dep in $predeps $postdeps; do 6065290001Sglebius case "$pre_post_deps " in 6066290001Sglebius *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 6067290001Sglebius esac 6068290001Sglebius func_append pre_post_deps " $pre_post_dep" 6069290001Sglebius done 6070290001Sglebius fi 6071290001Sglebius pre_post_deps= 6072290001Sglebius fi 6073290001Sglebius 6074290001Sglebius deplibs= 6075290001Sglebius newdependency_libs= 6076290001Sglebius newlib_search_path= 6077290001Sglebius need_relink=no # whether we're linking any uninstalled libtool libraries 6078290001Sglebius notinst_deplibs= # not-installed libtool libraries 6079290001Sglebius notinst_path= # paths that contain not-installed libtool libraries 6080290001Sglebius 6081290001Sglebius case $linkmode in 6082290001Sglebius lib) 6083290001Sglebius passes="conv dlpreopen link" 6084290001Sglebius for file in $dlfiles $dlprefiles; do 6085290001Sglebius case $file in 6086290001Sglebius *.la) ;; 6087290001Sglebius *) 6088290001Sglebius func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 6089290001Sglebius ;; 6090290001Sglebius esac 6091290001Sglebius done 6092290001Sglebius ;; 6093290001Sglebius prog) 6094290001Sglebius compile_deplibs= 6095290001Sglebius finalize_deplibs= 6096290001Sglebius alldeplibs=no 6097290001Sglebius newdlfiles= 6098290001Sglebius newdlprefiles= 6099290001Sglebius passes="conv scan dlopen dlpreopen link" 6100290001Sglebius ;; 6101290001Sglebius *) passes="conv" 6102290001Sglebius ;; 6103290001Sglebius esac 6104290001Sglebius 6105290001Sglebius for pass in $passes; do 6106290001Sglebius # The preopen pass in lib mode reverses $deplibs; put it back here 6107290001Sglebius # so that -L comes before libs that need it for instance... 6108290001Sglebius if test "$linkmode,$pass" = "lib,link"; then 6109290001Sglebius ## FIXME: Find the place where the list is rebuilt in the wrong 6110290001Sglebius ## order, and fix it there properly 6111290001Sglebius tmp_deplibs= 6112290001Sglebius for deplib in $deplibs; do 6113290001Sglebius tmp_deplibs="$deplib $tmp_deplibs" 6114290001Sglebius done 6115290001Sglebius deplibs="$tmp_deplibs" 6116290001Sglebius fi 6117290001Sglebius 6118290001Sglebius if test "$linkmode,$pass" = "lib,link" || 6119290001Sglebius test "$linkmode,$pass" = "prog,scan"; then 6120290001Sglebius libs="$deplibs" 6121290001Sglebius deplibs= 6122290001Sglebius fi 6123290001Sglebius if test "$linkmode" = prog; then 6124290001Sglebius case $pass in 6125290001Sglebius dlopen) libs="$dlfiles" ;; 6126290001Sglebius dlpreopen) libs="$dlprefiles" ;; 6127290001Sglebius link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 6128290001Sglebius esac 6129290001Sglebius fi 6130290001Sglebius if test "$linkmode,$pass" = "lib,dlpreopen"; then 6131290001Sglebius # Collect and forward deplibs of preopened libtool libs 6132290001Sglebius for lib in $dlprefiles; do 6133290001Sglebius # Ignore non-libtool-libs 6134290001Sglebius dependency_libs= 6135290001Sglebius func_resolve_sysroot "$lib" 6136290001Sglebius case $lib in 6137290001Sglebius *.la) func_source "$func_resolve_sysroot_result" ;; 6138290001Sglebius esac 6139290001Sglebius 6140290001Sglebius # Collect preopened libtool deplibs, except any this library 6141290001Sglebius # has declared as weak libs 6142290001Sglebius for deplib in $dependency_libs; do 6143290001Sglebius func_basename "$deplib" 6144290001Sglebius deplib_base=$func_basename_result 6145290001Sglebius case " $weak_libs " in 6146290001Sglebius *" $deplib_base "*) ;; 6147290001Sglebius *) func_append deplibs " $deplib" ;; 6148290001Sglebius esac 6149290001Sglebius done 6150290001Sglebius done 6151290001Sglebius libs="$dlprefiles" 6152290001Sglebius fi 6153290001Sglebius if test "$pass" = dlopen; then 6154290001Sglebius # Collect dlpreopened libraries 6155290001Sglebius save_deplibs="$deplibs" 6156290001Sglebius deplibs= 6157290001Sglebius fi 6158290001Sglebius 6159290001Sglebius for deplib in $libs; do 6160290001Sglebius lib= 6161290001Sglebius found=no 6162290001Sglebius case $deplib in 6163290001Sglebius -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ 6164290001Sglebius |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 6165290001Sglebius if test "$linkmode,$pass" = "prog,link"; then 6166290001Sglebius compile_deplibs="$deplib $compile_deplibs" 6167290001Sglebius finalize_deplibs="$deplib $finalize_deplibs" 6168290001Sglebius else 6169290001Sglebius func_append compiler_flags " $deplib" 6170290001Sglebius if test "$linkmode" = lib ; then 6171290001Sglebius case "$new_inherited_linker_flags " in 6172290001Sglebius *" $deplib "*) ;; 6173290001Sglebius * ) func_append new_inherited_linker_flags " $deplib" ;; 6174290001Sglebius esac 6175290001Sglebius fi 6176290001Sglebius fi 6177290001Sglebius continue 6178290001Sglebius ;; 6179290001Sglebius -l*) 6180290001Sglebius if test "$linkmode" != lib && test "$linkmode" != prog; then 6181290001Sglebius func_warning "\`-l' is ignored for archives/objects" 6182290001Sglebius continue 6183290001Sglebius fi 6184290001Sglebius func_stripname '-l' '' "$deplib" 6185290001Sglebius name=$func_stripname_result 6186290001Sglebius if test "$linkmode" = lib; then 6187290001Sglebius searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 6188290001Sglebius else 6189290001Sglebius searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 6190290001Sglebius fi 6191290001Sglebius for searchdir in $searchdirs; do 6192290001Sglebius for search_ext in .la $std_shrext .so .a; do 6193290001Sglebius # Search the libtool library 6194290001Sglebius lib="$searchdir/lib${name}${search_ext}" 6195290001Sglebius if test -f "$lib"; then 6196290001Sglebius if test "$search_ext" = ".la"; then 6197290001Sglebius found=yes 6198290001Sglebius else 6199290001Sglebius found=no 6200290001Sglebius fi 6201290001Sglebius break 2 6202290001Sglebius fi 6203290001Sglebius done 6204290001Sglebius done 6205290001Sglebius if test "$found" != yes; then 6206290001Sglebius # deplib doesn't seem to be a libtool library 6207290001Sglebius if test "$linkmode,$pass" = "prog,link"; then 6208290001Sglebius compile_deplibs="$deplib $compile_deplibs" 6209290001Sglebius finalize_deplibs="$deplib $finalize_deplibs" 6210290001Sglebius else 6211290001Sglebius deplibs="$deplib $deplibs" 6212290001Sglebius test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6213290001Sglebius fi 6214290001Sglebius continue 6215290001Sglebius else # deplib is a libtool library 6216290001Sglebius # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 6217290001Sglebius # We need to do some special things here, and not later. 6218290001Sglebius if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6219290001Sglebius case " $predeps $postdeps " in 6220290001Sglebius *" $deplib "*) 6221290001Sglebius if func_lalib_p "$lib"; then 6222290001Sglebius library_names= 6223290001Sglebius old_library= 6224290001Sglebius func_source "$lib" 6225290001Sglebius for l in $old_library $library_names; do 6226290001Sglebius ll="$l" 6227290001Sglebius done 6228290001Sglebius if test "X$ll" = "X$old_library" ; then # only static version available 6229290001Sglebius found=no 6230290001Sglebius func_dirname "$lib" "" "." 6231290001Sglebius ladir="$func_dirname_result" 6232290001Sglebius lib=$ladir/$old_library 6233290001Sglebius if test "$linkmode,$pass" = "prog,link"; then 6234290001Sglebius compile_deplibs="$deplib $compile_deplibs" 6235290001Sglebius finalize_deplibs="$deplib $finalize_deplibs" 6236290001Sglebius else 6237290001Sglebius deplibs="$deplib $deplibs" 6238290001Sglebius test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6239290001Sglebius fi 6240290001Sglebius continue 6241290001Sglebius fi 6242290001Sglebius fi 6243290001Sglebius ;; 6244290001Sglebius *) ;; 6245290001Sglebius esac 6246290001Sglebius fi 6247290001Sglebius fi 6248290001Sglebius ;; # -l 6249290001Sglebius *.ltframework) 6250290001Sglebius if test "$linkmode,$pass" = "prog,link"; then 6251290001Sglebius compile_deplibs="$deplib $compile_deplibs" 6252290001Sglebius finalize_deplibs="$deplib $finalize_deplibs" 6253290001Sglebius else 6254290001Sglebius deplibs="$deplib $deplibs" 6255290001Sglebius if test "$linkmode" = lib ; then 6256290001Sglebius case "$new_inherited_linker_flags " in 6257290001Sglebius *" $deplib "*) ;; 6258290001Sglebius * ) func_append new_inherited_linker_flags " $deplib" ;; 6259290001Sglebius esac 6260290001Sglebius fi 6261290001Sglebius fi 6262290001Sglebius continue 6263290001Sglebius ;; 6264290001Sglebius -L*) 6265290001Sglebius case $linkmode in 6266290001Sglebius lib) 6267290001Sglebius deplibs="$deplib $deplibs" 6268290001Sglebius test "$pass" = conv && continue 6269290001Sglebius newdependency_libs="$deplib $newdependency_libs" 6270290001Sglebius func_stripname '-L' '' "$deplib" 6271290001Sglebius func_resolve_sysroot "$func_stripname_result" 6272290001Sglebius func_append newlib_search_path " $func_resolve_sysroot_result" 6273290001Sglebius ;; 6274290001Sglebius prog) 6275290001Sglebius if test "$pass" = conv; then 6276290001Sglebius deplibs="$deplib $deplibs" 6277290001Sglebius continue 6278290001Sglebius fi 6279290001Sglebius if test "$pass" = scan; then 6280290001Sglebius deplibs="$deplib $deplibs" 6281290001Sglebius else 6282290001Sglebius compile_deplibs="$deplib $compile_deplibs" 6283290001Sglebius finalize_deplibs="$deplib $finalize_deplibs" 6284290001Sglebius fi 6285290001Sglebius func_stripname '-L' '' "$deplib" 6286290001Sglebius func_resolve_sysroot "$func_stripname_result" 6287290001Sglebius func_append newlib_search_path " $func_resolve_sysroot_result" 6288290001Sglebius ;; 6289290001Sglebius *) 6290290001Sglebius func_warning "\`-L' is ignored for archives/objects" 6291290001Sglebius ;; 6292290001Sglebius esac # linkmode 6293290001Sglebius continue 6294290001Sglebius ;; # -L 6295290001Sglebius -R*) 6296290001Sglebius if test "$pass" = link; then 6297290001Sglebius func_stripname '-R' '' "$deplib" 6298290001Sglebius func_resolve_sysroot "$func_stripname_result" 6299290001Sglebius dir=$func_resolve_sysroot_result 6300290001Sglebius # Make sure the xrpath contains only unique directories. 6301290001Sglebius case "$xrpath " in 6302290001Sglebius *" $dir "*) ;; 6303290001Sglebius *) func_append xrpath " $dir" ;; 6304290001Sglebius esac 6305290001Sglebius fi 6306290001Sglebius deplibs="$deplib $deplibs" 6307290001Sglebius continue 6308290001Sglebius ;; 6309290001Sglebius *.la) 6310290001Sglebius func_resolve_sysroot "$deplib" 6311290001Sglebius lib=$func_resolve_sysroot_result 6312290001Sglebius ;; 6313290001Sglebius *.$libext) 6314290001Sglebius if test "$pass" = conv; then 6315290001Sglebius deplibs="$deplib $deplibs" 6316290001Sglebius continue 6317290001Sglebius fi 6318290001Sglebius case $linkmode in 6319290001Sglebius lib) 6320290001Sglebius # Linking convenience modules into shared libraries is allowed, 6321290001Sglebius # but linking other static libraries is non-portable. 6322290001Sglebius case " $dlpreconveniencelibs " in 6323290001Sglebius *" $deplib "*) ;; 6324290001Sglebius *) 6325290001Sglebius valid_a_lib=no 6326290001Sglebius case $deplibs_check_method in 6327290001Sglebius match_pattern*) 6328290001Sglebius set dummy $deplibs_check_method; shift 6329290001Sglebius match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 6330290001Sglebius if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 6331290001Sglebius | $EGREP "$match_pattern_regex" > /dev/null; then 6332290001Sglebius valid_a_lib=yes 6333290001Sglebius fi 6334290001Sglebius ;; 6335290001Sglebius pass_all) 6336290001Sglebius valid_a_lib=yes 6337290001Sglebius ;; 6338290001Sglebius esac 6339290001Sglebius if test "$valid_a_lib" != yes; then 6340290001Sglebius echo 6341290001Sglebius $ECHO "*** Warning: Trying to link with static lib archive $deplib." 6342290001Sglebius echo "*** I have the capability to make that library automatically link in when" 6343290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 6344290001Sglebius echo "*** shared version of the library, which you do not appear to have" 6345290001Sglebius echo "*** because the file extensions .$libext of this argument makes me believe" 6346290001Sglebius echo "*** that it is just a static archive that I should not use here." 6347290001Sglebius else 6348290001Sglebius echo 6349290001Sglebius $ECHO "*** Warning: Linking the shared library $output against the" 6350290001Sglebius $ECHO "*** static library $deplib is not portable!" 6351290001Sglebius deplibs="$deplib $deplibs" 6352290001Sglebius fi 6353290001Sglebius ;; 6354290001Sglebius esac 6355290001Sglebius continue 6356290001Sglebius ;; 6357290001Sglebius prog) 6358290001Sglebius if test "$pass" != link; then 6359290001Sglebius deplibs="$deplib $deplibs" 6360290001Sglebius else 6361290001Sglebius compile_deplibs="$deplib $compile_deplibs" 6362290001Sglebius finalize_deplibs="$deplib $finalize_deplibs" 6363290001Sglebius fi 6364290001Sglebius continue 6365290001Sglebius ;; 6366290001Sglebius esac # linkmode 6367290001Sglebius ;; # *.$libext 6368290001Sglebius *.lo | *.$objext) 6369290001Sglebius if test "$pass" = conv; then 6370290001Sglebius deplibs="$deplib $deplibs" 6371290001Sglebius elif test "$linkmode" = prog; then 6372290001Sglebius if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 6373290001Sglebius # If there is no dlopen support or we're linking statically, 6374290001Sglebius # we need to preload. 6375290001Sglebius func_append newdlprefiles " $deplib" 6376290001Sglebius compile_deplibs="$deplib $compile_deplibs" 6377290001Sglebius finalize_deplibs="$deplib $finalize_deplibs" 6378290001Sglebius else 6379290001Sglebius func_append newdlfiles " $deplib" 6380290001Sglebius fi 6381290001Sglebius fi 6382290001Sglebius continue 6383290001Sglebius ;; 6384290001Sglebius %DEPLIBS%) 6385290001Sglebius alldeplibs=yes 6386290001Sglebius continue 6387290001Sglebius ;; 6388290001Sglebius esac # case $deplib 6389290001Sglebius 6390290001Sglebius if test "$found" = yes || test -f "$lib"; then : 6391290001Sglebius else 6392290001Sglebius func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 6393290001Sglebius fi 6394290001Sglebius 6395290001Sglebius # Check to see that this really is a libtool archive. 6396290001Sglebius func_lalib_unsafe_p "$lib" \ 6397290001Sglebius || func_fatal_error "\`$lib' is not a valid libtool archive" 6398290001Sglebius 6399290001Sglebius func_dirname "$lib" "" "." 6400290001Sglebius ladir="$func_dirname_result" 6401290001Sglebius 6402290001Sglebius dlname= 6403290001Sglebius dlopen= 6404290001Sglebius dlpreopen= 6405290001Sglebius libdir= 6406290001Sglebius library_names= 6407290001Sglebius old_library= 6408290001Sglebius inherited_linker_flags= 6409290001Sglebius # If the library was installed with an old release of libtool, 6410290001Sglebius # it will not redefine variables installed, or shouldnotlink 6411290001Sglebius installed=yes 6412290001Sglebius shouldnotlink=no 6413290001Sglebius avoidtemprpath= 6414290001Sglebius 6415290001Sglebius 6416290001Sglebius # Read the .la file 6417290001Sglebius func_source "$lib" 6418290001Sglebius 6419290001Sglebius # Convert "-framework foo" to "foo.ltframework" 6420290001Sglebius if test -n "$inherited_linker_flags"; then 6421290001Sglebius tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 6422290001Sglebius for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 6423290001Sglebius case " $new_inherited_linker_flags " in 6424290001Sglebius *" $tmp_inherited_linker_flag "*) ;; 6425290001Sglebius *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 6426290001Sglebius esac 6427290001Sglebius done 6428290001Sglebius fi 6429290001Sglebius dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 6430290001Sglebius if test "$linkmode,$pass" = "lib,link" || 6431290001Sglebius test "$linkmode,$pass" = "prog,scan" || 6432290001Sglebius { test "$linkmode" != prog && test "$linkmode" != lib; }; then 6433290001Sglebius test -n "$dlopen" && func_append dlfiles " $dlopen" 6434290001Sglebius test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 6435290001Sglebius fi 6436290001Sglebius 6437290001Sglebius if test "$pass" = conv; then 6438290001Sglebius # Only check for convenience libraries 6439290001Sglebius deplibs="$lib $deplibs" 6440290001Sglebius if test -z "$libdir"; then 6441290001Sglebius if test -z "$old_library"; then 6442290001Sglebius func_fatal_error "cannot find name of link library for \`$lib'" 6443290001Sglebius fi 6444290001Sglebius # It is a libtool convenience library, so add in its objects. 6445290001Sglebius func_append convenience " $ladir/$objdir/$old_library" 6446290001Sglebius func_append old_convenience " $ladir/$objdir/$old_library" 6447290001Sglebius elif test "$linkmode" != prog && test "$linkmode" != lib; then 6448290001Sglebius func_fatal_error "\`$lib' is not a convenience library" 6449290001Sglebius fi 6450290001Sglebius tmp_libs= 6451290001Sglebius for deplib in $dependency_libs; do 6452290001Sglebius deplibs="$deplib $deplibs" 6453290001Sglebius if $opt_preserve_dup_deps ; then 6454290001Sglebius case "$tmp_libs " in 6455290001Sglebius *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6456290001Sglebius esac 6457290001Sglebius fi 6458290001Sglebius func_append tmp_libs " $deplib" 6459290001Sglebius done 6460290001Sglebius continue 6461290001Sglebius fi # $pass = conv 6462290001Sglebius 6463290001Sglebius 6464290001Sglebius # Get the name of the library we link against. 6465290001Sglebius linklib= 6466290001Sglebius if test -n "$old_library" && 6467290001Sglebius { test "$prefer_static_libs" = yes || 6468290001Sglebius test "$prefer_static_libs,$installed" = "built,no"; }; then 6469290001Sglebius linklib=$old_library 6470290001Sglebius else 6471290001Sglebius for l in $old_library $library_names; do 6472290001Sglebius linklib="$l" 6473290001Sglebius done 6474290001Sglebius fi 6475290001Sglebius if test -z "$linklib"; then 6476290001Sglebius func_fatal_error "cannot find name of link library for \`$lib'" 6477290001Sglebius fi 6478290001Sglebius 6479290001Sglebius # This library was specified with -dlopen. 6480290001Sglebius if test "$pass" = dlopen; then 6481290001Sglebius if test -z "$libdir"; then 6482290001Sglebius func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 6483290001Sglebius fi 6484290001Sglebius if test -z "$dlname" || 6485290001Sglebius test "$dlopen_support" != yes || 6486290001Sglebius test "$build_libtool_libs" = no; then 6487290001Sglebius # If there is no dlname, no dlopen support or we're linking 6488290001Sglebius # statically, we need to preload. We also need to preload any 6489290001Sglebius # dependent libraries so libltdl's deplib preloader doesn't 6490290001Sglebius # bomb out in the load deplibs phase. 6491290001Sglebius func_append dlprefiles " $lib $dependency_libs" 6492290001Sglebius else 6493290001Sglebius func_append newdlfiles " $lib" 6494290001Sglebius fi 6495290001Sglebius continue 6496290001Sglebius fi # $pass = dlopen 6497290001Sglebius 6498290001Sglebius # We need an absolute path. 6499290001Sglebius case $ladir in 6500290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 6501290001Sglebius *) 6502290001Sglebius abs_ladir=`cd "$ladir" && pwd` 6503290001Sglebius if test -z "$abs_ladir"; then 6504290001Sglebius func_warning "cannot determine absolute directory name of \`$ladir'" 6505290001Sglebius func_warning "passing it literally to the linker, although it might fail" 6506290001Sglebius abs_ladir="$ladir" 6507290001Sglebius fi 6508290001Sglebius ;; 6509290001Sglebius esac 6510290001Sglebius func_basename "$lib" 6511290001Sglebius laname="$func_basename_result" 6512290001Sglebius 6513290001Sglebius # Find the relevant object directory and library name. 6514290001Sglebius if test "X$installed" = Xyes; then 6515290001Sglebius if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6516290001Sglebius func_warning "library \`$lib' was moved." 6517290001Sglebius dir="$ladir" 6518290001Sglebius absdir="$abs_ladir" 6519290001Sglebius libdir="$abs_ladir" 6520290001Sglebius else 6521290001Sglebius dir="$lt_sysroot$libdir" 6522290001Sglebius absdir="$lt_sysroot$libdir" 6523290001Sglebius fi 6524290001Sglebius test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 6525290001Sglebius else 6526290001Sglebius if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6527290001Sglebius dir="$ladir" 6528290001Sglebius absdir="$abs_ladir" 6529290001Sglebius # Remove this search path later 6530290001Sglebius func_append notinst_path " $abs_ladir" 6531290001Sglebius else 6532290001Sglebius dir="$ladir/$objdir" 6533290001Sglebius absdir="$abs_ladir/$objdir" 6534290001Sglebius # Remove this search path later 6535290001Sglebius func_append notinst_path " $abs_ladir" 6536290001Sglebius fi 6537290001Sglebius fi # $installed = yes 6538290001Sglebius func_stripname 'lib' '.la' "$laname" 6539290001Sglebius name=$func_stripname_result 6540290001Sglebius 6541290001Sglebius # This library was specified with -dlpreopen. 6542290001Sglebius if test "$pass" = dlpreopen; then 6543290001Sglebius if test -z "$libdir" && test "$linkmode" = prog; then 6544290001Sglebius func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 6545290001Sglebius fi 6546290001Sglebius case "$host" in 6547290001Sglebius # special handling for platforms with PE-DLLs. 6548290001Sglebius *cygwin* | *mingw* | *cegcc* ) 6549290001Sglebius # Linker will automatically link against shared library if both 6550290001Sglebius # static and shared are present. Therefore, ensure we extract 6551290001Sglebius # symbols from the import library if a shared library is present 6552290001Sglebius # (otherwise, the dlopen module name will be incorrect). We do 6553290001Sglebius # this by putting the import library name into $newdlprefiles. 6554290001Sglebius # We recover the dlopen module name by 'saving' the la file 6555290001Sglebius # name in a special purpose variable, and (later) extracting the 6556290001Sglebius # dlname from the la file. 6557290001Sglebius if test -n "$dlname"; then 6558290001Sglebius func_tr_sh "$dir/$linklib" 6559290001Sglebius eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 6560290001Sglebius func_append newdlprefiles " $dir/$linklib" 6561290001Sglebius else 6562290001Sglebius func_append newdlprefiles " $dir/$old_library" 6563290001Sglebius # Keep a list of preopened convenience libraries to check 6564290001Sglebius # that they are being used correctly in the link pass. 6565290001Sglebius test -z "$libdir" && \ 6566290001Sglebius func_append dlpreconveniencelibs " $dir/$old_library" 6567290001Sglebius fi 6568290001Sglebius ;; 6569290001Sglebius * ) 6570290001Sglebius # Prefer using a static library (so that no silly _DYNAMIC symbols 6571290001Sglebius # are required to link). 6572290001Sglebius if test -n "$old_library"; then 6573290001Sglebius func_append newdlprefiles " $dir/$old_library" 6574290001Sglebius # Keep a list of preopened convenience libraries to check 6575290001Sglebius # that they are being used correctly in the link pass. 6576290001Sglebius test -z "$libdir" && \ 6577290001Sglebius func_append dlpreconveniencelibs " $dir/$old_library" 6578290001Sglebius # Otherwise, use the dlname, so that lt_dlopen finds it. 6579290001Sglebius elif test -n "$dlname"; then 6580290001Sglebius func_append newdlprefiles " $dir/$dlname" 6581290001Sglebius else 6582290001Sglebius func_append newdlprefiles " $dir/$linklib" 6583290001Sglebius fi 6584290001Sglebius ;; 6585290001Sglebius esac 6586290001Sglebius fi # $pass = dlpreopen 6587290001Sglebius 6588290001Sglebius if test -z "$libdir"; then 6589290001Sglebius # Link the convenience library 6590290001Sglebius if test "$linkmode" = lib; then 6591290001Sglebius deplibs="$dir/$old_library $deplibs" 6592290001Sglebius elif test "$linkmode,$pass" = "prog,link"; then 6593290001Sglebius compile_deplibs="$dir/$old_library $compile_deplibs" 6594290001Sglebius finalize_deplibs="$dir/$old_library $finalize_deplibs" 6595290001Sglebius else 6596290001Sglebius deplibs="$lib $deplibs" # used for prog,scan pass 6597290001Sglebius fi 6598290001Sglebius continue 6599290001Sglebius fi 6600290001Sglebius 6601290001Sglebius 6602290001Sglebius if test "$linkmode" = prog && test "$pass" != link; then 6603290001Sglebius func_append newlib_search_path " $ladir" 6604290001Sglebius deplibs="$lib $deplibs" 6605290001Sglebius 6606290001Sglebius linkalldeplibs=no 6607290001Sglebius if test "$link_all_deplibs" != no || test -z "$library_names" || 6608290001Sglebius test "$build_libtool_libs" = no; then 6609290001Sglebius linkalldeplibs=yes 6610290001Sglebius fi 6611290001Sglebius 6612290001Sglebius tmp_libs= 6613290001Sglebius for deplib in $dependency_libs; do 6614290001Sglebius case $deplib in 6615290001Sglebius -L*) func_stripname '-L' '' "$deplib" 6616290001Sglebius func_resolve_sysroot "$func_stripname_result" 6617290001Sglebius func_append newlib_search_path " $func_resolve_sysroot_result" 6618290001Sglebius ;; 6619290001Sglebius esac 6620290001Sglebius # Need to link against all dependency_libs? 6621290001Sglebius if test "$linkalldeplibs" = yes; then 6622290001Sglebius deplibs="$deplib $deplibs" 6623290001Sglebius else 6624290001Sglebius # Need to hardcode shared library paths 6625290001Sglebius # or/and link against static libraries 6626290001Sglebius newdependency_libs="$deplib $newdependency_libs" 6627290001Sglebius fi 6628290001Sglebius if $opt_preserve_dup_deps ; then 6629290001Sglebius case "$tmp_libs " in 6630290001Sglebius *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6631290001Sglebius esac 6632290001Sglebius fi 6633290001Sglebius func_append tmp_libs " $deplib" 6634290001Sglebius done # for deplib 6635290001Sglebius continue 6636290001Sglebius fi # $linkmode = prog... 6637290001Sglebius 6638290001Sglebius if test "$linkmode,$pass" = "prog,link"; then 6639290001Sglebius if test -n "$library_names" && 6640290001Sglebius { { test "$prefer_static_libs" = no || 6641290001Sglebius test "$prefer_static_libs,$installed" = "built,yes"; } || 6642290001Sglebius test -z "$old_library"; }; then 6643290001Sglebius # We need to hardcode the library path 6644290001Sglebius if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 6645290001Sglebius # Make sure the rpath contains only unique directories. 6646290001Sglebius case "$temp_rpath:" in 6647290001Sglebius *"$absdir:"*) ;; 6648290001Sglebius *) func_append temp_rpath "$absdir:" ;; 6649290001Sglebius esac 6650290001Sglebius fi 6651290001Sglebius 6652290001Sglebius # Hardcode the library path. 6653290001Sglebius # Skip directories that are in the system default run-time 6654290001Sglebius # search path. 6655290001Sglebius case " $sys_lib_dlsearch_path " in 6656290001Sglebius *" $absdir "*) ;; 6657290001Sglebius *) 6658290001Sglebius case "$compile_rpath " in 6659290001Sglebius *" $absdir "*) ;; 6660290001Sglebius *) func_append compile_rpath " $absdir" ;; 6661290001Sglebius esac 6662290001Sglebius ;; 6663290001Sglebius esac 6664290001Sglebius case " $sys_lib_dlsearch_path " in 6665290001Sglebius *" $libdir "*) ;; 6666290001Sglebius *) 6667290001Sglebius case "$finalize_rpath " in 6668290001Sglebius *" $libdir "*) ;; 6669290001Sglebius *) func_append finalize_rpath " $libdir" ;; 6670290001Sglebius esac 6671290001Sglebius ;; 6672290001Sglebius esac 6673290001Sglebius fi # $linkmode,$pass = prog,link... 6674290001Sglebius 6675290001Sglebius if test "$alldeplibs" = yes && 6676290001Sglebius { test "$deplibs_check_method" = pass_all || 6677290001Sglebius { test "$build_libtool_libs" = yes && 6678290001Sglebius test -n "$library_names"; }; }; then 6679290001Sglebius # We only need to search for static libraries 6680290001Sglebius continue 6681290001Sglebius fi 6682290001Sglebius fi 6683290001Sglebius 6684290001Sglebius link_static=no # Whether the deplib will be linked statically 6685290001Sglebius use_static_libs=$prefer_static_libs 6686290001Sglebius if test "$use_static_libs" = built && test "$installed" = yes; then 6687290001Sglebius use_static_libs=no 6688290001Sglebius fi 6689290001Sglebius if test -n "$library_names" && 6690290001Sglebius { test "$use_static_libs" = no || test -z "$old_library"; }; then 6691290001Sglebius case $host in 6692290001Sglebius *cygwin* | *mingw* | *cegcc*) 6693290001Sglebius # No point in relinking DLLs because paths are not encoded 6694290001Sglebius func_append notinst_deplibs " $lib" 6695290001Sglebius need_relink=no 6696290001Sglebius ;; 6697290001Sglebius *) 6698290001Sglebius if test "$installed" = no; then 6699290001Sglebius func_append notinst_deplibs " $lib" 6700290001Sglebius need_relink=yes 6701290001Sglebius fi 6702290001Sglebius ;; 6703290001Sglebius esac 6704290001Sglebius # This is a shared library 6705290001Sglebius 6706290001Sglebius # Warn about portability, can't link against -module's on some 6707290001Sglebius # systems (darwin). Don't bleat about dlopened modules though! 6708290001Sglebius dlopenmodule="" 6709290001Sglebius for dlpremoduletest in $dlprefiles; do 6710290001Sglebius if test "X$dlpremoduletest" = "X$lib"; then 6711290001Sglebius dlopenmodule="$dlpremoduletest" 6712290001Sglebius break 6713290001Sglebius fi 6714290001Sglebius done 6715290001Sglebius if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 6716290001Sglebius echo 6717290001Sglebius if test "$linkmode" = prog; then 6718290001Sglebius $ECHO "*** Warning: Linking the executable $output against the loadable module" 6719290001Sglebius else 6720290001Sglebius $ECHO "*** Warning: Linking the shared library $output against the loadable module" 6721290001Sglebius fi 6722290001Sglebius $ECHO "*** $linklib is not portable!" 6723290001Sglebius fi 6724290001Sglebius if test "$linkmode" = lib && 6725290001Sglebius test "$hardcode_into_libs" = yes; then 6726290001Sglebius # Hardcode the library path. 6727290001Sglebius # Skip directories that are in the system default run-time 6728290001Sglebius # search path. 6729290001Sglebius case " $sys_lib_dlsearch_path " in 6730290001Sglebius *" $absdir "*) ;; 6731290001Sglebius *) 6732290001Sglebius case "$compile_rpath " in 6733290001Sglebius *" $absdir "*) ;; 6734290001Sglebius *) func_append compile_rpath " $absdir" ;; 6735290001Sglebius esac 6736290001Sglebius ;; 6737290001Sglebius esac 6738290001Sglebius case " $sys_lib_dlsearch_path " in 6739290001Sglebius *" $libdir "*) ;; 6740290001Sglebius *) 6741290001Sglebius case "$finalize_rpath " in 6742290001Sglebius *" $libdir "*) ;; 6743290001Sglebius *) func_append finalize_rpath " $libdir" ;; 6744290001Sglebius esac 6745290001Sglebius ;; 6746290001Sglebius esac 6747290001Sglebius fi 6748290001Sglebius 6749290001Sglebius if test -n "$old_archive_from_expsyms_cmds"; then 6750290001Sglebius # figure out the soname 6751290001Sglebius set dummy $library_names 6752290001Sglebius shift 6753290001Sglebius realname="$1" 6754290001Sglebius shift 6755290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 6756290001Sglebius # use dlname if we got it. it's perfectly good, no? 6757290001Sglebius if test -n "$dlname"; then 6758290001Sglebius soname="$dlname" 6759290001Sglebius elif test -n "$soname_spec"; then 6760290001Sglebius # bleh windows 6761290001Sglebius case $host in 6762290001Sglebius *cygwin* | mingw* | *cegcc*) 6763290001Sglebius func_arith $current - $age 6764290001Sglebius major=$func_arith_result 6765290001Sglebius versuffix="-$major" 6766290001Sglebius ;; 6767290001Sglebius esac 6768290001Sglebius eval soname=\"$soname_spec\" 6769290001Sglebius else 6770290001Sglebius soname="$realname" 6771290001Sglebius fi 6772290001Sglebius 6773290001Sglebius # Make a new name for the extract_expsyms_cmds to use 6774290001Sglebius soroot="$soname" 6775290001Sglebius func_basename "$soroot" 6776290001Sglebius soname="$func_basename_result" 6777290001Sglebius func_stripname 'lib' '.dll' "$soname" 6778290001Sglebius newlib=libimp-$func_stripname_result.a 6779290001Sglebius 6780290001Sglebius # If the library has no export list, then create one now 6781290001Sglebius if test -f "$output_objdir/$soname-def"; then : 6782290001Sglebius else 6783290001Sglebius func_verbose "extracting exported symbol list from \`$soname'" 6784290001Sglebius func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 6785290001Sglebius fi 6786290001Sglebius 6787290001Sglebius # Create $newlib 6788290001Sglebius if test -f "$output_objdir/$newlib"; then :; else 6789290001Sglebius func_verbose "generating import library for \`$soname'" 6790290001Sglebius func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 6791290001Sglebius fi 6792290001Sglebius # make sure the library variables are pointing to the new library 6793290001Sglebius dir=$output_objdir 6794290001Sglebius linklib=$newlib 6795290001Sglebius fi # test -n "$old_archive_from_expsyms_cmds" 6796290001Sglebius 6797290001Sglebius if test "$linkmode" = prog || test "$opt_mode" != relink; then 6798290001Sglebius add_shlibpath= 6799290001Sglebius add_dir= 6800290001Sglebius add= 6801290001Sglebius lib_linked=yes 6802290001Sglebius case $hardcode_action in 6803290001Sglebius immediate | unsupported) 6804290001Sglebius if test "$hardcode_direct" = no; then 6805290001Sglebius add="$dir/$linklib" 6806290001Sglebius case $host in 6807290001Sglebius *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 6808290001Sglebius *-*-sysv4*uw2*) add_dir="-L$dir" ;; 6809290001Sglebius *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 6810290001Sglebius *-*-unixware7*) add_dir="-L$dir" ;; 6811290001Sglebius *-*-darwin* ) 6812290001Sglebius # if the lib is a (non-dlopened) module then we can not 6813290001Sglebius # link against it, someone is ignoring the earlier warnings 6814290001Sglebius if /usr/bin/file -L $add 2> /dev/null | 6815290001Sglebius $GREP ": [^:]* bundle" >/dev/null ; then 6816290001Sglebius if test "X$dlopenmodule" != "X$lib"; then 6817290001Sglebius $ECHO "*** Warning: lib $linklib is a module, not a shared library" 6818290001Sglebius if test -z "$old_library" ; then 6819290001Sglebius echo 6820290001Sglebius echo "*** And there doesn't seem to be a static archive available" 6821290001Sglebius echo "*** The link will probably fail, sorry" 6822290001Sglebius else 6823290001Sglebius add="$dir/$old_library" 6824290001Sglebius fi 6825290001Sglebius elif test -n "$old_library"; then 6826290001Sglebius add="$dir/$old_library" 6827290001Sglebius fi 6828290001Sglebius fi 6829290001Sglebius esac 6830290001Sglebius elif test "$hardcode_minus_L" = no; then 6831290001Sglebius case $host in 6832290001Sglebius *-*-sunos*) add_shlibpath="$dir" ;; 6833290001Sglebius esac 6834290001Sglebius add_dir="-L$dir" 6835290001Sglebius add="-l$name" 6836290001Sglebius elif test "$hardcode_shlibpath_var" = no; then 6837290001Sglebius add_shlibpath="$dir" 6838290001Sglebius add="-l$name" 6839290001Sglebius else 6840290001Sglebius lib_linked=no 6841290001Sglebius fi 6842290001Sglebius ;; 6843290001Sglebius relink) 6844290001Sglebius if test "$hardcode_direct" = yes && 6845290001Sglebius test "$hardcode_direct_absolute" = no; then 6846290001Sglebius add="$dir/$linklib" 6847290001Sglebius elif test "$hardcode_minus_L" = yes; then 6848290001Sglebius add_dir="-L$absdir" 6849290001Sglebius # Try looking first in the location we're being installed to. 6850290001Sglebius if test -n "$inst_prefix_dir"; then 6851290001Sglebius case $libdir in 6852290001Sglebius [\\/]*) 6853290001Sglebius func_append add_dir " -L$inst_prefix_dir$libdir" 6854290001Sglebius ;; 6855290001Sglebius esac 6856290001Sglebius fi 6857290001Sglebius add="-l$name" 6858290001Sglebius elif test "$hardcode_shlibpath_var" = yes; then 6859290001Sglebius add_shlibpath="$dir" 6860290001Sglebius add="-l$name" 6861290001Sglebius else 6862290001Sglebius lib_linked=no 6863290001Sglebius fi 6864290001Sglebius ;; 6865290001Sglebius *) lib_linked=no ;; 6866290001Sglebius esac 6867290001Sglebius 6868290001Sglebius if test "$lib_linked" != yes; then 6869290001Sglebius func_fatal_configuration "unsupported hardcode properties" 6870290001Sglebius fi 6871290001Sglebius 6872290001Sglebius if test -n "$add_shlibpath"; then 6873290001Sglebius case :$compile_shlibpath: in 6874290001Sglebius *":$add_shlibpath:"*) ;; 6875290001Sglebius *) func_append compile_shlibpath "$add_shlibpath:" ;; 6876290001Sglebius esac 6877290001Sglebius fi 6878290001Sglebius if test "$linkmode" = prog; then 6879290001Sglebius test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 6880290001Sglebius test -n "$add" && compile_deplibs="$add $compile_deplibs" 6881290001Sglebius else 6882290001Sglebius test -n "$add_dir" && deplibs="$add_dir $deplibs" 6883290001Sglebius test -n "$add" && deplibs="$add $deplibs" 6884290001Sglebius if test "$hardcode_direct" != yes && 6885290001Sglebius test "$hardcode_minus_L" != yes && 6886290001Sglebius test "$hardcode_shlibpath_var" = yes; then 6887290001Sglebius case :$finalize_shlibpath: in 6888290001Sglebius *":$libdir:"*) ;; 6889290001Sglebius *) func_append finalize_shlibpath "$libdir:" ;; 6890290001Sglebius esac 6891290001Sglebius fi 6892290001Sglebius fi 6893290001Sglebius fi 6894290001Sglebius 6895290001Sglebius if test "$linkmode" = prog || test "$opt_mode" = relink; then 6896290001Sglebius add_shlibpath= 6897290001Sglebius add_dir= 6898290001Sglebius add= 6899290001Sglebius # Finalize command for both is simple: just hardcode it. 6900290001Sglebius if test "$hardcode_direct" = yes && 6901290001Sglebius test "$hardcode_direct_absolute" = no; then 6902290001Sglebius add="$libdir/$linklib" 6903290001Sglebius elif test "$hardcode_minus_L" = yes; then 6904290001Sglebius add_dir="-L$libdir" 6905290001Sglebius add="-l$name" 6906290001Sglebius elif test "$hardcode_shlibpath_var" = yes; then 6907290001Sglebius case :$finalize_shlibpath: in 6908290001Sglebius *":$libdir:"*) ;; 6909290001Sglebius *) func_append finalize_shlibpath "$libdir:" ;; 6910290001Sglebius esac 6911290001Sglebius add="-l$name" 6912290001Sglebius elif test "$hardcode_automatic" = yes; then 6913290001Sglebius if test -n "$inst_prefix_dir" && 6914290001Sglebius test -f "$inst_prefix_dir$libdir/$linklib" ; then 6915290001Sglebius add="$inst_prefix_dir$libdir/$linklib" 6916290001Sglebius else 6917290001Sglebius add="$libdir/$linklib" 6918290001Sglebius fi 6919290001Sglebius else 6920290001Sglebius # We cannot seem to hardcode it, guess we'll fake it. 6921290001Sglebius add_dir="-L$libdir" 6922290001Sglebius # Try looking first in the location we're being installed to. 6923290001Sglebius if test -n "$inst_prefix_dir"; then 6924290001Sglebius case $libdir in 6925290001Sglebius [\\/]*) 6926290001Sglebius func_append add_dir " -L$inst_prefix_dir$libdir" 6927290001Sglebius ;; 6928290001Sglebius esac 6929290001Sglebius fi 6930290001Sglebius add="-l$name" 6931290001Sglebius fi 6932290001Sglebius 6933290001Sglebius if test "$linkmode" = prog; then 6934290001Sglebius test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 6935290001Sglebius test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 6936290001Sglebius else 6937290001Sglebius test -n "$add_dir" && deplibs="$add_dir $deplibs" 6938290001Sglebius test -n "$add" && deplibs="$add $deplibs" 6939290001Sglebius fi 6940290001Sglebius fi 6941290001Sglebius elif test "$linkmode" = prog; then 6942290001Sglebius # Here we assume that one of hardcode_direct or hardcode_minus_L 6943290001Sglebius # is not unsupported. This is valid on all known static and 6944290001Sglebius # shared platforms. 6945290001Sglebius if test "$hardcode_direct" != unsupported; then 6946290001Sglebius test -n "$old_library" && linklib="$old_library" 6947290001Sglebius compile_deplibs="$dir/$linklib $compile_deplibs" 6948290001Sglebius finalize_deplibs="$dir/$linklib $finalize_deplibs" 6949290001Sglebius else 6950290001Sglebius compile_deplibs="-l$name -L$dir $compile_deplibs" 6951290001Sglebius finalize_deplibs="-l$name -L$dir $finalize_deplibs" 6952290001Sglebius fi 6953290001Sglebius elif test "$build_libtool_libs" = yes; then 6954290001Sglebius # Not a shared library 6955290001Sglebius if test "$deplibs_check_method" != pass_all; then 6956290001Sglebius # We're trying link a shared library against a static one 6957290001Sglebius # but the system doesn't support it. 6958290001Sglebius 6959290001Sglebius # Just print a warning and add the library to dependency_libs so 6960290001Sglebius # that the program can be linked against the static library. 6961290001Sglebius echo 6962290001Sglebius $ECHO "*** Warning: This system can not link to static lib archive $lib." 6963290001Sglebius echo "*** I have the capability to make that library automatically link in when" 6964290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 6965290001Sglebius echo "*** shared version of the library, which you do not appear to have." 6966290001Sglebius if test "$module" = yes; then 6967290001Sglebius echo "*** But as you try to build a module library, libtool will still create " 6968290001Sglebius echo "*** a static module, that should work as long as the dlopening application" 6969290001Sglebius echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 6970290001Sglebius if test -z "$global_symbol_pipe"; then 6971290001Sglebius echo 6972290001Sglebius echo "*** However, this would only work if libtool was able to extract symbol" 6973290001Sglebius echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 6974290001Sglebius echo "*** not find such a program. So, this module is probably useless." 6975290001Sglebius echo "*** \`nm' from GNU binutils and a full rebuild may help." 6976290001Sglebius fi 6977290001Sglebius if test "$build_old_libs" = no; then 6978290001Sglebius build_libtool_libs=module 6979290001Sglebius build_old_libs=yes 6980290001Sglebius else 6981290001Sglebius build_libtool_libs=no 6982290001Sglebius fi 6983290001Sglebius fi 6984290001Sglebius else 6985290001Sglebius deplibs="$dir/$old_library $deplibs" 6986290001Sglebius link_static=yes 6987290001Sglebius fi 6988290001Sglebius fi # link shared/static library? 6989290001Sglebius 6990290001Sglebius if test "$linkmode" = lib; then 6991290001Sglebius if test -n "$dependency_libs" && 6992290001Sglebius { test "$hardcode_into_libs" != yes || 6993290001Sglebius test "$build_old_libs" = yes || 6994290001Sglebius test "$link_static" = yes; }; then 6995290001Sglebius # Extract -R from dependency_libs 6996290001Sglebius temp_deplibs= 6997290001Sglebius for libdir in $dependency_libs; do 6998290001Sglebius case $libdir in 6999290001Sglebius -R*) func_stripname '-R' '' "$libdir" 7000290001Sglebius temp_xrpath=$func_stripname_result 7001290001Sglebius case " $xrpath " in 7002290001Sglebius *" $temp_xrpath "*) ;; 7003290001Sglebius *) func_append xrpath " $temp_xrpath";; 7004290001Sglebius esac;; 7005290001Sglebius *) func_append temp_deplibs " $libdir";; 7006290001Sglebius esac 7007290001Sglebius done 7008290001Sglebius dependency_libs="$temp_deplibs" 7009290001Sglebius fi 7010290001Sglebius 7011290001Sglebius func_append newlib_search_path " $absdir" 7012290001Sglebius # Link against this library 7013290001Sglebius test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 7014290001Sglebius # ... and its dependency_libs 7015290001Sglebius tmp_libs= 7016290001Sglebius for deplib in $dependency_libs; do 7017290001Sglebius newdependency_libs="$deplib $newdependency_libs" 7018290001Sglebius case $deplib in 7019290001Sglebius -L*) func_stripname '-L' '' "$deplib" 7020290001Sglebius func_resolve_sysroot "$func_stripname_result";; 7021290001Sglebius *) func_resolve_sysroot "$deplib" ;; 7022290001Sglebius esac 7023290001Sglebius if $opt_preserve_dup_deps ; then 7024290001Sglebius case "$tmp_libs " in 7025290001Sglebius *" $func_resolve_sysroot_result "*) 7026290001Sglebius func_append specialdeplibs " $func_resolve_sysroot_result" ;; 7027290001Sglebius esac 7028290001Sglebius fi 7029290001Sglebius func_append tmp_libs " $func_resolve_sysroot_result" 7030290001Sglebius done 7031290001Sglebius 7032290001Sglebius if test "$link_all_deplibs" != no; then 7033290001Sglebius # Add the search paths of all dependency libraries 7034290001Sglebius for deplib in $dependency_libs; do 7035290001Sglebius path= 7036290001Sglebius case $deplib in 7037290001Sglebius -L*) path="$deplib" ;; 7038290001Sglebius *.la) 7039290001Sglebius func_resolve_sysroot "$deplib" 7040290001Sglebius deplib=$func_resolve_sysroot_result 7041290001Sglebius func_dirname "$deplib" "" "." 7042290001Sglebius dir=$func_dirname_result 7043290001Sglebius # We need an absolute path. 7044290001Sglebius case $dir in 7045290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 7046290001Sglebius *) 7047290001Sglebius absdir=`cd "$dir" && pwd` 7048290001Sglebius if test -z "$absdir"; then 7049290001Sglebius func_warning "cannot determine absolute directory name of \`$dir'" 7050290001Sglebius absdir="$dir" 7051290001Sglebius fi 7052290001Sglebius ;; 7053290001Sglebius esac 7054290001Sglebius if $GREP "^installed=no" $deplib > /dev/null; then 7055290001Sglebius case $host in 7056290001Sglebius *-*-darwin*) 7057290001Sglebius depdepl= 7058290001Sglebius eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 7059290001Sglebius if test -n "$deplibrary_names" ; then 7060290001Sglebius for tmp in $deplibrary_names ; do 7061290001Sglebius depdepl=$tmp 7062290001Sglebius done 7063290001Sglebius if test -f "$absdir/$objdir/$depdepl" ; then 7064290001Sglebius depdepl="$absdir/$objdir/$depdepl" 7065290001Sglebius darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7066290001Sglebius if test -z "$darwin_install_name"; then 7067290001Sglebius darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7068290001Sglebius fi 7069290001Sglebius func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 7070290001Sglebius func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" 7071290001Sglebius path= 7072290001Sglebius fi 7073290001Sglebius fi 7074290001Sglebius ;; 7075290001Sglebius *) 7076290001Sglebius path="-L$absdir/$objdir" 7077290001Sglebius ;; 7078290001Sglebius esac 7079290001Sglebius else 7080290001Sglebius eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 7081290001Sglebius test -z "$libdir" && \ 7082290001Sglebius func_fatal_error "\`$deplib' is not a valid libtool archive" 7083290001Sglebius test "$absdir" != "$libdir" && \ 7084290001Sglebius func_warning "\`$deplib' seems to be moved" 7085290001Sglebius 7086290001Sglebius path="-L$absdir" 7087290001Sglebius fi 7088290001Sglebius ;; 7089290001Sglebius esac 7090290001Sglebius case " $deplibs " in 7091290001Sglebius *" $path "*) ;; 7092290001Sglebius *) deplibs="$path $deplibs" ;; 7093290001Sglebius esac 7094290001Sglebius done 7095290001Sglebius fi # link_all_deplibs != no 7096290001Sglebius fi # linkmode = lib 7097290001Sglebius done # for deplib in $libs 7098290001Sglebius if test "$pass" = link; then 7099290001Sglebius if test "$linkmode" = "prog"; then 7100290001Sglebius compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 7101290001Sglebius finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 7102290001Sglebius else 7103290001Sglebius compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7104290001Sglebius fi 7105290001Sglebius fi 7106290001Sglebius dependency_libs="$newdependency_libs" 7107290001Sglebius if test "$pass" = dlpreopen; then 7108290001Sglebius # Link the dlpreopened libraries before other libraries 7109290001Sglebius for deplib in $save_deplibs; do 7110290001Sglebius deplibs="$deplib $deplibs" 7111290001Sglebius done 7112290001Sglebius fi 7113290001Sglebius if test "$pass" != dlopen; then 7114290001Sglebius if test "$pass" != conv; then 7115290001Sglebius # Make sure lib_search_path contains only unique directories. 7116290001Sglebius lib_search_path= 7117290001Sglebius for dir in $newlib_search_path; do 7118290001Sglebius case "$lib_search_path " in 7119290001Sglebius *" $dir "*) ;; 7120290001Sglebius *) func_append lib_search_path " $dir" ;; 7121290001Sglebius esac 7122290001Sglebius done 7123290001Sglebius newlib_search_path= 7124290001Sglebius fi 7125290001Sglebius 7126290001Sglebius if test "$linkmode,$pass" != "prog,link"; then 7127290001Sglebius vars="deplibs" 7128290001Sglebius else 7129290001Sglebius vars="compile_deplibs finalize_deplibs" 7130290001Sglebius fi 7131290001Sglebius for var in $vars dependency_libs; do 7132290001Sglebius # Add libraries to $var in reverse order 7133290001Sglebius eval tmp_libs=\"\$$var\" 7134290001Sglebius new_libs= 7135290001Sglebius for deplib in $tmp_libs; do 7136290001Sglebius # FIXME: Pedantically, this is the right thing to do, so 7137290001Sglebius # that some nasty dependency loop isn't accidentally 7138290001Sglebius # broken: 7139290001Sglebius #new_libs="$deplib $new_libs" 7140290001Sglebius # Pragmatically, this seems to cause very few problems in 7141290001Sglebius # practice: 7142290001Sglebius case $deplib in 7143290001Sglebius -L*) new_libs="$deplib $new_libs" ;; 7144290001Sglebius -R*) ;; 7145290001Sglebius *) 7146290001Sglebius # And here is the reason: when a library appears more 7147290001Sglebius # than once as an explicit dependence of a library, or 7148290001Sglebius # is implicitly linked in more than once by the 7149290001Sglebius # compiler, it is considered special, and multiple 7150290001Sglebius # occurrences thereof are not removed. Compare this 7151290001Sglebius # with having the same library being listed as a 7152290001Sglebius # dependency of multiple other libraries: in this case, 7153290001Sglebius # we know (pedantically, we assume) the library does not 7154290001Sglebius # need to be listed more than once, so we keep only the 7155290001Sglebius # last copy. This is not always right, but it is rare 7156290001Sglebius # enough that we require users that really mean to play 7157290001Sglebius # such unportable linking tricks to link the library 7158290001Sglebius # using -Wl,-lname, so that libtool does not consider it 7159290001Sglebius # for duplicate removal. 7160290001Sglebius case " $specialdeplibs " in 7161290001Sglebius *" $deplib "*) new_libs="$deplib $new_libs" ;; 7162290001Sglebius *) 7163290001Sglebius case " $new_libs " in 7164290001Sglebius *" $deplib "*) ;; 7165290001Sglebius *) new_libs="$deplib $new_libs" ;; 7166290001Sglebius esac 7167290001Sglebius ;; 7168290001Sglebius esac 7169290001Sglebius ;; 7170290001Sglebius esac 7171290001Sglebius done 7172290001Sglebius tmp_libs= 7173290001Sglebius for deplib in $new_libs; do 7174290001Sglebius case $deplib in 7175290001Sglebius -L*) 7176290001Sglebius case " $tmp_libs " in 7177290001Sglebius *" $deplib "*) ;; 7178290001Sglebius *) func_append tmp_libs " $deplib" ;; 7179290001Sglebius esac 7180290001Sglebius ;; 7181290001Sglebius *) func_append tmp_libs " $deplib" ;; 7182290001Sglebius esac 7183290001Sglebius done 7184290001Sglebius eval $var=\"$tmp_libs\" 7185290001Sglebius done # for var 7186290001Sglebius fi 7187290001Sglebius # Last step: remove runtime libs from dependency_libs 7188290001Sglebius # (they stay in deplibs) 7189290001Sglebius tmp_libs= 7190290001Sglebius for i in $dependency_libs ; do 7191290001Sglebius case " $predeps $postdeps $compiler_lib_search_path " in 7192290001Sglebius *" $i "*) 7193290001Sglebius i="" 7194290001Sglebius ;; 7195290001Sglebius esac 7196290001Sglebius if test -n "$i" ; then 7197290001Sglebius func_append tmp_libs " $i" 7198290001Sglebius fi 7199290001Sglebius done 7200290001Sglebius dependency_libs=$tmp_libs 7201290001Sglebius done # for pass 7202290001Sglebius if test "$linkmode" = prog; then 7203290001Sglebius dlfiles="$newdlfiles" 7204290001Sglebius fi 7205290001Sglebius if test "$linkmode" = prog || test "$linkmode" = lib; then 7206290001Sglebius dlprefiles="$newdlprefiles" 7207290001Sglebius fi 7208290001Sglebius 7209290001Sglebius case $linkmode in 7210290001Sglebius oldlib) 7211290001Sglebius if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7212290001Sglebius func_warning "\`-dlopen' is ignored for archives" 7213290001Sglebius fi 7214290001Sglebius 7215290001Sglebius case " $deplibs" in 7216290001Sglebius *\ -l* | *\ -L*) 7217290001Sglebius func_warning "\`-l' and \`-L' are ignored for archives" ;; 7218290001Sglebius esac 7219290001Sglebius 7220290001Sglebius test -n "$rpath" && \ 7221290001Sglebius func_warning "\`-rpath' is ignored for archives" 7222290001Sglebius 7223290001Sglebius test -n "$xrpath" && \ 7224290001Sglebius func_warning "\`-R' is ignored for archives" 7225290001Sglebius 7226290001Sglebius test -n "$vinfo" && \ 7227290001Sglebius func_warning "\`-version-info/-version-number' is ignored for archives" 7228290001Sglebius 7229290001Sglebius test -n "$release" && \ 7230290001Sglebius func_warning "\`-release' is ignored for archives" 7231290001Sglebius 7232290001Sglebius test -n "$export_symbols$export_symbols_regex" && \ 7233290001Sglebius func_warning "\`-export-symbols' is ignored for archives" 7234290001Sglebius 7235290001Sglebius # Now set the variables for building old libraries. 7236290001Sglebius build_libtool_libs=no 7237290001Sglebius oldlibs="$output" 7238290001Sglebius func_append objs "$old_deplibs" 7239290001Sglebius ;; 7240290001Sglebius 7241290001Sglebius lib) 7242290001Sglebius # Make sure we only generate libraries of the form `libNAME.la'. 7243290001Sglebius case $outputname in 7244290001Sglebius lib*) 7245290001Sglebius func_stripname 'lib' '.la' "$outputname" 7246290001Sglebius name=$func_stripname_result 7247290001Sglebius eval shared_ext=\"$shrext_cmds\" 7248290001Sglebius eval libname=\"$libname_spec\" 7249290001Sglebius ;; 7250290001Sglebius *) 7251290001Sglebius test "$module" = no && \ 7252290001Sglebius func_fatal_help "libtool library \`$output' must begin with \`lib'" 7253290001Sglebius 7254290001Sglebius if test "$need_lib_prefix" != no; then 7255290001Sglebius # Add the "lib" prefix for modules if required 7256290001Sglebius func_stripname '' '.la' "$outputname" 7257290001Sglebius name=$func_stripname_result 7258290001Sglebius eval shared_ext=\"$shrext_cmds\" 7259290001Sglebius eval libname=\"$libname_spec\" 7260290001Sglebius else 7261290001Sglebius func_stripname '' '.la' "$outputname" 7262290001Sglebius libname=$func_stripname_result 7263290001Sglebius fi 7264290001Sglebius ;; 7265290001Sglebius esac 7266290001Sglebius 7267290001Sglebius if test -n "$objs"; then 7268290001Sglebius if test "$deplibs_check_method" != pass_all; then 7269290001Sglebius func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 7270290001Sglebius else 7271290001Sglebius echo 7272290001Sglebius $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 7273290001Sglebius $ECHO "*** objects $objs is not portable!" 7274290001Sglebius func_append libobjs " $objs" 7275290001Sglebius fi 7276290001Sglebius fi 7277290001Sglebius 7278290001Sglebius test "$dlself" != no && \ 7279290001Sglebius func_warning "\`-dlopen self' is ignored for libtool libraries" 7280290001Sglebius 7281290001Sglebius set dummy $rpath 7282290001Sglebius shift 7283290001Sglebius test "$#" -gt 1 && \ 7284290001Sglebius func_warning "ignoring multiple \`-rpath's for a libtool library" 7285290001Sglebius 7286290001Sglebius install_libdir="$1" 7287290001Sglebius 7288290001Sglebius oldlibs= 7289290001Sglebius if test -z "$rpath"; then 7290290001Sglebius if test "$build_libtool_libs" = yes; then 7291290001Sglebius # Building a libtool convenience library. 7292290001Sglebius # Some compilers have problems with a `.al' extension so 7293290001Sglebius # convenience libraries should have the same extension an 7294290001Sglebius # archive normally would. 7295290001Sglebius oldlibs="$output_objdir/$libname.$libext $oldlibs" 7296290001Sglebius build_libtool_libs=convenience 7297290001Sglebius build_old_libs=yes 7298290001Sglebius fi 7299290001Sglebius 7300290001Sglebius test -n "$vinfo" && \ 7301290001Sglebius func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 7302290001Sglebius 7303290001Sglebius test -n "$release" && \ 7304290001Sglebius func_warning "\`-release' is ignored for convenience libraries" 7305290001Sglebius else 7306290001Sglebius 7307290001Sglebius # Parse the version information argument. 7308290001Sglebius save_ifs="$IFS"; IFS=':' 7309290001Sglebius set dummy $vinfo 0 0 0 7310290001Sglebius shift 7311290001Sglebius IFS="$save_ifs" 7312290001Sglebius 7313290001Sglebius test -n "$7" && \ 7314290001Sglebius func_fatal_help "too many parameters to \`-version-info'" 7315290001Sglebius 7316290001Sglebius # convert absolute version numbers to libtool ages 7317290001Sglebius # this retains compatibility with .la files and attempts 7318290001Sglebius # to make the code below a bit more comprehensible 7319290001Sglebius 7320290001Sglebius case $vinfo_number in 7321290001Sglebius yes) 7322290001Sglebius number_major="$1" 7323290001Sglebius number_minor="$2" 7324290001Sglebius number_revision="$3" 7325290001Sglebius # 7326290001Sglebius # There are really only two kinds -- those that 7327290001Sglebius # use the current revision as the major version 7328290001Sglebius # and those that subtract age and use age as 7329290001Sglebius # a minor version. But, then there is irix 7330290001Sglebius # which has an extra 1 added just for fun 7331290001Sglebius # 7332290001Sglebius case $version_type in 7333290001Sglebius # correct linux to gnu/linux during the next big refactor 7334290001Sglebius darwin|linux|osf|windows|none) 7335290001Sglebius func_arith $number_major + $number_minor 7336290001Sglebius current=$func_arith_result 7337290001Sglebius age="$number_minor" 7338290001Sglebius revision="$number_revision" 7339290001Sglebius ;; 7340290001Sglebius freebsd-aout|freebsd-elf|qnx|sunos) 7341290001Sglebius current="$number_major" 7342290001Sglebius revision="$number_minor" 7343290001Sglebius age="0" 7344290001Sglebius ;; 7345290001Sglebius irix|nonstopux) 7346290001Sglebius func_arith $number_major + $number_minor 7347290001Sglebius current=$func_arith_result 7348290001Sglebius age="$number_minor" 7349290001Sglebius revision="$number_minor" 7350290001Sglebius lt_irix_increment=no 7351290001Sglebius ;; 7352290001Sglebius esac 7353290001Sglebius ;; 7354290001Sglebius no) 7355290001Sglebius current="$1" 7356290001Sglebius revision="$2" 7357290001Sglebius age="$3" 7358290001Sglebius ;; 7359290001Sglebius esac 7360290001Sglebius 7361290001Sglebius # Check that each of the things are valid numbers. 7362290001Sglebius case $current in 7363290001Sglebius 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]) ;; 7364290001Sglebius *) 7365290001Sglebius func_error "CURRENT \`$current' must be a nonnegative integer" 7366290001Sglebius func_fatal_error "\`$vinfo' is not valid version information" 7367290001Sglebius ;; 7368290001Sglebius esac 7369290001Sglebius 7370290001Sglebius case $revision in 7371290001Sglebius 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]) ;; 7372290001Sglebius *) 7373290001Sglebius func_error "REVISION \`$revision' must be a nonnegative integer" 7374290001Sglebius func_fatal_error "\`$vinfo' is not valid version information" 7375290001Sglebius ;; 7376290001Sglebius esac 7377290001Sglebius 7378290001Sglebius case $age in 7379290001Sglebius 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]) ;; 7380290001Sglebius *) 7381290001Sglebius func_error "AGE \`$age' must be a nonnegative integer" 7382290001Sglebius func_fatal_error "\`$vinfo' is not valid version information" 7383290001Sglebius ;; 7384290001Sglebius esac 7385290001Sglebius 7386290001Sglebius if test "$age" -gt "$current"; then 7387290001Sglebius func_error "AGE \`$age' is greater than the current interface number \`$current'" 7388290001Sglebius func_fatal_error "\`$vinfo' is not valid version information" 7389290001Sglebius fi 7390290001Sglebius 7391290001Sglebius # Calculate the version variables. 7392290001Sglebius major= 7393290001Sglebius versuffix= 7394290001Sglebius verstring= 7395290001Sglebius case $version_type in 7396290001Sglebius none) ;; 7397290001Sglebius 7398290001Sglebius darwin) 7399290001Sglebius # Like Linux, but with the current version available in 7400290001Sglebius # verstring for coding it into the library header 7401290001Sglebius func_arith $current - $age 7402290001Sglebius major=.$func_arith_result 7403290001Sglebius versuffix="$major.$age.$revision" 7404290001Sglebius # Darwin ld doesn't like 0 for these options... 7405290001Sglebius func_arith $current + 1 7406290001Sglebius minor_current=$func_arith_result 7407290001Sglebius xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 7408290001Sglebius verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 7409290001Sglebius ;; 7410290001Sglebius 7411290001Sglebius freebsd-aout) 7412290001Sglebius major=".$current" 7413290001Sglebius versuffix=".$current.$revision"; 7414290001Sglebius ;; 7415290001Sglebius 7416290001Sglebius freebsd-elf) 7417290001Sglebius major=".$current" 7418290001Sglebius versuffix=".$current" 7419290001Sglebius ;; 7420290001Sglebius 7421290001Sglebius irix | nonstopux) 7422290001Sglebius if test "X$lt_irix_increment" = "Xno"; then 7423290001Sglebius func_arith $current - $age 7424290001Sglebius else 7425290001Sglebius func_arith $current - $age + 1 7426290001Sglebius fi 7427290001Sglebius major=$func_arith_result 7428290001Sglebius 7429290001Sglebius case $version_type in 7430290001Sglebius nonstopux) verstring_prefix=nonstopux ;; 7431290001Sglebius *) verstring_prefix=sgi ;; 7432290001Sglebius esac 7433290001Sglebius verstring="$verstring_prefix$major.$revision" 7434290001Sglebius 7435290001Sglebius # Add in all the interfaces that we are compatible with. 7436290001Sglebius loop=$revision 7437290001Sglebius while test "$loop" -ne 0; do 7438290001Sglebius func_arith $revision - $loop 7439290001Sglebius iface=$func_arith_result 7440290001Sglebius func_arith $loop - 1 7441290001Sglebius loop=$func_arith_result 7442290001Sglebius verstring="$verstring_prefix$major.$iface:$verstring" 7443290001Sglebius done 7444290001Sglebius 7445290001Sglebius # Before this point, $major must not contain `.'. 7446290001Sglebius major=.$major 7447290001Sglebius versuffix="$major.$revision" 7448290001Sglebius ;; 7449290001Sglebius 7450290001Sglebius linux) # correct to gnu/linux during the next big refactor 7451290001Sglebius func_arith $current - $age 7452290001Sglebius major=.$func_arith_result 7453290001Sglebius versuffix="$major.$age.$revision" 7454290001Sglebius ;; 7455290001Sglebius 7456290001Sglebius osf) 7457290001Sglebius func_arith $current - $age 7458290001Sglebius major=.$func_arith_result 7459290001Sglebius versuffix=".$current.$age.$revision" 7460290001Sglebius verstring="$current.$age.$revision" 7461290001Sglebius 7462290001Sglebius # Add in all the interfaces that we are compatible with. 7463290001Sglebius loop=$age 7464290001Sglebius while test "$loop" -ne 0; do 7465290001Sglebius func_arith $current - $loop 7466290001Sglebius iface=$func_arith_result 7467290001Sglebius func_arith $loop - 1 7468290001Sglebius loop=$func_arith_result 7469290001Sglebius verstring="$verstring:${iface}.0" 7470290001Sglebius done 7471290001Sglebius 7472290001Sglebius # Make executables depend on our current version. 7473290001Sglebius func_append verstring ":${current}.0" 7474290001Sglebius ;; 7475290001Sglebius 7476290001Sglebius qnx) 7477290001Sglebius major=".$current" 7478290001Sglebius versuffix=".$current" 7479290001Sglebius ;; 7480290001Sglebius 7481290001Sglebius sunos) 7482290001Sglebius major=".$current" 7483290001Sglebius versuffix=".$current.$revision" 7484290001Sglebius ;; 7485290001Sglebius 7486290001Sglebius windows) 7487290001Sglebius # Use '-' rather than '.', since we only want one 7488290001Sglebius # extension on DOS 8.3 filesystems. 7489290001Sglebius func_arith $current - $age 7490290001Sglebius major=$func_arith_result 7491290001Sglebius versuffix="-$major" 7492290001Sglebius ;; 7493290001Sglebius 7494290001Sglebius *) 7495290001Sglebius func_fatal_configuration "unknown library version type \`$version_type'" 7496290001Sglebius ;; 7497290001Sglebius esac 7498290001Sglebius 7499290001Sglebius # Clear the version info if we defaulted, and they specified a release. 7500290001Sglebius if test -z "$vinfo" && test -n "$release"; then 7501290001Sglebius major= 7502290001Sglebius case $version_type in 7503290001Sglebius darwin) 7504290001Sglebius # we can't check for "0.0" in archive_cmds due to quoting 7505290001Sglebius # problems, so we reset it completely 7506290001Sglebius verstring= 7507290001Sglebius ;; 7508290001Sglebius *) 7509290001Sglebius verstring="0.0" 7510290001Sglebius ;; 7511290001Sglebius esac 7512290001Sglebius if test "$need_version" = no; then 7513290001Sglebius versuffix= 7514290001Sglebius else 7515290001Sglebius versuffix=".0.0" 7516290001Sglebius fi 7517290001Sglebius fi 7518290001Sglebius 7519290001Sglebius # Remove version info from name if versioning should be avoided 7520290001Sglebius if test "$avoid_version" = yes && test "$need_version" = no; then 7521290001Sglebius major= 7522290001Sglebius versuffix= 7523290001Sglebius verstring="" 7524290001Sglebius fi 7525290001Sglebius 7526290001Sglebius # Check to see if the archive will have undefined symbols. 7527290001Sglebius if test "$allow_undefined" = yes; then 7528290001Sglebius if test "$allow_undefined_flag" = unsupported; then 7529290001Sglebius func_warning "undefined symbols not allowed in $host shared libraries" 7530290001Sglebius build_libtool_libs=no 7531290001Sglebius build_old_libs=yes 7532290001Sglebius fi 7533290001Sglebius else 7534290001Sglebius # Don't allow undefined symbols. 7535290001Sglebius allow_undefined_flag="$no_undefined_flag" 7536290001Sglebius fi 7537290001Sglebius 7538290001Sglebius fi 7539290001Sglebius 7540290001Sglebius func_generate_dlsyms "$libname" "$libname" "yes" 7541290001Sglebius func_append libobjs " $symfileobj" 7542290001Sglebius test "X$libobjs" = "X " && libobjs= 7543290001Sglebius 7544290001Sglebius if test "$opt_mode" != relink; then 7545290001Sglebius # Remove our outputs, but don't remove object files since they 7546290001Sglebius # may have been created when compiling PIC objects. 7547290001Sglebius removelist= 7548290001Sglebius tempremovelist=`$ECHO "$output_objdir/*"` 7549290001Sglebius for p in $tempremovelist; do 7550290001Sglebius case $p in 7551290001Sglebius *.$objext | *.gcno) 7552290001Sglebius ;; 7553290001Sglebius $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 7554290001Sglebius if test "X$precious_files_regex" != "X"; then 7555290001Sglebius if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 7556290001Sglebius then 7557290001Sglebius continue 7558290001Sglebius fi 7559290001Sglebius fi 7560290001Sglebius func_append removelist " $p" 7561290001Sglebius ;; 7562290001Sglebius *) ;; 7563290001Sglebius esac 7564290001Sglebius done 7565290001Sglebius test -n "$removelist" && \ 7566290001Sglebius func_show_eval "${RM}r \$removelist" 7567290001Sglebius fi 7568290001Sglebius 7569290001Sglebius # Now set the variables for building old libraries. 7570290001Sglebius if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 7571290001Sglebius func_append oldlibs " $output_objdir/$libname.$libext" 7572290001Sglebius 7573290001Sglebius # Transform .lo files to .o files. 7574290001Sglebius oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 7575290001Sglebius fi 7576290001Sglebius 7577290001Sglebius # Eliminate all temporary directories. 7578290001Sglebius #for path in $notinst_path; do 7579290001Sglebius # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 7580290001Sglebius # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 7581290001Sglebius # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 7582290001Sglebius #done 7583290001Sglebius 7584290001Sglebius if test -n "$xrpath"; then 7585290001Sglebius # If the user specified any rpath flags, then add them. 7586290001Sglebius temp_xrpath= 7587290001Sglebius for libdir in $xrpath; do 7588290001Sglebius func_replace_sysroot "$libdir" 7589290001Sglebius func_append temp_xrpath " -R$func_replace_sysroot_result" 7590290001Sglebius case "$finalize_rpath " in 7591290001Sglebius *" $libdir "*) ;; 7592290001Sglebius *) func_append finalize_rpath " $libdir" ;; 7593290001Sglebius esac 7594290001Sglebius done 7595290001Sglebius if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 7596290001Sglebius dependency_libs="$temp_xrpath $dependency_libs" 7597290001Sglebius fi 7598290001Sglebius fi 7599290001Sglebius 7600290001Sglebius # Make sure dlfiles contains only unique files that won't be dlpreopened 7601290001Sglebius old_dlfiles="$dlfiles" 7602290001Sglebius dlfiles= 7603290001Sglebius for lib in $old_dlfiles; do 7604290001Sglebius case " $dlprefiles $dlfiles " in 7605290001Sglebius *" $lib "*) ;; 7606290001Sglebius *) func_append dlfiles " $lib" ;; 7607290001Sglebius esac 7608290001Sglebius done 7609290001Sglebius 7610290001Sglebius # Make sure dlprefiles contains only unique files 7611290001Sglebius old_dlprefiles="$dlprefiles" 7612290001Sglebius dlprefiles= 7613290001Sglebius for lib in $old_dlprefiles; do 7614290001Sglebius case "$dlprefiles " in 7615290001Sglebius *" $lib "*) ;; 7616290001Sglebius *) func_append dlprefiles " $lib" ;; 7617290001Sglebius esac 7618290001Sglebius done 7619290001Sglebius 7620290001Sglebius if test "$build_libtool_libs" = yes; then 7621290001Sglebius if test -n "$rpath"; then 7622290001Sglebius case $host in 7623290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 7624290001Sglebius # these systems don't actually have a c library (as such)! 7625290001Sglebius ;; 7626290001Sglebius *-*-rhapsody* | *-*-darwin1.[012]) 7627290001Sglebius # Rhapsody C library is in the System framework 7628290001Sglebius func_append deplibs " System.ltframework" 7629290001Sglebius ;; 7630290001Sglebius *-*-netbsd*) 7631290001Sglebius # Don't link with libc until the a.out ld.so is fixed. 7632290001Sglebius ;; 7633290001Sglebius *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 7634290001Sglebius # Do not include libc due to us having libc/libc_r. 7635290001Sglebius ;; 7636290001Sglebius *-*-sco3.2v5* | *-*-sco5v6*) 7637290001Sglebius # Causes problems with __ctype 7638290001Sglebius ;; 7639290001Sglebius *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 7640290001Sglebius # Compiler inserts libc in the correct place for threads to work 7641290001Sglebius ;; 7642290001Sglebius *) 7643290001Sglebius # Add libc to deplibs on all other systems if necessary. 7644290001Sglebius if test "$build_libtool_need_lc" = "yes"; then 7645290001Sglebius func_append deplibs " -lc" 7646290001Sglebius fi 7647290001Sglebius ;; 7648290001Sglebius esac 7649290001Sglebius fi 7650290001Sglebius 7651290001Sglebius # Transform deplibs into only deplibs that can be linked in shared. 7652290001Sglebius name_save=$name 7653290001Sglebius libname_save=$libname 7654290001Sglebius release_save=$release 7655290001Sglebius versuffix_save=$versuffix 7656290001Sglebius major_save=$major 7657290001Sglebius # I'm not sure if I'm treating the release correctly. I think 7658290001Sglebius # release should show up in the -l (ie -lgmp5) so we don't want to 7659290001Sglebius # add it in twice. Is that correct? 7660290001Sglebius release="" 7661290001Sglebius versuffix="" 7662290001Sglebius major="" 7663290001Sglebius newdeplibs= 7664290001Sglebius droppeddeps=no 7665290001Sglebius case $deplibs_check_method in 7666290001Sglebius pass_all) 7667290001Sglebius # Don't check for shared/static. Everything works. 7668290001Sglebius # This might be a little naive. We might want to check 7669290001Sglebius # whether the library exists or not. But this is on 7670290001Sglebius # osf3 & osf4 and I'm not really sure... Just 7671290001Sglebius # implementing what was already the behavior. 7672290001Sglebius newdeplibs=$deplibs 7673290001Sglebius ;; 7674290001Sglebius test_compile) 7675290001Sglebius # This code stresses the "libraries are programs" paradigm to its 7676290001Sglebius # limits. Maybe even breaks it. We compile a program, linking it 7677290001Sglebius # against the deplibs as a proxy for the library. Then we can check 7678290001Sglebius # whether they linked in statically or dynamically with ldd. 7679290001Sglebius $opt_dry_run || $RM conftest.c 7680290001Sglebius cat > conftest.c <<EOF 7681290001Sglebius int main() { return 0; } 7682290001SglebiusEOF 7683290001Sglebius $opt_dry_run || $RM conftest 7684290001Sglebius if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 7685290001Sglebius ldd_output=`ldd conftest` 7686290001Sglebius for i in $deplibs; do 7687290001Sglebius case $i in 7688290001Sglebius -l*) 7689290001Sglebius func_stripname -l '' "$i" 7690290001Sglebius name=$func_stripname_result 7691290001Sglebius if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7692290001Sglebius case " $predeps $postdeps " in 7693290001Sglebius *" $i "*) 7694290001Sglebius func_append newdeplibs " $i" 7695290001Sglebius i="" 7696290001Sglebius ;; 7697290001Sglebius esac 7698290001Sglebius fi 7699290001Sglebius if test -n "$i" ; then 7700290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 7701290001Sglebius deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7702290001Sglebius set dummy $deplib_matches; shift 7703290001Sglebius deplib_match=$1 7704290001Sglebius if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7705290001Sglebius func_append newdeplibs " $i" 7706290001Sglebius else 7707290001Sglebius droppeddeps=yes 7708290001Sglebius echo 7709290001Sglebius $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7710290001Sglebius echo "*** I have the capability to make that library automatically link in when" 7711290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 7712290001Sglebius echo "*** shared version of the library, which I believe you do not have" 7713290001Sglebius echo "*** because a test_compile did reveal that the linker did not use it for" 7714290001Sglebius echo "*** its dynamic dependency list that programs get resolved with at runtime." 7715290001Sglebius fi 7716290001Sglebius fi 7717290001Sglebius ;; 7718290001Sglebius *) 7719290001Sglebius func_append newdeplibs " $i" 7720290001Sglebius ;; 7721290001Sglebius esac 7722290001Sglebius done 7723290001Sglebius else 7724290001Sglebius # Error occurred in the first compile. Let's try to salvage 7725290001Sglebius # the situation: Compile a separate program for each library. 7726290001Sglebius for i in $deplibs; do 7727290001Sglebius case $i in 7728290001Sglebius -l*) 7729290001Sglebius func_stripname -l '' "$i" 7730290001Sglebius name=$func_stripname_result 7731290001Sglebius $opt_dry_run || $RM conftest 7732290001Sglebius if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 7733290001Sglebius ldd_output=`ldd conftest` 7734290001Sglebius if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7735290001Sglebius case " $predeps $postdeps " in 7736290001Sglebius *" $i "*) 7737290001Sglebius func_append newdeplibs " $i" 7738290001Sglebius i="" 7739290001Sglebius ;; 7740290001Sglebius esac 7741290001Sglebius fi 7742290001Sglebius if test -n "$i" ; then 7743290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 7744290001Sglebius deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7745290001Sglebius set dummy $deplib_matches; shift 7746290001Sglebius deplib_match=$1 7747290001Sglebius if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7748290001Sglebius func_append newdeplibs " $i" 7749290001Sglebius else 7750290001Sglebius droppeddeps=yes 7751290001Sglebius echo 7752290001Sglebius $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7753290001Sglebius echo "*** I have the capability to make that library automatically link in when" 7754290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 7755290001Sglebius echo "*** shared version of the library, which you do not appear to have" 7756290001Sglebius echo "*** because a test_compile did reveal that the linker did not use this one" 7757290001Sglebius echo "*** as a dynamic dependency that programs can get resolved with at runtime." 7758290001Sglebius fi 7759290001Sglebius fi 7760290001Sglebius else 7761290001Sglebius droppeddeps=yes 7762290001Sglebius echo 7763290001Sglebius $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 7764290001Sglebius echo "*** make it link in! You will probably need to install it or some" 7765290001Sglebius echo "*** library that it depends on before this library will be fully" 7766290001Sglebius echo "*** functional. Installing it before continuing would be even better." 7767290001Sglebius fi 7768290001Sglebius ;; 7769290001Sglebius *) 7770290001Sglebius func_append newdeplibs " $i" 7771290001Sglebius ;; 7772290001Sglebius esac 7773290001Sglebius done 7774290001Sglebius fi 7775290001Sglebius ;; 7776290001Sglebius file_magic*) 7777290001Sglebius set dummy $deplibs_check_method; shift 7778290001Sglebius file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7779290001Sglebius for a_deplib in $deplibs; do 7780290001Sglebius case $a_deplib in 7781290001Sglebius -l*) 7782290001Sglebius func_stripname -l '' "$a_deplib" 7783290001Sglebius name=$func_stripname_result 7784290001Sglebius if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7785290001Sglebius case " $predeps $postdeps " in 7786290001Sglebius *" $a_deplib "*) 7787290001Sglebius func_append newdeplibs " $a_deplib" 7788290001Sglebius a_deplib="" 7789290001Sglebius ;; 7790290001Sglebius esac 7791290001Sglebius fi 7792290001Sglebius if test -n "$a_deplib" ; then 7793290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 7794290001Sglebius if test -n "$file_magic_glob"; then 7795290001Sglebius libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 7796290001Sglebius else 7797290001Sglebius libnameglob=$libname 7798290001Sglebius fi 7799290001Sglebius test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` 7800290001Sglebius for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7801290001Sglebius if test "$want_nocaseglob" = yes; then 7802290001Sglebius shopt -s nocaseglob 7803290001Sglebius potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7804290001Sglebius $nocaseglob 7805290001Sglebius else 7806290001Sglebius potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7807290001Sglebius fi 7808290001Sglebius for potent_lib in $potential_libs; do 7809290001Sglebius # Follow soft links. 7810290001Sglebius if ls -lLd "$potent_lib" 2>/dev/null | 7811290001Sglebius $GREP " -> " >/dev/null; then 7812290001Sglebius continue 7813290001Sglebius fi 7814290001Sglebius # The statement above tries to avoid entering an 7815290001Sglebius # endless loop below, in case of cyclic links. 7816290001Sglebius # We might still enter an endless loop, since a link 7817290001Sglebius # loop can be closed while we follow links, 7818290001Sglebius # but so what? 7819290001Sglebius potlib="$potent_lib" 7820290001Sglebius while test -h "$potlib" 2>/dev/null; do 7821290001Sglebius potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 7822290001Sglebius case $potliblink in 7823290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 7824290001Sglebius *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 7825290001Sglebius esac 7826290001Sglebius done 7827290001Sglebius if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 7828290001Sglebius $SED -e 10q | 7829290001Sglebius $EGREP "$file_magic_regex" > /dev/null; then 7830290001Sglebius func_append newdeplibs " $a_deplib" 7831290001Sglebius a_deplib="" 7832290001Sglebius break 2 7833290001Sglebius fi 7834290001Sglebius done 7835290001Sglebius done 7836290001Sglebius fi 7837290001Sglebius if test -n "$a_deplib" ; then 7838290001Sglebius droppeddeps=yes 7839290001Sglebius echo 7840290001Sglebius $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7841290001Sglebius echo "*** I have the capability to make that library automatically link in when" 7842290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 7843290001Sglebius echo "*** shared version of the library, which you do not appear to have" 7844290001Sglebius echo "*** because I did check the linker path looking for a file starting" 7845290001Sglebius if test -z "$potlib" ; then 7846290001Sglebius $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 7847290001Sglebius else 7848290001Sglebius $ECHO "*** with $libname and none of the candidates passed a file format test" 7849290001Sglebius $ECHO "*** using a file magic. Last file checked: $potlib" 7850290001Sglebius fi 7851290001Sglebius fi 7852290001Sglebius ;; 7853290001Sglebius *) 7854290001Sglebius # Add a -L argument. 7855290001Sglebius func_append newdeplibs " $a_deplib" 7856290001Sglebius ;; 7857290001Sglebius esac 7858290001Sglebius done # Gone through all deplibs. 7859290001Sglebius ;; 7860290001Sglebius match_pattern*) 7861290001Sglebius set dummy $deplibs_check_method; shift 7862290001Sglebius match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7863290001Sglebius for a_deplib in $deplibs; do 7864290001Sglebius case $a_deplib in 7865290001Sglebius -l*) 7866290001Sglebius func_stripname -l '' "$a_deplib" 7867290001Sglebius name=$func_stripname_result 7868290001Sglebius if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7869290001Sglebius case " $predeps $postdeps " in 7870290001Sglebius *" $a_deplib "*) 7871290001Sglebius func_append newdeplibs " $a_deplib" 7872290001Sglebius a_deplib="" 7873290001Sglebius ;; 7874290001Sglebius esac 7875290001Sglebius fi 7876290001Sglebius if test -n "$a_deplib" ; then 7877290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 7878290001Sglebius for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7879290001Sglebius potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 7880290001Sglebius for potent_lib in $potential_libs; do 7881290001Sglebius potlib="$potent_lib" # see symlink-check above in file_magic test 7882290001Sglebius if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 7883290001Sglebius $EGREP "$match_pattern_regex" > /dev/null; then 7884290001Sglebius func_append newdeplibs " $a_deplib" 7885290001Sglebius a_deplib="" 7886290001Sglebius break 2 7887290001Sglebius fi 7888290001Sglebius done 7889290001Sglebius done 7890290001Sglebius fi 7891290001Sglebius if test -n "$a_deplib" ; then 7892290001Sglebius droppeddeps=yes 7893290001Sglebius echo 7894290001Sglebius $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7895290001Sglebius echo "*** I have the capability to make that library automatically link in when" 7896290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 7897290001Sglebius echo "*** shared version of the library, which you do not appear to have" 7898290001Sglebius echo "*** because I did check the linker path looking for a file starting" 7899290001Sglebius if test -z "$potlib" ; then 7900290001Sglebius $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 7901290001Sglebius else 7902290001Sglebius $ECHO "*** with $libname and none of the candidates passed a file format test" 7903290001Sglebius $ECHO "*** using a regex pattern. Last file checked: $potlib" 7904290001Sglebius fi 7905290001Sglebius fi 7906290001Sglebius ;; 7907290001Sglebius *) 7908290001Sglebius # Add a -L argument. 7909290001Sglebius func_append newdeplibs " $a_deplib" 7910290001Sglebius ;; 7911290001Sglebius esac 7912290001Sglebius done # Gone through all deplibs. 7913290001Sglebius ;; 7914290001Sglebius none | unknown | *) 7915290001Sglebius newdeplibs="" 7916290001Sglebius tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 7917290001Sglebius if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7918290001Sglebius for i in $predeps $postdeps ; do 7919290001Sglebius # can't use Xsed below, because $i might contain '/' 7920290001Sglebius tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 7921290001Sglebius done 7922290001Sglebius fi 7923290001Sglebius case $tmp_deplibs in 7924290001Sglebius *[!\ \ ]*) 7925290001Sglebius echo 7926290001Sglebius if test "X$deplibs_check_method" = "Xnone"; then 7927290001Sglebius echo "*** Warning: inter-library dependencies are not supported in this platform." 7928290001Sglebius else 7929290001Sglebius echo "*** Warning: inter-library dependencies are not known to be supported." 7930290001Sglebius fi 7931290001Sglebius echo "*** All declared inter-library dependencies are being dropped." 7932290001Sglebius droppeddeps=yes 7933290001Sglebius ;; 7934290001Sglebius esac 7935290001Sglebius ;; 7936290001Sglebius esac 7937290001Sglebius versuffix=$versuffix_save 7938290001Sglebius major=$major_save 7939290001Sglebius release=$release_save 7940290001Sglebius libname=$libname_save 7941290001Sglebius name=$name_save 7942290001Sglebius 7943290001Sglebius case $host in 7944290001Sglebius *-*-rhapsody* | *-*-darwin1.[012]) 7945290001Sglebius # On Rhapsody replace the C library with the System framework 7946290001Sglebius newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 7947290001Sglebius ;; 7948290001Sglebius esac 7949290001Sglebius 7950290001Sglebius if test "$droppeddeps" = yes; then 7951290001Sglebius if test "$module" = yes; then 7952290001Sglebius echo 7953290001Sglebius echo "*** Warning: libtool could not satisfy all declared inter-library" 7954290001Sglebius $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 7955290001Sglebius echo "*** a static module, that should work as long as the dlopening" 7956290001Sglebius echo "*** application is linked with the -dlopen flag." 7957290001Sglebius if test -z "$global_symbol_pipe"; then 7958290001Sglebius echo 7959290001Sglebius echo "*** However, this would only work if libtool was able to extract symbol" 7960290001Sglebius echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 7961290001Sglebius echo "*** not find such a program. So, this module is probably useless." 7962290001Sglebius echo "*** \`nm' from GNU binutils and a full rebuild may help." 7963290001Sglebius fi 7964290001Sglebius if test "$build_old_libs" = no; then 7965290001Sglebius oldlibs="$output_objdir/$libname.$libext" 7966290001Sglebius build_libtool_libs=module 7967290001Sglebius build_old_libs=yes 7968290001Sglebius else 7969290001Sglebius build_libtool_libs=no 7970290001Sglebius fi 7971290001Sglebius else 7972290001Sglebius echo "*** The inter-library dependencies that have been dropped here will be" 7973290001Sglebius echo "*** automatically added whenever a program is linked with this library" 7974290001Sglebius echo "*** or is declared to -dlopen it." 7975290001Sglebius 7976290001Sglebius if test "$allow_undefined" = no; then 7977290001Sglebius echo 7978290001Sglebius echo "*** Since this library must not contain undefined symbols," 7979290001Sglebius echo "*** because either the platform does not support them or" 7980290001Sglebius echo "*** it was explicitly requested with -no-undefined," 7981290001Sglebius echo "*** libtool will only create a static version of it." 7982290001Sglebius if test "$build_old_libs" = no; then 7983290001Sglebius oldlibs="$output_objdir/$libname.$libext" 7984290001Sglebius build_libtool_libs=module 7985290001Sglebius build_old_libs=yes 7986290001Sglebius else 7987290001Sglebius build_libtool_libs=no 7988290001Sglebius fi 7989290001Sglebius fi 7990290001Sglebius fi 7991290001Sglebius fi 7992290001Sglebius # Done checking deplibs! 7993290001Sglebius deplibs=$newdeplibs 7994290001Sglebius fi 7995290001Sglebius # Time to change all our "foo.ltframework" stuff back to "-framework foo" 7996290001Sglebius case $host in 7997290001Sglebius *-*-darwin*) 7998290001Sglebius newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7999290001Sglebius new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8000290001Sglebius deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8001290001Sglebius ;; 8002290001Sglebius esac 8003290001Sglebius 8004290001Sglebius # move library search paths that coincide with paths to not yet 8005290001Sglebius # installed libraries to the beginning of the library search list 8006290001Sglebius new_libs= 8007290001Sglebius for path in $notinst_path; do 8008290001Sglebius case " $new_libs " in 8009290001Sglebius *" -L$path/$objdir "*) ;; 8010290001Sglebius *) 8011290001Sglebius case " $deplibs " in 8012290001Sglebius *" -L$path/$objdir "*) 8013290001Sglebius func_append new_libs " -L$path/$objdir" ;; 8014290001Sglebius esac 8015290001Sglebius ;; 8016290001Sglebius esac 8017290001Sglebius done 8018290001Sglebius for deplib in $deplibs; do 8019290001Sglebius case $deplib in 8020290001Sglebius -L*) 8021290001Sglebius case " $new_libs " in 8022290001Sglebius *" $deplib "*) ;; 8023290001Sglebius *) func_append new_libs " $deplib" ;; 8024290001Sglebius esac 8025290001Sglebius ;; 8026290001Sglebius *) func_append new_libs " $deplib" ;; 8027290001Sglebius esac 8028290001Sglebius done 8029290001Sglebius deplibs="$new_libs" 8030290001Sglebius 8031290001Sglebius # All the library-specific variables (install_libdir is set above). 8032290001Sglebius library_names= 8033290001Sglebius old_library= 8034290001Sglebius dlname= 8035290001Sglebius 8036290001Sglebius # Test again, we may have decided not to build it any more 8037290001Sglebius if test "$build_libtool_libs" = yes; then 8038290001Sglebius # Remove ${wl} instances when linking with ld. 8039290001Sglebius # FIXME: should test the right _cmds variable. 8040290001Sglebius case $archive_cmds in 8041290001Sglebius *\$LD\ *) wl= ;; 8042290001Sglebius esac 8043290001Sglebius if test "$hardcode_into_libs" = yes; then 8044290001Sglebius # Hardcode the library paths 8045290001Sglebius hardcode_libdirs= 8046290001Sglebius dep_rpath= 8047290001Sglebius rpath="$finalize_rpath" 8048290001Sglebius test "$opt_mode" != relink && rpath="$compile_rpath$rpath" 8049290001Sglebius for libdir in $rpath; do 8050290001Sglebius if test -n "$hardcode_libdir_flag_spec"; then 8051290001Sglebius if test -n "$hardcode_libdir_separator"; then 8052290001Sglebius func_replace_sysroot "$libdir" 8053290001Sglebius libdir=$func_replace_sysroot_result 8054290001Sglebius if test -z "$hardcode_libdirs"; then 8055290001Sglebius hardcode_libdirs="$libdir" 8056290001Sglebius else 8057290001Sglebius # Just accumulate the unique libdirs. 8058290001Sglebius case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8059290001Sglebius *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8060290001Sglebius ;; 8061290001Sglebius *) 8062290001Sglebius func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8063290001Sglebius ;; 8064290001Sglebius esac 8065290001Sglebius fi 8066290001Sglebius else 8067290001Sglebius eval flag=\"$hardcode_libdir_flag_spec\" 8068290001Sglebius func_append dep_rpath " $flag" 8069290001Sglebius fi 8070290001Sglebius elif test -n "$runpath_var"; then 8071290001Sglebius case "$perm_rpath " in 8072290001Sglebius *" $libdir "*) ;; 8073290001Sglebius *) func_append perm_rpath " $libdir" ;; 8074290001Sglebius esac 8075290001Sglebius fi 8076290001Sglebius done 8077290001Sglebius # Substitute the hardcoded libdirs into the rpath. 8078290001Sglebius if test -n "$hardcode_libdir_separator" && 8079290001Sglebius test -n "$hardcode_libdirs"; then 8080290001Sglebius libdir="$hardcode_libdirs" 8081290001Sglebius eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" 8082290001Sglebius fi 8083290001Sglebius if test -n "$runpath_var" && test -n "$perm_rpath"; then 8084290001Sglebius # We should set the runpath_var. 8085290001Sglebius rpath= 8086290001Sglebius for dir in $perm_rpath; do 8087290001Sglebius func_append rpath "$dir:" 8088290001Sglebius done 8089290001Sglebius eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 8090290001Sglebius fi 8091290001Sglebius test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 8092290001Sglebius fi 8093290001Sglebius 8094290001Sglebius shlibpath="$finalize_shlibpath" 8095290001Sglebius test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 8096290001Sglebius if test -n "$shlibpath"; then 8097290001Sglebius eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 8098290001Sglebius fi 8099290001Sglebius 8100290001Sglebius # Get the real and link names of the library. 8101290001Sglebius eval shared_ext=\"$shrext_cmds\" 8102290001Sglebius eval library_names=\"$library_names_spec\" 8103290001Sglebius set dummy $library_names 8104290001Sglebius shift 8105290001Sglebius realname="$1" 8106290001Sglebius shift 8107290001Sglebius 8108290001Sglebius if test -n "$soname_spec"; then 8109290001Sglebius eval soname=\"$soname_spec\" 8110290001Sglebius else 8111290001Sglebius soname="$realname" 8112290001Sglebius fi 8113290001Sglebius if test -z "$dlname"; then 8114290001Sglebius dlname=$soname 8115290001Sglebius fi 8116290001Sglebius 8117290001Sglebius lib="$output_objdir/$realname" 8118290001Sglebius linknames= 8119290001Sglebius for link 8120290001Sglebius do 8121290001Sglebius func_append linknames " $link" 8122290001Sglebius done 8123290001Sglebius 8124290001Sglebius # Use standard objects if they are pic 8125290001Sglebius test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 8126290001Sglebius test "X$libobjs" = "X " && libobjs= 8127290001Sglebius 8128290001Sglebius delfiles= 8129290001Sglebius if test -n "$export_symbols" && test -n "$include_expsyms"; then 8130290001Sglebius $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 8131290001Sglebius export_symbols="$output_objdir/$libname.uexp" 8132290001Sglebius func_append delfiles " $export_symbols" 8133290001Sglebius fi 8134290001Sglebius 8135290001Sglebius orig_export_symbols= 8136290001Sglebius case $host_os in 8137290001Sglebius cygwin* | mingw* | cegcc*) 8138290001Sglebius if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 8139290001Sglebius # exporting using user supplied symfile 8140290001Sglebius if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 8141290001Sglebius # and it's NOT already a .def file. Must figure out 8142290001Sglebius # which of the given symbols are data symbols and tag 8143290001Sglebius # them as such. So, trigger use of export_symbols_cmds. 8144290001Sglebius # export_symbols gets reassigned inside the "prepare 8145290001Sglebius # the list of exported symbols" if statement, so the 8146290001Sglebius # include_expsyms logic still works. 8147290001Sglebius orig_export_symbols="$export_symbols" 8148290001Sglebius export_symbols= 8149290001Sglebius always_export_symbols=yes 8150290001Sglebius fi 8151290001Sglebius fi 8152290001Sglebius ;; 8153290001Sglebius esac 8154290001Sglebius 8155290001Sglebius # Prepare the list of exported symbols 8156290001Sglebius if test -z "$export_symbols"; then 8157290001Sglebius if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 8158290001Sglebius func_verbose "generating symbol list for \`$libname.la'" 8159290001Sglebius export_symbols="$output_objdir/$libname.exp" 8160290001Sglebius $opt_dry_run || $RM $export_symbols 8161290001Sglebius cmds=$export_symbols_cmds 8162290001Sglebius save_ifs="$IFS"; IFS='~' 8163290001Sglebius for cmd1 in $cmds; do 8164290001Sglebius IFS="$save_ifs" 8165290001Sglebius # Take the normal branch if the nm_file_list_spec branch 8166290001Sglebius # doesn't work or if tool conversion is not needed. 8167290001Sglebius case $nm_file_list_spec~$to_tool_file_cmd in 8168290001Sglebius *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 8169290001Sglebius try_normal_branch=yes 8170290001Sglebius eval cmd=\"$cmd1\" 8171290001Sglebius func_len " $cmd" 8172290001Sglebius len=$func_len_result 8173290001Sglebius ;; 8174290001Sglebius *) 8175290001Sglebius try_normal_branch=no 8176290001Sglebius ;; 8177290001Sglebius esac 8178290001Sglebius if test "$try_normal_branch" = yes \ 8179290001Sglebius && { test "$len" -lt "$max_cmd_len" \ 8180290001Sglebius || test "$max_cmd_len" -le -1; } 8181290001Sglebius then 8182290001Sglebius func_show_eval "$cmd" 'exit $?' 8183290001Sglebius skipped_export=false 8184290001Sglebius elif test -n "$nm_file_list_spec"; then 8185290001Sglebius func_basename "$output" 8186290001Sglebius output_la=$func_basename_result 8187290001Sglebius save_libobjs=$libobjs 8188290001Sglebius save_output=$output 8189290001Sglebius output=${output_objdir}/${output_la}.nm 8190290001Sglebius func_to_tool_file "$output" 8191290001Sglebius libobjs=$nm_file_list_spec$func_to_tool_file_result 8192290001Sglebius func_append delfiles " $output" 8193290001Sglebius func_verbose "creating $NM input file list: $output" 8194290001Sglebius for obj in $save_libobjs; do 8195290001Sglebius func_to_tool_file "$obj" 8196290001Sglebius $ECHO "$func_to_tool_file_result" 8197290001Sglebius done > "$output" 8198290001Sglebius eval cmd=\"$cmd1\" 8199290001Sglebius func_show_eval "$cmd" 'exit $?' 8200290001Sglebius output=$save_output 8201290001Sglebius libobjs=$save_libobjs 8202290001Sglebius skipped_export=false 8203290001Sglebius else 8204290001Sglebius # The command line is too long to execute in one step. 8205290001Sglebius func_verbose "using reloadable object file for export list..." 8206290001Sglebius skipped_export=: 8207290001Sglebius # Break out early, otherwise skipped_export may be 8208290001Sglebius # set to false by a later but shorter cmd. 8209290001Sglebius break 8210290001Sglebius fi 8211290001Sglebius done 8212290001Sglebius IFS="$save_ifs" 8213290001Sglebius if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 8214290001Sglebius func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8215290001Sglebius func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8216290001Sglebius fi 8217290001Sglebius fi 8218290001Sglebius fi 8219290001Sglebius 8220290001Sglebius if test -n "$export_symbols" && test -n "$include_expsyms"; then 8221290001Sglebius tmp_export_symbols="$export_symbols" 8222290001Sglebius test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8223290001Sglebius $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8224290001Sglebius fi 8225290001Sglebius 8226290001Sglebius if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 8227290001Sglebius # The given exports_symbols file has to be filtered, so filter it. 8228290001Sglebius func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8229290001Sglebius # FIXME: $output_objdir/$libname.filter potentially contains lots of 8230290001Sglebius # 's' commands which not all seds can handle. GNU sed should be fine 8231290001Sglebius # though. Also, the filter scales superlinearly with the number of 8232290001Sglebius # global variables. join(1) would be nice here, but unfortunately 8233290001Sglebius # isn't a blessed tool. 8234290001Sglebius $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8235290001Sglebius func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8236290001Sglebius export_symbols=$output_objdir/$libname.def 8237290001Sglebius $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8238290001Sglebius fi 8239290001Sglebius 8240290001Sglebius tmp_deplibs= 8241290001Sglebius for test_deplib in $deplibs; do 8242290001Sglebius case " $convenience " in 8243290001Sglebius *" $test_deplib "*) ;; 8244290001Sglebius *) 8245290001Sglebius func_append tmp_deplibs " $test_deplib" 8246290001Sglebius ;; 8247290001Sglebius esac 8248290001Sglebius done 8249290001Sglebius deplibs="$tmp_deplibs" 8250290001Sglebius 8251290001Sglebius if test -n "$convenience"; then 8252290001Sglebius if test -n "$whole_archive_flag_spec" && 8253290001Sglebius test "$compiler_needs_object" = yes && 8254290001Sglebius test -z "$libobjs"; then 8255290001Sglebius # extract the archives, so we have objects to list. 8256290001Sglebius # TODO: could optimize this to just extract one archive. 8257290001Sglebius whole_archive_flag_spec= 8258290001Sglebius fi 8259290001Sglebius if test -n "$whole_archive_flag_spec"; then 8260290001Sglebius save_libobjs=$libobjs 8261290001Sglebius eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8262290001Sglebius test "X$libobjs" = "X " && libobjs= 8263290001Sglebius else 8264290001Sglebius gentop="$output_objdir/${outputname}x" 8265290001Sglebius func_append generated " $gentop" 8266290001Sglebius 8267290001Sglebius func_extract_archives $gentop $convenience 8268290001Sglebius func_append libobjs " $func_extract_archives_result" 8269290001Sglebius test "X$libobjs" = "X " && libobjs= 8270290001Sglebius fi 8271290001Sglebius fi 8272290001Sglebius 8273290001Sglebius if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 8274290001Sglebius eval flag=\"$thread_safe_flag_spec\" 8275290001Sglebius func_append linker_flags " $flag" 8276290001Sglebius fi 8277290001Sglebius 8278290001Sglebius # Make a backup of the uninstalled library when relinking 8279290001Sglebius if test "$opt_mode" = relink; then 8280290001Sglebius $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 8281290001Sglebius fi 8282290001Sglebius 8283290001Sglebius # Do each of the archive commands. 8284290001Sglebius if test "$module" = yes && test -n "$module_cmds" ; then 8285290001Sglebius if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8286290001Sglebius eval test_cmds=\"$module_expsym_cmds\" 8287290001Sglebius cmds=$module_expsym_cmds 8288290001Sglebius else 8289290001Sglebius eval test_cmds=\"$module_cmds\" 8290290001Sglebius cmds=$module_cmds 8291290001Sglebius fi 8292290001Sglebius else 8293290001Sglebius if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8294290001Sglebius eval test_cmds=\"$archive_expsym_cmds\" 8295290001Sglebius cmds=$archive_expsym_cmds 8296290001Sglebius else 8297290001Sglebius eval test_cmds=\"$archive_cmds\" 8298290001Sglebius cmds=$archive_cmds 8299290001Sglebius fi 8300290001Sglebius fi 8301290001Sglebius 8302290001Sglebius if test "X$skipped_export" != "X:" && 8303290001Sglebius func_len " $test_cmds" && 8304290001Sglebius len=$func_len_result && 8305290001Sglebius test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 8306290001Sglebius : 8307290001Sglebius else 8308290001Sglebius # The command line is too long to link in one step, link piecewise 8309290001Sglebius # or, if using GNU ld and skipped_export is not :, use a linker 8310290001Sglebius # script. 8311290001Sglebius 8312290001Sglebius # Save the value of $output and $libobjs because we want to 8313290001Sglebius # use them later. If we have whole_archive_flag_spec, we 8314290001Sglebius # want to use save_libobjs as it was before 8315290001Sglebius # whole_archive_flag_spec was expanded, because we can't 8316290001Sglebius # assume the linker understands whole_archive_flag_spec. 8317290001Sglebius # This may have to be revisited, in case too many 8318290001Sglebius # convenience libraries get linked in and end up exceeding 8319290001Sglebius # the spec. 8320290001Sglebius if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 8321290001Sglebius save_libobjs=$libobjs 8322290001Sglebius fi 8323290001Sglebius save_output=$output 8324290001Sglebius func_basename "$output" 8325290001Sglebius output_la=$func_basename_result 8326290001Sglebius 8327290001Sglebius # Clear the reloadable object creation command queue and 8328290001Sglebius # initialize k to one. 8329290001Sglebius test_cmds= 8330290001Sglebius concat_cmds= 8331290001Sglebius objlist= 8332290001Sglebius last_robj= 8333290001Sglebius k=1 8334290001Sglebius 8335290001Sglebius if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 8336290001Sglebius output=${output_objdir}/${output_la}.lnkscript 8337290001Sglebius func_verbose "creating GNU ld script: $output" 8338290001Sglebius echo 'INPUT (' > $output 8339290001Sglebius for obj in $save_libobjs 8340290001Sglebius do 8341290001Sglebius func_to_tool_file "$obj" 8342290001Sglebius $ECHO "$func_to_tool_file_result" >> $output 8343290001Sglebius done 8344290001Sglebius echo ')' >> $output 8345290001Sglebius func_append delfiles " $output" 8346290001Sglebius func_to_tool_file "$output" 8347290001Sglebius output=$func_to_tool_file_result 8348290001Sglebius elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 8349290001Sglebius output=${output_objdir}/${output_la}.lnk 8350290001Sglebius func_verbose "creating linker input file list: $output" 8351290001Sglebius : > $output 8352290001Sglebius set x $save_libobjs 8353290001Sglebius shift 8354290001Sglebius firstobj= 8355290001Sglebius if test "$compiler_needs_object" = yes; then 8356290001Sglebius firstobj="$1 " 8357290001Sglebius shift 8358290001Sglebius fi 8359290001Sglebius for obj 8360290001Sglebius do 8361290001Sglebius func_to_tool_file "$obj" 8362290001Sglebius $ECHO "$func_to_tool_file_result" >> $output 8363290001Sglebius done 8364290001Sglebius func_append delfiles " $output" 8365290001Sglebius func_to_tool_file "$output" 8366290001Sglebius output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 8367290001Sglebius else 8368290001Sglebius if test -n "$save_libobjs"; then 8369290001Sglebius func_verbose "creating reloadable object files..." 8370290001Sglebius output=$output_objdir/$output_la-${k}.$objext 8371290001Sglebius eval test_cmds=\"$reload_cmds\" 8372290001Sglebius func_len " $test_cmds" 8373290001Sglebius len0=$func_len_result 8374290001Sglebius len=$len0 8375290001Sglebius 8376290001Sglebius # Loop over the list of objects to be linked. 8377290001Sglebius for obj in $save_libobjs 8378290001Sglebius do 8379290001Sglebius func_len " $obj" 8380290001Sglebius func_arith $len + $func_len_result 8381290001Sglebius len=$func_arith_result 8382290001Sglebius if test "X$objlist" = X || 8383290001Sglebius test "$len" -lt "$max_cmd_len"; then 8384290001Sglebius func_append objlist " $obj" 8385290001Sglebius else 8386290001Sglebius # The command $test_cmds is almost too long, add a 8387290001Sglebius # command to the queue. 8388290001Sglebius if test "$k" -eq 1 ; then 8389290001Sglebius # The first file doesn't have a previous command to add. 8390290001Sglebius reload_objs=$objlist 8391290001Sglebius eval concat_cmds=\"$reload_cmds\" 8392290001Sglebius else 8393290001Sglebius # All subsequent reloadable object files will link in 8394290001Sglebius # the last one created. 8395290001Sglebius reload_objs="$objlist $last_robj" 8396290001Sglebius eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 8397290001Sglebius fi 8398290001Sglebius last_robj=$output_objdir/$output_la-${k}.$objext 8399290001Sglebius func_arith $k + 1 8400290001Sglebius k=$func_arith_result 8401290001Sglebius output=$output_objdir/$output_la-${k}.$objext 8402290001Sglebius objlist=" $obj" 8403290001Sglebius func_len " $last_robj" 8404290001Sglebius func_arith $len0 + $func_len_result 8405290001Sglebius len=$func_arith_result 8406290001Sglebius fi 8407290001Sglebius done 8408290001Sglebius # Handle the remaining objects by creating one last 8409290001Sglebius # reloadable object file. All subsequent reloadable object 8410290001Sglebius # files will link in the last one created. 8411290001Sglebius test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8412290001Sglebius reload_objs="$objlist $last_robj" 8413290001Sglebius eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 8414290001Sglebius if test -n "$last_robj"; then 8415290001Sglebius eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 8416290001Sglebius fi 8417290001Sglebius func_append delfiles " $output" 8418290001Sglebius 8419290001Sglebius else 8420290001Sglebius output= 8421290001Sglebius fi 8422290001Sglebius 8423290001Sglebius if ${skipped_export-false}; then 8424290001Sglebius func_verbose "generating symbol list for \`$libname.la'" 8425290001Sglebius export_symbols="$output_objdir/$libname.exp" 8426290001Sglebius $opt_dry_run || $RM $export_symbols 8427290001Sglebius libobjs=$output 8428290001Sglebius # Append the command to create the export file. 8429290001Sglebius test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8430290001Sglebius eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 8431290001Sglebius if test -n "$last_robj"; then 8432290001Sglebius eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 8433290001Sglebius fi 8434290001Sglebius fi 8435290001Sglebius 8436290001Sglebius test -n "$save_libobjs" && 8437290001Sglebius func_verbose "creating a temporary reloadable object file: $output" 8438290001Sglebius 8439290001Sglebius # Loop through the commands generated above and execute them. 8440290001Sglebius save_ifs="$IFS"; IFS='~' 8441290001Sglebius for cmd in $concat_cmds; do 8442290001Sglebius IFS="$save_ifs" 8443290001Sglebius $opt_silent || { 8444290001Sglebius func_quote_for_expand "$cmd" 8445290001Sglebius eval "func_echo $func_quote_for_expand_result" 8446290001Sglebius } 8447290001Sglebius $opt_dry_run || eval "$cmd" || { 8448290001Sglebius lt_exit=$? 8449290001Sglebius 8450290001Sglebius # Restore the uninstalled library and exit 8451290001Sglebius if test "$opt_mode" = relink; then 8452290001Sglebius ( cd "$output_objdir" && \ 8453290001Sglebius $RM "${realname}T" && \ 8454290001Sglebius $MV "${realname}U" "$realname" ) 8455290001Sglebius fi 8456290001Sglebius 8457290001Sglebius exit $lt_exit 8458290001Sglebius } 8459290001Sglebius done 8460290001Sglebius IFS="$save_ifs" 8461290001Sglebius 8462290001Sglebius if test -n "$export_symbols_regex" && ${skipped_export-false}; then 8463290001Sglebius func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8464290001Sglebius func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8465290001Sglebius fi 8466290001Sglebius fi 8467290001Sglebius 8468290001Sglebius if ${skipped_export-false}; then 8469290001Sglebius if test -n "$export_symbols" && test -n "$include_expsyms"; then 8470290001Sglebius tmp_export_symbols="$export_symbols" 8471290001Sglebius test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8472290001Sglebius $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8473290001Sglebius fi 8474290001Sglebius 8475290001Sglebius if test -n "$orig_export_symbols"; then 8476290001Sglebius # The given exports_symbols file has to be filtered, so filter it. 8477290001Sglebius func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8478290001Sglebius # FIXME: $output_objdir/$libname.filter potentially contains lots of 8479290001Sglebius # 's' commands which not all seds can handle. GNU sed should be fine 8480290001Sglebius # though. Also, the filter scales superlinearly with the number of 8481290001Sglebius # global variables. join(1) would be nice here, but unfortunately 8482290001Sglebius # isn't a blessed tool. 8483290001Sglebius $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8484290001Sglebius func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8485290001Sglebius export_symbols=$output_objdir/$libname.def 8486290001Sglebius $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8487290001Sglebius fi 8488290001Sglebius fi 8489290001Sglebius 8490290001Sglebius libobjs=$output 8491290001Sglebius # Restore the value of output. 8492290001Sglebius output=$save_output 8493290001Sglebius 8494290001Sglebius if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 8495290001Sglebius eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8496290001Sglebius test "X$libobjs" = "X " && libobjs= 8497290001Sglebius fi 8498290001Sglebius # Expand the library linking commands again to reset the 8499290001Sglebius # value of $libobjs for piecewise linking. 8500290001Sglebius 8501290001Sglebius # Do each of the archive commands. 8502290001Sglebius if test "$module" = yes && test -n "$module_cmds" ; then 8503290001Sglebius if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8504290001Sglebius cmds=$module_expsym_cmds 8505290001Sglebius else 8506290001Sglebius cmds=$module_cmds 8507290001Sglebius fi 8508290001Sglebius else 8509290001Sglebius if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8510290001Sglebius cmds=$archive_expsym_cmds 8511290001Sglebius else 8512290001Sglebius cmds=$archive_cmds 8513290001Sglebius fi 8514290001Sglebius fi 8515290001Sglebius fi 8516290001Sglebius 8517290001Sglebius if test -n "$delfiles"; then 8518290001Sglebius # Append the command to remove temporary files to $cmds. 8519290001Sglebius eval cmds=\"\$cmds~\$RM $delfiles\" 8520290001Sglebius fi 8521290001Sglebius 8522290001Sglebius # Add any objects from preloaded convenience libraries 8523290001Sglebius if test -n "$dlprefiles"; then 8524290001Sglebius gentop="$output_objdir/${outputname}x" 8525290001Sglebius func_append generated " $gentop" 8526290001Sglebius 8527290001Sglebius func_extract_archives $gentop $dlprefiles 8528290001Sglebius func_append libobjs " $func_extract_archives_result" 8529290001Sglebius test "X$libobjs" = "X " && libobjs= 8530290001Sglebius fi 8531290001Sglebius 8532290001Sglebius save_ifs="$IFS"; IFS='~' 8533290001Sglebius for cmd in $cmds; do 8534290001Sglebius IFS="$save_ifs" 8535290001Sglebius eval cmd=\"$cmd\" 8536290001Sglebius $opt_silent || { 8537290001Sglebius func_quote_for_expand "$cmd" 8538290001Sglebius eval "func_echo $func_quote_for_expand_result" 8539290001Sglebius } 8540290001Sglebius $opt_dry_run || eval "$cmd" || { 8541290001Sglebius lt_exit=$? 8542290001Sglebius 8543290001Sglebius # Restore the uninstalled library and exit 8544290001Sglebius if test "$opt_mode" = relink; then 8545290001Sglebius ( cd "$output_objdir" && \ 8546290001Sglebius $RM "${realname}T" && \ 8547290001Sglebius $MV "${realname}U" "$realname" ) 8548290001Sglebius fi 8549290001Sglebius 8550290001Sglebius exit $lt_exit 8551290001Sglebius } 8552290001Sglebius done 8553290001Sglebius IFS="$save_ifs" 8554290001Sglebius 8555290001Sglebius # Restore the uninstalled library and exit 8556290001Sglebius if test "$opt_mode" = relink; then 8557290001Sglebius $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 8558290001Sglebius 8559290001Sglebius if test -n "$convenience"; then 8560290001Sglebius if test -z "$whole_archive_flag_spec"; then 8561290001Sglebius func_show_eval '${RM}r "$gentop"' 8562290001Sglebius fi 8563290001Sglebius fi 8564290001Sglebius 8565290001Sglebius exit $EXIT_SUCCESS 8566290001Sglebius fi 8567290001Sglebius 8568290001Sglebius # Create links to the real library. 8569290001Sglebius for linkname in $linknames; do 8570290001Sglebius if test "$realname" != "$linkname"; then 8571290001Sglebius func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 8572290001Sglebius fi 8573290001Sglebius done 8574290001Sglebius 8575290001Sglebius # If -module or -export-dynamic was specified, set the dlname. 8576290001Sglebius if test "$module" = yes || test "$export_dynamic" = yes; then 8577290001Sglebius # On all known operating systems, these are identical. 8578290001Sglebius dlname="$soname" 8579290001Sglebius fi 8580290001Sglebius fi 8581290001Sglebius ;; 8582290001Sglebius 8583290001Sglebius obj) 8584290001Sglebius if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 8585290001Sglebius func_warning "\`-dlopen' is ignored for objects" 8586290001Sglebius fi 8587290001Sglebius 8588290001Sglebius case " $deplibs" in 8589290001Sglebius *\ -l* | *\ -L*) 8590290001Sglebius func_warning "\`-l' and \`-L' are ignored for objects" ;; 8591290001Sglebius esac 8592290001Sglebius 8593290001Sglebius test -n "$rpath" && \ 8594290001Sglebius func_warning "\`-rpath' is ignored for objects" 8595290001Sglebius 8596290001Sglebius test -n "$xrpath" && \ 8597290001Sglebius func_warning "\`-R' is ignored for objects" 8598290001Sglebius 8599290001Sglebius test -n "$vinfo" && \ 8600290001Sglebius func_warning "\`-version-info' is ignored for objects" 8601290001Sglebius 8602290001Sglebius test -n "$release" && \ 8603290001Sglebius func_warning "\`-release' is ignored for objects" 8604290001Sglebius 8605290001Sglebius case $output in 8606290001Sglebius *.lo) 8607290001Sglebius test -n "$objs$old_deplibs" && \ 8608290001Sglebius func_fatal_error "cannot build library object \`$output' from non-libtool objects" 8609290001Sglebius 8610290001Sglebius libobj=$output 8611290001Sglebius func_lo2o "$libobj" 8612290001Sglebius obj=$func_lo2o_result 8613290001Sglebius ;; 8614290001Sglebius *) 8615290001Sglebius libobj= 8616290001Sglebius obj="$output" 8617290001Sglebius ;; 8618290001Sglebius esac 8619290001Sglebius 8620290001Sglebius # Delete the old objects. 8621290001Sglebius $opt_dry_run || $RM $obj $libobj 8622290001Sglebius 8623290001Sglebius # Objects from convenience libraries. This assumes 8624290001Sglebius # single-version convenience libraries. Whenever we create 8625290001Sglebius # different ones for PIC/non-PIC, this we'll have to duplicate 8626290001Sglebius # the extraction. 8627290001Sglebius reload_conv_objs= 8628290001Sglebius gentop= 8629290001Sglebius # reload_cmds runs $LD directly, so let us get rid of 8630290001Sglebius # -Wl from whole_archive_flag_spec and hope we can get by with 8631290001Sglebius # turning comma into space.. 8632290001Sglebius wl= 8633290001Sglebius 8634290001Sglebius if test -n "$convenience"; then 8635290001Sglebius if test -n "$whole_archive_flag_spec"; then 8636290001Sglebius eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 8637290001Sglebius reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 8638290001Sglebius else 8639290001Sglebius gentop="$output_objdir/${obj}x" 8640290001Sglebius func_append generated " $gentop" 8641290001Sglebius 8642290001Sglebius func_extract_archives $gentop $convenience 8643290001Sglebius reload_conv_objs="$reload_objs $func_extract_archives_result" 8644290001Sglebius fi 8645290001Sglebius fi 8646290001Sglebius 8647290001Sglebius # If we're not building shared, we need to use non_pic_objs 8648290001Sglebius test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" 8649290001Sglebius 8650290001Sglebius # Create the old-style object. 8651290001Sglebius reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 8652290001Sglebius 8653290001Sglebius output="$obj" 8654290001Sglebius func_execute_cmds "$reload_cmds" 'exit $?' 8655290001Sglebius 8656290001Sglebius # Exit if we aren't doing a library object file. 8657290001Sglebius if test -z "$libobj"; then 8658290001Sglebius if test -n "$gentop"; then 8659290001Sglebius func_show_eval '${RM}r "$gentop"' 8660290001Sglebius fi 8661290001Sglebius 8662290001Sglebius exit $EXIT_SUCCESS 8663290001Sglebius fi 8664290001Sglebius 8665290001Sglebius if test "$build_libtool_libs" != yes; then 8666290001Sglebius if test -n "$gentop"; then 8667290001Sglebius func_show_eval '${RM}r "$gentop"' 8668290001Sglebius fi 8669290001Sglebius 8670290001Sglebius # Create an invalid libtool object if no PIC, so that we don't 8671290001Sglebius # accidentally link it into a program. 8672290001Sglebius # $show "echo timestamp > $libobj" 8673290001Sglebius # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 8674290001Sglebius exit $EXIT_SUCCESS 8675290001Sglebius fi 8676290001Sglebius 8677290001Sglebius if test -n "$pic_flag" || test "$pic_mode" != default; then 8678290001Sglebius # Only do commands if we really have different PIC objects. 8679290001Sglebius reload_objs="$libobjs $reload_conv_objs" 8680290001Sglebius output="$libobj" 8681290001Sglebius func_execute_cmds "$reload_cmds" 'exit $?' 8682290001Sglebius fi 8683290001Sglebius 8684290001Sglebius if test -n "$gentop"; then 8685290001Sglebius func_show_eval '${RM}r "$gentop"' 8686290001Sglebius fi 8687290001Sglebius 8688290001Sglebius exit $EXIT_SUCCESS 8689290001Sglebius ;; 8690290001Sglebius 8691290001Sglebius prog) 8692290001Sglebius case $host in 8693290001Sglebius *cygwin*) func_stripname '' '.exe' "$output" 8694290001Sglebius output=$func_stripname_result.exe;; 8695290001Sglebius esac 8696290001Sglebius test -n "$vinfo" && \ 8697290001Sglebius func_warning "\`-version-info' is ignored for programs" 8698290001Sglebius 8699290001Sglebius test -n "$release" && \ 8700290001Sglebius func_warning "\`-release' is ignored for programs" 8701290001Sglebius 8702290001Sglebius test "$preload" = yes \ 8703290001Sglebius && test "$dlopen_support" = unknown \ 8704290001Sglebius && test "$dlopen_self" = unknown \ 8705290001Sglebius && test "$dlopen_self_static" = unknown && \ 8706290001Sglebius func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 8707290001Sglebius 8708290001Sglebius case $host in 8709290001Sglebius *-*-rhapsody* | *-*-darwin1.[012]) 8710290001Sglebius # On Rhapsody replace the C library is the System framework 8711290001Sglebius compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 8712290001Sglebius finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 8713290001Sglebius ;; 8714290001Sglebius esac 8715290001Sglebius 8716290001Sglebius case $host in 8717290001Sglebius *-*-darwin*) 8718290001Sglebius # Don't allow lazy linking, it breaks C++ global constructors 8719290001Sglebius # But is supposedly fixed on 10.4 or later (yay!). 8720290001Sglebius if test "$tagname" = CXX ; then 8721290001Sglebius case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 8722290001Sglebius 10.[0123]) 8723290001Sglebius func_append compile_command " ${wl}-bind_at_load" 8724290001Sglebius func_append finalize_command " ${wl}-bind_at_load" 8725290001Sglebius ;; 8726290001Sglebius esac 8727290001Sglebius fi 8728290001Sglebius # Time to change all our "foo.ltframework" stuff back to "-framework foo" 8729290001Sglebius compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8730290001Sglebius finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8731290001Sglebius ;; 8732290001Sglebius esac 8733290001Sglebius 8734290001Sglebius 8735290001Sglebius # move library search paths that coincide with paths to not yet 8736290001Sglebius # installed libraries to the beginning of the library search list 8737290001Sglebius new_libs= 8738290001Sglebius for path in $notinst_path; do 8739290001Sglebius case " $new_libs " in 8740290001Sglebius *" -L$path/$objdir "*) ;; 8741290001Sglebius *) 8742290001Sglebius case " $compile_deplibs " in 8743290001Sglebius *" -L$path/$objdir "*) 8744290001Sglebius func_append new_libs " -L$path/$objdir" ;; 8745290001Sglebius esac 8746290001Sglebius ;; 8747290001Sglebius esac 8748290001Sglebius done 8749290001Sglebius for deplib in $compile_deplibs; do 8750290001Sglebius case $deplib in 8751290001Sglebius -L*) 8752290001Sglebius case " $new_libs " in 8753290001Sglebius *" $deplib "*) ;; 8754290001Sglebius *) func_append new_libs " $deplib" ;; 8755290001Sglebius esac 8756290001Sglebius ;; 8757290001Sglebius *) func_append new_libs " $deplib" ;; 8758290001Sglebius esac 8759290001Sglebius done 8760290001Sglebius compile_deplibs="$new_libs" 8761290001Sglebius 8762290001Sglebius 8763290001Sglebius func_append compile_command " $compile_deplibs" 8764290001Sglebius func_append finalize_command " $finalize_deplibs" 8765290001Sglebius 8766290001Sglebius if test -n "$rpath$xrpath"; then 8767290001Sglebius # If the user specified any rpath flags, then add them. 8768290001Sglebius for libdir in $rpath $xrpath; do 8769290001Sglebius # This is the magic to use -rpath. 8770290001Sglebius case "$finalize_rpath " in 8771290001Sglebius *" $libdir "*) ;; 8772290001Sglebius *) func_append finalize_rpath " $libdir" ;; 8773290001Sglebius esac 8774290001Sglebius done 8775290001Sglebius fi 8776290001Sglebius 8777290001Sglebius # Now hardcode the library paths 8778290001Sglebius rpath= 8779290001Sglebius hardcode_libdirs= 8780290001Sglebius for libdir in $compile_rpath $finalize_rpath; do 8781290001Sglebius if test -n "$hardcode_libdir_flag_spec"; then 8782290001Sglebius if test -n "$hardcode_libdir_separator"; then 8783290001Sglebius if test -z "$hardcode_libdirs"; then 8784290001Sglebius hardcode_libdirs="$libdir" 8785290001Sglebius else 8786290001Sglebius # Just accumulate the unique libdirs. 8787290001Sglebius case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8788290001Sglebius *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8789290001Sglebius ;; 8790290001Sglebius *) 8791290001Sglebius func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8792290001Sglebius ;; 8793290001Sglebius esac 8794290001Sglebius fi 8795290001Sglebius else 8796290001Sglebius eval flag=\"$hardcode_libdir_flag_spec\" 8797290001Sglebius func_append rpath " $flag" 8798290001Sglebius fi 8799290001Sglebius elif test -n "$runpath_var"; then 8800290001Sglebius case "$perm_rpath " in 8801290001Sglebius *" $libdir "*) ;; 8802290001Sglebius *) func_append perm_rpath " $libdir" ;; 8803290001Sglebius esac 8804290001Sglebius fi 8805290001Sglebius case $host in 8806290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 8807290001Sglebius testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 8808290001Sglebius case :$dllsearchpath: in 8809290001Sglebius *":$libdir:"*) ;; 8810290001Sglebius ::) dllsearchpath=$libdir;; 8811290001Sglebius *) func_append dllsearchpath ":$libdir";; 8812290001Sglebius esac 8813290001Sglebius case :$dllsearchpath: in 8814290001Sglebius *":$testbindir:"*) ;; 8815290001Sglebius ::) dllsearchpath=$testbindir;; 8816290001Sglebius *) func_append dllsearchpath ":$testbindir";; 8817290001Sglebius esac 8818290001Sglebius ;; 8819290001Sglebius esac 8820290001Sglebius done 8821290001Sglebius # Substitute the hardcoded libdirs into the rpath. 8822290001Sglebius if test -n "$hardcode_libdir_separator" && 8823290001Sglebius test -n "$hardcode_libdirs"; then 8824290001Sglebius libdir="$hardcode_libdirs" 8825290001Sglebius eval rpath=\" $hardcode_libdir_flag_spec\" 8826290001Sglebius fi 8827290001Sglebius compile_rpath="$rpath" 8828290001Sglebius 8829290001Sglebius rpath= 8830290001Sglebius hardcode_libdirs= 8831290001Sglebius for libdir in $finalize_rpath; do 8832290001Sglebius if test -n "$hardcode_libdir_flag_spec"; then 8833290001Sglebius if test -n "$hardcode_libdir_separator"; then 8834290001Sglebius if test -z "$hardcode_libdirs"; then 8835290001Sglebius hardcode_libdirs="$libdir" 8836290001Sglebius else 8837290001Sglebius # Just accumulate the unique libdirs. 8838290001Sglebius case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8839290001Sglebius *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8840290001Sglebius ;; 8841290001Sglebius *) 8842290001Sglebius func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8843290001Sglebius ;; 8844290001Sglebius esac 8845290001Sglebius fi 8846290001Sglebius else 8847290001Sglebius eval flag=\"$hardcode_libdir_flag_spec\" 8848290001Sglebius func_append rpath " $flag" 8849290001Sglebius fi 8850290001Sglebius elif test -n "$runpath_var"; then 8851290001Sglebius case "$finalize_perm_rpath " in 8852290001Sglebius *" $libdir "*) ;; 8853290001Sglebius *) func_append finalize_perm_rpath " $libdir" ;; 8854290001Sglebius esac 8855290001Sglebius fi 8856290001Sglebius done 8857290001Sglebius # Substitute the hardcoded libdirs into the rpath. 8858290001Sglebius if test -n "$hardcode_libdir_separator" && 8859290001Sglebius test -n "$hardcode_libdirs"; then 8860290001Sglebius libdir="$hardcode_libdirs" 8861290001Sglebius eval rpath=\" $hardcode_libdir_flag_spec\" 8862290001Sglebius fi 8863290001Sglebius finalize_rpath="$rpath" 8864290001Sglebius 8865290001Sglebius if test -n "$libobjs" && test "$build_old_libs" = yes; then 8866290001Sglebius # Transform all the library objects into standard objects. 8867290001Sglebius compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8868290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8869290001Sglebius fi 8870290001Sglebius 8871290001Sglebius func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8872290001Sglebius 8873290001Sglebius # template prelinking step 8874290001Sglebius if test -n "$prelink_cmds"; then 8875290001Sglebius func_execute_cmds "$prelink_cmds" 'exit $?' 8876290001Sglebius fi 8877290001Sglebius 8878290001Sglebius wrappers_required=yes 8879290001Sglebius case $host in 8880290001Sglebius *cegcc* | *mingw32ce*) 8881290001Sglebius # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 8882290001Sglebius wrappers_required=no 8883290001Sglebius ;; 8884290001Sglebius *cygwin* | *mingw* ) 8885290001Sglebius if test "$build_libtool_libs" != yes; then 8886290001Sglebius wrappers_required=no 8887290001Sglebius fi 8888290001Sglebius ;; 8889290001Sglebius *) 8890290001Sglebius if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 8891290001Sglebius wrappers_required=no 8892290001Sglebius fi 8893290001Sglebius ;; 8894290001Sglebius esac 8895290001Sglebius if test "$wrappers_required" = no; then 8896290001Sglebius # Replace the output file specification. 8897290001Sglebius compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8898290001Sglebius link_command="$compile_command$compile_rpath" 8899290001Sglebius 8900290001Sglebius # We have no uninstalled library dependencies, so finalize right now. 8901290001Sglebius exit_status=0 8902290001Sglebius func_show_eval "$link_command" 'exit_status=$?' 8903290001Sglebius 8904290001Sglebius if test -n "$postlink_cmds"; then 8905290001Sglebius func_to_tool_file "$output" 8906290001Sglebius postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8907290001Sglebius func_execute_cmds "$postlink_cmds" 'exit $?' 8908290001Sglebius fi 8909290001Sglebius 8910290001Sglebius # Delete the generated files. 8911290001Sglebius if test -f "$output_objdir/${outputname}S.${objext}"; then 8912290001Sglebius func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8913290001Sglebius fi 8914290001Sglebius 8915290001Sglebius exit $exit_status 8916290001Sglebius fi 8917290001Sglebius 8918290001Sglebius if test -n "$compile_shlibpath$finalize_shlibpath"; then 8919290001Sglebius compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 8920290001Sglebius fi 8921290001Sglebius if test -n "$finalize_shlibpath"; then 8922290001Sglebius finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 8923290001Sglebius fi 8924290001Sglebius 8925290001Sglebius compile_var= 8926290001Sglebius finalize_var= 8927290001Sglebius if test -n "$runpath_var"; then 8928290001Sglebius if test -n "$perm_rpath"; then 8929290001Sglebius # We should set the runpath_var. 8930290001Sglebius rpath= 8931290001Sglebius for dir in $perm_rpath; do 8932290001Sglebius func_append rpath "$dir:" 8933290001Sglebius done 8934290001Sglebius compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8935290001Sglebius fi 8936290001Sglebius if test -n "$finalize_perm_rpath"; then 8937290001Sglebius # We should set the runpath_var. 8938290001Sglebius rpath= 8939290001Sglebius for dir in $finalize_perm_rpath; do 8940290001Sglebius func_append rpath "$dir:" 8941290001Sglebius done 8942290001Sglebius finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8943290001Sglebius fi 8944290001Sglebius fi 8945290001Sglebius 8946290001Sglebius if test "$no_install" = yes; then 8947290001Sglebius # We don't need to create a wrapper script. 8948290001Sglebius link_command="$compile_var$compile_command$compile_rpath" 8949290001Sglebius # Replace the output file specification. 8950290001Sglebius link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8951290001Sglebius # Delete the old output file. 8952290001Sglebius $opt_dry_run || $RM $output 8953290001Sglebius # Link the executable and exit 8954290001Sglebius func_show_eval "$link_command" 'exit $?' 8955290001Sglebius 8956290001Sglebius if test -n "$postlink_cmds"; then 8957290001Sglebius func_to_tool_file "$output" 8958290001Sglebius postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8959290001Sglebius func_execute_cmds "$postlink_cmds" 'exit $?' 8960290001Sglebius fi 8961290001Sglebius 8962290001Sglebius exit $EXIT_SUCCESS 8963290001Sglebius fi 8964290001Sglebius 8965290001Sglebius if test "$hardcode_action" = relink; then 8966290001Sglebius # Fast installation is not supported 8967290001Sglebius link_command="$compile_var$compile_command$compile_rpath" 8968290001Sglebius relink_command="$finalize_var$finalize_command$finalize_rpath" 8969290001Sglebius 8970290001Sglebius func_warning "this platform does not like uninstalled shared libraries" 8971290001Sglebius func_warning "\`$output' will be relinked during installation" 8972290001Sglebius else 8973290001Sglebius if test "$fast_install" != no; then 8974290001Sglebius link_command="$finalize_var$compile_command$finalize_rpath" 8975290001Sglebius if test "$fast_install" = yes; then 8976290001Sglebius relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 8977290001Sglebius else 8978290001Sglebius # fast_install is set to needless 8979290001Sglebius relink_command= 8980290001Sglebius fi 8981290001Sglebius else 8982290001Sglebius link_command="$compile_var$compile_command$compile_rpath" 8983290001Sglebius relink_command="$finalize_var$finalize_command$finalize_rpath" 8984290001Sglebius fi 8985290001Sglebius fi 8986290001Sglebius 8987290001Sglebius # Replace the output file specification. 8988290001Sglebius link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8989290001Sglebius 8990290001Sglebius # Delete the old output files. 8991290001Sglebius $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8992290001Sglebius 8993290001Sglebius func_show_eval "$link_command" 'exit $?' 8994290001Sglebius 8995290001Sglebius if test -n "$postlink_cmds"; then 8996290001Sglebius func_to_tool_file "$output_objdir/$outputname" 8997290001Sglebius 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'` 8998290001Sglebius func_execute_cmds "$postlink_cmds" 'exit $?' 8999290001Sglebius fi 9000290001Sglebius 9001290001Sglebius # Now create the wrapper script. 9002290001Sglebius func_verbose "creating $output" 9003290001Sglebius 9004290001Sglebius # Quote the relink command for shipping. 9005290001Sglebius if test -n "$relink_command"; then 9006290001Sglebius # Preserve any variables that may affect compiler behavior 9007290001Sglebius for var in $variables_saved_for_relink; do 9008290001Sglebius if eval test -z \"\${$var+set}\"; then 9009290001Sglebius relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9010290001Sglebius elif eval var_value=\$$var; test -z "$var_value"; then 9011290001Sglebius relink_command="$var=; export $var; $relink_command" 9012290001Sglebius else 9013290001Sglebius func_quote_for_eval "$var_value" 9014290001Sglebius relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9015290001Sglebius fi 9016290001Sglebius done 9017290001Sglebius relink_command="(cd `pwd`; $relink_command)" 9018290001Sglebius relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9019290001Sglebius fi 9020290001Sglebius 9021290001Sglebius # Only actually do things if not in dry run mode. 9022290001Sglebius $opt_dry_run || { 9023290001Sglebius # win32 will think the script is a binary if it has 9024290001Sglebius # a .exe suffix, so we strip it off here. 9025290001Sglebius case $output in 9026290001Sglebius *.exe) func_stripname '' '.exe' "$output" 9027290001Sglebius output=$func_stripname_result ;; 9028290001Sglebius esac 9029290001Sglebius # test for cygwin because mv fails w/o .exe extensions 9030290001Sglebius case $host in 9031290001Sglebius *cygwin*) 9032290001Sglebius exeext=.exe 9033290001Sglebius func_stripname '' '.exe' "$outputname" 9034290001Sglebius outputname=$func_stripname_result ;; 9035290001Sglebius *) exeext= ;; 9036290001Sglebius esac 9037290001Sglebius case $host in 9038290001Sglebius *cygwin* | *mingw* ) 9039290001Sglebius func_dirname_and_basename "$output" "" "." 9040290001Sglebius output_name=$func_basename_result 9041290001Sglebius output_path=$func_dirname_result 9042290001Sglebius cwrappersource="$output_path/$objdir/lt-$output_name.c" 9043290001Sglebius cwrapper="$output_path/$output_name.exe" 9044290001Sglebius $RM $cwrappersource $cwrapper 9045290001Sglebius trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 9046290001Sglebius 9047290001Sglebius func_emit_cwrapperexe_src > $cwrappersource 9048290001Sglebius 9049290001Sglebius # The wrapper executable is built using the $host compiler, 9050290001Sglebius # because it contains $host paths and files. If cross- 9051290001Sglebius # compiling, it, like the target executable, must be 9052290001Sglebius # executed on the $host or under an emulation environment. 9053290001Sglebius $opt_dry_run || { 9054290001Sglebius $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 9055290001Sglebius $STRIP $cwrapper 9056290001Sglebius } 9057290001Sglebius 9058290001Sglebius # Now, create the wrapper script for func_source use: 9059290001Sglebius func_ltwrapper_scriptname $cwrapper 9060290001Sglebius $RM $func_ltwrapper_scriptname_result 9061290001Sglebius trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 9062290001Sglebius $opt_dry_run || { 9063290001Sglebius # note: this script will not be executed, so do not chmod. 9064290001Sglebius if test "x$build" = "x$host" ; then 9065290001Sglebius $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 9066290001Sglebius else 9067290001Sglebius func_emit_wrapper no > $func_ltwrapper_scriptname_result 9068290001Sglebius fi 9069290001Sglebius } 9070290001Sglebius ;; 9071290001Sglebius * ) 9072290001Sglebius $RM $output 9073290001Sglebius trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 9074290001Sglebius 9075290001Sglebius func_emit_wrapper no > $output 9076290001Sglebius chmod +x $output 9077290001Sglebius ;; 9078290001Sglebius esac 9079290001Sglebius } 9080290001Sglebius exit $EXIT_SUCCESS 9081290001Sglebius ;; 9082290001Sglebius esac 9083290001Sglebius 9084290001Sglebius # See if we need to build an old-fashioned archive. 9085290001Sglebius for oldlib in $oldlibs; do 9086290001Sglebius 9087290001Sglebius if test "$build_libtool_libs" = convenience; then 9088290001Sglebius oldobjs="$libobjs_save $symfileobj" 9089290001Sglebius addlibs="$convenience" 9090290001Sglebius build_libtool_libs=no 9091290001Sglebius else 9092290001Sglebius if test "$build_libtool_libs" = module; then 9093290001Sglebius oldobjs="$libobjs_save" 9094290001Sglebius build_libtool_libs=no 9095290001Sglebius else 9096290001Sglebius oldobjs="$old_deplibs $non_pic_objects" 9097290001Sglebius if test "$preload" = yes && test -f "$symfileobj"; then 9098290001Sglebius func_append oldobjs " $symfileobj" 9099290001Sglebius fi 9100290001Sglebius fi 9101290001Sglebius addlibs="$old_convenience" 9102290001Sglebius fi 9103290001Sglebius 9104290001Sglebius if test -n "$addlibs"; then 9105290001Sglebius gentop="$output_objdir/${outputname}x" 9106290001Sglebius func_append generated " $gentop" 9107290001Sglebius 9108290001Sglebius func_extract_archives $gentop $addlibs 9109290001Sglebius func_append oldobjs " $func_extract_archives_result" 9110290001Sglebius fi 9111290001Sglebius 9112290001Sglebius # Do each command in the archive commands. 9113290001Sglebius if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 9114290001Sglebius cmds=$old_archive_from_new_cmds 9115290001Sglebius else 9116290001Sglebius 9117290001Sglebius # Add any objects from preloaded convenience libraries 9118290001Sglebius if test -n "$dlprefiles"; then 9119290001Sglebius gentop="$output_objdir/${outputname}x" 9120290001Sglebius func_append generated " $gentop" 9121290001Sglebius 9122290001Sglebius func_extract_archives $gentop $dlprefiles 9123290001Sglebius func_append oldobjs " $func_extract_archives_result" 9124290001Sglebius fi 9125290001Sglebius 9126290001Sglebius # POSIX demands no paths to be encoded in archives. We have 9127290001Sglebius # to avoid creating archives with duplicate basenames if we 9128290001Sglebius # might have to extract them afterwards, e.g., when creating a 9129290001Sglebius # static archive out of a convenience library, or when linking 9130290001Sglebius # the entirety of a libtool archive into another (currently 9131290001Sglebius # not supported by libtool). 9132290001Sglebius if (for obj in $oldobjs 9133290001Sglebius do 9134290001Sglebius func_basename "$obj" 9135290001Sglebius $ECHO "$func_basename_result" 9136290001Sglebius done | sort | sort -uc >/dev/null 2>&1); then 9137290001Sglebius : 9138290001Sglebius else 9139290001Sglebius echo "copying selected object files to avoid basename conflicts..." 9140290001Sglebius gentop="$output_objdir/${outputname}x" 9141290001Sglebius func_append generated " $gentop" 9142290001Sglebius func_mkdir_p "$gentop" 9143290001Sglebius save_oldobjs=$oldobjs 9144290001Sglebius oldobjs= 9145290001Sglebius counter=1 9146290001Sglebius for obj in $save_oldobjs 9147290001Sglebius do 9148290001Sglebius func_basename "$obj" 9149290001Sglebius objbase="$func_basename_result" 9150290001Sglebius case " $oldobjs " in 9151290001Sglebius " ") oldobjs=$obj ;; 9152290001Sglebius *[\ /]"$objbase "*) 9153290001Sglebius while :; do 9154290001Sglebius # Make sure we don't pick an alternate name that also 9155290001Sglebius # overlaps. 9156290001Sglebius newobj=lt$counter-$objbase 9157290001Sglebius func_arith $counter + 1 9158290001Sglebius counter=$func_arith_result 9159290001Sglebius case " $oldobjs " in 9160290001Sglebius *[\ /]"$newobj "*) ;; 9161290001Sglebius *) if test ! -f "$gentop/$newobj"; then break; fi ;; 9162290001Sglebius esac 9163290001Sglebius done 9164290001Sglebius func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 9165290001Sglebius func_append oldobjs " $gentop/$newobj" 9166290001Sglebius ;; 9167290001Sglebius *) func_append oldobjs " $obj" ;; 9168290001Sglebius esac 9169290001Sglebius done 9170290001Sglebius fi 9171290001Sglebius func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 9172290001Sglebius tool_oldlib=$func_to_tool_file_result 9173290001Sglebius eval cmds=\"$old_archive_cmds\" 9174290001Sglebius 9175290001Sglebius func_len " $cmds" 9176290001Sglebius len=$func_len_result 9177290001Sglebius if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 9178290001Sglebius cmds=$old_archive_cmds 9179290001Sglebius elif test -n "$archiver_list_spec"; then 9180290001Sglebius func_verbose "using command file archive linking..." 9181290001Sglebius for obj in $oldobjs 9182290001Sglebius do 9183290001Sglebius func_to_tool_file "$obj" 9184290001Sglebius $ECHO "$func_to_tool_file_result" 9185290001Sglebius done > $output_objdir/$libname.libcmd 9186290001Sglebius func_to_tool_file "$output_objdir/$libname.libcmd" 9187290001Sglebius oldobjs=" $archiver_list_spec$func_to_tool_file_result" 9188290001Sglebius cmds=$old_archive_cmds 9189290001Sglebius else 9190290001Sglebius # the command line is too long to link in one step, link in parts 9191290001Sglebius func_verbose "using piecewise archive linking..." 9192290001Sglebius save_RANLIB=$RANLIB 9193290001Sglebius RANLIB=: 9194290001Sglebius objlist= 9195290001Sglebius concat_cmds= 9196290001Sglebius save_oldobjs=$oldobjs 9197290001Sglebius oldobjs= 9198290001Sglebius # Is there a better way of finding the last object in the list? 9199290001Sglebius for obj in $save_oldobjs 9200290001Sglebius do 9201290001Sglebius last_oldobj=$obj 9202290001Sglebius done 9203290001Sglebius eval test_cmds=\"$old_archive_cmds\" 9204290001Sglebius func_len " $test_cmds" 9205290001Sglebius len0=$func_len_result 9206290001Sglebius len=$len0 9207290001Sglebius for obj in $save_oldobjs 9208290001Sglebius do 9209290001Sglebius func_len " $obj" 9210290001Sglebius func_arith $len + $func_len_result 9211290001Sglebius len=$func_arith_result 9212290001Sglebius func_append objlist " $obj" 9213290001Sglebius if test "$len" -lt "$max_cmd_len"; then 9214290001Sglebius : 9215290001Sglebius else 9216290001Sglebius # the above command should be used before it gets too long 9217290001Sglebius oldobjs=$objlist 9218290001Sglebius if test "$obj" = "$last_oldobj" ; then 9219290001Sglebius RANLIB=$save_RANLIB 9220290001Sglebius fi 9221290001Sglebius test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 9222290001Sglebius eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 9223290001Sglebius objlist= 9224290001Sglebius len=$len0 9225290001Sglebius fi 9226290001Sglebius done 9227290001Sglebius RANLIB=$save_RANLIB 9228290001Sglebius oldobjs=$objlist 9229290001Sglebius if test "X$oldobjs" = "X" ; then 9230290001Sglebius eval cmds=\"\$concat_cmds\" 9231290001Sglebius else 9232290001Sglebius eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 9233290001Sglebius fi 9234290001Sglebius fi 9235290001Sglebius fi 9236290001Sglebius func_execute_cmds "$cmds" 'exit $?' 9237290001Sglebius done 9238290001Sglebius 9239290001Sglebius test -n "$generated" && \ 9240290001Sglebius func_show_eval "${RM}r$generated" 9241290001Sglebius 9242290001Sglebius # Now create the libtool archive. 9243290001Sglebius case $output in 9244290001Sglebius *.la) 9245290001Sglebius old_library= 9246290001Sglebius test "$build_old_libs" = yes && old_library="$libname.$libext" 9247290001Sglebius func_verbose "creating $output" 9248290001Sglebius 9249290001Sglebius # Preserve any variables that may affect compiler behavior 9250290001Sglebius for var in $variables_saved_for_relink; do 9251290001Sglebius if eval test -z \"\${$var+set}\"; then 9252290001Sglebius relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9253290001Sglebius elif eval var_value=\$$var; test -z "$var_value"; then 9254290001Sglebius relink_command="$var=; export $var; $relink_command" 9255290001Sglebius else 9256290001Sglebius func_quote_for_eval "$var_value" 9257290001Sglebius relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9258290001Sglebius fi 9259290001Sglebius done 9260290001Sglebius # Quote the link command for shipping. 9261290001Sglebius relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 9262290001Sglebius relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9263290001Sglebius if test "$hardcode_automatic" = yes ; then 9264290001Sglebius relink_command= 9265290001Sglebius fi 9266290001Sglebius 9267290001Sglebius # Only create the output if not a dry run. 9268290001Sglebius $opt_dry_run || { 9269290001Sglebius for installed in no yes; do 9270290001Sglebius if test "$installed" = yes; then 9271290001Sglebius if test -z "$install_libdir"; then 9272290001Sglebius break 9273290001Sglebius fi 9274290001Sglebius output="$output_objdir/$outputname"i 9275290001Sglebius # Replace all uninstalled libtool libraries with the installed ones 9276290001Sglebius newdependency_libs= 9277290001Sglebius for deplib in $dependency_libs; do 9278290001Sglebius case $deplib in 9279290001Sglebius *.la) 9280290001Sglebius func_basename "$deplib" 9281290001Sglebius name="$func_basename_result" 9282290001Sglebius func_resolve_sysroot "$deplib" 9283290001Sglebius eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` 9284290001Sglebius test -z "$libdir" && \ 9285290001Sglebius func_fatal_error "\`$deplib' is not a valid libtool archive" 9286290001Sglebius func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 9287290001Sglebius ;; 9288290001Sglebius -L*) 9289290001Sglebius func_stripname -L '' "$deplib" 9290290001Sglebius func_replace_sysroot "$func_stripname_result" 9291290001Sglebius func_append newdependency_libs " -L$func_replace_sysroot_result" 9292290001Sglebius ;; 9293290001Sglebius -R*) 9294290001Sglebius func_stripname -R '' "$deplib" 9295290001Sglebius func_replace_sysroot "$func_stripname_result" 9296290001Sglebius func_append newdependency_libs " -R$func_replace_sysroot_result" 9297290001Sglebius ;; 9298290001Sglebius *) func_append newdependency_libs " $deplib" ;; 9299290001Sglebius esac 9300290001Sglebius done 9301290001Sglebius dependency_libs="$newdependency_libs" 9302290001Sglebius newdlfiles= 9303290001Sglebius 9304290001Sglebius for lib in $dlfiles; do 9305290001Sglebius case $lib in 9306290001Sglebius *.la) 9307290001Sglebius func_basename "$lib" 9308290001Sglebius name="$func_basename_result" 9309290001Sglebius eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9310290001Sglebius test -z "$libdir" && \ 9311290001Sglebius func_fatal_error "\`$lib' is not a valid libtool archive" 9312290001Sglebius func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 9313290001Sglebius ;; 9314290001Sglebius *) func_append newdlfiles " $lib" ;; 9315290001Sglebius esac 9316290001Sglebius done 9317290001Sglebius dlfiles="$newdlfiles" 9318290001Sglebius newdlprefiles= 9319290001Sglebius for lib in $dlprefiles; do 9320290001Sglebius case $lib in 9321290001Sglebius *.la) 9322290001Sglebius # Only pass preopened files to the pseudo-archive (for 9323290001Sglebius # eventual linking with the app. that links it) if we 9324290001Sglebius # didn't already link the preopened objects directly into 9325290001Sglebius # the library: 9326290001Sglebius func_basename "$lib" 9327290001Sglebius name="$func_basename_result" 9328290001Sglebius eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9329290001Sglebius test -z "$libdir" && \ 9330290001Sglebius func_fatal_error "\`$lib' is not a valid libtool archive" 9331290001Sglebius func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 9332290001Sglebius ;; 9333290001Sglebius esac 9334290001Sglebius done 9335290001Sglebius dlprefiles="$newdlprefiles" 9336290001Sglebius else 9337290001Sglebius newdlfiles= 9338290001Sglebius for lib in $dlfiles; do 9339290001Sglebius case $lib in 9340290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9341290001Sglebius *) abs=`pwd`"/$lib" ;; 9342290001Sglebius esac 9343290001Sglebius func_append newdlfiles " $abs" 9344290001Sglebius done 9345290001Sglebius dlfiles="$newdlfiles" 9346290001Sglebius newdlprefiles= 9347290001Sglebius for lib in $dlprefiles; do 9348290001Sglebius case $lib in 9349290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9350290001Sglebius *) abs=`pwd`"/$lib" ;; 9351290001Sglebius esac 9352290001Sglebius func_append newdlprefiles " $abs" 9353290001Sglebius done 9354290001Sglebius dlprefiles="$newdlprefiles" 9355290001Sglebius fi 9356290001Sglebius $RM $output 9357290001Sglebius # place dlname in correct position for cygwin 9358290001Sglebius # In fact, it would be nice if we could use this code for all target 9359290001Sglebius # systems that can't hard-code library paths into their executables 9360290001Sglebius # and that have no shared library path variable independent of PATH, 9361290001Sglebius # but it turns out we can't easily determine that from inspecting 9362290001Sglebius # libtool variables, so we have to hard-code the OSs to which it 9363290001Sglebius # applies here; at the moment, that means platforms that use the PE 9364290001Sglebius # object format with DLL files. See the long comment at the top of 9365290001Sglebius # tests/bindir.at for full details. 9366290001Sglebius tdlname=$dlname 9367290001Sglebius case $host,$output,$installed,$module,$dlname in 9368290001Sglebius *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 9369290001Sglebius # If a -bindir argument was supplied, place the dll there. 9370290001Sglebius if test "x$bindir" != x ; 9371290001Sglebius then 9372290001Sglebius func_relative_path "$install_libdir" "$bindir" 9373290001Sglebius tdlname=$func_relative_path_result$dlname 9374290001Sglebius else 9375290001Sglebius # Otherwise fall back on heuristic. 9376290001Sglebius tdlname=../bin/$dlname 9377290001Sglebius fi 9378290001Sglebius ;; 9379290001Sglebius esac 9380290001Sglebius $ECHO > $output "\ 9381290001Sglebius# $outputname - a libtool library file 9382290001Sglebius# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 9383290001Sglebius# 9384290001Sglebius# Please DO NOT delete this file! 9385290001Sglebius# It is necessary for linking the library. 9386290001Sglebius 9387290001Sglebius# The name that we can dlopen(3). 9388290001Sglebiusdlname='$tdlname' 9389290001Sglebius 9390290001Sglebius# Names of this library. 9391290001Sglebiuslibrary_names='$library_names' 9392290001Sglebius 9393290001Sglebius# The name of the static archive. 9394290001Sglebiusold_library='$old_library' 9395290001Sglebius 9396290001Sglebius# Linker flags that can not go in dependency_libs. 9397290001Sglebiusinherited_linker_flags='$new_inherited_linker_flags' 9398290001Sglebius 9399290001Sglebius# Libraries that this one depends upon. 9400290001Sglebiusdependency_libs='$dependency_libs' 9401290001Sglebius 9402290001Sglebius# Names of additional weak libraries provided by this library 9403290001Sglebiusweak_library_names='$weak_libs' 9404290001Sglebius 9405290001Sglebius# Version information for $libname. 9406290001Sglebiuscurrent=$current 9407290001Sglebiusage=$age 9408290001Sglebiusrevision=$revision 9409290001Sglebius 9410290001Sglebius# Is this an already installed library? 9411290001Sglebiusinstalled=$installed 9412290001Sglebius 9413290001Sglebius# Should we warn about portability when linking against -modules? 9414290001Sglebiusshouldnotlink=$module 9415290001Sglebius 9416290001Sglebius# Files to dlopen/dlpreopen 9417290001Sglebiusdlopen='$dlfiles' 9418290001Sglebiusdlpreopen='$dlprefiles' 9419290001Sglebius 9420290001Sglebius# Directory that this library needs to be installed in: 9421290001Sglebiuslibdir='$install_libdir'" 9422290001Sglebius if test "$installed" = no && test "$need_relink" = yes; then 9423290001Sglebius $ECHO >> $output "\ 9424290001Sglebiusrelink_command=\"$relink_command\"" 9425290001Sglebius fi 9426290001Sglebius done 9427290001Sglebius } 9428290001Sglebius 9429290001Sglebius # Do a symbolic link so that the libtool archive can be found in 9430290001Sglebius # LD_LIBRARY_PATH before the program is installed. 9431290001Sglebius func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 9432290001Sglebius ;; 9433290001Sglebius esac 9434290001Sglebius exit $EXIT_SUCCESS 9435290001Sglebius} 9436290001Sglebius 9437290001Sglebius{ test "$opt_mode" = link || test "$opt_mode" = relink; } && 9438290001Sglebius func_mode_link ${1+"$@"} 9439290001Sglebius 9440290001Sglebius 9441290001Sglebius# func_mode_uninstall arg... 9442290001Sglebiusfunc_mode_uninstall () 9443290001Sglebius{ 9444290001Sglebius $opt_debug 9445290001Sglebius RM="$nonopt" 9446290001Sglebius files= 9447290001Sglebius rmforce= 9448290001Sglebius exit_status=0 9449290001Sglebius 9450290001Sglebius # This variable tells wrapper scripts just to set variables rather 9451290001Sglebius # than running their programs. 9452290001Sglebius libtool_install_magic="$magic" 9453290001Sglebius 9454290001Sglebius for arg 9455290001Sglebius do 9456290001Sglebius case $arg in 9457290001Sglebius -f) func_append RM " $arg"; rmforce=yes ;; 9458290001Sglebius -*) func_append RM " $arg" ;; 9459290001Sglebius *) func_append files " $arg" ;; 9460290001Sglebius esac 9461290001Sglebius done 9462290001Sglebius 9463290001Sglebius test -z "$RM" && \ 9464290001Sglebius func_fatal_help "you must specify an RM program" 9465290001Sglebius 9466290001Sglebius rmdirs= 9467290001Sglebius 9468290001Sglebius for file in $files; do 9469290001Sglebius func_dirname "$file" "" "." 9470290001Sglebius dir="$func_dirname_result" 9471290001Sglebius if test "X$dir" = X.; then 9472290001Sglebius odir="$objdir" 9473290001Sglebius else 9474290001Sglebius odir="$dir/$objdir" 9475290001Sglebius fi 9476290001Sglebius func_basename "$file" 9477290001Sglebius name="$func_basename_result" 9478290001Sglebius test "$opt_mode" = uninstall && odir="$dir" 9479290001Sglebius 9480290001Sglebius # Remember odir for removal later, being careful to avoid duplicates 9481290001Sglebius if test "$opt_mode" = clean; then 9482290001Sglebius case " $rmdirs " in 9483290001Sglebius *" $odir "*) ;; 9484290001Sglebius *) func_append rmdirs " $odir" ;; 9485290001Sglebius esac 9486290001Sglebius fi 9487290001Sglebius 9488290001Sglebius # Don't error if the file doesn't exist and rm -f was used. 9489290001Sglebius if { test -L "$file"; } >/dev/null 2>&1 || 9490290001Sglebius { test -h "$file"; } >/dev/null 2>&1 || 9491290001Sglebius test -f "$file"; then 9492290001Sglebius : 9493290001Sglebius elif test -d "$file"; then 9494290001Sglebius exit_status=1 9495290001Sglebius continue 9496290001Sglebius elif test "$rmforce" = yes; then 9497290001Sglebius continue 9498290001Sglebius fi 9499290001Sglebius 9500290001Sglebius rmfiles="$file" 9501290001Sglebius 9502290001Sglebius case $name in 9503290001Sglebius *.la) 9504290001Sglebius # Possibly a libtool archive, so verify it. 9505290001Sglebius if func_lalib_p "$file"; then 9506290001Sglebius func_source $dir/$name 9507290001Sglebius 9508290001Sglebius # Delete the libtool libraries and symlinks. 9509290001Sglebius for n in $library_names; do 9510290001Sglebius func_append rmfiles " $odir/$n" 9511290001Sglebius done 9512290001Sglebius test -n "$old_library" && func_append rmfiles " $odir/$old_library" 9513290001Sglebius 9514290001Sglebius case "$opt_mode" in 9515290001Sglebius clean) 9516290001Sglebius case " $library_names " in 9517290001Sglebius *" $dlname "*) ;; 9518290001Sglebius *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 9519290001Sglebius esac 9520290001Sglebius test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 9521290001Sglebius ;; 9522290001Sglebius uninstall) 9523290001Sglebius if test -n "$library_names"; then 9524290001Sglebius # Do each command in the postuninstall commands. 9525290001Sglebius func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9526290001Sglebius fi 9527290001Sglebius 9528290001Sglebius if test -n "$old_library"; then 9529290001Sglebius # Do each command in the old_postuninstall commands. 9530290001Sglebius func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9531290001Sglebius fi 9532290001Sglebius # FIXME: should reinstall the best remaining shared library. 9533290001Sglebius ;; 9534290001Sglebius esac 9535290001Sglebius fi 9536290001Sglebius ;; 9537290001Sglebius 9538290001Sglebius *.lo) 9539290001Sglebius # Possibly a libtool object, so verify it. 9540290001Sglebius if func_lalib_p "$file"; then 9541290001Sglebius 9542290001Sglebius # Read the .lo file 9543290001Sglebius func_source $dir/$name 9544290001Sglebius 9545290001Sglebius # Add PIC object to the list of files to remove. 9546290001Sglebius if test -n "$pic_object" && 9547290001Sglebius test "$pic_object" != none; then 9548290001Sglebius func_append rmfiles " $dir/$pic_object" 9549290001Sglebius fi 9550290001Sglebius 9551290001Sglebius # Add non-PIC object to the list of files to remove. 9552290001Sglebius if test -n "$non_pic_object" && 9553290001Sglebius test "$non_pic_object" != none; then 9554290001Sglebius func_append rmfiles " $dir/$non_pic_object" 9555290001Sglebius fi 9556290001Sglebius fi 9557290001Sglebius ;; 9558290001Sglebius 9559290001Sglebius *) 9560290001Sglebius if test "$opt_mode" = clean ; then 9561290001Sglebius noexename=$name 9562290001Sglebius case $file in 9563290001Sglebius *.exe) 9564290001Sglebius func_stripname '' '.exe' "$file" 9565290001Sglebius file=$func_stripname_result 9566290001Sglebius func_stripname '' '.exe' "$name" 9567290001Sglebius noexename=$func_stripname_result 9568290001Sglebius # $file with .exe has already been added to rmfiles, 9569290001Sglebius # add $file without .exe 9570290001Sglebius func_append rmfiles " $file" 9571290001Sglebius ;; 9572290001Sglebius esac 9573290001Sglebius # Do a test to see if this is a libtool program. 9574290001Sglebius if func_ltwrapper_p "$file"; then 9575290001Sglebius if func_ltwrapper_executable_p "$file"; then 9576290001Sglebius func_ltwrapper_scriptname "$file" 9577290001Sglebius relink_command= 9578290001Sglebius func_source $func_ltwrapper_scriptname_result 9579290001Sglebius func_append rmfiles " $func_ltwrapper_scriptname_result" 9580290001Sglebius else 9581290001Sglebius relink_command= 9582290001Sglebius func_source $dir/$noexename 9583290001Sglebius fi 9584290001Sglebius 9585290001Sglebius # note $name still contains .exe if it was in $file originally 9586290001Sglebius # as does the version of $file that was added into $rmfiles 9587290001Sglebius func_append rmfiles " $odir/$name $odir/${name}S.${objext}" 9588290001Sglebius if test "$fast_install" = yes && test -n "$relink_command"; then 9589290001Sglebius func_append rmfiles " $odir/lt-$name" 9590290001Sglebius fi 9591290001Sglebius if test "X$noexename" != "X$name" ; then 9592290001Sglebius func_append rmfiles " $odir/lt-${noexename}.c" 9593290001Sglebius fi 9594290001Sglebius fi 9595290001Sglebius fi 9596290001Sglebius ;; 9597290001Sglebius esac 9598290001Sglebius func_show_eval "$RM $rmfiles" 'exit_status=1' 9599290001Sglebius done 9600290001Sglebius 9601290001Sglebius # Try to remove the ${objdir}s in the directories where we deleted files 9602290001Sglebius for dir in $rmdirs; do 9603290001Sglebius if test -d "$dir"; then 9604290001Sglebius func_show_eval "rmdir $dir >/dev/null 2>&1" 9605290001Sglebius fi 9606290001Sglebius done 9607290001Sglebius 9608290001Sglebius exit $exit_status 9609290001Sglebius} 9610290001Sglebius 9611290001Sglebius{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && 9612290001Sglebius func_mode_uninstall ${1+"$@"} 9613290001Sglebius 9614290001Sglebiustest -z "$opt_mode" && { 9615290001Sglebius help="$generic_help" 9616290001Sglebius func_fatal_help "you must specify a MODE" 9617290001Sglebius} 9618290001Sglebius 9619290001Sglebiustest -z "$exec_cmd" && \ 9620290001Sglebius func_fatal_help "invalid operation mode \`$opt_mode'" 9621290001Sglebius 9622290001Sglebiusif test -n "$exec_cmd"; then 9623290001Sglebius eval exec "$exec_cmd" 9624290001Sglebius exit $EXIT_FAILURE 9625290001Sglebiusfi 9626290001Sglebius 9627290001Sglebiusexit $exit_status 9628290001Sglebius 9629290001Sglebius 9630290001Sglebius# The TAGs below are defined such that we never get into a situation 9631290001Sglebius# in which we disable both kinds of libraries. Given conflicting 9632290001Sglebius# choices, we go for a static library, that is the most portable, 9633290001Sglebius# since we can't tell whether shared libraries were disabled because 9634290001Sglebius# the user asked for that or because the platform doesn't support 9635290001Sglebius# them. This is particularly important on AIX, because we don't 9636290001Sglebius# support having both static and shared libraries enabled at the same 9637290001Sglebius# time on that platform, so we default to a shared-only configuration. 9638290001Sglebius# If a disable-shared tag is given, we'll fallback to a static-only 9639290001Sglebius# configuration. But we'll never go from static-only to shared-only. 9640290001Sglebius 9641290001Sglebius# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 9642290001Sglebiusbuild_libtool_libs=no 9643290001Sglebiusbuild_old_libs=yes 9644290001Sglebius# ### END LIBTOOL TAG CONFIG: disable-shared 9645290001Sglebius 9646290001Sglebius# ### BEGIN LIBTOOL TAG CONFIG: disable-static 9647290001Sglebiusbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 9648290001Sglebius# ### END LIBTOOL TAG CONFIG: disable-static 9649290001Sglebius 9650290001Sglebius# Local Variables: 9651290001Sglebius# mode:shell-script 9652290001Sglebius# sh-indentation:2 9653290001Sglebius# End: 9654290001Sglebius# vi:sw=2 9655290001Sglebius 9656