1290001Sglebius 2290001Sglebius# libtool (GNU libtool) 2.4 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 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 11181834Sroberto# it under the terms of the GNU General Public License as published by 12181834Sroberto# the Free Software Foundation; either version 2 of the License, or 13181834Sroberto# (at your option) any later version. 14181834Sroberto# 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 21181834Sroberto# WITHOUT ANY WARRANTY; without even the implied warranty of 22181834Sroberto# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23181834Sroberto# General Public License for more details. 24181834Sroberto# 25181834Sroberto# 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]... 32181834Sroberto# 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# --tag=TAG use configuration variables from tag TAG 45290001Sglebius# -v, --verbose print more informational messages than default 46290001Sglebius# --no-verbose don't print the extra informational messages 47290001Sglebius# --version print version information 48290001Sglebius# -h, --help, --help-all print short, long, or detailed help message 49290001Sglebius# 50290001Sglebius# MODE must be one of the following: 51290001Sglebius# 52290001Sglebius# clean remove files from the build directory 53290001Sglebius# compile compile a source file into a libtool object 54290001Sglebius# execute automatically set library path, then run a program 55290001Sglebius# finish complete the installation of libtool libraries 56290001Sglebius# install install libraries or executables 57290001Sglebius# link create a library or an executable 58290001Sglebius# uninstall remove libraries from an installed directory 59290001Sglebius# 60290001Sglebius# MODE-ARGS vary depending on the MODE. When passed as first option, 61290001Sglebius# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 62290001Sglebius# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 63290001Sglebius# 64290001Sglebius# When reporting a bug, please describe a test case to reproduce it and 65290001Sglebius# include the following information: 66290001Sglebius# 67290001Sglebius# host-triplet: $host 68290001Sglebius# shell: $SHELL 69290001Sglebius# compiler: $LTCC 70290001Sglebius# compiler flags: $LTCFLAGS 71290001Sglebius# linker: $LD (gnu? $with_gnu_ld) 72290001Sglebius# $progname: (GNU libtool) 2.4 73290001Sglebius# automake: $automake_version 74290001Sglebius# autoconf: $autoconf_version 75290001Sglebius# 76290001Sglebius# Report bugs to <bug-libtool@gnu.org>. 77290001Sglebius# GNU libtool home page: <http://www.gnu.org/software/libtool/>. 78290001Sglebius# General help using GNU software: <http://www.gnu.org/gethelp/>. 79181834Sroberto 80290001SglebiusPROGRAM=libtool 81290001SglebiusPACKAGE=libtool 82290001SglebiusVERSION=2.4 83290001SglebiusTIMESTAMP="" 84290001Sglebiuspackage_revision=1.3293 85181834Sroberto 86290001Sglebius# Be Bourne compatible 87290001Sglebiusif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 88290001Sglebius emulate sh 89290001Sglebius NULLCMD=: 90290001Sglebius # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 91290001Sglebius # is contrary to our usage. Disable this feature. 92290001Sglebius alias -g '${1+"$@"}'='"$@"' 93290001Sglebius setopt NO_GLOB_SUBST 94290001Sglebiuselse 95290001Sglebius case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 96290001Sglebiusfi 97290001SglebiusBIN_SH=xpg4; export BIN_SH # for Tru64 98290001SglebiusDUALCASE=1; export DUALCASE # for MKS sh 99290001Sglebius 100290001Sglebius# A function that is used when there is no print builtin or printf. 101290001Sglebiusfunc_fallback_echo () 102290001Sglebius{ 103290001Sglebius eval 'cat <<_LTECHO_EOF 104290001Sglebius$1 105290001Sglebius_LTECHO_EOF' 106290001Sglebius} 107290001Sglebius 108290001Sglebius# NLS nuisances: We save the old values to restore during execute mode. 109290001Sglebiuslt_user_locale= 110290001Sglebiuslt_safe_locale= 111290001Sglebiusfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 112290001Sglebiusdo 113290001Sglebius eval "if test \"\${$lt_var+set}\" = set; then 114290001Sglebius save_$lt_var=\$$lt_var 115290001Sglebius $lt_var=C 116290001Sglebius export $lt_var 117290001Sglebius lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 118290001Sglebius lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 119290001Sglebius fi" 120290001Sglebiusdone 121290001SglebiusLC_ALL=C 122290001SglebiusLANGUAGE=C 123290001Sglebiusexport LANGUAGE LC_ALL 124290001Sglebius 125290001Sglebius$lt_unset CDPATH 126290001Sglebius 127290001Sglebius 128181834Sroberto# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 129181834Sroberto# is ksh but when the shell is invoked as "sh" and the current value of 130181834Sroberto# the _XPG environment variable is not equal to 1 (one), the special 131181834Sroberto# positional parameter $0, within a function call, is the name of the 132181834Sroberto# function. 133181834Srobertoprogpath="$0" 134181834Sroberto 135181834Sroberto 136290001Sglebius 137290001Sglebius: ${CP="cp -f"} 138290001Sglebiustest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 139290001Sglebius: ${EGREP="grep -E"} 140290001Sglebius: ${FGREP="grep -F"} 141290001Sglebius: ${GREP="grep"} 142290001Sglebius: ${LN_S="ln -s"} 143290001Sglebius: ${MAKE="make"} 144290001Sglebius: ${MKDIR="mkdir"} 145290001Sglebius: ${MV="mv -f"} 146290001Sglebius: ${RM="rm -f"} 147290001Sglebius: ${SED="sed"} 148290001Sglebius: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 149290001Sglebius: ${Xsed="$SED -e 1s/^X//"} 150290001Sglebius 151181834Sroberto# Global variables: 152181834SrobertoEXIT_SUCCESS=0 153181834SrobertoEXIT_FAILURE=1 154290001SglebiusEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 155290001SglebiusEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 156181834Sroberto 157290001Sglebiusexit_status=$EXIT_SUCCESS 158181834Sroberto 159290001Sglebius# Make sure IFS has a sensible default 160290001Sglebiuslt_nl=' 161290001Sglebius' 162290001SglebiusIFS=" $lt_nl" 163181834Sroberto 164290001Sglebiusdirname="s,/[^/]*$,," 165290001Sglebiusbasename="s,^.*/,," 166181834Sroberto 167290001Sglebius# func_dirname file append nondir_replacement 168290001Sglebius# Compute the dirname of FILE. If nonempty, add APPEND to the result, 169290001Sglebius# otherwise set result to NONDIR_REPLACEMENT. 170290001Sglebiusfunc_dirname () 171290001Sglebius{ 172290001Sglebius func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` 173290001Sglebius if test "X$func_dirname_result" = "X${1}"; then 174290001Sglebius func_dirname_result="${3}" 175290001Sglebius else 176290001Sglebius func_dirname_result="$func_dirname_result${2}" 177290001Sglebius fi 178290001Sglebius} # func_dirname may be replaced by extended shell implementation 179181834Sroberto 180181834Sroberto 181290001Sglebius# func_basename file 182290001Sglebiusfunc_basename () 183290001Sglebius{ 184290001Sglebius func_basename_result=`$ECHO "${1}" | $SED "$basename"` 185290001Sglebius} # func_basename may be replaced by extended shell implementation 186290001Sglebius 187290001Sglebius 188290001Sglebius# func_dirname_and_basename file append nondir_replacement 189290001Sglebius# perform func_basename and func_dirname in a single function 190290001Sglebius# call: 191290001Sglebius# dirname: Compute the dirname of FILE. If nonempty, 192290001Sglebius# add APPEND to the result, otherwise set result 193290001Sglebius# to NONDIR_REPLACEMENT. 194290001Sglebius# value returned in "$func_dirname_result" 195290001Sglebius# basename: Compute filename of FILE. 196290001Sglebius# value retuned in "$func_basename_result" 197290001Sglebius# Implementation must be kept synchronized with func_dirname 198290001Sglebius# and func_basename. For efficiency, we do not delegate to 199290001Sglebius# those functions but instead duplicate the functionality here. 200290001Sglebiusfunc_dirname_and_basename () 201290001Sglebius{ 202290001Sglebius # Extract subdirectory from the argument. 203290001Sglebius func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 204290001Sglebius if test "X$func_dirname_result" = "X${1}"; then 205290001Sglebius func_dirname_result="${3}" 206290001Sglebius else 207290001Sglebius func_dirname_result="$func_dirname_result${2}" 208290001Sglebius fi 209290001Sglebius func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 210290001Sglebius} # func_dirname_and_basename may be replaced by extended shell implementation 211290001Sglebius 212290001Sglebius 213290001Sglebius# func_stripname prefix suffix name 214290001Sglebius# strip PREFIX and SUFFIX off of NAME. 215290001Sglebius# PREFIX and SUFFIX must not contain globbing or regex special 216290001Sglebius# characters, hashes, percent signs, but SUFFIX may contain a leading 217290001Sglebius# dot (in which case that matches only a dot). 218290001Sglebius# func_strip_suffix prefix name 219290001Sglebiusfunc_stripname () 220290001Sglebius{ 221290001Sglebius case ${2} in 222290001Sglebius .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; 223290001Sglebius *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; 224290001Sglebius esac 225290001Sglebius} # func_stripname may be replaced by extended shell implementation 226290001Sglebius 227290001Sglebius 228290001Sglebius# These SED scripts presuppose an absolute path with a trailing slash. 229290001Sglebiuspathcar='s,^/\([^/]*\).*$,\1,' 230290001Sglebiuspathcdr='s,^/[^/]*,,' 231290001Sglebiusremovedotparts=':dotsl 232290001Sglebius s@/\./@/@g 233290001Sglebius t dotsl 234290001Sglebius s,/\.$,/,' 235290001Sglebiuscollapseslashes='s@/\{1,\}@/@g' 236290001Sglebiusfinalslash='s,/*$,/,' 237290001Sglebius 238290001Sglebius# func_normal_abspath PATH 239290001Sglebius# Remove doubled-up and trailing slashes, "." path components, 240290001Sglebius# and cancel out any ".." path components in PATH after making 241290001Sglebius# it an absolute path. 242290001Sglebius# value returned in "$func_normal_abspath_result" 243290001Sglebiusfunc_normal_abspath () 244290001Sglebius{ 245290001Sglebius # Start from root dir and reassemble the path. 246290001Sglebius func_normal_abspath_result= 247290001Sglebius func_normal_abspath_tpath=$1 248290001Sglebius func_normal_abspath_altnamespace= 249290001Sglebius case $func_normal_abspath_tpath in 250290001Sglebius "") 251290001Sglebius # Empty path, that just means $cwd. 252290001Sglebius func_stripname '' '/' "`pwd`" 253290001Sglebius func_normal_abspath_result=$func_stripname_result 254290001Sglebius return 255290001Sglebius ;; 256290001Sglebius # The next three entries are used to spot a run of precisely 257290001Sglebius # two leading slashes without using negated character classes; 258290001Sglebius # we take advantage of case's first-match behaviour. 259290001Sglebius ///*) 260290001Sglebius # Unusual form of absolute path, do nothing. 261290001Sglebius ;; 262290001Sglebius //*) 263290001Sglebius # Not necessarily an ordinary path; POSIX reserves leading '//' 264290001Sglebius # and for example Cygwin uses it to access remote file shares 265290001Sglebius # over CIFS/SMB, so we conserve a leading double slash if found. 266290001Sglebius func_normal_abspath_altnamespace=/ 267290001Sglebius ;; 268290001Sglebius /*) 269290001Sglebius # Absolute path, do nothing. 270290001Sglebius ;; 271290001Sglebius *) 272290001Sglebius # Relative path, prepend $cwd. 273290001Sglebius func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 274290001Sglebius ;; 275290001Sglebius esac 276290001Sglebius # Cancel out all the simple stuff to save iterations. We also want 277290001Sglebius # the path to end with a slash for ease of parsing, so make sure 278290001Sglebius # there is one (and only one) here. 279290001Sglebius func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 280290001Sglebius -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 281290001Sglebius while :; do 282290001Sglebius # Processed it all yet? 283290001Sglebius if test "$func_normal_abspath_tpath" = / ; then 284290001Sglebius # If we ascended to the root using ".." the result may be empty now. 285290001Sglebius if test -z "$func_normal_abspath_result" ; then 286290001Sglebius func_normal_abspath_result=/ 287290001Sglebius fi 288290001Sglebius break 289290001Sglebius fi 290290001Sglebius func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 291290001Sglebius -e "$pathcar"` 292290001Sglebius func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 293290001Sglebius -e "$pathcdr"` 294290001Sglebius # Figure out what to do with it 295290001Sglebius case $func_normal_abspath_tcomponent in 296290001Sglebius "") 297290001Sglebius # Trailing empty path component, ignore it. 298290001Sglebius ;; 299290001Sglebius ..) 300290001Sglebius # Parent dir; strip last assembled component from result. 301290001Sglebius func_dirname "$func_normal_abspath_result" 302290001Sglebius func_normal_abspath_result=$func_dirname_result 303290001Sglebius ;; 304290001Sglebius *) 305290001Sglebius # Actual path component, append it. 306290001Sglebius func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 307290001Sglebius ;; 308290001Sglebius esac 309290001Sglebius done 310290001Sglebius # Restore leading double-slash if one was found on entry. 311290001Sglebius func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 312290001Sglebius} 313290001Sglebius 314290001Sglebius# func_relative_path SRCDIR DSTDIR 315290001Sglebius# generates a relative path from SRCDIR to DSTDIR, with a trailing 316290001Sglebius# slash if non-empty, suitable for immediately appending a filename 317290001Sglebius# without needing to append a separator. 318290001Sglebius# value returned in "$func_relative_path_result" 319290001Sglebiusfunc_relative_path () 320290001Sglebius{ 321290001Sglebius func_relative_path_result= 322290001Sglebius func_normal_abspath "$1" 323290001Sglebius func_relative_path_tlibdir=$func_normal_abspath_result 324290001Sglebius func_normal_abspath "$2" 325290001Sglebius func_relative_path_tbindir=$func_normal_abspath_result 326290001Sglebius 327290001Sglebius # Ascend the tree starting from libdir 328290001Sglebius while :; do 329290001Sglebius # check if we have found a prefix of bindir 330290001Sglebius case $func_relative_path_tbindir in 331290001Sglebius $func_relative_path_tlibdir) 332290001Sglebius # found an exact match 333290001Sglebius func_relative_path_tcancelled= 334290001Sglebius break 335290001Sglebius ;; 336290001Sglebius $func_relative_path_tlibdir*) 337290001Sglebius # found a matching prefix 338290001Sglebius func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 339290001Sglebius func_relative_path_tcancelled=$func_stripname_result 340290001Sglebius if test -z "$func_relative_path_result"; then 341290001Sglebius func_relative_path_result=. 342290001Sglebius fi 343290001Sglebius break 344290001Sglebius ;; 345290001Sglebius *) 346290001Sglebius func_dirname $func_relative_path_tlibdir 347290001Sglebius func_relative_path_tlibdir=${func_dirname_result} 348290001Sglebius if test "x$func_relative_path_tlibdir" = x ; then 349290001Sglebius # Have to descend all the way to the root! 350290001Sglebius func_relative_path_result=../$func_relative_path_result 351290001Sglebius func_relative_path_tcancelled=$func_relative_path_tbindir 352290001Sglebius break 353290001Sglebius fi 354290001Sglebius func_relative_path_result=../$func_relative_path_result 355290001Sglebius ;; 356290001Sglebius esac 357290001Sglebius done 358290001Sglebius 359290001Sglebius # Now calculate path; take care to avoid doubling-up slashes. 360290001Sglebius func_stripname '' '/' "$func_relative_path_result" 361290001Sglebius func_relative_path_result=$func_stripname_result 362290001Sglebius func_stripname '/' '/' "$func_relative_path_tcancelled" 363290001Sglebius if test "x$func_stripname_result" != x ; then 364290001Sglebius func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 365290001Sglebius fi 366290001Sglebius 367290001Sglebius # Normalisation. If bindir is libdir, return empty string, 368290001Sglebius # else relative path ending with a slash; either way, target 369290001Sglebius # file name can be directly appended. 370290001Sglebius if test ! -z "$func_relative_path_result"; then 371290001Sglebius func_stripname './' '' "$func_relative_path_result/" 372290001Sglebius func_relative_path_result=$func_stripname_result 373290001Sglebius fi 374290001Sglebius} 375290001Sglebius 376290001Sglebius# The name of this program: 377290001Sglebiusfunc_dirname_and_basename "$progpath" 378290001Sglebiusprogname=$func_basename_result 379290001Sglebius 380290001Sglebius# Make sure we have an absolute path for reexecution: 381290001Sglebiuscase $progpath in 382290001Sglebius [\\/]*|[A-Za-z]:\\*) ;; 383290001Sglebius *[\\/]*) 384290001Sglebius progdir=$func_dirname_result 385290001Sglebius progdir=`cd "$progdir" && pwd` 386290001Sglebius progpath="$progdir/$progname" 387290001Sglebius ;; 388290001Sglebius *) 389290001Sglebius save_IFS="$IFS" 390290001Sglebius IFS=: 391290001Sglebius for progdir in $PATH; do 392290001Sglebius IFS="$save_IFS" 393290001Sglebius test -x "$progdir/$progname" && break 394290001Sglebius done 395290001Sglebius IFS="$save_IFS" 396290001Sglebius test -n "$progdir" || progdir=`pwd` 397290001Sglebius progpath="$progdir/$progname" 398290001Sglebius ;; 399290001Sglebiusesac 400290001Sglebius 401181834Sroberto# Sed substitution that helps us do robust quoting. It backslashifies 402181834Sroberto# metacharacters that are still active within double-quoted strings. 403181834SrobertoXsed="${SED}"' -e 1s/^X//' 404290001Sglebiussed_quote_subst='s/\([`"$\\]\)/\\\1/g' 405181834Sroberto 406290001Sglebius# Same as above, but do not quote variable references. 407290001Sglebiusdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 408181834Sroberto 409290001Sglebius# Sed substitution that turns a string into a regex matching for the 410290001Sglebius# string literally. 411290001Sglebiussed_make_literal_regex='s,[].[^$\\*\/],\\&,g' 412181834Sroberto 413290001Sglebius# Sed substitution that converts a w32 file name or path 414290001Sglebius# which contains forward slashes, into one that contains 415290001Sglebius# (escaped) backslashes. A very naive implementation. 416290001Sglebiuslt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 417181834Sroberto 418290001Sglebius# Re-`\' parameter expansions in output of double_quote_subst that were 419290001Sglebius# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 420290001Sglebius# in input to double_quote_subst, that '$' was protected from expansion. 421290001Sglebius# Since each input `\' is now two `\'s, look for any number of runs of 422290001Sglebius# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 423290001Sglebiusbs='\\' 424290001Sglebiusbs2='\\\\' 425290001Sglebiusbs4='\\\\\\\\' 426290001Sglebiusdollar='\$' 427290001Sglebiussed_double_backslash="\ 428290001Sglebius s/$bs4/&\\ 429290001Sglebius/g 430290001Sglebius s/^$bs2$dollar/$bs&/ 431290001Sglebius s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 432290001Sglebius s/\n//g" 433181834Sroberto 434290001Sglebius# Standard options: 435290001Sglebiusopt_dry_run=false 436290001Sglebiusopt_help=false 437290001Sglebiusopt_quiet=false 438290001Sglebiusopt_verbose=false 439290001Sglebiusopt_warning=: 440181834Sroberto 441290001Sglebius# func_echo arg... 442290001Sglebius# Echo program name prefixed message, along with the current mode 443290001Sglebius# name if it has been set yet. 444290001Sglebiusfunc_echo () 445290001Sglebius{ 446290001Sglebius $ECHO "$progname: ${opt_mode+$opt_mode: }$*" 447290001Sglebius} 448290001Sglebius 449290001Sglebius# func_verbose arg... 450290001Sglebius# Echo program name prefixed message in verbose mode only. 451290001Sglebiusfunc_verbose () 452290001Sglebius{ 453290001Sglebius $opt_verbose && func_echo ${1+"$@"} 454290001Sglebius 455290001Sglebius # A bug in bash halts the script if the last line of a function 456290001Sglebius # fails when set -e is in force, so we need another command to 457290001Sglebius # work around that: 458290001Sglebius : 459290001Sglebius} 460290001Sglebius 461290001Sglebius# func_echo_all arg... 462290001Sglebius# Invoke $ECHO with all args, space-separated. 463290001Sglebiusfunc_echo_all () 464290001Sglebius{ 465290001Sglebius $ECHO "$*" 466290001Sglebius} 467290001Sglebius 468290001Sglebius# func_error arg... 469290001Sglebius# Echo program name prefixed message to standard error. 470290001Sglebiusfunc_error () 471290001Sglebius{ 472290001Sglebius $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 473290001Sglebius} 474290001Sglebius 475290001Sglebius# func_warning arg... 476290001Sglebius# Echo program name prefixed warning message to standard error. 477290001Sglebiusfunc_warning () 478290001Sglebius{ 479290001Sglebius $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 480290001Sglebius 481290001Sglebius # bash bug again: 482290001Sglebius : 483290001Sglebius} 484290001Sglebius 485290001Sglebius# func_fatal_error arg... 486290001Sglebius# Echo program name prefixed message to standard error, and exit. 487290001Sglebiusfunc_fatal_error () 488290001Sglebius{ 489290001Sglebius func_error ${1+"$@"} 490290001Sglebius exit $EXIT_FAILURE 491290001Sglebius} 492290001Sglebius 493290001Sglebius# func_fatal_help arg... 494290001Sglebius# Echo program name prefixed message to standard error, followed by 495290001Sglebius# a help hint, and exit. 496290001Sglebiusfunc_fatal_help () 497290001Sglebius{ 498290001Sglebius func_error ${1+"$@"} 499290001Sglebius func_fatal_error "$help" 500290001Sglebius} 501290001Sglebiushelp="Try \`$progname --help' for more information." ## default 502290001Sglebius 503290001Sglebius 504290001Sglebius# func_grep expression filename 505290001Sglebius# Check whether EXPRESSION matches any line of FILENAME, without output. 506290001Sglebiusfunc_grep () 507290001Sglebius{ 508290001Sglebius $GREP "$1" "$2" >/dev/null 2>&1 509290001Sglebius} 510290001Sglebius 511290001Sglebius 512290001Sglebius# func_mkdir_p directory-path 513290001Sglebius# Make sure the entire path to DIRECTORY-PATH is available. 514290001Sglebiusfunc_mkdir_p () 515290001Sglebius{ 516290001Sglebius my_directory_path="$1" 517290001Sglebius my_dir_list= 518290001Sglebius 519290001Sglebius if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 520290001Sglebius 521290001Sglebius # Protect directory names starting with `-' 522290001Sglebius case $my_directory_path in 523290001Sglebius -*) my_directory_path="./$my_directory_path" ;; 524290001Sglebius esac 525290001Sglebius 526290001Sglebius # While some portion of DIR does not yet exist... 527290001Sglebius while test ! -d "$my_directory_path"; do 528290001Sglebius # ...make a list in topmost first order. Use a colon delimited 529290001Sglebius # list incase some portion of path contains whitespace. 530290001Sglebius my_dir_list="$my_directory_path:$my_dir_list" 531290001Sglebius 532290001Sglebius # If the last portion added has no slash in it, the list is done 533290001Sglebius case $my_directory_path in */*) ;; *) break ;; esac 534290001Sglebius 535290001Sglebius # ...otherwise throw away the child directory and loop 536290001Sglebius my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 537290001Sglebius done 538290001Sglebius my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 539290001Sglebius 540290001Sglebius save_mkdir_p_IFS="$IFS"; IFS=':' 541290001Sglebius for my_dir in $my_dir_list; do 542290001Sglebius IFS="$save_mkdir_p_IFS" 543290001Sglebius # mkdir can fail with a `File exist' error if two processes 544290001Sglebius # try to create one of the directories concurrently. Don't 545290001Sglebius # stop in that case! 546290001Sglebius $MKDIR "$my_dir" 2>/dev/null || : 547290001Sglebius done 548290001Sglebius IFS="$save_mkdir_p_IFS" 549290001Sglebius 550290001Sglebius # Bail out if we (or some other process) failed to create a directory. 551290001Sglebius test -d "$my_directory_path" || \ 552290001Sglebius func_fatal_error "Failed to create \`$1'" 553290001Sglebius fi 554290001Sglebius} 555290001Sglebius 556290001Sglebius 557181834Sroberto# func_mktempdir [string] 558181834Sroberto# Make a temporary directory that won't clash with other running 559181834Sroberto# libtool processes, and avoids race conditions if possible. If 560181834Sroberto# given, STRING is the basename for that directory. 561181834Srobertofunc_mktempdir () 562181834Sroberto{ 563181834Sroberto my_template="${TMPDIR-/tmp}/${1-$progname}" 564181834Sroberto 565290001Sglebius if test "$opt_dry_run" = ":"; then 566181834Sroberto # Return a directory name, but don't create it in dry-run mode 567181834Sroberto my_tmpdir="${my_template}-$$" 568181834Sroberto else 569181834Sroberto 570181834Sroberto # If mktemp works, use that first and foremost 571181834Sroberto my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 572181834Sroberto 573181834Sroberto if test ! -d "$my_tmpdir"; then 574290001Sglebius # Failing that, at least try and use $RANDOM to avoid a race 575290001Sglebius my_tmpdir="${my_template}-${RANDOM-0}$$" 576181834Sroberto 577290001Sglebius save_mktempdir_umask=`umask` 578290001Sglebius umask 0077 579290001Sglebius $MKDIR "$my_tmpdir" 580290001Sglebius umask $save_mktempdir_umask 581181834Sroberto fi 582181834Sroberto 583181834Sroberto # If we're not in dry-run mode, bomb out on failure 584290001Sglebius test -d "$my_tmpdir" || \ 585290001Sglebius func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 586181834Sroberto fi 587181834Sroberto 588290001Sglebius $ECHO "$my_tmpdir" 589181834Sroberto} 590181834Sroberto 591181834Sroberto 592290001Sglebius# func_quote_for_eval arg 593290001Sglebius# Aesthetically quote ARG to be evaled later. 594290001Sglebius# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 595290001Sglebius# is double-quoted, suitable for a subsequent eval, whereas 596290001Sglebius# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 597290001Sglebius# which are still active within double quotes backslashified. 598290001Sglebiusfunc_quote_for_eval () 599181834Sroberto{ 600290001Sglebius case $1 in 601290001Sglebius *[\\\`\"\$]*) 602290001Sglebius func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 603290001Sglebius *) 604290001Sglebius func_quote_for_eval_unquoted_result="$1" ;; 605290001Sglebius esac 606290001Sglebius 607290001Sglebius case $func_quote_for_eval_unquoted_result in 608290001Sglebius # Double-quote args containing shell metacharacters to delay 609290001Sglebius # word splitting, command substitution and and variable 610290001Sglebius # expansion for a subsequent eval. 611290001Sglebius # Many Bourne shells cannot handle close brackets correctly 612290001Sglebius # in scan sets, so we specify it separately. 613290001Sglebius *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 614290001Sglebius func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 615290001Sglebius ;; 616290001Sglebius *) 617290001Sglebius func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 618290001Sglebius esac 619290001Sglebius} 620290001Sglebius 621290001Sglebius 622290001Sglebius# func_quote_for_expand arg 623290001Sglebius# Aesthetically quote ARG to be evaled later; same as above, 624290001Sglebius# but do not quote variable references. 625290001Sglebiusfunc_quote_for_expand () 626290001Sglebius{ 627290001Sglebius case $1 in 628290001Sglebius *[\\\`\"]*) 629290001Sglebius my_arg=`$ECHO "$1" | $SED \ 630290001Sglebius -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 631290001Sglebius *) 632290001Sglebius my_arg="$1" ;; 633290001Sglebius esac 634290001Sglebius 635290001Sglebius case $my_arg in 636290001Sglebius # Double-quote args containing shell metacharacters to delay 637290001Sglebius # word splitting and command substitution for a subsequent eval. 638290001Sglebius # Many Bourne shells cannot handle close brackets correctly 639290001Sglebius # in scan sets, so we specify it separately. 640290001Sglebius *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 641290001Sglebius my_arg="\"$my_arg\"" 642290001Sglebius ;; 643290001Sglebius esac 644290001Sglebius 645290001Sglebius func_quote_for_expand_result="$my_arg" 646290001Sglebius} 647290001Sglebius 648290001Sglebius 649290001Sglebius# func_show_eval cmd [fail_exp] 650290001Sglebius# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 651290001Sglebius# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 652290001Sglebius# is given, then evaluate it. 653290001Sglebiusfunc_show_eval () 654290001Sglebius{ 655290001Sglebius my_cmd="$1" 656290001Sglebius my_fail_exp="${2-:}" 657290001Sglebius 658290001Sglebius ${opt_silent-false} || { 659290001Sglebius func_quote_for_expand "$my_cmd" 660290001Sglebius eval "func_echo $func_quote_for_expand_result" 661290001Sglebius } 662290001Sglebius 663290001Sglebius if ${opt_dry_run-false}; then :; else 664290001Sglebius eval "$my_cmd" 665290001Sglebius my_status=$? 666290001Sglebius if test "$my_status" -eq 0; then :; else 667290001Sglebius eval "(exit $my_status); $my_fail_exp" 668290001Sglebius fi 669181834Sroberto fi 670290001Sglebius} 671290001Sglebius 672290001Sglebius 673290001Sglebius# func_show_eval_locale cmd [fail_exp] 674290001Sglebius# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 675290001Sglebius# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 676290001Sglebius# is given, then evaluate it. Use the saved locale for evaluation. 677290001Sglebiusfunc_show_eval_locale () 678290001Sglebius{ 679290001Sglebius my_cmd="$1" 680290001Sglebius my_fail_exp="${2-:}" 681290001Sglebius 682290001Sglebius ${opt_silent-false} || { 683290001Sglebius func_quote_for_expand "$my_cmd" 684290001Sglebius eval "func_echo $func_quote_for_expand_result" 685290001Sglebius } 686290001Sglebius 687290001Sglebius if ${opt_dry_run-false}; then :; else 688290001Sglebius eval "$lt_user_locale 689290001Sglebius $my_cmd" 690290001Sglebius my_status=$? 691290001Sglebius eval "$lt_safe_locale" 692290001Sglebius if test "$my_status" -eq 0; then :; else 693290001Sglebius eval "(exit $my_status); $my_fail_exp" 694290001Sglebius fi 695290001Sglebius fi 696290001Sglebius} 697290001Sglebius 698290001Sglebius# func_tr_sh 699290001Sglebius# Turn $1 into a string suitable for a shell variable name. 700290001Sglebius# Result is stored in $func_tr_sh_result. All characters 701290001Sglebius# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 702290001Sglebius# if $1 begins with a digit, a '_' is prepended as well. 703290001Sglebiusfunc_tr_sh () 704290001Sglebius{ 705290001Sglebius case $1 in 706290001Sglebius [0-9]* | *[!a-zA-Z0-9_]*) 707290001Sglebius func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` 708181834Sroberto ;; 709290001Sglebius * ) 710290001Sglebius func_tr_sh_result=$1 711181834Sroberto ;; 712290001Sglebius esac 713290001Sglebius} 714290001Sglebius 715290001Sglebius 716290001Sglebius# func_version 717290001Sglebius# Echo version message to standard output and exit. 718290001Sglebiusfunc_version () 719290001Sglebius{ 720290001Sglebius $opt_debug 721290001Sglebius 722290001Sglebius $SED -n '/(C)/!b go 723290001Sglebius :more 724290001Sglebius /\./!{ 725290001Sglebius N 726290001Sglebius s/\n# / / 727290001Sglebius b more 728290001Sglebius } 729290001Sglebius :go 730290001Sglebius /^# '$PROGRAM' (GNU /,/# warranty; / { 731290001Sglebius s/^# // 732290001Sglebius s/^# *$// 733290001Sglebius s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 734290001Sglebius p 735290001Sglebius }' < "$progpath" 736290001Sglebius exit $? 737290001Sglebius} 738290001Sglebius 739290001Sglebius# func_usage 740290001Sglebius# Echo short help message to standard output and exit. 741290001Sglebiusfunc_usage () 742290001Sglebius{ 743290001Sglebius $opt_debug 744290001Sglebius 745290001Sglebius $SED -n '/^# Usage:/,/^# *.*--help/ { 746290001Sglebius s/^# // 747290001Sglebius s/^# *$// 748290001Sglebius s/\$progname/'$progname'/ 749290001Sglebius p 750290001Sglebius }' < "$progpath" 751290001Sglebius echo 752290001Sglebius $ECHO "run \`$progname --help | more' for full usage" 753290001Sglebius exit $? 754290001Sglebius} 755290001Sglebius 756290001Sglebius# func_help [NOEXIT] 757290001Sglebius# Echo long help message to standard output and exit, 758290001Sglebius# unless 'noexit' is passed as argument. 759290001Sglebiusfunc_help () 760290001Sglebius{ 761290001Sglebius $opt_debug 762290001Sglebius 763290001Sglebius $SED -n '/^# Usage:/,/# Report bugs to/ { 764290001Sglebius :print 765290001Sglebius s/^# // 766290001Sglebius s/^# *$// 767290001Sglebius s*\$progname*'$progname'* 768290001Sglebius s*\$host*'"$host"'* 769290001Sglebius s*\$SHELL*'"$SHELL"'* 770290001Sglebius s*\$LTCC*'"$LTCC"'* 771290001Sglebius s*\$LTCFLAGS*'"$LTCFLAGS"'* 772290001Sglebius s*\$LD*'"$LD"'* 773290001Sglebius s/\$with_gnu_ld/'"$with_gnu_ld"'/ 774290001Sglebius s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 775290001Sglebius s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 776290001Sglebius p 777290001Sglebius d 778290001Sglebius } 779290001Sglebius /^# .* home page:/b print 780290001Sglebius /^# General help using/b print 781290001Sglebius ' < "$progpath" 782290001Sglebius ret=$? 783290001Sglebius if test -z "$1"; then 784290001Sglebius exit $ret 785290001Sglebius fi 786290001Sglebius} 787290001Sglebius 788290001Sglebius# func_missing_arg argname 789290001Sglebius# Echo program name prefixed message to standard error and set global 790290001Sglebius# exit_cmd. 791290001Sglebiusfunc_missing_arg () 792290001Sglebius{ 793290001Sglebius $opt_debug 794290001Sglebius 795290001Sglebius func_error "missing argument for $1." 796290001Sglebius exit_cmd=exit 797290001Sglebius} 798290001Sglebius 799290001Sglebius 800290001Sglebius# func_split_short_opt shortopt 801290001Sglebius# Set func_split_short_opt_name and func_split_short_opt_arg shell 802290001Sglebius# variables after splitting SHORTOPT after the 2nd character. 803290001Sglebiusfunc_split_short_opt () 804290001Sglebius{ 805290001Sglebius my_sed_short_opt='1s/^\(..\).*$/\1/;q' 806290001Sglebius my_sed_short_rest='1s/^..\(.*\)$/\1/;q' 807290001Sglebius 808290001Sglebius func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` 809290001Sglebius func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` 810290001Sglebius} # func_split_short_opt may be replaced by extended shell implementation 811290001Sglebius 812290001Sglebius 813290001Sglebius# func_split_long_opt longopt 814290001Sglebius# Set func_split_long_opt_name and func_split_long_opt_arg shell 815290001Sglebius# variables after splitting LONGOPT at the `=' sign. 816290001Sglebiusfunc_split_long_opt () 817290001Sglebius{ 818290001Sglebius my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' 819290001Sglebius my_sed_long_arg='1s/^--[^=]*=//' 820290001Sglebius 821290001Sglebius func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` 822290001Sglebius func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` 823290001Sglebius} # func_split_long_opt may be replaced by extended shell implementation 824290001Sglebius 825290001Sglebiusexit_cmd=: 826290001Sglebius 827290001Sglebius 828290001Sglebius 829290001Sglebius 830290001Sglebius 831290001Sglebiusmagic="%%%MAGIC variable%%%" 832290001Sglebiusmagic_exe="%%%MAGIC EXE variable%%%" 833290001Sglebius 834290001Sglebius# Global variables. 835290001Sglebiusnonopt= 836290001Sglebiuspreserve_args= 837290001Sglebiuslo2o="s/\\.lo\$/.${objext}/" 838290001Sglebiuso2lo="s/\\.${objext}\$/.lo/" 839290001Sglebiusextracted_archives= 840290001Sglebiusextracted_serial=0 841290001Sglebius 842290001Sglebius# If this variable is set in any of the actions, the command in it 843290001Sglebius# will be execed at the end. This prevents here-documents from being 844290001Sglebius# left over by shells. 845290001Sglebiusexec_cmd= 846290001Sglebius 847290001Sglebius# func_append var value 848290001Sglebius# Append VALUE to the end of shell variable VAR. 849290001Sglebiusfunc_append () 850290001Sglebius{ 851290001Sglebius eval "${1}=\$${1}\${2}" 852290001Sglebius} # func_append may be replaced by extended shell implementation 853290001Sglebius 854290001Sglebius# func_append_quoted var value 855290001Sglebius# Quote VALUE and append to the end of shell variable VAR, separated 856290001Sglebius# by a space. 857290001Sglebiusfunc_append_quoted () 858290001Sglebius{ 859290001Sglebius func_quote_for_eval "${2}" 860290001Sglebius eval "${1}=\$${1}\\ \$func_quote_for_eval_result" 861290001Sglebius} # func_append_quoted may be replaced by extended shell implementation 862290001Sglebius 863290001Sglebius 864290001Sglebius# func_arith arithmetic-term... 865290001Sglebiusfunc_arith () 866290001Sglebius{ 867290001Sglebius func_arith_result=`expr "${@}"` 868290001Sglebius} # func_arith may be replaced by extended shell implementation 869290001Sglebius 870290001Sglebius 871290001Sglebius# func_len string 872290001Sglebius# STRING may not start with a hyphen. 873290001Sglebiusfunc_len () 874290001Sglebius{ 875290001Sglebius func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` 876290001Sglebius} # func_len may be replaced by extended shell implementation 877290001Sglebius 878290001Sglebius 879290001Sglebius# func_lo2o object 880290001Sglebiusfunc_lo2o () 881290001Sglebius{ 882290001Sglebius func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` 883290001Sglebius} # func_lo2o may be replaced by extended shell implementation 884290001Sglebius 885290001Sglebius 886290001Sglebius# func_xform libobj-or-source 887290001Sglebiusfunc_xform () 888290001Sglebius{ 889290001Sglebius func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` 890290001Sglebius} # func_xform may be replaced by extended shell implementation 891290001Sglebius 892290001Sglebius 893290001Sglebius# func_fatal_configuration arg... 894290001Sglebius# Echo program name prefixed message to standard error, followed by 895290001Sglebius# a configuration failure hint, and exit. 896290001Sglebiusfunc_fatal_configuration () 897290001Sglebius{ 898290001Sglebius func_error ${1+"$@"} 899290001Sglebius func_error "See the $PACKAGE documentation for more information." 900290001Sglebius func_fatal_error "Fatal configuration error." 901290001Sglebius} 902290001Sglebius 903290001Sglebius 904290001Sglebius# func_config 905290001Sglebius# Display the configuration for all the tags in this script. 906290001Sglebiusfunc_config () 907290001Sglebius{ 908290001Sglebius re_begincf='^# ### BEGIN LIBTOOL' 909290001Sglebius re_endcf='^# ### END LIBTOOL' 910290001Sglebius 911290001Sglebius # Default configuration. 912290001Sglebius $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 913290001Sglebius 914290001Sglebius # Now print the configurations for the tags. 915290001Sglebius for tagname in $taglist; do 916290001Sglebius $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 917290001Sglebius done 918290001Sglebius 919290001Sglebius exit $? 920290001Sglebius} 921290001Sglebius 922290001Sglebius# func_features 923290001Sglebius# Display the features supported by this script. 924290001Sglebiusfunc_features () 925290001Sglebius{ 926290001Sglebius echo "host: $host" 927290001Sglebius if test "$build_libtool_libs" = yes; then 928290001Sglebius echo "enable shared libraries" 929290001Sglebius else 930290001Sglebius echo "disable shared libraries" 931290001Sglebius fi 932290001Sglebius if test "$build_old_libs" = yes; then 933290001Sglebius echo "enable static libraries" 934290001Sglebius else 935290001Sglebius echo "disable static libraries" 936290001Sglebius fi 937290001Sglebius 938290001Sglebius exit $? 939290001Sglebius} 940290001Sglebius 941290001Sglebius# func_enable_tag tagname 942290001Sglebius# Verify that TAGNAME is valid, and either flag an error and exit, or 943290001Sglebius# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 944290001Sglebius# variable here. 945290001Sglebiusfunc_enable_tag () 946290001Sglebius{ 947290001Sglebius # Global variable: 948290001Sglebius tagname="$1" 949290001Sglebius 950290001Sglebius re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 951290001Sglebius re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 952290001Sglebius sed_extractcf="/$re_begincf/,/$re_endcf/p" 953290001Sglebius 954290001Sglebius # Validate tagname. 955290001Sglebius case $tagname in 956290001Sglebius *[!-_A-Za-z0-9,/]*) 957290001Sglebius func_fatal_error "invalid tag name: $tagname" 958181834Sroberto ;; 959290001Sglebius esac 960290001Sglebius 961290001Sglebius # Don't test for the "default" C tag, as we know it's 962290001Sglebius # there but not specially marked. 963290001Sglebius case $tagname in 964290001Sglebius CC) ;; 965290001Sglebius *) 966290001Sglebius if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 967290001Sglebius taglist="$taglist $tagname" 968290001Sglebius 969290001Sglebius # Evaluate the configuration. Be careful to quote the path 970290001Sglebius # and the sed script, to avoid splitting on whitespace, but 971290001Sglebius # also don't use non-portable quotes within backquotes within 972290001Sglebius # quotes we have to do it in 2 steps: 973290001Sglebius extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 974290001Sglebius eval "$extractedcf" 975290001Sglebius else 976290001Sglebius func_error "ignoring unknown tag $tagname" 977290001Sglebius fi 978290001Sglebius ;; 979290001Sglebius esac 980290001Sglebius} 981290001Sglebius 982290001Sglebius# func_check_version_match 983290001Sglebius# Ensure that we are using m4 macros, and libtool script from the same 984290001Sglebius# release of libtool. 985290001Sglebiusfunc_check_version_match () 986290001Sglebius{ 987290001Sglebius if test "$package_revision" != "$macro_revision"; then 988290001Sglebius if test "$VERSION" != "$macro_version"; then 989290001Sglebius if test -z "$macro_version"; then 990290001Sglebius cat >&2 <<_LT_EOF 991290001Sglebius$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 992290001Sglebius$progname: definition of this LT_INIT comes from an older release. 993290001Sglebius$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 994290001Sglebius$progname: and run autoconf again. 995290001Sglebius_LT_EOF 996290001Sglebius else 997290001Sglebius cat >&2 <<_LT_EOF 998290001Sglebius$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 999290001Sglebius$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 1000290001Sglebius$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 1001290001Sglebius$progname: and run autoconf again. 1002290001Sglebius_LT_EOF 1003290001Sglebius fi 1004290001Sglebius else 1005290001Sglebius cat >&2 <<_LT_EOF 1006290001Sglebius$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 1007290001Sglebius$progname: but the definition of this LT_INIT comes from revision $macro_revision. 1008290001Sglebius$progname: You should recreate aclocal.m4 with macros from revision $package_revision 1009290001Sglebius$progname: of $PACKAGE $VERSION and run autoconf again. 1010290001Sglebius_LT_EOF 1011290001Sglebius fi 1012290001Sglebius 1013290001Sglebius exit $EXIT_MISMATCH 1014290001Sglebius fi 1015290001Sglebius} 1016290001Sglebius 1017290001Sglebius 1018290001Sglebius# Shorthand for --mode=foo, only valid as the first argument 1019290001Sglebiuscase $1 in 1020290001Sglebiusclean|clea|cle|cl) 1021290001Sglebius shift; set dummy --mode clean ${1+"$@"}; shift 1022290001Sglebius ;; 1023290001Sglebiuscompile|compil|compi|comp|com|co|c) 1024290001Sglebius shift; set dummy --mode compile ${1+"$@"}; shift 1025290001Sglebius ;; 1026290001Sglebiusexecute|execut|execu|exec|exe|ex|e) 1027290001Sglebius shift; set dummy --mode execute ${1+"$@"}; shift 1028290001Sglebius ;; 1029290001Sglebiusfinish|finis|fini|fin|fi|f) 1030290001Sglebius shift; set dummy --mode finish ${1+"$@"}; shift 1031290001Sglebius ;; 1032290001Sglebiusinstall|instal|insta|inst|ins|in|i) 1033290001Sglebius shift; set dummy --mode install ${1+"$@"}; shift 1034290001Sglebius ;; 1035290001Sglebiuslink|lin|li|l) 1036290001Sglebius shift; set dummy --mode link ${1+"$@"}; shift 1037290001Sglebius ;; 1038290001Sglebiusuninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 1039290001Sglebius shift; set dummy --mode uninstall ${1+"$@"}; shift 1040290001Sglebius ;; 1041290001Sglebiusesac 1042290001Sglebius 1043290001Sglebius 1044290001Sglebius 1045290001Sglebius# Option defaults: 1046290001Sglebiusopt_debug=: 1047290001Sglebiusopt_dry_run=false 1048290001Sglebiusopt_config=false 1049290001Sglebiusopt_preserve_dup_deps=false 1050290001Sglebiusopt_features=false 1051290001Sglebiusopt_finish=false 1052290001Sglebiusopt_help=false 1053290001Sglebiusopt_help_all=false 1054290001Sglebiusopt_silent=: 1055290001Sglebiusopt_verbose=: 1056290001Sglebiusopt_silent=false 1057290001Sglebiusopt_verbose=false 1058290001Sglebius 1059290001Sglebius 1060290001Sglebius# Parse options once, thoroughly. This comes as soon as possible in the 1061290001Sglebius# script to make things like `--version' happen as quickly as we can. 1062290001Sglebius{ 1063290001Sglebius # this just eases exit handling 1064290001Sglebius while test $# -gt 0; do 1065290001Sglebius opt="$1" 1066290001Sglebius shift 1067290001Sglebius case $opt in 1068290001Sglebius --debug|-x) opt_debug='set -x' 1069290001Sglebius func_echo "enabling shell trace mode" 1070290001Sglebius $opt_debug 1071290001Sglebius ;; 1072290001Sglebius --dry-run|--dryrun|-n) 1073290001Sglebius opt_dry_run=: 1074290001Sglebius ;; 1075290001Sglebius --config) 1076290001Sglebius opt_config=: 1077290001Sglebiusfunc_config 1078290001Sglebius ;; 1079290001Sglebius --dlopen|-dlopen) 1080290001Sglebius optarg="$1" 1081290001Sglebius opt_dlopen="${opt_dlopen+$opt_dlopen 1082290001Sglebius}$optarg" 1083290001Sglebius shift 1084290001Sglebius ;; 1085290001Sglebius --preserve-dup-deps) 1086290001Sglebius opt_preserve_dup_deps=: 1087290001Sglebius ;; 1088290001Sglebius --features) 1089290001Sglebius opt_features=: 1090290001Sglebiusfunc_features 1091290001Sglebius ;; 1092290001Sglebius --finish) 1093290001Sglebius opt_finish=: 1094290001Sglebiusset dummy --mode finish ${1+"$@"}; shift 1095290001Sglebius ;; 1096290001Sglebius --help) 1097290001Sglebius opt_help=: 1098290001Sglebius ;; 1099290001Sglebius --help-all) 1100290001Sglebius opt_help_all=: 1101290001Sglebiusopt_help=': help-all' 1102290001Sglebius ;; 1103290001Sglebius --mode) 1104290001Sglebius test $# = 0 && func_missing_arg $opt && break 1105290001Sglebius optarg="$1" 1106290001Sglebius opt_mode="$optarg" 1107290001Sglebiuscase $optarg in 1108290001Sglebius # Valid mode arguments: 1109290001Sglebius clean|compile|execute|finish|install|link|relink|uninstall) ;; 1110290001Sglebius 1111290001Sglebius # Catch anything else as an error 1112290001Sglebius *) func_error "invalid argument for $opt" 1113290001Sglebius exit_cmd=exit 1114290001Sglebius break 1115290001Sglebius ;; 1116290001Sglebiusesac 1117290001Sglebius shift 1118290001Sglebius ;; 1119290001Sglebius --no-silent|--no-quiet) 1120290001Sglebius opt_silent=false 1121290001Sglebiusfunc_append preserve_args " $opt" 1122290001Sglebius ;; 1123290001Sglebius --no-verbose) 1124290001Sglebius opt_verbose=false 1125290001Sglebiusfunc_append preserve_args " $opt" 1126290001Sglebius ;; 1127290001Sglebius --silent|--quiet) 1128290001Sglebius opt_silent=: 1129290001Sglebiusfunc_append preserve_args " $opt" 1130290001Sglebius opt_verbose=false 1131290001Sglebius ;; 1132290001Sglebius --verbose|-v) 1133290001Sglebius opt_verbose=: 1134290001Sglebiusfunc_append preserve_args " $opt" 1135290001Sglebiusopt_silent=false 1136290001Sglebius ;; 1137290001Sglebius --tag) 1138290001Sglebius test $# = 0 && func_missing_arg $opt && break 1139290001Sglebius optarg="$1" 1140290001Sglebius opt_tag="$optarg" 1141290001Sglebiusfunc_append preserve_args " $opt $optarg" 1142290001Sglebiusfunc_enable_tag "$optarg" 1143290001Sglebius shift 1144290001Sglebius ;; 1145290001Sglebius 1146290001Sglebius -\?|-h) func_usage ;; 1147290001Sglebius --help) func_help ;; 1148290001Sglebius --version) func_version ;; 1149290001Sglebius 1150290001Sglebius # Separate optargs to long options: 1151290001Sglebius --*=*) 1152290001Sglebius func_split_long_opt "$opt" 1153290001Sglebius set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} 1154290001Sglebius shift 1155290001Sglebius ;; 1156290001Sglebius 1157290001Sglebius # Separate non-argument short options: 1158290001Sglebius -\?*|-h*|-n*|-v*) 1159290001Sglebius func_split_short_opt "$opt" 1160290001Sglebius set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} 1161290001Sglebius shift 1162290001Sglebius ;; 1163290001Sglebius 1164290001Sglebius --) break ;; 1165290001Sglebius -*) func_fatal_help "unrecognized option \`$opt'" ;; 1166290001Sglebius *) set dummy "$opt" ${1+"$@"}; shift; break ;; 1167181834Sroberto esac 1168290001Sglebius done 1169290001Sglebius 1170290001Sglebius # Validate options: 1171290001Sglebius 1172290001Sglebius # save first non-option argument 1173290001Sglebius if test "$#" -gt 0; then 1174290001Sglebius nonopt="$opt" 1175290001Sglebius shift 1176290001Sglebius fi 1177290001Sglebius 1178290001Sglebius # preserve --debug 1179290001Sglebius test "$opt_debug" = : || func_append preserve_args " --debug" 1180290001Sglebius 1181290001Sglebius case $host in 1182290001Sglebius *cygwin* | *mingw* | *pw32* | *cegcc*) 1183290001Sglebius # don't eliminate duplications in $postdeps and $predeps 1184290001Sglebius opt_duplicate_compiler_generated_deps=: 1185290001Sglebius ;; 1186290001Sglebius *) 1187290001Sglebius opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 1188290001Sglebius ;; 1189290001Sglebius esac 1190290001Sglebius 1191290001Sglebius $opt_help || { 1192290001Sglebius # Sanity checks first: 1193290001Sglebius func_check_version_match 1194290001Sglebius 1195290001Sglebius if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 1196290001Sglebius func_fatal_configuration "not configured to build any kind of library" 1197290001Sglebius fi 1198290001Sglebius 1199290001Sglebius # Darwin sucks 1200290001Sglebius eval std_shrext=\"$shrext_cmds\" 1201290001Sglebius 1202290001Sglebius # Only execute mode is allowed to have -dlopen flags. 1203290001Sglebius if test -n "$opt_dlopen" && test "$opt_mode" != execute; then 1204290001Sglebius func_error "unrecognized option \`-dlopen'" 1205290001Sglebius $ECHO "$help" 1>&2 1206290001Sglebius exit $EXIT_FAILURE 1207290001Sglebius fi 1208290001Sglebius 1209290001Sglebius # Change the help message to a mode-specific one. 1210290001Sglebius generic_help="$help" 1211290001Sglebius help="Try \`$progname --help --mode=$opt_mode' for more information." 1212290001Sglebius } 1213290001Sglebius 1214290001Sglebius 1215290001Sglebius # Bail if the options were screwed 1216290001Sglebius $exit_cmd $EXIT_FAILURE 1217290001Sglebius} 1218290001Sglebius 1219290001Sglebius 1220290001Sglebius 1221290001Sglebius 1222290001Sglebius## ----------- ## 1223290001Sglebius## Main. ## 1224290001Sglebius## ----------- ## 1225290001Sglebius 1226290001Sglebius# func_lalib_p file 1227290001Sglebius# True iff FILE is a libtool `.la' library or `.lo' object file. 1228290001Sglebius# This function is only a basic sanity check; it will hardly flush out 1229290001Sglebius# determined imposters. 1230290001Sglebiusfunc_lalib_p () 1231290001Sglebius{ 1232290001Sglebius test -f "$1" && 1233290001Sglebius $SED -e 4q "$1" 2>/dev/null \ 1234290001Sglebius | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 1235290001Sglebius} 1236290001Sglebius 1237290001Sglebius# func_lalib_unsafe_p file 1238290001Sglebius# True iff FILE is a libtool `.la' library or `.lo' object file. 1239290001Sglebius# This function implements the same check as func_lalib_p without 1240290001Sglebius# resorting to external programs. To this end, it redirects stdin and 1241290001Sglebius# closes it afterwards, without saving the original file descriptor. 1242290001Sglebius# As a safety measure, use it only where a negative result would be 1243290001Sglebius# fatal anyway. Works if `file' does not exist. 1244290001Sglebiusfunc_lalib_unsafe_p () 1245290001Sglebius{ 1246290001Sglebius lalib_p=no 1247290001Sglebius if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 1248290001Sglebius for lalib_p_l in 1 2 3 4 1249290001Sglebius do 1250290001Sglebius read lalib_p_line 1251290001Sglebius case "$lalib_p_line" in 1252290001Sglebius \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 1253290001Sglebius esac 1254290001Sglebius done 1255290001Sglebius exec 0<&5 5<&- 1256290001Sglebius fi 1257290001Sglebius test "$lalib_p" = yes 1258290001Sglebius} 1259290001Sglebius 1260290001Sglebius# func_ltwrapper_script_p file 1261290001Sglebius# True iff FILE is a libtool wrapper script 1262290001Sglebius# This function is only a basic sanity check; it will hardly flush out 1263290001Sglebius# determined imposters. 1264290001Sglebiusfunc_ltwrapper_script_p () 1265290001Sglebius{ 1266290001Sglebius func_lalib_p "$1" 1267290001Sglebius} 1268290001Sglebius 1269290001Sglebius# func_ltwrapper_executable_p file 1270290001Sglebius# True iff FILE is a libtool wrapper executable 1271290001Sglebius# This function is only a basic sanity check; it will hardly flush out 1272290001Sglebius# determined imposters. 1273290001Sglebiusfunc_ltwrapper_executable_p () 1274290001Sglebius{ 1275290001Sglebius func_ltwrapper_exec_suffix= 1276290001Sglebius case $1 in 1277290001Sglebius *.exe) ;; 1278290001Sglebius *) func_ltwrapper_exec_suffix=.exe ;; 1279290001Sglebius esac 1280290001Sglebius $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 1281290001Sglebius} 1282290001Sglebius 1283290001Sglebius# func_ltwrapper_scriptname file 1284290001Sglebius# Assumes file is an ltwrapper_executable 1285290001Sglebius# uses $file to determine the appropriate filename for a 1286290001Sglebius# temporary ltwrapper_script. 1287290001Sglebiusfunc_ltwrapper_scriptname () 1288290001Sglebius{ 1289290001Sglebius func_dirname_and_basename "$1" "" "." 1290290001Sglebius func_stripname '' '.exe' "$func_basename_result" 1291290001Sglebius func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 1292290001Sglebius} 1293290001Sglebius 1294290001Sglebius# func_ltwrapper_p file 1295290001Sglebius# True iff FILE is a libtool wrapper script or wrapper executable 1296290001Sglebius# This function is only a basic sanity check; it will hardly flush out 1297290001Sglebius# determined imposters. 1298290001Sglebiusfunc_ltwrapper_p () 1299290001Sglebius{ 1300290001Sglebius func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 1301290001Sglebius} 1302290001Sglebius 1303290001Sglebius 1304290001Sglebius# func_execute_cmds commands fail_cmd 1305290001Sglebius# Execute tilde-delimited COMMANDS. 1306290001Sglebius# If FAIL_CMD is given, eval that upon failure. 1307290001Sglebius# FAIL_CMD may read-access the current command in variable CMD! 1308290001Sglebiusfunc_execute_cmds () 1309290001Sglebius{ 1310290001Sglebius $opt_debug 1311290001Sglebius save_ifs=$IFS; IFS='~' 1312290001Sglebius for cmd in $1; do 1313290001Sglebius IFS=$save_ifs 1314290001Sglebius eval cmd=\"$cmd\" 1315290001Sglebius func_show_eval "$cmd" "${2-:}" 1316290001Sglebius done 1317290001Sglebius IFS=$save_ifs 1318290001Sglebius} 1319290001Sglebius 1320290001Sglebius 1321290001Sglebius# func_source file 1322290001Sglebius# Source FILE, adding directory component if necessary. 1323290001Sglebius# Note that it is not necessary on cygwin/mingw to append a dot to 1324290001Sglebius# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 1325290001Sglebius# behavior happens only for exec(3), not for open(2)! Also, sourcing 1326290001Sglebius# `FILE.' does not work on cygwin managed mounts. 1327290001Sglebiusfunc_source () 1328290001Sglebius{ 1329290001Sglebius $opt_debug 1330290001Sglebius case $1 in 1331290001Sglebius */* | *\\*) . "$1" ;; 1332290001Sglebius *) . "./$1" ;; 1333290001Sglebius esac 1334290001Sglebius} 1335290001Sglebius 1336290001Sglebius 1337290001Sglebius# func_resolve_sysroot PATH 1338290001Sglebius# Replace a leading = in PATH with a sysroot. Store the result into 1339290001Sglebius# func_resolve_sysroot_result 1340290001Sglebiusfunc_resolve_sysroot () 1341290001Sglebius{ 1342290001Sglebius func_resolve_sysroot_result=$1 1343290001Sglebius case $func_resolve_sysroot_result in 1344290001Sglebius =*) 1345290001Sglebius func_stripname '=' '' "$func_resolve_sysroot_result" 1346290001Sglebius func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 1347181834Sroberto ;; 1348181834Sroberto esac 1349181834Sroberto} 1350181834Sroberto 1351290001Sglebius# func_replace_sysroot PATH 1352290001Sglebius# If PATH begins with the sysroot, replace it with = and 1353290001Sglebius# store the result into func_replace_sysroot_result. 1354290001Sglebiusfunc_replace_sysroot () 1355290001Sglebius{ 1356290001Sglebius case "$lt_sysroot:$1" in 1357290001Sglebius ?*:"$lt_sysroot"*) 1358290001Sglebius func_stripname "$lt_sysroot" '' "$1" 1359290001Sglebius func_replace_sysroot_result="=$func_stripname_result" 1360290001Sglebius ;; 1361290001Sglebius *) 1362290001Sglebius # Including no sysroot. 1363290001Sglebius func_replace_sysroot_result=$1 1364290001Sglebius ;; 1365290001Sglebius esac 1366290001Sglebius} 1367181834Sroberto 1368181834Sroberto# func_infer_tag arg 1369181834Sroberto# Infer tagged configuration to use if any are available and 1370181834Sroberto# if one wasn't chosen via the "--tag" command line option. 1371181834Sroberto# Only attempt this if the compiler in the base compile 1372181834Sroberto# command doesn't match the default compiler. 1373181834Sroberto# arg is usually of the form 'gcc ...' 1374181834Srobertofunc_infer_tag () 1375181834Sroberto{ 1376290001Sglebius $opt_debug 1377181834Sroberto if test -n "$available_tags" && test -z "$tagname"; then 1378181834Sroberto CC_quoted= 1379181834Sroberto for arg in $CC; do 1380290001Sglebius func_append_quoted CC_quoted "$arg" 1381181834Sroberto done 1382290001Sglebius CC_expanded=`func_echo_all $CC` 1383290001Sglebius CC_quoted_expanded=`func_echo_all $CC_quoted` 1384181834Sroberto case $@ in 1385181834Sroberto # Blanks in the command may have been stripped by the calling shell, 1386181834Sroberto # but not from the CC environment variable when configure was run. 1387290001Sglebius " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1388290001Sglebius " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 1389181834Sroberto # Blanks at the start of $base_compile will cause this to fail 1390181834Sroberto # if we don't check for them as well. 1391181834Sroberto *) 1392181834Sroberto for z in $available_tags; do 1393290001Sglebius if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 1394181834Sroberto # Evaluate the configuration. 1395181834Sroberto eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 1396181834Sroberto CC_quoted= 1397181834Sroberto for arg in $CC; do 1398290001Sglebius # Double-quote args containing other shell metacharacters. 1399290001Sglebius func_append_quoted CC_quoted "$arg" 1400290001Sglebius done 1401290001Sglebius CC_expanded=`func_echo_all $CC` 1402290001Sglebius CC_quoted_expanded=`func_echo_all $CC_quoted` 1403181834Sroberto case "$@ " in 1404290001Sglebius " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1405290001Sglebius " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 1406181834Sroberto # The compiler in the base compile command matches 1407181834Sroberto # the one in the tagged configuration. 1408181834Sroberto # Assume this is the tagged configuration we want. 1409181834Sroberto tagname=$z 1410181834Sroberto break 1411181834Sroberto ;; 1412181834Sroberto esac 1413181834Sroberto fi 1414181834Sroberto done 1415181834Sroberto # If $tagname still isn't set, then no tagged configuration 1416181834Sroberto # was found and let the user know that the "--tag" command 1417181834Sroberto # line option must be used. 1418181834Sroberto if test -z "$tagname"; then 1419290001Sglebius func_echo "unable to infer tagged configuration" 1420290001Sglebius func_fatal_error "specify a tag with \`--tag'" 1421290001Sglebius# else 1422290001Sglebius# func_verbose "using $tagname tagged configuration" 1423181834Sroberto fi 1424181834Sroberto ;; 1425181834Sroberto esac 1426181834Sroberto fi 1427181834Sroberto} 1428181834Sroberto 1429181834Sroberto 1430290001Sglebius 1431290001Sglebius# func_write_libtool_object output_name pic_name nonpic_name 1432290001Sglebius# Create a libtool object file (analogous to a ".la" file), 1433290001Sglebius# but don't create it if we're doing a dry run. 1434290001Sglebiusfunc_write_libtool_object () 1435181834Sroberto{ 1436290001Sglebius write_libobj=${1} 1437290001Sglebius if test "$build_libtool_libs" = yes; then 1438290001Sglebius write_lobj=\'${2}\' 1439290001Sglebius else 1440290001Sglebius write_lobj=none 1441290001Sglebius fi 1442181834Sroberto 1443290001Sglebius if test "$build_old_libs" = yes; then 1444290001Sglebius write_oldobj=\'${3}\' 1445181834Sroberto else 1446290001Sglebius write_oldobj=none 1447181834Sroberto fi 1448290001Sglebius 1449290001Sglebius $opt_dry_run || { 1450290001Sglebius cat >${write_libobj}T <<EOF 1451290001Sglebius# $write_libobj - a libtool object file 1452290001Sglebius# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1453290001Sglebius# 1454290001Sglebius# Please DO NOT delete this file! 1455290001Sglebius# It is necessary for linking the library. 1456290001Sglebius 1457290001Sglebius# Name of the PIC object. 1458290001Sglebiuspic_object=$write_lobj 1459290001Sglebius 1460290001Sglebius# Name of the non-PIC object 1461290001Sglebiusnon_pic_object=$write_oldobj 1462290001Sglebius 1463290001SglebiusEOF 1464290001Sglebius $MV "${write_libobj}T" "${write_libobj}" 1465290001Sglebius } 1466181834Sroberto} 1467181834Sroberto 1468290001Sglebius 1469290001Sglebius################################################## 1470290001Sglebius# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 1471290001Sglebius################################################## 1472290001Sglebius 1473290001Sglebius# func_convert_core_file_wine_to_w32 ARG 1474290001Sglebius# Helper function used by file name conversion functions when $build is *nix, 1475290001Sglebius# and $host is mingw, cygwin, or some other w32 environment. Relies on a 1476290001Sglebius# correctly configured wine environment available, with the winepath program 1477290001Sglebius# in $build's $PATH. 1478290001Sglebius# 1479290001Sglebius# ARG is the $build file name to be converted to w32 format. 1480290001Sglebius# Result is available in $func_convert_core_file_wine_to_w32_result, and will 1481290001Sglebius# be empty on error (or when ARG is empty) 1482290001Sglebiusfunc_convert_core_file_wine_to_w32 () 1483181834Sroberto{ 1484290001Sglebius $opt_debug 1485290001Sglebius func_convert_core_file_wine_to_w32_result="$1" 1486290001Sglebius if test -n "$1"; then 1487290001Sglebius # Unfortunately, winepath does not exit with a non-zero error code, so we 1488290001Sglebius # are forced to check the contents of stdout. On the other hand, if the 1489290001Sglebius # command is not found, the shell will set an exit code of 127 and print 1490290001Sglebius # *an error message* to stdout. So we must check for both error code of 1491290001Sglebius # zero AND non-empty stdout, which explains the odd construction: 1492290001Sglebius func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 1493290001Sglebius if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then 1494290001Sglebius func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 1495290001Sglebius $SED -e "$lt_sed_naive_backslashify"` 1496290001Sglebius else 1497290001Sglebius func_convert_core_file_wine_to_w32_result= 1498181834Sroberto fi 1499290001Sglebius fi 1500290001Sglebius} 1501290001Sglebius# end: func_convert_core_file_wine_to_w32 1502181834Sroberto 1503181834Sroberto 1504290001Sglebius# func_convert_core_path_wine_to_w32 ARG 1505290001Sglebius# Helper function used by path conversion functions when $build is *nix, and 1506290001Sglebius# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 1507290001Sglebius# configured wine environment available, with the winepath program in $build's 1508290001Sglebius# $PATH. Assumes ARG has no leading or trailing path separator characters. 1509290001Sglebius# 1510290001Sglebius# ARG is path to be converted from $build format to win32. 1511290001Sglebius# Result is available in $func_convert_core_path_wine_to_w32_result. 1512290001Sglebius# Unconvertible file (directory) names in ARG are skipped; if no directory names 1513290001Sglebius# are convertible, then the result may be empty. 1514290001Sglebiusfunc_convert_core_path_wine_to_w32 () 1515290001Sglebius{ 1516290001Sglebius $opt_debug 1517290001Sglebius # unfortunately, winepath doesn't convert paths, only file names 1518290001Sglebius func_convert_core_path_wine_to_w32_result="" 1519290001Sglebius if test -n "$1"; then 1520290001Sglebius oldIFS=$IFS 1521290001Sglebius IFS=: 1522290001Sglebius for func_convert_core_path_wine_to_w32_f in $1; do 1523290001Sglebius IFS=$oldIFS 1524290001Sglebius func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 1525290001Sglebius if test -n "$func_convert_core_file_wine_to_w32_result" ; then 1526290001Sglebius if test -z "$func_convert_core_path_wine_to_w32_result"; then 1527290001Sglebius func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" 1528290001Sglebius else 1529290001Sglebius func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 1530290001Sglebius fi 1531181834Sroberto fi 1532181834Sroberto done 1533290001Sglebius IFS=$oldIFS 1534290001Sglebius fi 1535181834Sroberto} 1536290001Sglebius# end: func_convert_core_path_wine_to_w32 1537181834Sroberto 1538181834Sroberto 1539290001Sglebius# func_cygpath ARGS... 1540290001Sglebius# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 1541290001Sglebius# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 1542290001Sglebius# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 1543290001Sglebius# (2), returns the Cygwin file name or path in func_cygpath_result (input 1544290001Sglebius# file name or path is assumed to be in w32 format, as previously converted 1545290001Sglebius# from $build's *nix or MSYS format). In case (3), returns the w32 file name 1546290001Sglebius# or path in func_cygpath_result (input file name or path is assumed to be in 1547290001Sglebius# Cygwin format). Returns an empty string on error. 1548290001Sglebius# 1549290001Sglebius# ARGS are passed to cygpath, with the last one being the file name or path to 1550290001Sglebius# be converted. 1551290001Sglebius# 1552290001Sglebius# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 1553290001Sglebius# environment variable; do not put it in $PATH. 1554290001Sglebiusfunc_cygpath () 1555290001Sglebius{ 1556290001Sglebius $opt_debug 1557290001Sglebius if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 1558290001Sglebius func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 1559290001Sglebius if test "$?" -ne 0; then 1560290001Sglebius # on failure, ensure result is empty 1561290001Sglebius func_cygpath_result= 1562290001Sglebius fi 1563290001Sglebius else 1564290001Sglebius func_cygpath_result= 1565290001Sglebius func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" 1566290001Sglebius fi 1567290001Sglebius} 1568290001Sglebius#end: func_cygpath 1569181834Sroberto 1570181834Sroberto 1571290001Sglebius# func_convert_core_msys_to_w32 ARG 1572290001Sglebius# Convert file name or path ARG from MSYS format to w32 format. Return 1573290001Sglebius# result in func_convert_core_msys_to_w32_result. 1574290001Sglebiusfunc_convert_core_msys_to_w32 () 1575290001Sglebius{ 1576290001Sglebius $opt_debug 1577290001Sglebius # awkward: cmd appends spaces to result 1578290001Sglebius func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 1579290001Sglebius $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 1580290001Sglebius} 1581290001Sglebius#end: func_convert_core_msys_to_w32 1582290001Sglebius 1583290001Sglebius 1584290001Sglebius# func_convert_file_check ARG1 ARG2 1585290001Sglebius# Verify that ARG1 (a file name in $build format) was converted to $host 1586290001Sglebius# format in ARG2. Otherwise, emit an error message, but continue (resetting 1587290001Sglebius# func_to_host_file_result to ARG1). 1588290001Sglebiusfunc_convert_file_check () 1589290001Sglebius{ 1590290001Sglebius $opt_debug 1591290001Sglebius if test -z "$2" && test -n "$1" ; then 1592290001Sglebius func_error "Could not determine host file name corresponding to" 1593290001Sglebius func_error " \`$1'" 1594290001Sglebius func_error "Continuing, but uninstalled executables may not work." 1595290001Sglebius # Fallback: 1596290001Sglebius func_to_host_file_result="$1" 1597290001Sglebius fi 1598290001Sglebius} 1599290001Sglebius# end func_convert_file_check 1600290001Sglebius 1601290001Sglebius 1602290001Sglebius# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 1603290001Sglebius# Verify that FROM_PATH (a path in $build format) was converted to $host 1604290001Sglebius# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 1605290001Sglebius# func_to_host_file_result to a simplistic fallback value (see below). 1606290001Sglebiusfunc_convert_path_check () 1607290001Sglebius{ 1608290001Sglebius $opt_debug 1609290001Sglebius if test -z "$4" && test -n "$3"; then 1610290001Sglebius func_error "Could not determine the host path corresponding to" 1611290001Sglebius func_error " \`$3'" 1612290001Sglebius func_error "Continuing, but uninstalled executables may not work." 1613290001Sglebius # Fallback. This is a deliberately simplistic "conversion" and 1614290001Sglebius # should not be "improved". See libtool.info. 1615290001Sglebius if test "x$1" != "x$2"; then 1616290001Sglebius lt_replace_pathsep_chars="s|$1|$2|g" 1617290001Sglebius func_to_host_path_result=`echo "$3" | 1618290001Sglebius $SED -e "$lt_replace_pathsep_chars"` 1619290001Sglebius else 1620290001Sglebius func_to_host_path_result="$3" 1621290001Sglebius fi 1622290001Sglebius fi 1623290001Sglebius} 1624290001Sglebius# end func_convert_path_check 1625290001Sglebius 1626290001Sglebius 1627290001Sglebius# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 1628290001Sglebius# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 1629290001Sglebius# and appending REPL if ORIG matches BACKPAT. 1630290001Sglebiusfunc_convert_path_front_back_pathsep () 1631290001Sglebius{ 1632290001Sglebius $opt_debug 1633290001Sglebius case $4 in 1634290001Sglebius $1 ) func_to_host_path_result="$3$func_to_host_path_result" 1635290001Sglebius ;; 1636181834Sroberto esac 1637290001Sglebius case $4 in 1638290001Sglebius $2 ) func_append func_to_host_path_result "$3" 1639290001Sglebius ;; 1640290001Sglebius esac 1641290001Sglebius} 1642290001Sglebius# end func_convert_path_front_back_pathsep 1643181834Sroberto 1644181834Sroberto 1645290001Sglebius################################################## 1646290001Sglebius# $build to $host FILE NAME CONVERSION FUNCTIONS # 1647290001Sglebius################################################## 1648290001Sglebius# invoked via `$to_host_file_cmd ARG' 1649290001Sglebius# 1650290001Sglebius# In each case, ARG is the path to be converted from $build to $host format. 1651290001Sglebius# Result will be available in $func_to_host_file_result. 1652181834Sroberto 1653290001Sglebius 1654290001Sglebius# func_to_host_file ARG 1655290001Sglebius# Converts the file name ARG from $build format to $host format. Return result 1656290001Sglebius# in func_to_host_file_result. 1657290001Sglebiusfunc_to_host_file () 1658290001Sglebius{ 1659290001Sglebius $opt_debug 1660290001Sglebius $to_host_file_cmd "$1" 1661290001Sglebius} 1662290001Sglebius# end func_to_host_file 1663290001Sglebius 1664290001Sglebius 1665290001Sglebius# func_to_tool_file ARG LAZY 1666290001Sglebius# converts the file name ARG from $build format to toolchain format. Return 1667290001Sglebius# result in func_to_tool_file_result. If the conversion in use is listed 1668290001Sglebius# in (the comma separated) LAZY, no conversion takes place. 1669290001Sglebiusfunc_to_tool_file () 1670290001Sglebius{ 1671290001Sglebius $opt_debug 1672290001Sglebius case ,$2, in 1673290001Sglebius *,"$to_tool_file_cmd",*) 1674290001Sglebius func_to_tool_file_result=$1 1675181834Sroberto ;; 1676181834Sroberto *) 1677290001Sglebius $to_tool_file_cmd "$1" 1678290001Sglebius func_to_tool_file_result=$func_to_host_file_result 1679181834Sroberto ;; 1680290001Sglebius esac 1681290001Sglebius} 1682290001Sglebius# end func_to_tool_file 1683181834Sroberto 1684290001Sglebius 1685290001Sglebius# func_convert_file_noop ARG 1686290001Sglebius# Copy ARG to func_to_host_file_result. 1687290001Sglebiusfunc_convert_file_noop () 1688290001Sglebius{ 1689290001Sglebius func_to_host_file_result="$1" 1690290001Sglebius} 1691290001Sglebius# end func_convert_file_noop 1692290001Sglebius 1693290001Sglebius 1694290001Sglebius# func_convert_file_msys_to_w32 ARG 1695290001Sglebius# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 1696290001Sglebius# conversion to w32 is not available inside the cwrapper. Returns result in 1697290001Sglebius# func_to_host_file_result. 1698290001Sglebiusfunc_convert_file_msys_to_w32 () 1699290001Sglebius{ 1700290001Sglebius $opt_debug 1701290001Sglebius func_to_host_file_result="$1" 1702290001Sglebius if test -n "$1"; then 1703290001Sglebius func_convert_core_msys_to_w32 "$1" 1704290001Sglebius func_to_host_file_result="$func_convert_core_msys_to_w32_result" 1705181834Sroberto fi 1706290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1707290001Sglebius} 1708290001Sglebius# end func_convert_file_msys_to_w32 1709181834Sroberto 1710181834Sroberto 1711290001Sglebius# func_convert_file_cygwin_to_w32 ARG 1712290001Sglebius# Convert file name ARG from Cygwin to w32 format. Returns result in 1713290001Sglebius# func_to_host_file_result. 1714290001Sglebiusfunc_convert_file_cygwin_to_w32 () 1715290001Sglebius{ 1716290001Sglebius $opt_debug 1717290001Sglebius func_to_host_file_result="$1" 1718290001Sglebius if test -n "$1"; then 1719290001Sglebius # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 1720290001Sglebius # LT_CYGPATH in this case. 1721290001Sglebius func_to_host_file_result=`cygpath -m "$1"` 1722290001Sglebius fi 1723290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1724290001Sglebius} 1725290001Sglebius# end func_convert_file_cygwin_to_w32 1726181834Sroberto 1727181834Sroberto 1728290001Sglebius# func_convert_file_nix_to_w32 ARG 1729290001Sglebius# Convert file name ARG from *nix to w32 format. Requires a wine environment 1730290001Sglebius# and a working winepath. Returns result in func_to_host_file_result. 1731290001Sglebiusfunc_convert_file_nix_to_w32 () 1732290001Sglebius{ 1733290001Sglebius $opt_debug 1734290001Sglebius func_to_host_file_result="$1" 1735290001Sglebius if test -n "$1"; then 1736290001Sglebius func_convert_core_file_wine_to_w32 "$1" 1737290001Sglebius func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" 1738290001Sglebius fi 1739290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1740290001Sglebius} 1741290001Sglebius# end func_convert_file_nix_to_w32 1742181834Sroberto 1743181834Sroberto 1744290001Sglebius# func_convert_file_msys_to_cygwin ARG 1745290001Sglebius# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 1746290001Sglebius# Returns result in func_to_host_file_result. 1747290001Sglebiusfunc_convert_file_msys_to_cygwin () 1748290001Sglebius{ 1749290001Sglebius $opt_debug 1750290001Sglebius func_to_host_file_result="$1" 1751290001Sglebius if test -n "$1"; then 1752290001Sglebius func_convert_core_msys_to_w32 "$1" 1753290001Sglebius func_cygpath -u "$func_convert_core_msys_to_w32_result" 1754290001Sglebius func_to_host_file_result="$func_cygpath_result" 1755290001Sglebius fi 1756290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1757290001Sglebius} 1758290001Sglebius# end func_convert_file_msys_to_cygwin 1759181834Sroberto 1760181834Sroberto 1761290001Sglebius# func_convert_file_nix_to_cygwin ARG 1762290001Sglebius# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 1763290001Sglebius# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 1764290001Sglebius# in func_to_host_file_result. 1765290001Sglebiusfunc_convert_file_nix_to_cygwin () 1766290001Sglebius{ 1767290001Sglebius $opt_debug 1768290001Sglebius func_to_host_file_result="$1" 1769290001Sglebius if test -n "$1"; then 1770290001Sglebius # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 1771290001Sglebius func_convert_core_file_wine_to_w32 "$1" 1772290001Sglebius func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 1773290001Sglebius func_to_host_file_result="$func_cygpath_result" 1774290001Sglebius fi 1775290001Sglebius func_convert_file_check "$1" "$func_to_host_file_result" 1776290001Sglebius} 1777290001Sglebius# end func_convert_file_nix_to_cygwin 1778181834Sroberto 1779181834Sroberto 1780290001Sglebius############################################# 1781290001Sglebius# $build to $host PATH CONVERSION FUNCTIONS # 1782290001Sglebius############################################# 1783290001Sglebius# invoked via `$to_host_path_cmd ARG' 1784290001Sglebius# 1785290001Sglebius# In each case, ARG is the path to be converted from $build to $host format. 1786290001Sglebius# The result will be available in $func_to_host_path_result. 1787290001Sglebius# 1788290001Sglebius# Path separators are also converted from $build format to $host format. If 1789290001Sglebius# ARG begins or ends with a path separator character, it is preserved (but 1790290001Sglebius# converted to $host format) on output. 1791290001Sglebius# 1792290001Sglebius# All path conversion functions are named using the following convention: 1793290001Sglebius# file name conversion function : func_convert_file_X_to_Y () 1794290001Sglebius# path conversion function : func_convert_path_X_to_Y () 1795290001Sglebius# where, for any given $build/$host combination the 'X_to_Y' value is the 1796290001Sglebius# same. If conversion functions are added for new $build/$host combinations, 1797290001Sglebius# the two new functions must follow this pattern, or func_init_to_host_path_cmd 1798290001Sglebius# will break. 1799181834Sroberto 1800181834Sroberto 1801290001Sglebius# func_init_to_host_path_cmd 1802290001Sglebius# Ensures that function "pointer" variable $to_host_path_cmd is set to the 1803290001Sglebius# appropriate value, based on the value of $to_host_file_cmd. 1804290001Sglebiusto_host_path_cmd= 1805290001Sglebiusfunc_init_to_host_path_cmd () 1806290001Sglebius{ 1807290001Sglebius $opt_debug 1808290001Sglebius if test -z "$to_host_path_cmd"; then 1809290001Sglebius func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 1810290001Sglebius to_host_path_cmd="func_convert_path_${func_stripname_result}" 1811290001Sglebius fi 1812290001Sglebius} 1813181834Sroberto 1814181834Sroberto 1815290001Sglebius# func_to_host_path ARG 1816290001Sglebius# Converts the path ARG from $build format to $host format. Return result 1817290001Sglebius# in func_to_host_path_result. 1818290001Sglebiusfunc_to_host_path () 1819290001Sglebius{ 1820290001Sglebius $opt_debug 1821290001Sglebius func_init_to_host_path_cmd 1822290001Sglebius $to_host_path_cmd "$1" 1823290001Sglebius} 1824290001Sglebius# end func_to_host_path 1825181834Sroberto 1826181834Sroberto 1827290001Sglebius# func_convert_path_noop ARG 1828290001Sglebius# Copy ARG to func_to_host_path_result. 1829290001Sglebiusfunc_convert_path_noop () 1830290001Sglebius{ 1831290001Sglebius func_to_host_path_result="$1" 1832290001Sglebius} 1833290001Sglebius# end func_convert_path_noop 1834181834Sroberto 1835181834Sroberto 1836290001Sglebius# func_convert_path_msys_to_w32 ARG 1837290001Sglebius# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 1838290001Sglebius# conversion to w32 is not available inside the cwrapper. Returns result in 1839290001Sglebius# func_to_host_path_result. 1840290001Sglebiusfunc_convert_path_msys_to_w32 () 1841290001Sglebius{ 1842290001Sglebius $opt_debug 1843290001Sglebius func_to_host_path_result="$1" 1844290001Sglebius if test -n "$1"; then 1845290001Sglebius # Remove leading and trailing path separator characters from ARG. MSYS 1846290001Sglebius # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 1847290001Sglebius # and winepath ignores them completely. 1848290001Sglebius func_stripname : : "$1" 1849290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1850290001Sglebius func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 1851290001Sglebius func_to_host_path_result="$func_convert_core_msys_to_w32_result" 1852290001Sglebius func_convert_path_check : ";" \ 1853290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1854290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1855290001Sglebius fi 1856290001Sglebius} 1857290001Sglebius# end func_convert_path_msys_to_w32 1858181834Sroberto 1859181834Sroberto 1860290001Sglebius# func_convert_path_cygwin_to_w32 ARG 1861290001Sglebius# Convert path ARG from Cygwin to w32 format. Returns result in 1862290001Sglebius# func_to_host_file_result. 1863290001Sglebiusfunc_convert_path_cygwin_to_w32 () 1864290001Sglebius{ 1865290001Sglebius $opt_debug 1866290001Sglebius func_to_host_path_result="$1" 1867290001Sglebius if test -n "$1"; then 1868290001Sglebius # See func_convert_path_msys_to_w32: 1869290001Sglebius func_stripname : : "$1" 1870290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1871290001Sglebius func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 1872290001Sglebius func_convert_path_check : ";" \ 1873290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1874290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1875181834Sroberto fi 1876290001Sglebius} 1877290001Sglebius# end func_convert_path_cygwin_to_w32 1878181834Sroberto 1879290001Sglebius 1880290001Sglebius# func_convert_path_nix_to_w32 ARG 1881290001Sglebius# Convert path ARG from *nix to w32 format. Requires a wine environment and 1882290001Sglebius# a working winepath. Returns result in func_to_host_file_result. 1883290001Sglebiusfunc_convert_path_nix_to_w32 () 1884290001Sglebius{ 1885290001Sglebius $opt_debug 1886290001Sglebius func_to_host_path_result="$1" 1887290001Sglebius if test -n "$1"; then 1888290001Sglebius # See func_convert_path_msys_to_w32: 1889290001Sglebius func_stripname : : "$1" 1890290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1891290001Sglebius func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 1892290001Sglebius func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" 1893290001Sglebius func_convert_path_check : ";" \ 1894290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1895290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1896181834Sroberto fi 1897290001Sglebius} 1898290001Sglebius# end func_convert_path_nix_to_w32 1899181834Sroberto 1900181834Sroberto 1901290001Sglebius# func_convert_path_msys_to_cygwin ARG 1902290001Sglebius# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 1903290001Sglebius# Returns result in func_to_host_file_result. 1904290001Sglebiusfunc_convert_path_msys_to_cygwin () 1905290001Sglebius{ 1906290001Sglebius $opt_debug 1907290001Sglebius func_to_host_path_result="$1" 1908290001Sglebius if test -n "$1"; then 1909290001Sglebius # See func_convert_path_msys_to_w32: 1910290001Sglebius func_stripname : : "$1" 1911290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1912290001Sglebius func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 1913290001Sglebius func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 1914290001Sglebius func_to_host_path_result="$func_cygpath_result" 1915290001Sglebius func_convert_path_check : : \ 1916290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1917290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" : "$1" 1918290001Sglebius fi 1919290001Sglebius} 1920290001Sglebius# end func_convert_path_msys_to_cygwin 1921290001Sglebius 1922290001Sglebius 1923290001Sglebius# func_convert_path_nix_to_cygwin ARG 1924290001Sglebius# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 1925290001Sglebius# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 1926290001Sglebius# func_to_host_file_result. 1927290001Sglebiusfunc_convert_path_nix_to_cygwin () 1928290001Sglebius{ 1929290001Sglebius $opt_debug 1930290001Sglebius func_to_host_path_result="$1" 1931290001Sglebius if test -n "$1"; then 1932290001Sglebius # Remove leading and trailing path separator characters from 1933290001Sglebius # ARG. msys behavior is inconsistent here, cygpath turns them 1934290001Sglebius # into '.;' and ';.', and winepath ignores them completely. 1935290001Sglebius func_stripname : : "$1" 1936290001Sglebius func_to_host_path_tmp1=$func_stripname_result 1937290001Sglebius func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 1938290001Sglebius func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 1939290001Sglebius func_to_host_path_result="$func_cygpath_result" 1940290001Sglebius func_convert_path_check : : \ 1941290001Sglebius "$func_to_host_path_tmp1" "$func_to_host_path_result" 1942290001Sglebius func_convert_path_front_back_pathsep ":*" "*:" : "$1" 1943290001Sglebius fi 1944290001Sglebius} 1945290001Sglebius# end func_convert_path_nix_to_cygwin 1946290001Sglebius 1947290001Sglebius 1948290001Sglebius# func_mode_compile arg... 1949290001Sglebiusfunc_mode_compile () 1950290001Sglebius{ 1951290001Sglebius $opt_debug 1952181834Sroberto # Get the compilation command and the source file. 1953181834Sroberto base_compile= 1954181834Sroberto srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1955181834Sroberto suppress_opt=yes 1956181834Sroberto suppress_output= 1957181834Sroberto arg_mode=normal 1958181834Sroberto libobj= 1959181834Sroberto later= 1960290001Sglebius pie_flag= 1961181834Sroberto 1962181834Sroberto for arg 1963181834Sroberto do 1964181834Sroberto case $arg_mode in 1965181834Sroberto arg ) 1966181834Sroberto # do not "continue". Instead, add this to base_compile 1967181834Sroberto lastarg="$arg" 1968181834Sroberto arg_mode=normal 1969181834Sroberto ;; 1970181834Sroberto 1971181834Sroberto target ) 1972181834Sroberto libobj="$arg" 1973181834Sroberto arg_mode=normal 1974181834Sroberto continue 1975181834Sroberto ;; 1976181834Sroberto 1977181834Sroberto normal ) 1978181834Sroberto # Accept any command-line options. 1979181834Sroberto case $arg in 1980181834Sroberto -o) 1981290001Sglebius test -n "$libobj" && \ 1982290001Sglebius func_fatal_error "you cannot specify \`-o' more than once" 1983181834Sroberto arg_mode=target 1984181834Sroberto continue 1985181834Sroberto ;; 1986181834Sroberto 1987290001Sglebius -pie | -fpie | -fPIE) 1988290001Sglebius func_append pie_flag " $arg" 1989181834Sroberto continue 1990181834Sroberto ;; 1991181834Sroberto 1992290001Sglebius -shared | -static | -prefer-pic | -prefer-non-pic) 1993290001Sglebius func_append later " $arg" 1994290001Sglebius continue 1995290001Sglebius ;; 1996290001Sglebius 1997181834Sroberto -no-suppress) 1998181834Sroberto suppress_opt=no 1999181834Sroberto continue 2000181834Sroberto ;; 2001181834Sroberto 2002181834Sroberto -Xcompiler) 2003181834Sroberto arg_mode=arg # the next one goes into the "base_compile" arg list 2004181834Sroberto continue # The current "srcfile" will either be retained or 2005181834Sroberto ;; # replaced later. I would guess that would be a bug. 2006181834Sroberto 2007181834Sroberto -Wc,*) 2008290001Sglebius func_stripname '-Wc,' '' "$arg" 2009290001Sglebius args=$func_stripname_result 2010181834Sroberto lastarg= 2011181834Sroberto save_ifs="$IFS"; IFS=',' 2012290001Sglebius for arg in $args; do 2013181834Sroberto IFS="$save_ifs" 2014290001Sglebius func_append_quoted lastarg "$arg" 2015181834Sroberto done 2016181834Sroberto IFS="$save_ifs" 2017290001Sglebius func_stripname ' ' '' "$lastarg" 2018290001Sglebius lastarg=$func_stripname_result 2019181834Sroberto 2020181834Sroberto # Add the arguments to base_compile. 2021290001Sglebius func_append base_compile " $lastarg" 2022181834Sroberto continue 2023181834Sroberto ;; 2024181834Sroberto 2025290001Sglebius *) 2026181834Sroberto # Accept the current argument as the source file. 2027181834Sroberto # The previous "srcfile" becomes the current argument. 2028181834Sroberto # 2029181834Sroberto lastarg="$srcfile" 2030181834Sroberto srcfile="$arg" 2031181834Sroberto ;; 2032181834Sroberto esac # case $arg 2033181834Sroberto ;; 2034181834Sroberto esac # case $arg_mode 2035181834Sroberto 2036181834Sroberto # Aesthetically quote the previous argument. 2037290001Sglebius func_append_quoted base_compile "$lastarg" 2038181834Sroberto done # for arg 2039181834Sroberto 2040181834Sroberto case $arg_mode in 2041181834Sroberto arg) 2042290001Sglebius func_fatal_error "you must specify an argument for -Xcompile" 2043181834Sroberto ;; 2044181834Sroberto target) 2045290001Sglebius func_fatal_error "you must specify a target with \`-o'" 2046181834Sroberto ;; 2047181834Sroberto *) 2048181834Sroberto # Get the name of the library object. 2049290001Sglebius test -z "$libobj" && { 2050290001Sglebius func_basename "$srcfile" 2051290001Sglebius libobj="$func_basename_result" 2052290001Sglebius } 2053181834Sroberto ;; 2054181834Sroberto esac 2055181834Sroberto 2056181834Sroberto # Recognize several different file suffixes. 2057181834Sroberto # If the user specifies -o file.o, it is replaced with file.lo 2058181834Sroberto case $libobj in 2059290001Sglebius *.[cCFSifmso] | \ 2060290001Sglebius *.ada | *.adb | *.ads | *.asm | \ 2061290001Sglebius *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 2062290001Sglebius *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) 2063290001Sglebius func_xform "$libobj" 2064290001Sglebius libobj=$func_xform_result 2065290001Sglebius ;; 2066181834Sroberto esac 2067181834Sroberto 2068181834Sroberto case $libobj in 2069290001Sglebius *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 2070181834Sroberto *) 2071290001Sglebius func_fatal_error "cannot determine name of library object from \`$libobj'" 2072181834Sroberto ;; 2073181834Sroberto esac 2074181834Sroberto 2075181834Sroberto func_infer_tag $base_compile 2076181834Sroberto 2077181834Sroberto for arg in $later; do 2078181834Sroberto case $arg in 2079290001Sglebius -shared) 2080290001Sglebius test "$build_libtool_libs" != yes && \ 2081290001Sglebius func_fatal_configuration "can not build a shared library" 2082290001Sglebius build_old_libs=no 2083290001Sglebius continue 2084290001Sglebius ;; 2085290001Sglebius 2086181834Sroberto -static) 2087290001Sglebius build_libtool_libs=no 2088181834Sroberto build_old_libs=yes 2089181834Sroberto continue 2090181834Sroberto ;; 2091181834Sroberto 2092181834Sroberto -prefer-pic) 2093181834Sroberto pic_mode=yes 2094181834Sroberto continue 2095181834Sroberto ;; 2096181834Sroberto 2097181834Sroberto -prefer-non-pic) 2098181834Sroberto pic_mode=no 2099181834Sroberto continue 2100181834Sroberto ;; 2101181834Sroberto esac 2102181834Sroberto done 2103181834Sroberto 2104290001Sglebius func_quote_for_eval "$libobj" 2105290001Sglebius test "X$libobj" != "X$func_quote_for_eval_result" \ 2106290001Sglebius && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 2107290001Sglebius && func_warning "libobj name \`$libobj' may not contain shell special characters." 2108290001Sglebius func_dirname_and_basename "$obj" "/" "" 2109290001Sglebius objname="$func_basename_result" 2110290001Sglebius xdir="$func_dirname_result" 2111181834Sroberto lobj=${xdir}$objdir/$objname 2112181834Sroberto 2113290001Sglebius test -z "$base_compile" && \ 2114290001Sglebius func_fatal_help "you must specify a compilation command" 2115181834Sroberto 2116181834Sroberto # Delete any leftover library objects. 2117181834Sroberto if test "$build_old_libs" = yes; then 2118181834Sroberto removelist="$obj $lobj $libobj ${libobj}T" 2119181834Sroberto else 2120181834Sroberto removelist="$lobj $libobj ${libobj}T" 2121181834Sroberto fi 2122181834Sroberto 2123181834Sroberto # On Cygwin there's no "real" PIC flag so we must build both object types 2124181834Sroberto case $host_os in 2125290001Sglebius cygwin* | mingw* | pw32* | os2* | cegcc*) 2126181834Sroberto pic_mode=default 2127181834Sroberto ;; 2128181834Sroberto esac 2129181834Sroberto if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 2130181834Sroberto # non-PIC code in shared libraries is not supported 2131181834Sroberto pic_mode=default 2132181834Sroberto fi 2133181834Sroberto 2134181834Sroberto # Calculate the filename of the output object if compiler does 2135181834Sroberto # not support -o with -c 2136181834Sroberto if test "$compiler_c_o" = no; then 2137290001Sglebius output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 2138181834Sroberto lockfile="$output_obj.lock" 2139181834Sroberto else 2140181834Sroberto output_obj= 2141181834Sroberto need_locks=no 2142181834Sroberto lockfile= 2143181834Sroberto fi 2144181834Sroberto 2145181834Sroberto # Lock this critical section if it is needed 2146181834Sroberto # We use this script file to make the link, it avoids creating a new file 2147181834Sroberto if test "$need_locks" = yes; then 2148290001Sglebius until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 2149290001Sglebius func_echo "Waiting for $lockfile to be removed" 2150181834Sroberto sleep 2 2151181834Sroberto done 2152181834Sroberto elif test "$need_locks" = warn; then 2153181834Sroberto if test -f "$lockfile"; then 2154290001Sglebius $ECHO "\ 2155181834Sroberto*** ERROR, $lockfile exists and contains: 2156181834Sroberto`cat $lockfile 2>/dev/null` 2157181834Sroberto 2158181834SrobertoThis indicates that another process is trying to use the same 2159181834Srobertotemporary object file, and libtool could not work around it because 2160181834Srobertoyour compiler does not support \`-c' and \`-o' together. If you 2161181834Srobertorepeat this compilation, it may succeed, by chance, but you had better 2162181834Srobertoavoid parallel builds (make -j) in this platform, or get a better 2163181834Srobertocompiler." 2164181834Sroberto 2165290001Sglebius $opt_dry_run || $RM $removelist 2166181834Sroberto exit $EXIT_FAILURE 2167181834Sroberto fi 2168290001Sglebius func_append removelist " $output_obj" 2169290001Sglebius $ECHO "$srcfile" > "$lockfile" 2170181834Sroberto fi 2171181834Sroberto 2172290001Sglebius $opt_dry_run || $RM $removelist 2173290001Sglebius func_append removelist " $lockfile" 2174290001Sglebius trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 2175181834Sroberto 2176290001Sglebius func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 2177290001Sglebius srcfile=$func_to_tool_file_result 2178290001Sglebius func_quote_for_eval "$srcfile" 2179290001Sglebius qsrcfile=$func_quote_for_eval_result 2180181834Sroberto 2181181834Sroberto # Only build a PIC object if we are building libtool libraries. 2182181834Sroberto if test "$build_libtool_libs" = yes; then 2183181834Sroberto # Without this assignment, base_compile gets emptied. 2184181834Sroberto fbsd_hideous_sh_bug=$base_compile 2185181834Sroberto 2186181834Sroberto if test "$pic_mode" != no; then 2187181834Sroberto command="$base_compile $qsrcfile $pic_flag" 2188181834Sroberto else 2189181834Sroberto # Don't build PIC code 2190181834Sroberto command="$base_compile $qsrcfile" 2191181834Sroberto fi 2192181834Sroberto 2193290001Sglebius func_mkdir_p "$xdir$objdir" 2194181834Sroberto 2195181834Sroberto if test -z "$output_obj"; then 2196181834Sroberto # Place PIC objects in $objdir 2197290001Sglebius func_append command " -o $lobj" 2198181834Sroberto fi 2199181834Sroberto 2200290001Sglebius func_show_eval_locale "$command" \ 2201290001Sglebius 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 2202181834Sroberto 2203181834Sroberto if test "$need_locks" = warn && 2204181834Sroberto test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2205290001Sglebius $ECHO "\ 2206181834Sroberto*** ERROR, $lockfile contains: 2207181834Sroberto`cat $lockfile 2>/dev/null` 2208181834Sroberto 2209181834Srobertobut it should contain: 2210181834Sroberto$srcfile 2211181834Sroberto 2212181834SrobertoThis indicates that another process is trying to use the same 2213181834Srobertotemporary object file, and libtool could not work around it because 2214181834Srobertoyour compiler does not support \`-c' and \`-o' together. If you 2215181834Srobertorepeat this compilation, it may succeed, by chance, but you had better 2216181834Srobertoavoid parallel builds (make -j) in this platform, or get a better 2217181834Srobertocompiler." 2218181834Sroberto 2219290001Sglebius $opt_dry_run || $RM $removelist 2220181834Sroberto exit $EXIT_FAILURE 2221181834Sroberto fi 2222181834Sroberto 2223181834Sroberto # Just move the object if needed, then go on to compile the next one 2224181834Sroberto if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 2225290001Sglebius func_show_eval '$MV "$output_obj" "$lobj"' \ 2226290001Sglebius 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2227181834Sroberto fi 2228181834Sroberto 2229181834Sroberto # Allow error messages only from the first compilation. 2230181834Sroberto if test "$suppress_opt" = yes; then 2231290001Sglebius suppress_output=' >/dev/null 2>&1' 2232181834Sroberto fi 2233181834Sroberto fi 2234181834Sroberto 2235181834Sroberto # Only build a position-dependent object if we build old libraries. 2236181834Sroberto if test "$build_old_libs" = yes; then 2237181834Sroberto if test "$pic_mode" != yes; then 2238181834Sroberto # Don't build PIC code 2239290001Sglebius command="$base_compile $qsrcfile$pie_flag" 2240181834Sroberto else 2241181834Sroberto command="$base_compile $qsrcfile $pic_flag" 2242181834Sroberto fi 2243181834Sroberto if test "$compiler_c_o" = yes; then 2244290001Sglebius func_append command " -o $obj" 2245181834Sroberto fi 2246181834Sroberto 2247181834Sroberto # Suppress compiler output if we already did a PIC compilation. 2248290001Sglebius func_append command "$suppress_output" 2249290001Sglebius func_show_eval_locale "$command" \ 2250290001Sglebius '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 2251181834Sroberto 2252181834Sroberto if test "$need_locks" = warn && 2253181834Sroberto test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2254290001Sglebius $ECHO "\ 2255181834Sroberto*** ERROR, $lockfile contains: 2256181834Sroberto`cat $lockfile 2>/dev/null` 2257181834Sroberto 2258181834Srobertobut it should contain: 2259181834Sroberto$srcfile 2260181834Sroberto 2261181834SrobertoThis indicates that another process is trying to use the same 2262181834Srobertotemporary object file, and libtool could not work around it because 2263181834Srobertoyour compiler does not support \`-c' and \`-o' together. If you 2264181834Srobertorepeat this compilation, it may succeed, by chance, but you had better 2265181834Srobertoavoid parallel builds (make -j) in this platform, or get a better 2266181834Srobertocompiler." 2267181834Sroberto 2268290001Sglebius $opt_dry_run || $RM $removelist 2269181834Sroberto exit $EXIT_FAILURE 2270181834Sroberto fi 2271181834Sroberto 2272181834Sroberto # Just move the object if needed 2273181834Sroberto if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 2274290001Sglebius func_show_eval '$MV "$output_obj" "$obj"' \ 2275290001Sglebius 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2276290001Sglebius fi 2277290001Sglebius fi 2278290001Sglebius 2279290001Sglebius $opt_dry_run || { 2280290001Sglebius func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 2281290001Sglebius 2282290001Sglebius # Unlock the critical section if it was locked 2283290001Sglebius if test "$need_locks" != no; then 2284290001Sglebius removelist=$lockfile 2285290001Sglebius $RM "$lockfile" 2286290001Sglebius fi 2287290001Sglebius } 2288290001Sglebius 2289290001Sglebius exit $EXIT_SUCCESS 2290290001Sglebius} 2291290001Sglebius 2292290001Sglebius$opt_help || { 2293290001Sglebius test "$opt_mode" = compile && func_mode_compile ${1+"$@"} 2294290001Sglebius} 2295290001Sglebius 2296290001Sglebiusfunc_mode_help () 2297290001Sglebius{ 2298290001Sglebius # We need to display help for each of the modes. 2299290001Sglebius case $opt_mode in 2300290001Sglebius "") 2301290001Sglebius # Generic help is extracted from the usage comments 2302290001Sglebius # at the start of this file. 2303290001Sglebius func_help 2304290001Sglebius ;; 2305290001Sglebius 2306290001Sglebius clean) 2307290001Sglebius $ECHO \ 2308290001Sglebius"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 2309290001Sglebius 2310290001SglebiusRemove files from the build directory. 2311290001Sglebius 2312290001SglebiusRM is the name of the program to use to delete files associated with each FILE 2313290001Sglebius(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2314290001Sglebiusto RM. 2315290001Sglebius 2316290001SglebiusIf FILE is a libtool library, object or program, all the files associated 2317290001Sglebiuswith it are deleted. Otherwise, only FILE itself is deleted using RM." 2318290001Sglebius ;; 2319290001Sglebius 2320290001Sglebius compile) 2321290001Sglebius $ECHO \ 2322290001Sglebius"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 2323290001Sglebius 2324290001SglebiusCompile a source file into a libtool library object. 2325290001Sglebius 2326290001SglebiusThis mode accepts the following additional options: 2327290001Sglebius 2328290001Sglebius -o OUTPUT-FILE set the output file name to OUTPUT-FILE 2329290001Sglebius -no-suppress do not suppress compiler output for multiple passes 2330290001Sglebius -prefer-pic try to build PIC objects only 2331290001Sglebius -prefer-non-pic try to build non-PIC objects only 2332290001Sglebius -shared do not build a \`.o' file suitable for static linking 2333290001Sglebius -static only build a \`.o' file suitable for static linking 2334290001Sglebius -Wc,FLAG pass FLAG directly to the compiler 2335290001Sglebius 2336290001SglebiusCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 2337290001Sglebiusfrom the given SOURCEFILE. 2338290001Sglebius 2339290001SglebiusThe output file name is determined by removing the directory component from 2340290001SglebiusSOURCEFILE, then substituting the C source code suffix \`.c' with the 2341290001Sglebiuslibrary object suffix, \`.lo'." 2342290001Sglebius ;; 2343290001Sglebius 2344290001Sglebius execute) 2345290001Sglebius $ECHO \ 2346290001Sglebius"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 2347290001Sglebius 2348290001SglebiusAutomatically set library path, then run a program. 2349290001Sglebius 2350290001SglebiusThis mode accepts the following additional options: 2351290001Sglebius 2352290001Sglebius -dlopen FILE add the directory containing FILE to the library path 2353290001Sglebius 2354290001SglebiusThis mode sets the library path environment variable according to \`-dlopen' 2355290001Sglebiusflags. 2356290001Sglebius 2357290001SglebiusIf any of the ARGS are libtool executable wrappers, then they are translated 2358290001Sglebiusinto their corresponding uninstalled binary, and any of their required library 2359290001Sglebiusdirectories are added to the library path. 2360290001Sglebius 2361290001SglebiusThen, COMMAND is executed, with ARGS as arguments." 2362290001Sglebius ;; 2363290001Sglebius 2364290001Sglebius finish) 2365290001Sglebius $ECHO \ 2366290001Sglebius"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 2367290001Sglebius 2368290001SglebiusComplete the installation of libtool libraries. 2369290001Sglebius 2370290001SglebiusEach LIBDIR is a directory that contains libtool libraries. 2371290001Sglebius 2372290001SglebiusThe commands that this mode executes may require superuser privileges. Use 2373290001Sglebiusthe \`--dry-run' option if you just want to see what would be executed." 2374290001Sglebius ;; 2375290001Sglebius 2376290001Sglebius install) 2377290001Sglebius $ECHO \ 2378290001Sglebius"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 2379290001Sglebius 2380290001SglebiusInstall executables or libraries. 2381290001Sglebius 2382290001SglebiusINSTALL-COMMAND is the installation command. The first component should be 2383290001Sglebiuseither the \`install' or \`cp' program. 2384290001Sglebius 2385290001SglebiusThe following components of INSTALL-COMMAND are treated specially: 2386290001Sglebius 2387290001Sglebius -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 2388290001Sglebius 2389290001SglebiusThe rest of the components are interpreted as arguments to that command (only 2390290001SglebiusBSD-compatible install options are recognized)." 2391290001Sglebius ;; 2392290001Sglebius 2393290001Sglebius link) 2394290001Sglebius $ECHO \ 2395290001Sglebius"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 2396290001Sglebius 2397290001SglebiusLink object files or libraries together to form another library, or to 2398290001Sglebiuscreate an executable program. 2399290001Sglebius 2400290001SglebiusLINK-COMMAND is a command using the C compiler that you would use to create 2401290001Sglebiusa program from several object files. 2402290001Sglebius 2403290001SglebiusThe following components of LINK-COMMAND are treated specially: 2404290001Sglebius 2405290001Sglebius -all-static do not do any dynamic linking at all 2406290001Sglebius -avoid-version do not add a version suffix if possible 2407290001Sglebius -bindir BINDIR specify path to binaries directory (for systems where 2408290001Sglebius libraries must be found in the PATH setting at runtime) 2409290001Sglebius -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 2410290001Sglebius -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 2411290001Sglebius -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 2412290001Sglebius -export-symbols SYMFILE 2413290001Sglebius try to export only the symbols listed in SYMFILE 2414290001Sglebius -export-symbols-regex REGEX 2415290001Sglebius try to export only the symbols matching REGEX 2416290001Sglebius -LLIBDIR search LIBDIR for required installed libraries 2417290001Sglebius -lNAME OUTPUT-FILE requires the installed library libNAME 2418290001Sglebius -module build a library that can dlopened 2419290001Sglebius -no-fast-install disable the fast-install mode 2420290001Sglebius -no-install link a not-installable executable 2421290001Sglebius -no-undefined declare that a library does not refer to external symbols 2422290001Sglebius -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 2423290001Sglebius -objectlist FILE Use a list of object files found in FILE to specify objects 2424290001Sglebius -precious-files-regex REGEX 2425290001Sglebius don't remove output files matching REGEX 2426290001Sglebius -release RELEASE specify package release information 2427290001Sglebius -rpath LIBDIR the created library will eventually be installed in LIBDIR 2428290001Sglebius -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 2429290001Sglebius -shared only do dynamic linking of libtool libraries 2430290001Sglebius -shrext SUFFIX override the standard shared library file extension 2431290001Sglebius -static do not do any dynamic linking of uninstalled libtool libraries 2432290001Sglebius -static-libtool-libs 2433290001Sglebius do not do any dynamic linking of libtool libraries 2434290001Sglebius -version-info CURRENT[:REVISION[:AGE]] 2435290001Sglebius specify library version info [each variable defaults to 0] 2436290001Sglebius -weak LIBNAME declare that the target provides the LIBNAME interface 2437290001Sglebius -Wc,FLAG 2438290001Sglebius -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 2439290001Sglebius -Wl,FLAG 2440290001Sglebius -Xlinker FLAG pass linker-specific FLAG directly to the linker 2441290001Sglebius -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 2442290001Sglebius 2443290001SglebiusAll other options (arguments beginning with \`-') are ignored. 2444290001Sglebius 2445290001SglebiusEvery other argument is treated as a filename. Files ending in \`.la' are 2446290001Sglebiustreated as uninstalled libtool libraries, other files are standard or library 2447290001Sglebiusobject files. 2448290001Sglebius 2449290001SglebiusIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 2450290001Sglebiusonly library objects (\`.lo' files) may be specified, and \`-rpath' is 2451290001Sglebiusrequired, except when creating a convenience library. 2452290001Sglebius 2453290001SglebiusIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 2454290001Sglebiususing \`ar' and \`ranlib', or on Windows using \`lib'. 2455290001Sglebius 2456290001SglebiusIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 2457290001Sglebiusis created, otherwise an executable program is created." 2458290001Sglebius ;; 2459290001Sglebius 2460290001Sglebius uninstall) 2461290001Sglebius $ECHO \ 2462290001Sglebius"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 2463290001Sglebius 2464290001SglebiusRemove libraries from an installation directory. 2465290001Sglebius 2466290001SglebiusRM is the name of the program to use to delete files associated with each FILE 2467290001Sglebius(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2468290001Sglebiusto RM. 2469290001Sglebius 2470290001SglebiusIf FILE is a libtool library, all the files associated with it are deleted. 2471290001SglebiusOtherwise, only FILE itself is deleted using RM." 2472290001Sglebius ;; 2473290001Sglebius 2474290001Sglebius *) 2475290001Sglebius func_fatal_help "invalid operation mode \`$opt_mode'" 2476290001Sglebius ;; 2477290001Sglebius esac 2478290001Sglebius 2479290001Sglebius echo 2480290001Sglebius $ECHO "Try \`$progname --help' for more information about other modes." 2481290001Sglebius} 2482290001Sglebius 2483290001Sglebius# Now that we've collected a possible --mode arg, show help if necessary 2484290001Sglebiusif $opt_help; then 2485290001Sglebius if test "$opt_help" = :; then 2486290001Sglebius func_mode_help 2487290001Sglebius else 2488290001Sglebius { 2489290001Sglebius func_help noexit 2490290001Sglebius for opt_mode in compile link execute install finish uninstall clean; do 2491290001Sglebius func_mode_help 2492290001Sglebius done 2493290001Sglebius } | sed -n '1p; 2,$s/^Usage:/ or: /p' 2494290001Sglebius { 2495290001Sglebius func_help noexit 2496290001Sglebius for opt_mode in compile link execute install finish uninstall clean; do 2497290001Sglebius echo 2498290001Sglebius func_mode_help 2499290001Sglebius done 2500290001Sglebius } | 2501290001Sglebius sed '1d 2502290001Sglebius /^When reporting/,/^Report/{ 2503290001Sglebius H 2504290001Sglebius d 2505290001Sglebius } 2506290001Sglebius $x 2507290001Sglebius /information about other modes/d 2508290001Sglebius /more detailed .*MODE/d 2509290001Sglebius s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 2510290001Sglebius fi 2511290001Sglebius exit $? 2512290001Sglebiusfi 2513290001Sglebius 2514290001Sglebius 2515290001Sglebius# func_mode_execute arg... 2516290001Sglebiusfunc_mode_execute () 2517290001Sglebius{ 2518290001Sglebius $opt_debug 2519290001Sglebius # The first argument is the command name. 2520290001Sglebius cmd="$nonopt" 2521290001Sglebius test -z "$cmd" && \ 2522290001Sglebius func_fatal_help "you must specify a COMMAND" 2523290001Sglebius 2524290001Sglebius # Handle -dlopen flags immediately. 2525290001Sglebius for file in $opt_dlopen; do 2526290001Sglebius test -f "$file" \ 2527290001Sglebius || func_fatal_help "\`$file' is not a file" 2528290001Sglebius 2529290001Sglebius dir= 2530290001Sglebius case $file in 2531290001Sglebius *.la) 2532290001Sglebius func_resolve_sysroot "$file" 2533290001Sglebius file=$func_resolve_sysroot_result 2534290001Sglebius 2535290001Sglebius # Check to see that this really is a libtool archive. 2536290001Sglebius func_lalib_unsafe_p "$file" \ 2537290001Sglebius || func_fatal_help "\`$lib' is not a valid libtool archive" 2538290001Sglebius 2539290001Sglebius # Read the libtool library. 2540290001Sglebius dlname= 2541290001Sglebius library_names= 2542290001Sglebius func_source "$file" 2543290001Sglebius 2544290001Sglebius # Skip this library if it cannot be dlopened. 2545290001Sglebius if test -z "$dlname"; then 2546290001Sglebius # Warn if it was a shared library. 2547290001Sglebius test -n "$library_names" && \ 2548290001Sglebius func_warning "\`$file' was not linked with \`-export-dynamic'" 2549290001Sglebius continue 2550290001Sglebius fi 2551290001Sglebius 2552290001Sglebius func_dirname "$file" "" "." 2553290001Sglebius dir="$func_dirname_result" 2554290001Sglebius 2555290001Sglebius if test -f "$dir/$objdir/$dlname"; then 2556290001Sglebius func_append dir "/$objdir" 2557181834Sroberto else 2558290001Sglebius if test ! -f "$dir/$dlname"; then 2559290001Sglebius func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 2560290001Sglebius fi 2561181834Sroberto fi 2562290001Sglebius ;; 2563290001Sglebius 2564290001Sglebius *.lo) 2565290001Sglebius # Just add the directory containing the .lo file. 2566290001Sglebius func_dirname "$file" "" "." 2567290001Sglebius dir="$func_dirname_result" 2568290001Sglebius ;; 2569290001Sglebius 2570290001Sglebius *) 2571290001Sglebius func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 2572290001Sglebius continue 2573290001Sglebius ;; 2574290001Sglebius esac 2575290001Sglebius 2576290001Sglebius # Get the absolute pathname. 2577290001Sglebius absdir=`cd "$dir" && pwd` 2578290001Sglebius test -n "$absdir" && dir="$absdir" 2579290001Sglebius 2580290001Sglebius # Now add the directory to shlibpath_var. 2581290001Sglebius if eval "test -z \"\$$shlibpath_var\""; then 2582290001Sglebius eval "$shlibpath_var=\"\$dir\"" 2583290001Sglebius else 2584290001Sglebius eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 2585181834Sroberto fi 2586290001Sglebius done 2587181834Sroberto 2588290001Sglebius # This variable tells wrapper scripts just to set shlibpath_var 2589290001Sglebius # rather than running their programs. 2590290001Sglebius libtool_execute_magic="$magic" 2591181834Sroberto 2592290001Sglebius # Check if any of the arguments is a wrapper script. 2593290001Sglebius args= 2594290001Sglebius for file 2595290001Sglebius do 2596290001Sglebius case $file in 2597290001Sglebius -* | *.la | *.lo ) ;; 2598290001Sglebius *) 2599290001Sglebius # Do a test to see if this is really a libtool program. 2600290001Sglebius if func_ltwrapper_script_p "$file"; then 2601290001Sglebius func_source "$file" 2602290001Sglebius # Transform arg to wrapped name. 2603290001Sglebius file="$progdir/$program" 2604290001Sglebius elif func_ltwrapper_executable_p "$file"; then 2605290001Sglebius func_ltwrapper_scriptname "$file" 2606290001Sglebius func_source "$func_ltwrapper_scriptname_result" 2607290001Sglebius # Transform arg to wrapped name. 2608290001Sglebius file="$progdir/$program" 2609290001Sglebius fi 2610290001Sglebius ;; 2611290001Sglebius esac 2612290001Sglebius # Quote arguments (to preserve shell metacharacters). 2613290001Sglebius func_append_quoted args "$file" 2614290001Sglebius done 2615290001Sglebius 2616290001Sglebius if test "X$opt_dry_run" = Xfalse; then 2617290001Sglebius if test -n "$shlibpath_var"; then 2618290001Sglebius # Export the shlibpath_var. 2619290001Sglebius eval "export $shlibpath_var" 2620290001Sglebius fi 2621290001Sglebius 2622290001Sglebius # Restore saved environment variables 2623290001Sglebius for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 2624290001Sglebius do 2625290001Sglebius eval "if test \"\${save_$lt_var+set}\" = set; then 2626290001Sglebius $lt_var=\$save_$lt_var; export $lt_var 2627290001Sglebius else 2628290001Sglebius $lt_unset $lt_var 2629290001Sglebius fi" 2630290001Sglebius done 2631290001Sglebius 2632290001Sglebius # Now prepare to actually exec the command. 2633290001Sglebius exec_cmd="\$cmd$args" 2634181834Sroberto else 2635290001Sglebius # Display what would be done. 2636290001Sglebius if test -n "$shlibpath_var"; then 2637290001Sglebius eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 2638290001Sglebius echo "export $shlibpath_var" 2639290001Sglebius fi 2640290001Sglebius $ECHO "$cmd$args" 2641290001Sglebius exit $EXIT_SUCCESS 2642290001Sglebius fi 2643290001Sglebius} 2644181834Sroberto 2645290001Sglebiustest "$opt_mode" = execute && func_mode_execute ${1+"$@"} 2646290001Sglebius 2647290001Sglebius 2648290001Sglebius# func_mode_finish arg... 2649290001Sglebiusfunc_mode_finish () 2650290001Sglebius{ 2651290001Sglebius $opt_debug 2652290001Sglebius libs= 2653290001Sglebius libdirs= 2654290001Sglebius admincmds= 2655290001Sglebius 2656290001Sglebius for opt in "$nonopt" ${1+"$@"} 2657290001Sglebius do 2658290001Sglebius if test -d "$opt"; then 2659290001Sglebius func_append libdirs " $opt" 2660290001Sglebius 2661290001Sglebius elif test -f "$opt"; then 2662290001Sglebius if func_lalib_unsafe_p "$opt"; then 2663290001Sglebius func_append libs " $opt" 2664290001Sglebius else 2665290001Sglebius func_warning "\`$opt' is not a valid libtool archive" 2666290001Sglebius fi 2667290001Sglebius 2668290001Sglebius else 2669290001Sglebius func_fatal_error "invalid argument \`$opt'" 2670290001Sglebius fi 2671290001Sglebius done 2672290001Sglebius 2673290001Sglebius if test -n "$libs"; then 2674290001Sglebius if test -n "$lt_sysroot"; then 2675290001Sglebius sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 2676290001Sglebius sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 2677290001Sglebius else 2678290001Sglebius sysroot_cmd= 2679290001Sglebius fi 2680290001Sglebius 2681290001Sglebius # Remove sysroot references 2682290001Sglebius if $opt_dry_run; then 2683290001Sglebius for lib in $libs; do 2684290001Sglebius echo "removing references to $lt_sysroot and \`=' prefixes from $lib" 2685290001Sglebius done 2686290001Sglebius else 2687290001Sglebius tmpdir=`func_mktempdir` 2688290001Sglebius for lib in $libs; do 2689290001Sglebius sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 2690290001Sglebius > $tmpdir/tmp-la 2691290001Sglebius mv -f $tmpdir/tmp-la $lib 2692290001Sglebius done 2693290001Sglebius ${RM}r "$tmpdir" 2694290001Sglebius fi 2695181834Sroberto fi 2696181834Sroberto 2697290001Sglebius if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2698290001Sglebius for libdir in $libdirs; do 2699290001Sglebius if test -n "$finish_cmds"; then 2700290001Sglebius # Do each command in the finish commands. 2701290001Sglebius func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 2702290001Sglebius'"$cmd"'"' 2703290001Sglebius fi 2704290001Sglebius if test -n "$finish_eval"; then 2705290001Sglebius # Do the single finish_eval. 2706290001Sglebius eval cmds=\"$finish_eval\" 2707290001Sglebius $opt_dry_run || eval "$cmds" || func_append admincmds " 2708290001Sglebius $cmds" 2709290001Sglebius fi 2710290001Sglebius done 2711290001Sglebius fi 2712181834Sroberto 2713290001Sglebius # Exit here if they wanted silent mode. 2714290001Sglebius $opt_silent && exit $EXIT_SUCCESS 2715290001Sglebius 2716290001Sglebius if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2717290001Sglebius echo "----------------------------------------------------------------------" 2718290001Sglebius echo "Libraries have been installed in:" 2719290001Sglebius for libdir in $libdirs; do 2720290001Sglebius $ECHO " $libdir" 2721290001Sglebius done 2722290001Sglebius echo 2723290001Sglebius echo "If you ever happen to want to link against installed libraries" 2724290001Sglebius echo "in a given directory, LIBDIR, you must either use libtool, and" 2725290001Sglebius echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 2726290001Sglebius echo "flag during linking and do at least one of the following:" 2727290001Sglebius if test -n "$shlibpath_var"; then 2728290001Sglebius echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 2729290001Sglebius echo " during execution" 2730290001Sglebius fi 2731290001Sglebius if test -n "$runpath_var"; then 2732290001Sglebius echo " - add LIBDIR to the \`$runpath_var' environment variable" 2733290001Sglebius echo " during linking" 2734290001Sglebius fi 2735290001Sglebius if test -n "$hardcode_libdir_flag_spec"; then 2736290001Sglebius libdir=LIBDIR 2737290001Sglebius eval flag=\"$hardcode_libdir_flag_spec\" 2738290001Sglebius 2739290001Sglebius $ECHO " - use the \`$flag' linker flag" 2740290001Sglebius fi 2741290001Sglebius if test -n "$admincmds"; then 2742290001Sglebius $ECHO " - have your system administrator run these commands:$admincmds" 2743290001Sglebius fi 2744290001Sglebius if test -f /etc/ld.so.conf; then 2745290001Sglebius echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 2746290001Sglebius fi 2747290001Sglebius echo 2748290001Sglebius 2749290001Sglebius echo "See any operating system documentation about shared libraries for" 2750290001Sglebius case $host in 2751290001Sglebius solaris2.[6789]|solaris2.1[0-9]) 2752290001Sglebius echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 2753290001Sglebius echo "pages." 2754290001Sglebius ;; 2755290001Sglebius *) 2756290001Sglebius echo "more information, such as the ld(1) and ld.so(8) manual pages." 2757290001Sglebius ;; 2758290001Sglebius esac 2759290001Sglebius echo "----------------------------------------------------------------------" 2760181834Sroberto fi 2761290001Sglebius exit $EXIT_SUCCESS 2762290001Sglebius} 2763181834Sroberto 2764290001Sglebiustest "$opt_mode" = finish && func_mode_finish ${1+"$@"} 2765290001Sglebius 2766290001Sglebius 2767290001Sglebius# func_mode_install arg... 2768290001Sglebiusfunc_mode_install () 2769290001Sglebius{ 2770290001Sglebius $opt_debug 2771290001Sglebius # There may be an optional sh(1) argument at the beginning of 2772290001Sglebius # install_prog (especially on Windows NT). 2773290001Sglebius if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 2774290001Sglebius # Allow the use of GNU shtool's install command. 2775290001Sglebius case $nonopt in *shtool*) :;; *) false;; esac; then 2776290001Sglebius # Aesthetically quote it. 2777290001Sglebius func_quote_for_eval "$nonopt" 2778290001Sglebius install_prog="$func_quote_for_eval_result " 2779290001Sglebius arg=$1 2780290001Sglebius shift 2781290001Sglebius else 2782290001Sglebius install_prog= 2783290001Sglebius arg=$nonopt 2784290001Sglebius fi 2785290001Sglebius 2786290001Sglebius # The real first argument should be the name of the installation program. 2787290001Sglebius # Aesthetically quote it. 2788290001Sglebius func_quote_for_eval "$arg" 2789290001Sglebius func_append install_prog "$func_quote_for_eval_result" 2790290001Sglebius install_shared_prog=$install_prog 2791290001Sglebius case " $install_prog " in 2792290001Sglebius *[\\\ /]cp\ *) install_cp=: ;; 2793290001Sglebius *) install_cp=false ;; 2794290001Sglebius esac 2795290001Sglebius 2796290001Sglebius # We need to accept at least all the BSD install flags. 2797290001Sglebius dest= 2798290001Sglebius files= 2799290001Sglebius opts= 2800290001Sglebius prev= 2801290001Sglebius install_type= 2802290001Sglebius isdir=no 2803290001Sglebius stripme= 2804290001Sglebius no_mode=: 2805290001Sglebius for arg 2806290001Sglebius do 2807290001Sglebius arg2= 2808290001Sglebius if test -n "$dest"; then 2809290001Sglebius func_append files " $dest" 2810290001Sglebius dest=$arg 2811290001Sglebius continue 2812290001Sglebius fi 2813290001Sglebius 2814290001Sglebius case $arg in 2815290001Sglebius -d) isdir=yes ;; 2816290001Sglebius -f) 2817290001Sglebius if $install_cp; then :; else 2818290001Sglebius prev=$arg 2819290001Sglebius fi 2820290001Sglebius ;; 2821290001Sglebius -g | -m | -o) 2822290001Sglebius prev=$arg 2823290001Sglebius ;; 2824290001Sglebius -s) 2825290001Sglebius stripme=" -s" 2826290001Sglebius continue 2827290001Sglebius ;; 2828290001Sglebius -*) 2829290001Sglebius ;; 2830290001Sglebius *) 2831290001Sglebius # If the previous option needed an argument, then skip it. 2832290001Sglebius if test -n "$prev"; then 2833290001Sglebius if test "x$prev" = x-m && test -n "$install_override_mode"; then 2834290001Sglebius arg2=$install_override_mode 2835290001Sglebius no_mode=false 2836290001Sglebius fi 2837290001Sglebius prev= 2838290001Sglebius else 2839290001Sglebius dest=$arg 2840290001Sglebius continue 2841290001Sglebius fi 2842290001Sglebius ;; 2843290001Sglebius esac 2844290001Sglebius 2845290001Sglebius # Aesthetically quote the argument. 2846290001Sglebius func_quote_for_eval "$arg" 2847290001Sglebius func_append install_prog " $func_quote_for_eval_result" 2848290001Sglebius if test -n "$arg2"; then 2849290001Sglebius func_quote_for_eval "$arg2" 2850290001Sglebius fi 2851290001Sglebius func_append install_shared_prog " $func_quote_for_eval_result" 2852290001Sglebius done 2853290001Sglebius 2854290001Sglebius test -z "$install_prog" && \ 2855290001Sglebius func_fatal_help "you must specify an install program" 2856290001Sglebius 2857290001Sglebius test -n "$prev" && \ 2858290001Sglebius func_fatal_help "the \`$prev' option requires an argument" 2859290001Sglebius 2860290001Sglebius if test -n "$install_override_mode" && $no_mode; then 2861290001Sglebius if $install_cp; then :; else 2862290001Sglebius func_quote_for_eval "$install_override_mode" 2863290001Sglebius func_append install_shared_prog " -m $func_quote_for_eval_result" 2864290001Sglebius fi 2865290001Sglebius fi 2866290001Sglebius 2867290001Sglebius if test -z "$files"; then 2868290001Sglebius if test -z "$dest"; then 2869290001Sglebius func_fatal_help "no file or destination specified" 2870290001Sglebius else 2871290001Sglebius func_fatal_help "you must specify a destination" 2872290001Sglebius fi 2873290001Sglebius fi 2874290001Sglebius 2875290001Sglebius # Strip any trailing slash from the destination. 2876290001Sglebius func_stripname '' '/' "$dest" 2877290001Sglebius dest=$func_stripname_result 2878290001Sglebius 2879290001Sglebius # Check to see that the destination is a directory. 2880290001Sglebius test -d "$dest" && isdir=yes 2881290001Sglebius if test "$isdir" = yes; then 2882290001Sglebius destdir="$dest" 2883290001Sglebius destname= 2884290001Sglebius else 2885290001Sglebius func_dirname_and_basename "$dest" "" "." 2886290001Sglebius destdir="$func_dirname_result" 2887290001Sglebius destname="$func_basename_result" 2888290001Sglebius 2889290001Sglebius # Not a directory, so check to see that there is only one file specified. 2890290001Sglebius set dummy $files; shift 2891290001Sglebius test "$#" -gt 1 && \ 2892290001Sglebius func_fatal_help "\`$dest' is not a directory" 2893290001Sglebius fi 2894290001Sglebius case $destdir in 2895290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) ;; 2896290001Sglebius *) 2897290001Sglebius for file in $files; do 2898290001Sglebius case $file in 2899290001Sglebius *.lo) ;; 2900290001Sglebius *) 2901290001Sglebius func_fatal_help "\`$destdir' must be an absolute directory name" 2902290001Sglebius ;; 2903290001Sglebius esac 2904290001Sglebius done 2905290001Sglebius ;; 2906290001Sglebius esac 2907290001Sglebius 2908290001Sglebius # This variable tells wrapper scripts just to set variables rather 2909290001Sglebius # than running their programs. 2910290001Sglebius libtool_install_magic="$magic" 2911290001Sglebius 2912290001Sglebius staticlibs= 2913290001Sglebius future_libdirs= 2914290001Sglebius current_libdirs= 2915290001Sglebius for file in $files; do 2916290001Sglebius 2917290001Sglebius # Do each installation. 2918290001Sglebius case $file in 2919290001Sglebius *.$libext) 2920290001Sglebius # Do the static libraries later. 2921290001Sglebius func_append staticlibs " $file" 2922290001Sglebius ;; 2923290001Sglebius 2924290001Sglebius *.la) 2925290001Sglebius func_resolve_sysroot "$file" 2926290001Sglebius file=$func_resolve_sysroot_result 2927290001Sglebius 2928290001Sglebius # Check to see that this really is a libtool archive. 2929290001Sglebius func_lalib_unsafe_p "$file" \ 2930290001Sglebius || func_fatal_help "\`$file' is not a valid libtool archive" 2931290001Sglebius 2932290001Sglebius library_names= 2933290001Sglebius old_library= 2934290001Sglebius relink_command= 2935290001Sglebius func_source "$file" 2936290001Sglebius 2937290001Sglebius # Add the libdir to current_libdirs if it is the destination. 2938290001Sglebius if test "X$destdir" = "X$libdir"; then 2939290001Sglebius case "$current_libdirs " in 2940290001Sglebius *" $libdir "*) ;; 2941290001Sglebius *) func_append current_libdirs " $libdir" ;; 2942290001Sglebius esac 2943290001Sglebius else 2944290001Sglebius # Note the libdir as a future libdir. 2945290001Sglebius case "$future_libdirs " in 2946290001Sglebius *" $libdir "*) ;; 2947290001Sglebius *) func_append future_libdirs " $libdir" ;; 2948290001Sglebius esac 2949290001Sglebius fi 2950290001Sglebius 2951290001Sglebius func_dirname "$file" "/" "" 2952290001Sglebius dir="$func_dirname_result" 2953290001Sglebius func_append dir "$objdir" 2954290001Sglebius 2955290001Sglebius if test -n "$relink_command"; then 2956290001Sglebius # Determine the prefix the user has applied to our future dir. 2957290001Sglebius inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 2958290001Sglebius 2959290001Sglebius # Don't allow the user to place us outside of our expected 2960290001Sglebius # location b/c this prevents finding dependent libraries that 2961290001Sglebius # are installed to the same prefix. 2962290001Sglebius # At present, this check doesn't affect windows .dll's that 2963290001Sglebius # are installed into $libdir/../bin (currently, that works fine) 2964290001Sglebius # but it's something to keep an eye on. 2965290001Sglebius test "$inst_prefix_dir" = "$destdir" && \ 2966290001Sglebius func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2967290001Sglebius 2968290001Sglebius if test -n "$inst_prefix_dir"; then 2969290001Sglebius # Stick the inst_prefix_dir data into the link command. 2970290001Sglebius relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2971290001Sglebius else 2972290001Sglebius relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 2973290001Sglebius fi 2974290001Sglebius 2975290001Sglebius func_warning "relinking \`$file'" 2976290001Sglebius func_show_eval "$relink_command" \ 2977290001Sglebius 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2978290001Sglebius fi 2979290001Sglebius 2980290001Sglebius # See the names of the shared library. 2981290001Sglebius set dummy $library_names; shift 2982290001Sglebius if test -n "$1"; then 2983290001Sglebius realname="$1" 2984290001Sglebius shift 2985290001Sglebius 2986290001Sglebius srcname="$realname" 2987290001Sglebius test -n "$relink_command" && srcname="$realname"T 2988290001Sglebius 2989290001Sglebius # Install the shared library and build the symlinks. 2990290001Sglebius func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 2991290001Sglebius 'exit $?' 2992290001Sglebius tstripme="$stripme" 2993290001Sglebius case $host_os in 2994290001Sglebius cygwin* | mingw* | pw32* | cegcc*) 2995290001Sglebius case $realname in 2996290001Sglebius *.dll.a) 2997290001Sglebius tstripme="" 2998290001Sglebius ;; 2999290001Sglebius esac 3000290001Sglebius ;; 3001290001Sglebius esac 3002290001Sglebius if test -n "$tstripme" && test -n "$striplib"; then 3003290001Sglebius func_show_eval "$striplib $destdir/$realname" 'exit $?' 3004290001Sglebius fi 3005290001Sglebius 3006290001Sglebius if test "$#" -gt 0; then 3007290001Sglebius # Delete the old symlinks, and create new ones. 3008290001Sglebius # Try `ln -sf' first, because the `ln' binary might depend on 3009290001Sglebius # the symlink we replace! Solaris /bin/ln does not understand -f, 3010290001Sglebius # so we also need to try rm && ln -s. 3011290001Sglebius for linkname 3012290001Sglebius do 3013290001Sglebius test "$linkname" != "$realname" \ 3014290001Sglebius && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 3015290001Sglebius done 3016290001Sglebius fi 3017290001Sglebius 3018290001Sglebius # Do each command in the postinstall commands. 3019290001Sglebius lib="$destdir/$realname" 3020290001Sglebius func_execute_cmds "$postinstall_cmds" 'exit $?' 3021290001Sglebius fi 3022290001Sglebius 3023290001Sglebius # Install the pseudo-library for information purposes. 3024290001Sglebius func_basename "$file" 3025290001Sglebius name="$func_basename_result" 3026290001Sglebius instname="$dir/$name"i 3027290001Sglebius func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 3028290001Sglebius 3029290001Sglebius # Maybe install the static library, too. 3030290001Sglebius test -n "$old_library" && func_append staticlibs " $dir/$old_library" 3031290001Sglebius ;; 3032290001Sglebius 3033290001Sglebius *.lo) 3034290001Sglebius # Install (i.e. copy) a libtool object. 3035290001Sglebius 3036290001Sglebius # Figure out destination file name, if it wasn't already specified. 3037290001Sglebius if test -n "$destname"; then 3038290001Sglebius destfile="$destdir/$destname" 3039290001Sglebius else 3040290001Sglebius func_basename "$file" 3041290001Sglebius destfile="$func_basename_result" 3042290001Sglebius destfile="$destdir/$destfile" 3043290001Sglebius fi 3044290001Sglebius 3045290001Sglebius # Deduce the name of the destination old-style object file. 3046290001Sglebius case $destfile in 3047290001Sglebius *.lo) 3048290001Sglebius func_lo2o "$destfile" 3049290001Sglebius staticdest=$func_lo2o_result 3050290001Sglebius ;; 3051290001Sglebius *.$objext) 3052290001Sglebius staticdest="$destfile" 3053290001Sglebius destfile= 3054290001Sglebius ;; 3055290001Sglebius *) 3056290001Sglebius func_fatal_help "cannot copy a libtool object to \`$destfile'" 3057290001Sglebius ;; 3058290001Sglebius esac 3059290001Sglebius 3060290001Sglebius # Install the libtool object if requested. 3061290001Sglebius test -n "$destfile" && \ 3062290001Sglebius func_show_eval "$install_prog $file $destfile" 'exit $?' 3063290001Sglebius 3064290001Sglebius # Install the old object if enabled. 3065290001Sglebius if test "$build_old_libs" = yes; then 3066290001Sglebius # Deduce the name of the old-style object file. 3067290001Sglebius func_lo2o "$file" 3068290001Sglebius staticobj=$func_lo2o_result 3069290001Sglebius func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 3070290001Sglebius fi 3071290001Sglebius exit $EXIT_SUCCESS 3072290001Sglebius ;; 3073290001Sglebius 3074290001Sglebius *) 3075290001Sglebius # Figure out destination file name, if it wasn't already specified. 3076290001Sglebius if test -n "$destname"; then 3077290001Sglebius destfile="$destdir/$destname" 3078290001Sglebius else 3079290001Sglebius func_basename "$file" 3080290001Sglebius destfile="$func_basename_result" 3081290001Sglebius destfile="$destdir/$destfile" 3082290001Sglebius fi 3083290001Sglebius 3084290001Sglebius # If the file is missing, and there is a .exe on the end, strip it 3085290001Sglebius # because it is most likely a libtool script we actually want to 3086290001Sglebius # install 3087290001Sglebius stripped_ext="" 3088290001Sglebius case $file in 3089290001Sglebius *.exe) 3090290001Sglebius if test ! -f "$file"; then 3091290001Sglebius func_stripname '' '.exe' "$file" 3092290001Sglebius file=$func_stripname_result 3093290001Sglebius stripped_ext=".exe" 3094290001Sglebius fi 3095290001Sglebius ;; 3096290001Sglebius esac 3097290001Sglebius 3098290001Sglebius # Do a test to see if this is really a libtool program. 3099290001Sglebius case $host in 3100290001Sglebius *cygwin* | *mingw*) 3101290001Sglebius if func_ltwrapper_executable_p "$file"; then 3102290001Sglebius func_ltwrapper_scriptname "$file" 3103290001Sglebius wrapper=$func_ltwrapper_scriptname_result 3104290001Sglebius else 3105290001Sglebius func_stripname '' '.exe' "$file" 3106290001Sglebius wrapper=$func_stripname_result 3107290001Sglebius fi 3108290001Sglebius ;; 3109290001Sglebius *) 3110290001Sglebius wrapper=$file 3111290001Sglebius ;; 3112290001Sglebius esac 3113290001Sglebius if func_ltwrapper_script_p "$wrapper"; then 3114290001Sglebius notinst_deplibs= 3115290001Sglebius relink_command= 3116290001Sglebius 3117290001Sglebius func_source "$wrapper" 3118290001Sglebius 3119290001Sglebius # Check the variables that should have been set. 3120290001Sglebius test -z "$generated_by_libtool_version" && \ 3121290001Sglebius func_fatal_error "invalid libtool wrapper script \`$wrapper'" 3122290001Sglebius 3123290001Sglebius finalize=yes 3124290001Sglebius for lib in $notinst_deplibs; do 3125290001Sglebius # Check to see that each library is installed. 3126290001Sglebius libdir= 3127290001Sglebius if test -f "$lib"; then 3128290001Sglebius func_source "$lib" 3129290001Sglebius fi 3130290001Sglebius libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 3131290001Sglebius if test -n "$libdir" && test ! -f "$libfile"; then 3132290001Sglebius func_warning "\`$lib' has not been installed in \`$libdir'" 3133290001Sglebius finalize=no 3134290001Sglebius fi 3135290001Sglebius done 3136290001Sglebius 3137290001Sglebius relink_command= 3138290001Sglebius func_source "$wrapper" 3139290001Sglebius 3140290001Sglebius outputname= 3141290001Sglebius if test "$fast_install" = no && test -n "$relink_command"; then 3142290001Sglebius $opt_dry_run || { 3143290001Sglebius if test "$finalize" = yes; then 3144290001Sglebius tmpdir=`func_mktempdir` 3145290001Sglebius func_basename "$file$stripped_ext" 3146290001Sglebius file="$func_basename_result" 3147290001Sglebius outputname="$tmpdir/$file" 3148290001Sglebius # Replace the output file specification. 3149290001Sglebius relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 3150290001Sglebius 3151290001Sglebius $opt_silent || { 3152290001Sglebius func_quote_for_expand "$relink_command" 3153290001Sglebius eval "func_echo $func_quote_for_expand_result" 3154290001Sglebius } 3155290001Sglebius if eval "$relink_command"; then : 3156290001Sglebius else 3157290001Sglebius func_error "error: relink \`$file' with the above command before installing it" 3158290001Sglebius $opt_dry_run || ${RM}r "$tmpdir" 3159290001Sglebius continue 3160290001Sglebius fi 3161290001Sglebius file="$outputname" 3162290001Sglebius else 3163290001Sglebius func_warning "cannot relink \`$file'" 3164290001Sglebius fi 3165290001Sglebius } 3166290001Sglebius else 3167290001Sglebius # Install the binary that we compiled earlier. 3168290001Sglebius file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 3169290001Sglebius fi 3170290001Sglebius fi 3171290001Sglebius 3172290001Sglebius # remove .exe since cygwin /usr/bin/install will append another 3173290001Sglebius # one anyway 3174290001Sglebius case $install_prog,$host in 3175290001Sglebius */usr/bin/install*,*cygwin*) 3176290001Sglebius case $file:$destfile in 3177290001Sglebius *.exe:*.exe) 3178290001Sglebius # this is ok 3179290001Sglebius ;; 3180290001Sglebius *.exe:*) 3181290001Sglebius destfile=$destfile.exe 3182290001Sglebius ;; 3183290001Sglebius *:*.exe) 3184290001Sglebius func_stripname '' '.exe' "$destfile" 3185290001Sglebius destfile=$func_stripname_result 3186290001Sglebius ;; 3187290001Sglebius esac 3188290001Sglebius ;; 3189290001Sglebius esac 3190290001Sglebius func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 3191290001Sglebius $opt_dry_run || if test -n "$outputname"; then 3192290001Sglebius ${RM}r "$tmpdir" 3193290001Sglebius fi 3194290001Sglebius ;; 3195290001Sglebius esac 3196290001Sglebius done 3197290001Sglebius 3198290001Sglebius for file in $staticlibs; do 3199290001Sglebius func_basename "$file" 3200290001Sglebius name="$func_basename_result" 3201290001Sglebius 3202290001Sglebius # Set up the ranlib parameters. 3203290001Sglebius oldlib="$destdir/$name" 3204290001Sglebius 3205290001Sglebius func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 3206290001Sglebius 3207290001Sglebius if test -n "$stripme" && test -n "$old_striplib"; then 3208290001Sglebius func_show_eval "$old_striplib $oldlib" 'exit $?' 3209290001Sglebius fi 3210290001Sglebius 3211290001Sglebius # Do each command in the postinstall commands. 3212290001Sglebius func_execute_cmds "$old_postinstall_cmds" 'exit $?' 3213290001Sglebius done 3214290001Sglebius 3215290001Sglebius test -n "$future_libdirs" && \ 3216290001Sglebius func_warning "remember to run \`$progname --finish$future_libdirs'" 3217290001Sglebius 3218290001Sglebius if test -n "$current_libdirs"; then 3219290001Sglebius # Maybe just do a dry run. 3220290001Sglebius $opt_dry_run && current_libdirs=" -n$current_libdirs" 3221290001Sglebius exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 3222290001Sglebius else 3223290001Sglebius exit $EXIT_SUCCESS 3224290001Sglebius fi 3225290001Sglebius} 3226290001Sglebius 3227290001Sglebiustest "$opt_mode" = install && func_mode_install ${1+"$@"} 3228290001Sglebius 3229290001Sglebius 3230290001Sglebius# func_generate_dlsyms outputname originator pic_p 3231290001Sglebius# Extract symbols from dlprefiles and create ${outputname}S.o with 3232290001Sglebius# a dlpreopen symbol table. 3233290001Sglebiusfunc_generate_dlsyms () 3234290001Sglebius{ 3235290001Sglebius $opt_debug 3236290001Sglebius my_outputname="$1" 3237290001Sglebius my_originator="$2" 3238290001Sglebius my_pic_p="${3-no}" 3239290001Sglebius my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 3240290001Sglebius my_dlsyms= 3241290001Sglebius 3242290001Sglebius if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3243290001Sglebius if test -n "$NM" && test -n "$global_symbol_pipe"; then 3244290001Sglebius my_dlsyms="${my_outputname}S.c" 3245290001Sglebius else 3246290001Sglebius func_error "not configured to extract global symbols from dlpreopened files" 3247290001Sglebius fi 3248290001Sglebius fi 3249290001Sglebius 3250290001Sglebius if test -n "$my_dlsyms"; then 3251290001Sglebius case $my_dlsyms in 3252290001Sglebius "") ;; 3253290001Sglebius *.c) 3254290001Sglebius # Discover the nlist of each of the dlfiles. 3255290001Sglebius nlist="$output_objdir/${my_outputname}.nm" 3256290001Sglebius 3257290001Sglebius func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 3258290001Sglebius 3259290001Sglebius # Parse the name list into a source file. 3260290001Sglebius func_verbose "creating $output_objdir/$my_dlsyms" 3261290001Sglebius 3262290001Sglebius $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 3263290001Sglebius/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 3264290001Sglebius/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 3265290001Sglebius 3266290001Sglebius#ifdef __cplusplus 3267290001Sglebiusextern \"C\" { 3268290001Sglebius#endif 3269290001Sglebius 3270290001Sglebius#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 3271290001Sglebius#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 3272290001Sglebius#endif 3273290001Sglebius 3274290001Sglebius/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 3275290001Sglebius#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 3276290001Sglebius/* DATA imports from DLLs on WIN32 con't be const, because runtime 3277290001Sglebius relocations are performed -- see ld's documentation on pseudo-relocs. */ 3278290001Sglebius# define LT_DLSYM_CONST 3279290001Sglebius#elif defined(__osf__) 3280290001Sglebius/* This system does not cope well with relocations in const data. */ 3281290001Sglebius# define LT_DLSYM_CONST 3282290001Sglebius#else 3283290001Sglebius# define LT_DLSYM_CONST const 3284290001Sglebius#endif 3285290001Sglebius 3286290001Sglebius/* External symbol declarations for the compiler. */\ 3287290001Sglebius" 3288290001Sglebius 3289290001Sglebius if test "$dlself" = yes; then 3290290001Sglebius func_verbose "generating symbol list for \`$output'" 3291290001Sglebius 3292290001Sglebius $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 3293290001Sglebius 3294290001Sglebius # Add our own program objects to the symbol list. 3295290001Sglebius progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 3296290001Sglebius for progfile in $progfiles; do 3297290001Sglebius func_to_tool_file "$progfile" func_convert_file_msys_to_w32 3298290001Sglebius func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" 3299290001Sglebius $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 3300290001Sglebius done 3301290001Sglebius 3302290001Sglebius if test -n "$exclude_expsyms"; then 3303290001Sglebius $opt_dry_run || { 3304290001Sglebius eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 3305290001Sglebius eval '$MV "$nlist"T "$nlist"' 3306290001Sglebius } 3307290001Sglebius fi 3308290001Sglebius 3309290001Sglebius if test -n "$export_symbols_regex"; then 3310290001Sglebius $opt_dry_run || { 3311290001Sglebius eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 3312290001Sglebius eval '$MV "$nlist"T "$nlist"' 3313290001Sglebius } 3314290001Sglebius fi 3315290001Sglebius 3316290001Sglebius # Prepare the list of exported symbols 3317290001Sglebius if test -z "$export_symbols"; then 3318290001Sglebius export_symbols="$output_objdir/$outputname.exp" 3319290001Sglebius $opt_dry_run || { 3320290001Sglebius $RM $export_symbols 3321290001Sglebius eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 3322290001Sglebius case $host in 3323290001Sglebius *cygwin* | *mingw* | *cegcc* ) 3324290001Sglebius eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3325290001Sglebius eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 3326290001Sglebius ;; 3327290001Sglebius esac 3328290001Sglebius } 3329290001Sglebius else 3330290001Sglebius $opt_dry_run || { 3331290001Sglebius eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 3332290001Sglebius eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 3333290001Sglebius eval '$MV "$nlist"T "$nlist"' 3334290001Sglebius case $host in 3335290001Sglebius *cygwin* | *mingw* | *cegcc* ) 3336290001Sglebius eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3337290001Sglebius eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 3338290001Sglebius ;; 3339290001Sglebius esac 3340290001Sglebius } 3341290001Sglebius fi 3342290001Sglebius fi 3343290001Sglebius 3344290001Sglebius for dlprefile in $dlprefiles; do 3345290001Sglebius func_verbose "extracting global C symbols from \`$dlprefile'" 3346290001Sglebius func_basename "$dlprefile" 3347290001Sglebius name="$func_basename_result" 3348290001Sglebius case $host in 3349290001Sglebius *cygwin* | *mingw* | *cegcc* ) 3350290001Sglebius # if an import library, we need to obtain dlname 3351290001Sglebius if func_win32_import_lib_p "$dlprefile"; then 3352290001Sglebius func_tr_sh "$dlprefile" 3353290001Sglebius eval "curr_lafile=\$libfile_$func_tr_sh_result" 3354290001Sglebius dlprefile_dlbasename="" 3355290001Sglebius if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 3356290001Sglebius # Use subshell, to avoid clobbering current variable values 3357290001Sglebius dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 3358290001Sglebius if test -n "$dlprefile_dlname" ; then 3359290001Sglebius func_basename "$dlprefile_dlname" 3360290001Sglebius dlprefile_dlbasename="$func_basename_result" 3361290001Sglebius else 3362290001Sglebius # no lafile. user explicitly requested -dlpreopen <import library>. 3363290001Sglebius $sharedlib_from_linklib_cmd "$dlprefile" 3364290001Sglebius dlprefile_dlbasename=$sharedlib_from_linklib_result 3365290001Sglebius fi 3366290001Sglebius fi 3367290001Sglebius $opt_dry_run || { 3368290001Sglebius if test -n "$dlprefile_dlbasename" ; then 3369290001Sglebius eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 3370290001Sglebius else 3371290001Sglebius func_warning "Could not compute DLL name from $name" 3372290001Sglebius eval '$ECHO ": $name " >> "$nlist"' 3373290001Sglebius fi 3374290001Sglebius func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3375290001Sglebius eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 3376290001Sglebius $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 3377290001Sglebius } 3378290001Sglebius else # not an import lib 3379290001Sglebius $opt_dry_run || { 3380290001Sglebius eval '$ECHO ": $name " >> "$nlist"' 3381290001Sglebius func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3382290001Sglebius eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 3383290001Sglebius } 3384290001Sglebius fi 3385290001Sglebius ;; 3386290001Sglebius *) 3387290001Sglebius $opt_dry_run || { 3388290001Sglebius eval '$ECHO ": $name " >> "$nlist"' 3389290001Sglebius func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3390290001Sglebius eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 3391290001Sglebius } 3392290001Sglebius ;; 3393290001Sglebius esac 3394290001Sglebius done 3395290001Sglebius 3396290001Sglebius $opt_dry_run || { 3397290001Sglebius # Make sure we have at least an empty file. 3398290001Sglebius test -f "$nlist" || : > "$nlist" 3399290001Sglebius 3400290001Sglebius if test -n "$exclude_expsyms"; then 3401290001Sglebius $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 3402290001Sglebius $MV "$nlist"T "$nlist" 3403290001Sglebius fi 3404290001Sglebius 3405290001Sglebius # Try sorting and uniquifying the output. 3406290001Sglebius if $GREP -v "^: " < "$nlist" | 3407290001Sglebius if sort -k 3 </dev/null >/dev/null 2>&1; then 3408290001Sglebius sort -k 3 3409290001Sglebius else 3410290001Sglebius sort +2 3411290001Sglebius fi | 3412290001Sglebius uniq > "$nlist"S; then 3413290001Sglebius : 3414290001Sglebius else 3415290001Sglebius $GREP -v "^: " < "$nlist" > "$nlist"S 3416290001Sglebius fi 3417290001Sglebius 3418290001Sglebius if test -f "$nlist"S; then 3419290001Sglebius eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 3420290001Sglebius else 3421290001Sglebius echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 3422290001Sglebius fi 3423290001Sglebius 3424290001Sglebius echo >> "$output_objdir/$my_dlsyms" "\ 3425290001Sglebius 3426290001Sglebius/* The mapping between symbol names and symbols. */ 3427290001Sglebiustypedef struct { 3428290001Sglebius const char *name; 3429290001Sglebius void *address; 3430290001Sglebius} lt_dlsymlist; 3431290001Sglebiusextern LT_DLSYM_CONST lt_dlsymlist 3432290001Sglebiuslt_${my_prefix}_LTX_preloaded_symbols[]; 3433290001SglebiusLT_DLSYM_CONST lt_dlsymlist 3434290001Sglebiuslt_${my_prefix}_LTX_preloaded_symbols[] = 3435290001Sglebius{\ 3436290001Sglebius { \"$my_originator\", (void *) 0 }," 3437290001Sglebius 3438290001Sglebius case $need_lib_prefix in 3439290001Sglebius no) 3440290001Sglebius eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 3441290001Sglebius ;; 3442290001Sglebius *) 3443290001Sglebius eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 3444290001Sglebius ;; 3445290001Sglebius esac 3446290001Sglebius echo >> "$output_objdir/$my_dlsyms" "\ 3447290001Sglebius {0, (void *) 0} 3448290001Sglebius}; 3449290001Sglebius 3450290001Sglebius/* This works around a problem in FreeBSD linker */ 3451290001Sglebius#ifdef FREEBSD_WORKAROUND 3452290001Sglebiusstatic const void *lt_preloaded_setup() { 3453290001Sglebius return lt_${my_prefix}_LTX_preloaded_symbols; 3454290001Sglebius} 3455290001Sglebius#endif 3456290001Sglebius 3457290001Sglebius#ifdef __cplusplus 3458290001Sglebius} 3459290001Sglebius#endif\ 3460290001Sglebius" 3461290001Sglebius } # !$opt_dry_run 3462290001Sglebius 3463290001Sglebius pic_flag_for_symtable= 3464290001Sglebius case "$compile_command " in 3465290001Sglebius *" -static "*) ;; 3466290001Sglebius *) 3467290001Sglebius case $host in 3468290001Sglebius # compiling the symbol table file with pic_flag works around 3469290001Sglebius # a FreeBSD bug that causes programs to crash when -lm is 3470290001Sglebius # linked before any other PIC object. But we must not use 3471290001Sglebius # pic_flag when linking with -static. The problem exists in 3472290001Sglebius # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 3473290001Sglebius *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 3474290001Sglebius pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 3475290001Sglebius *-*-hpux*) 3476290001Sglebius pic_flag_for_symtable=" $pic_flag" ;; 3477290001Sglebius *) 3478290001Sglebius if test "X$my_pic_p" != Xno; then 3479290001Sglebius pic_flag_for_symtable=" $pic_flag" 3480290001Sglebius fi 3481290001Sglebius ;; 3482290001Sglebius esac 3483290001Sglebius ;; 3484290001Sglebius esac 3485290001Sglebius symtab_cflags= 3486290001Sglebius for arg in $LTCFLAGS; do 3487290001Sglebius case $arg in 3488290001Sglebius -pie | -fpie | -fPIE) ;; 3489290001Sglebius *) func_append symtab_cflags " $arg" ;; 3490290001Sglebius esac 3491290001Sglebius done 3492290001Sglebius 3493290001Sglebius # Now compile the dynamic symbol file. 3494290001Sglebius func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 3495290001Sglebius 3496290001Sglebius # Clean up the generated files. 3497290001Sglebius func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 3498290001Sglebius 3499290001Sglebius # Transform the symbol file into the correct name. 3500290001Sglebius symfileobj="$output_objdir/${my_outputname}S.$objext" 3501290001Sglebius case $host in 3502290001Sglebius *cygwin* | *mingw* | *cegcc* ) 3503290001Sglebius if test -f "$output_objdir/$my_outputname.def"; then 3504290001Sglebius compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3505290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3506290001Sglebius else 3507290001Sglebius compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3508290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3509290001Sglebius fi 3510290001Sglebius ;; 3511290001Sglebius *) 3512290001Sglebius compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3513290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3514290001Sglebius ;; 3515290001Sglebius esac 3516290001Sglebius ;; 3517290001Sglebius *) 3518290001Sglebius func_fatal_error "unknown suffix for \`$my_dlsyms'" 3519290001Sglebius ;; 3520290001Sglebius esac 3521290001Sglebius else 3522290001Sglebius # We keep going just in case the user didn't refer to 3523290001Sglebius # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 3524290001Sglebius # really was required. 3525290001Sglebius 3526290001Sglebius # Nullify the symbol file. 3527290001Sglebius compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 3528290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 3529290001Sglebius fi 3530290001Sglebius} 3531290001Sglebius 3532290001Sglebius# func_win32_libid arg 3533290001Sglebius# return the library type of file 'arg' 3534290001Sglebius# 3535290001Sglebius# Need a lot of goo to handle *both* DLLs and import libs 3536290001Sglebius# Has to be a shell function in order to 'eat' the argument 3537290001Sglebius# that is supplied when $file_magic_command is called. 3538290001Sglebius# Despite the name, also deal with 64 bit binaries. 3539290001Sglebiusfunc_win32_libid () 3540290001Sglebius{ 3541290001Sglebius $opt_debug 3542290001Sglebius win32_libid_type="unknown" 3543290001Sglebius win32_fileres=`file -L $1 2>/dev/null` 3544290001Sglebius case $win32_fileres in 3545290001Sglebius *ar\ archive\ import\ library*) # definitely import 3546290001Sglebius win32_libid_type="x86 archive import" 3547181834Sroberto ;; 3548290001Sglebius *ar\ archive*) # could be an import, or static 3549290001Sglebius # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 3550290001Sglebius if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 3551290001Sglebius $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 3552290001Sglebius func_to_tool_file "$1" func_convert_file_msys_to_w32 3553290001Sglebius win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 3554290001Sglebius $SED -n -e ' 3555290001Sglebius 1,100{ 3556290001Sglebius / I /{ 3557290001Sglebius s,.*,import, 3558290001Sglebius p 3559290001Sglebius q 3560290001Sglebius } 3561290001Sglebius }'` 3562290001Sglebius case $win32_nmres in 3563290001Sglebius import*) win32_libid_type="x86 archive import";; 3564290001Sglebius *) win32_libid_type="x86 archive static";; 3565290001Sglebius esac 3566290001Sglebius fi 3567290001Sglebius ;; 3568290001Sglebius *DLL*) 3569290001Sglebius win32_libid_type="x86 DLL" 3570290001Sglebius ;; 3571290001Sglebius *executable*) # but shell scripts are "executable" too... 3572290001Sglebius case $win32_fileres in 3573290001Sglebius *MS\ Windows\ PE\ Intel*) 3574290001Sglebius win32_libid_type="x86 DLL" 3575290001Sglebius ;; 3576290001Sglebius esac 3577290001Sglebius ;; 3578290001Sglebius esac 3579290001Sglebius $ECHO "$win32_libid_type" 3580290001Sglebius} 3581181834Sroberto 3582290001Sglebius# func_cygming_dll_for_implib ARG 3583290001Sglebius# 3584290001Sglebius# Platform-specific function to extract the 3585290001Sglebius# name of the DLL associated with the specified 3586290001Sglebius# import library ARG. 3587290001Sglebius# Invoked by eval'ing the libtool variable 3588290001Sglebius# $sharedlib_from_linklib_cmd 3589290001Sglebius# Result is available in the variable 3590290001Sglebius# $sharedlib_from_linklib_result 3591290001Sglebiusfunc_cygming_dll_for_implib () 3592290001Sglebius{ 3593290001Sglebius $opt_debug 3594290001Sglebius sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 3595290001Sglebius} 3596290001Sglebius 3597290001Sglebius# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 3598290001Sglebius# 3599290001Sglebius# The is the core of a fallback implementation of a 3600290001Sglebius# platform-specific function to extract the name of the 3601290001Sglebius# DLL associated with the specified import library LIBNAME. 3602290001Sglebius# 3603290001Sglebius# SECTION_NAME is either .idata$6 or .idata$7, depending 3604290001Sglebius# on the platform and compiler that created the implib. 3605290001Sglebius# 3606290001Sglebius# Echos the name of the DLL associated with the 3607290001Sglebius# specified import library. 3608290001Sglebiusfunc_cygming_dll_for_implib_fallback_core () 3609290001Sglebius{ 3610290001Sglebius $opt_debug 3611290001Sglebius match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 3612290001Sglebius $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 3613290001Sglebius $SED '/^Contents of section '"$match_literal"':/{ 3614290001Sglebius # Place marker at beginning of archive member dllname section 3615290001Sglebius s/.*/====MARK====/ 3616290001Sglebius p 3617290001Sglebius d 3618290001Sglebius } 3619290001Sglebius # These lines can sometimes be longer than 43 characters, but 3620290001Sglebius # are always uninteresting 3621290001Sglebius /:[ ]*file format pe[i]\{,1\}-/d 3622290001Sglebius /^In archive [^:]*:/d 3623290001Sglebius # Ensure marker is printed 3624290001Sglebius /^====MARK====/p 3625290001Sglebius # Remove all lines with less than 43 characters 3626290001Sglebius /^.\{43\}/!d 3627290001Sglebius # From remaining lines, remove first 43 characters 3628290001Sglebius s/^.\{43\}//' | 3629290001Sglebius $SED -n ' 3630290001Sglebius # Join marker and all lines until next marker into a single line 3631290001Sglebius /^====MARK====/ b para 3632290001Sglebius H 3633290001Sglebius $ b para 3634290001Sglebius b 3635290001Sglebius :para 3636290001Sglebius x 3637290001Sglebius s/\n//g 3638290001Sglebius # Remove the marker 3639290001Sglebius s/^====MARK====// 3640290001Sglebius # Remove trailing dots and whitespace 3641290001Sglebius s/[\. \t]*$// 3642290001Sglebius # Print 3643290001Sglebius /./p' | 3644290001Sglebius # we now have a list, one entry per line, of the stringified 3645290001Sglebius # contents of the appropriate section of all members of the 3646290001Sglebius # archive which possess that section. Heuristic: eliminate 3647290001Sglebius # all those which have a first or second character that is 3648290001Sglebius # a '.' (that is, objdump's representation of an unprintable 3649290001Sglebius # character.) This should work for all archives with less than 3650290001Sglebius # 0x302f exports -- but will fail for DLLs whose name actually 3651290001Sglebius # begins with a literal '.' or a single character followed by 3652290001Sglebius # a '.'. 3653290001Sglebius # 3654290001Sglebius # Of those that remain, print the first one. 3655290001Sglebius $SED -e '/^\./d;/^.\./d;q' 3656290001Sglebius} 3657290001Sglebius 3658290001Sglebius# func_cygming_gnu_implib_p ARG 3659290001Sglebius# This predicate returns with zero status (TRUE) if 3660290001Sglebius# ARG is a GNU/binutils-style import library. Returns 3661290001Sglebius# with nonzero status (FALSE) otherwise. 3662290001Sglebiusfunc_cygming_gnu_implib_p () 3663290001Sglebius{ 3664290001Sglebius $opt_debug 3665290001Sglebius func_to_tool_file "$1" func_convert_file_msys_to_w32 3666290001Sglebius 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)$'` 3667290001Sglebius test -n "$func_cygming_gnu_implib_tmp" 3668290001Sglebius} 3669290001Sglebius 3670290001Sglebius# func_cygming_ms_implib_p ARG 3671290001Sglebius# This predicate returns with zero status (TRUE) if 3672290001Sglebius# ARG is an MS-style import library. Returns 3673290001Sglebius# with nonzero status (FALSE) otherwise. 3674290001Sglebiusfunc_cygming_ms_implib_p () 3675290001Sglebius{ 3676290001Sglebius $opt_debug 3677290001Sglebius func_to_tool_file "$1" func_convert_file_msys_to_w32 3678290001Sglebius func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 3679290001Sglebius test -n "$func_cygming_ms_implib_tmp" 3680290001Sglebius} 3681290001Sglebius 3682290001Sglebius# func_cygming_dll_for_implib_fallback ARG 3683290001Sglebius# Platform-specific function to extract the 3684290001Sglebius# name of the DLL associated with the specified 3685290001Sglebius# import library ARG. 3686290001Sglebius# 3687290001Sglebius# This fallback implementation is for use when $DLLTOOL 3688290001Sglebius# does not support the --identify-strict option. 3689290001Sglebius# Invoked by eval'ing the libtool variable 3690290001Sglebius# $sharedlib_from_linklib_cmd 3691290001Sglebius# Result is available in the variable 3692290001Sglebius# $sharedlib_from_linklib_result 3693290001Sglebiusfunc_cygming_dll_for_implib_fallback () 3694290001Sglebius{ 3695290001Sglebius $opt_debug 3696290001Sglebius if func_cygming_gnu_implib_p "$1" ; then 3697290001Sglebius # binutils import library 3698290001Sglebius sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 3699290001Sglebius elif func_cygming_ms_implib_p "$1" ; then 3700290001Sglebius # ms-generated import library 3701290001Sglebius sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 3702290001Sglebius else 3703290001Sglebius # unknown 3704290001Sglebius sharedlib_from_linklib_result="" 3705290001Sglebius fi 3706290001Sglebius} 3707290001Sglebius 3708290001Sglebius 3709290001Sglebius# func_extract_an_archive dir oldlib 3710290001Sglebiusfunc_extract_an_archive () 3711290001Sglebius{ 3712290001Sglebius $opt_debug 3713290001Sglebius f_ex_an_ar_dir="$1"; shift 3714290001Sglebius f_ex_an_ar_oldlib="$1" 3715290001Sglebius if test "$lock_old_archive_extraction" = yes; then 3716290001Sglebius lockfile=$f_ex_an_ar_oldlib.lock 3717290001Sglebius until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 3718290001Sglebius func_echo "Waiting for $lockfile to be removed" 3719290001Sglebius sleep 2 3720290001Sglebius done 3721290001Sglebius fi 3722290001Sglebius func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 3723290001Sglebius 'stat=$?; rm -f "$lockfile"; exit $stat' 3724290001Sglebius if test "$lock_old_archive_extraction" = yes; then 3725290001Sglebius $opt_dry_run || rm -f "$lockfile" 3726290001Sglebius fi 3727290001Sglebius if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3728290001Sglebius : 3729290001Sglebius else 3730290001Sglebius func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 3731290001Sglebius fi 3732290001Sglebius} 3733290001Sglebius 3734290001Sglebius 3735290001Sglebius# func_extract_archives gentop oldlib ... 3736290001Sglebiusfunc_extract_archives () 3737290001Sglebius{ 3738290001Sglebius $opt_debug 3739290001Sglebius my_gentop="$1"; shift 3740290001Sglebius my_oldlibs=${1+"$@"} 3741290001Sglebius my_oldobjs="" 3742290001Sglebius my_xlib="" 3743290001Sglebius my_xabs="" 3744290001Sglebius my_xdir="" 3745290001Sglebius 3746290001Sglebius for my_xlib in $my_oldlibs; do 3747290001Sglebius # Extract the objects. 3748290001Sglebius case $my_xlib in 3749290001Sglebius [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3750290001Sglebius *) my_xabs=`pwd`"/$my_xlib" ;; 3751290001Sglebius esac 3752290001Sglebius func_basename "$my_xlib" 3753290001Sglebius my_xlib="$func_basename_result" 3754290001Sglebius my_xlib_u=$my_xlib 3755290001Sglebius while :; do 3756290001Sglebius case " $extracted_archives " in 3757290001Sglebius *" $my_xlib_u "*) 3758290001Sglebius func_arith $extracted_serial + 1 3759290001Sglebius extracted_serial=$func_arith_result 3760290001Sglebius my_xlib_u=lt$extracted_serial-$my_xlib ;; 3761290001Sglebius *) break ;; 3762290001Sglebius esac 3763290001Sglebius done 3764290001Sglebius extracted_archives="$extracted_archives $my_xlib_u" 3765290001Sglebius my_xdir="$my_gentop/$my_xlib_u" 3766290001Sglebius 3767290001Sglebius func_mkdir_p "$my_xdir" 3768290001Sglebius 3769290001Sglebius case $host in 3770290001Sglebius *-darwin*) 3771290001Sglebius func_verbose "Extracting $my_xabs" 3772290001Sglebius # Do not bother doing anything if just a dry run 3773290001Sglebius $opt_dry_run || { 3774290001Sglebius darwin_orig_dir=`pwd` 3775290001Sglebius cd $my_xdir || exit $? 3776290001Sglebius darwin_archive=$my_xabs 3777290001Sglebius darwin_curdir=`pwd` 3778290001Sglebius darwin_base_archive=`basename "$darwin_archive"` 3779290001Sglebius darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 3780290001Sglebius if test -n "$darwin_arches"; then 3781290001Sglebius darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 3782290001Sglebius darwin_arch= 3783290001Sglebius func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 3784290001Sglebius for darwin_arch in $darwin_arches ; do 3785290001Sglebius func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3786290001Sglebius $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3787290001Sglebius cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3788290001Sglebius func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3789290001Sglebius cd "$darwin_curdir" 3790290001Sglebius $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3791290001Sglebius done # $darwin_arches 3792290001Sglebius ## Okay now we've a bunch of thin objects, gotta fatten them up :) 3793290001Sglebius darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 3794290001Sglebius darwin_file= 3795290001Sglebius darwin_files= 3796290001Sglebius for darwin_file in $darwin_filelist; do 3797290001Sglebius darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 3798290001Sglebius $LIPO -create -output "$darwin_file" $darwin_files 3799290001Sglebius done # $darwin_filelist 3800290001Sglebius $RM -rf unfat-$$ 3801290001Sglebius cd "$darwin_orig_dir" 3802290001Sglebius else 3803290001Sglebius cd $darwin_orig_dir 3804290001Sglebius func_extract_an_archive "$my_xdir" "$my_xabs" 3805290001Sglebius fi # $darwin_arches 3806290001Sglebius } # !$opt_dry_run 3807290001Sglebius ;; 3808290001Sglebius *) 3809290001Sglebius func_extract_an_archive "$my_xdir" "$my_xabs" 3810290001Sglebius ;; 3811290001Sglebius esac 3812290001Sglebius my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 3813290001Sglebius done 3814290001Sglebius 3815290001Sglebius func_extract_archives_result="$my_oldobjs" 3816290001Sglebius} 3817290001Sglebius 3818290001Sglebius 3819290001Sglebius# func_emit_wrapper [arg=no] 3820290001Sglebius# 3821290001Sglebius# Emit a libtool wrapper script on stdout. 3822290001Sglebius# Don't directly open a file because we may want to 3823290001Sglebius# incorporate the script contents within a cygwin/mingw 3824290001Sglebius# wrapper executable. Must ONLY be called from within 3825290001Sglebius# func_mode_link because it depends on a number of variables 3826290001Sglebius# set therein. 3827290001Sglebius# 3828290001Sglebius# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 3829290001Sglebius# variable will take. If 'yes', then the emitted script 3830290001Sglebius# will assume that the directory in which it is stored is 3831290001Sglebius# the $objdir directory. This is a cygwin/mingw-specific 3832290001Sglebius# behavior. 3833290001Sglebiusfunc_emit_wrapper () 3834290001Sglebius{ 3835290001Sglebius func_emit_wrapper_arg1=${1-no} 3836290001Sglebius 3837290001Sglebius $ECHO "\ 3838290001Sglebius#! $SHELL 3839290001Sglebius 3840290001Sglebius# $output - temporary wrapper script for $objdir/$outputname 3841290001Sglebius# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3842290001Sglebius# 3843290001Sglebius# The $output program cannot be directly executed until all the libtool 3844290001Sglebius# libraries that it depends on are installed. 3845290001Sglebius# 3846290001Sglebius# This wrapper script should never be moved out of the build directory. 3847290001Sglebius# If it is, it will not operate correctly. 3848290001Sglebius 3849290001Sglebius# Sed substitution that helps us do robust quoting. It backslashifies 3850290001Sglebius# metacharacters that are still active within double-quoted strings. 3851290001Sglebiussed_quote_subst='$sed_quote_subst' 3852290001Sglebius 3853290001Sglebius# Be Bourne compatible 3854290001Sglebiusif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 3855290001Sglebius emulate sh 3856290001Sglebius NULLCMD=: 3857290001Sglebius # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 3858290001Sglebius # is contrary to our usage. Disable this feature. 3859290001Sglebius alias -g '\${1+\"\$@\"}'='\"\$@\"' 3860290001Sglebius setopt NO_GLOB_SUBST 3861290001Sglebiuselse 3862290001Sglebius case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 3863290001Sglebiusfi 3864290001SglebiusBIN_SH=xpg4; export BIN_SH # for Tru64 3865290001SglebiusDUALCASE=1; export DUALCASE # for MKS sh 3866290001Sglebius 3867290001Sglebius# The HP-UX ksh and POSIX shell print the target directory to stdout 3868290001Sglebius# if CDPATH is set. 3869290001Sglebius(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 3870290001Sglebius 3871290001Sglebiusrelink_command=\"$relink_command\" 3872290001Sglebius 3873290001Sglebius# This environment variable determines our operation mode. 3874290001Sglebiusif test \"\$libtool_install_magic\" = \"$magic\"; then 3875290001Sglebius # install mode needs the following variables: 3876290001Sglebius generated_by_libtool_version='$macro_version' 3877290001Sglebius notinst_deplibs='$notinst_deplibs' 3878290001Sglebiuselse 3879290001Sglebius # When we are sourced in execute mode, \$file and \$ECHO are already set. 3880290001Sglebius if test \"\$libtool_execute_magic\" != \"$magic\"; then 3881290001Sglebius file=\"\$0\"" 3882290001Sglebius 3883290001Sglebius qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 3884290001Sglebius $ECHO "\ 3885290001Sglebius 3886290001Sglebius# A function that is used when there is no print builtin or printf. 3887290001Sglebiusfunc_fallback_echo () 3888290001Sglebius{ 3889290001Sglebius eval 'cat <<_LTECHO_EOF 3890290001Sglebius\$1 3891290001Sglebius_LTECHO_EOF' 3892290001Sglebius} 3893290001Sglebius ECHO=\"$qECHO\" 3894290001Sglebius fi 3895290001Sglebius 3896290001Sglebius# Very basic option parsing. These options are (a) specific to 3897290001Sglebius# the libtool wrapper, (b) are identical between the wrapper 3898290001Sglebius# /script/ and the wrapper /executable/ which is used only on 3899290001Sglebius# windows platforms, and (c) all begin with the string "--lt-" 3900290001Sglebius# (application programs are unlikely to have options which match 3901290001Sglebius# this pattern). 3902290001Sglebius# 3903290001Sglebius# There are only two supported options: --lt-debug and 3904290001Sglebius# --lt-dump-script. There is, deliberately, no --lt-help. 3905290001Sglebius# 3906290001Sglebius# The first argument to this parsing function should be the 3907290001Sglebius# script's $0 value, followed by "$@". 3908290001Sglebiuslt_option_debug= 3909290001Sglebiusfunc_parse_lt_options () 3910290001Sglebius{ 3911290001Sglebius lt_script_arg0=\$0 3912290001Sglebius shift 3913290001Sglebius for lt_opt 3914290001Sglebius do 3915290001Sglebius case \"\$lt_opt\" in 3916290001Sglebius --lt-debug) lt_option_debug=1 ;; 3917290001Sglebius --lt-dump-script) 3918290001Sglebius lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 3919290001Sglebius test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 3920290001Sglebius lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 3921290001Sglebius cat \"\$lt_dump_D/\$lt_dump_F\" 3922290001Sglebius exit 0 3923290001Sglebius ;; 3924290001Sglebius --lt-*) 3925290001Sglebius \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 3926290001Sglebius exit 1 3927290001Sglebius ;; 3928290001Sglebius esac 3929290001Sglebius done 3930290001Sglebius 3931290001Sglebius # Print the debug banner immediately: 3932290001Sglebius if test -n \"\$lt_option_debug\"; then 3933290001Sglebius echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 3934290001Sglebius fi 3935290001Sglebius} 3936290001Sglebius 3937290001Sglebius# Used when --lt-debug. Prints its arguments to stdout 3938290001Sglebius# (redirection is the responsibility of the caller) 3939290001Sglebiusfunc_lt_dump_args () 3940290001Sglebius{ 3941290001Sglebius lt_dump_args_N=1; 3942290001Sglebius for lt_arg 3943290001Sglebius do 3944290001Sglebius \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 3945290001Sglebius lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 3946290001Sglebius done 3947290001Sglebius} 3948290001Sglebius 3949290001Sglebius# Core function for launching the target application 3950290001Sglebiusfunc_exec_program_core () 3951290001Sglebius{ 3952290001Sglebius" 3953290001Sglebius case $host in 3954290001Sglebius # Backslashes separate directories on plain windows 3955290001Sglebius *-*-mingw | *-*-os2* | *-cegcc*) 3956290001Sglebius $ECHO "\ 3957290001Sglebius if test -n \"\$lt_option_debug\"; then 3958290001Sglebius \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 3959290001Sglebius func_lt_dump_args \${1+\"\$@\"} 1>&2 3960290001Sglebius fi 3961290001Sglebius exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 3962290001Sglebius" 3963290001Sglebius ;; 3964290001Sglebius 3965290001Sglebius *) 3966290001Sglebius $ECHO "\ 3967290001Sglebius if test -n \"\$lt_option_debug\"; then 3968290001Sglebius \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 3969290001Sglebius func_lt_dump_args \${1+\"\$@\"} 1>&2 3970290001Sglebius fi 3971290001Sglebius exec \"\$progdir/\$program\" \${1+\"\$@\"} 3972290001Sglebius" 3973290001Sglebius ;; 3974290001Sglebius esac 3975290001Sglebius $ECHO "\ 3976290001Sglebius \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 3977290001Sglebius exit 1 3978290001Sglebius} 3979290001Sglebius 3980290001Sglebius# A function to encapsulate launching the target application 3981290001Sglebius# Strips options in the --lt-* namespace from \$@ and 3982290001Sglebius# launches target application with the remaining arguments. 3983290001Sglebiusfunc_exec_program () 3984290001Sglebius{ 3985290001Sglebius for lt_wr_arg 3986290001Sglebius do 3987290001Sglebius case \$lt_wr_arg in 3988290001Sglebius --lt-*) ;; 3989290001Sglebius *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 3990290001Sglebius esac 3991290001Sglebius shift 3992290001Sglebius done 3993290001Sglebius func_exec_program_core \${1+\"\$@\"} 3994290001Sglebius} 3995290001Sglebius 3996290001Sglebius # Parse options 3997290001Sglebius func_parse_lt_options \"\$0\" \${1+\"\$@\"} 3998290001Sglebius 3999290001Sglebius # Find the directory that this script lives in. 4000290001Sglebius thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 4001290001Sglebius test \"x\$thisdir\" = \"x\$file\" && thisdir=. 4002290001Sglebius 4003290001Sglebius # Follow symbolic links until we get to the real thisdir. 4004290001Sglebius file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 4005290001Sglebius while test -n \"\$file\"; do 4006290001Sglebius destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 4007290001Sglebius 4008290001Sglebius # If there was a directory component, then change thisdir. 4009290001Sglebius if test \"x\$destdir\" != \"x\$file\"; then 4010290001Sglebius case \"\$destdir\" in 4011290001Sglebius [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 4012290001Sglebius *) thisdir=\"\$thisdir/\$destdir\" ;; 4013290001Sglebius esac 4014290001Sglebius fi 4015290001Sglebius 4016290001Sglebius file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 4017290001Sglebius file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 4018290001Sglebius done 4019290001Sglebius 4020290001Sglebius # Usually 'no', except on cygwin/mingw when embedded into 4021290001Sglebius # the cwrapper. 4022290001Sglebius WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 4023290001Sglebius if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 4024290001Sglebius # special case for '.' 4025290001Sglebius if test \"\$thisdir\" = \".\"; then 4026290001Sglebius thisdir=\`pwd\` 4027290001Sglebius fi 4028290001Sglebius # remove .libs from thisdir 4029290001Sglebius case \"\$thisdir\" in 4030290001Sglebius *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 4031290001Sglebius $objdir ) thisdir=. ;; 4032290001Sglebius esac 4033290001Sglebius fi 4034290001Sglebius 4035290001Sglebius # Try to get the absolute directory name. 4036290001Sglebius absdir=\`cd \"\$thisdir\" && pwd\` 4037290001Sglebius test -n \"\$absdir\" && thisdir=\"\$absdir\" 4038290001Sglebius" 4039290001Sglebius 4040290001Sglebius if test "$fast_install" = yes; then 4041290001Sglebius $ECHO "\ 4042290001Sglebius program=lt-'$outputname'$exeext 4043290001Sglebius progdir=\"\$thisdir/$objdir\" 4044290001Sglebius 4045290001Sglebius if test ! -f \"\$progdir/\$program\" || 4046290001Sglebius { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 4047290001Sglebius test \"X\$file\" != \"X\$progdir/\$program\"; }; then 4048290001Sglebius 4049290001Sglebius file=\"\$\$-\$program\" 4050290001Sglebius 4051290001Sglebius if test ! -d \"\$progdir\"; then 4052290001Sglebius $MKDIR \"\$progdir\" 4053290001Sglebius else 4054290001Sglebius $RM \"\$progdir/\$file\" 4055290001Sglebius fi" 4056290001Sglebius 4057290001Sglebius $ECHO "\ 4058290001Sglebius 4059290001Sglebius # relink executable if necessary 4060290001Sglebius if test -n \"\$relink_command\"; then 4061290001Sglebius if relink_command_output=\`eval \$relink_command 2>&1\`; then : 4062290001Sglebius else 4063290001Sglebius $ECHO \"\$relink_command_output\" >&2 4064290001Sglebius $RM \"\$progdir/\$file\" 4065290001Sglebius exit 1 4066290001Sglebius fi 4067290001Sglebius fi 4068290001Sglebius 4069290001Sglebius $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 4070290001Sglebius { $RM \"\$progdir/\$program\"; 4071290001Sglebius $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 4072290001Sglebius $RM \"\$progdir/\$file\" 4073290001Sglebius fi" 4074290001Sglebius else 4075290001Sglebius $ECHO "\ 4076290001Sglebius program='$outputname' 4077290001Sglebius progdir=\"\$thisdir/$objdir\" 4078290001Sglebius" 4079290001Sglebius fi 4080290001Sglebius 4081290001Sglebius $ECHO "\ 4082290001Sglebius 4083290001Sglebius if test -f \"\$progdir/\$program\"; then" 4084290001Sglebius 4085290001Sglebius # fixup the dll searchpath if we need to. 4086290001Sglebius # 4087290001Sglebius # Fix the DLL searchpath if we need to. Do this before prepending 4088290001Sglebius # to shlibpath, because on Windows, both are PATH and uninstalled 4089290001Sglebius # libraries must come first. 4090290001Sglebius if test -n "$dllsearchpath"; then 4091290001Sglebius $ECHO "\ 4092290001Sglebius # Add the dll search path components to the executable PATH 4093290001Sglebius PATH=$dllsearchpath:\$PATH 4094290001Sglebius" 4095290001Sglebius fi 4096290001Sglebius 4097290001Sglebius # Export our shlibpath_var if we have one. 4098290001Sglebius if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4099290001Sglebius $ECHO "\ 4100290001Sglebius # Add our own library path to $shlibpath_var 4101290001Sglebius $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 4102290001Sglebius 4103290001Sglebius # Some systems cannot cope with colon-terminated $shlibpath_var 4104290001Sglebius # The second colon is a workaround for a bug in BeOS R4 sed 4105290001Sglebius $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 4106290001Sglebius 4107290001Sglebius export $shlibpath_var 4108290001Sglebius" 4109290001Sglebius fi 4110290001Sglebius 4111290001Sglebius $ECHO "\ 4112290001Sglebius if test \"\$libtool_execute_magic\" != \"$magic\"; then 4113290001Sglebius # Run the actual program with our arguments. 4114290001Sglebius func_exec_program \${1+\"\$@\"} 4115290001Sglebius fi 4116290001Sglebius else 4117290001Sglebius # The program doesn't exist. 4118290001Sglebius \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 4119290001Sglebius \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 4120290001Sglebius \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 4121290001Sglebius exit 1 4122290001Sglebius fi 4123290001Sglebiusfi\ 4124290001Sglebius" 4125290001Sglebius} 4126290001Sglebius 4127290001Sglebius 4128290001Sglebius# func_emit_cwrapperexe_src 4129290001Sglebius# emit the source code for a wrapper executable on stdout 4130290001Sglebius# Must ONLY be called from within func_mode_link because 4131290001Sglebius# it depends on a number of variable set therein. 4132290001Sglebiusfunc_emit_cwrapperexe_src () 4133290001Sglebius{ 4134290001Sglebius cat <<EOF 4135290001Sglebius 4136290001Sglebius/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4137290001Sglebius Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 4138290001Sglebius 4139290001Sglebius The $output program cannot be directly executed until all the libtool 4140290001Sglebius libraries that it depends on are installed. 4141290001Sglebius 4142290001Sglebius This wrapper executable should never be moved out of the build directory. 4143290001Sglebius If it is, it will not operate correctly. 4144290001Sglebius*/ 4145290001SglebiusEOF 4146290001Sglebius cat <<"EOF" 4147290001Sglebius#ifdef _MSC_VER 4148290001Sglebius# define _CRT_SECURE_NO_DEPRECATE 1 4149290001Sglebius#endif 4150290001Sglebius#include <stdio.h> 4151290001Sglebius#include <stdlib.h> 4152290001Sglebius#ifdef _MSC_VER 4153290001Sglebius# include <direct.h> 4154290001Sglebius# include <process.h> 4155290001Sglebius# include <io.h> 4156290001Sglebius#else 4157290001Sglebius# include <unistd.h> 4158290001Sglebius# include <stdint.h> 4159290001Sglebius# ifdef __CYGWIN__ 4160290001Sglebius# include <io.h> 4161290001Sglebius# endif 4162290001Sglebius#endif 4163290001Sglebius#include <malloc.h> 4164290001Sglebius#include <stdarg.h> 4165290001Sglebius#include <assert.h> 4166290001Sglebius#include <string.h> 4167290001Sglebius#include <ctype.h> 4168290001Sglebius#include <errno.h> 4169290001Sglebius#include <fcntl.h> 4170290001Sglebius#include <sys/stat.h> 4171290001Sglebius 4172290001Sglebius/* declarations of non-ANSI functions */ 4173290001Sglebius#if defined(__MINGW32__) 4174290001Sglebius# ifdef __STRICT_ANSI__ 4175290001Sglebiusint _putenv (const char *); 4176290001Sglebius# endif 4177290001Sglebius#elif defined(__CYGWIN__) 4178290001Sglebius# ifdef __STRICT_ANSI__ 4179290001Sglebiuschar *realpath (const char *, char *); 4180290001Sglebiusint putenv (char *); 4181290001Sglebiusint setenv (const char *, const char *, int); 4182290001Sglebius# endif 4183290001Sglebius/* #elif defined (other platforms) ... */ 4184290001Sglebius#endif 4185290001Sglebius 4186290001Sglebius/* portability defines, excluding path handling macros */ 4187290001Sglebius#if defined(_MSC_VER) 4188290001Sglebius# define setmode _setmode 4189290001Sglebius# define stat _stat 4190290001Sglebius# define chmod _chmod 4191290001Sglebius# define getcwd _getcwd 4192290001Sglebius# define putenv _putenv 4193290001Sglebius# define S_IXUSR _S_IEXEC 4194290001Sglebius# ifndef _INTPTR_T_DEFINED 4195290001Sglebius# define _INTPTR_T_DEFINED 4196290001Sglebius# define intptr_t int 4197290001Sglebius# endif 4198290001Sglebius#elif defined(__MINGW32__) 4199290001Sglebius# define setmode _setmode 4200290001Sglebius# define stat _stat 4201290001Sglebius# define chmod _chmod 4202290001Sglebius# define getcwd _getcwd 4203290001Sglebius# define putenv _putenv 4204290001Sglebius#elif defined(__CYGWIN__) 4205290001Sglebius# define HAVE_SETENV 4206290001Sglebius# define FOPEN_WB "wb" 4207290001Sglebius/* #elif defined (other platforms) ... */ 4208290001Sglebius#endif 4209290001Sglebius 4210290001Sglebius#if defined(PATH_MAX) 4211290001Sglebius# define LT_PATHMAX PATH_MAX 4212290001Sglebius#elif defined(MAXPATHLEN) 4213290001Sglebius# define LT_PATHMAX MAXPATHLEN 4214290001Sglebius#else 4215290001Sglebius# define LT_PATHMAX 1024 4216290001Sglebius#endif 4217290001Sglebius 4218290001Sglebius#ifndef S_IXOTH 4219290001Sglebius# define S_IXOTH 0 4220290001Sglebius#endif 4221290001Sglebius#ifndef S_IXGRP 4222290001Sglebius# define S_IXGRP 0 4223290001Sglebius#endif 4224290001Sglebius 4225290001Sglebius/* path handling portability macros */ 4226290001Sglebius#ifndef DIR_SEPARATOR 4227290001Sglebius# define DIR_SEPARATOR '/' 4228290001Sglebius# define PATH_SEPARATOR ':' 4229290001Sglebius#endif 4230290001Sglebius 4231290001Sglebius#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4232290001Sglebius defined (__OS2__) 4233290001Sglebius# define HAVE_DOS_BASED_FILE_SYSTEM 4234290001Sglebius# define FOPEN_WB "wb" 4235290001Sglebius# ifndef DIR_SEPARATOR_2 4236290001Sglebius# define DIR_SEPARATOR_2 '\\' 4237290001Sglebius# endif 4238290001Sglebius# ifndef PATH_SEPARATOR_2 4239290001Sglebius# define PATH_SEPARATOR_2 ';' 4240290001Sglebius# endif 4241290001Sglebius#endif 4242290001Sglebius 4243290001Sglebius#ifndef DIR_SEPARATOR_2 4244290001Sglebius# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4245290001Sglebius#else /* DIR_SEPARATOR_2 */ 4246290001Sglebius# define IS_DIR_SEPARATOR(ch) \ 4247290001Sglebius (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4248290001Sglebius#endif /* DIR_SEPARATOR_2 */ 4249290001Sglebius 4250290001Sglebius#ifndef PATH_SEPARATOR_2 4251290001Sglebius# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 4252290001Sglebius#else /* PATH_SEPARATOR_2 */ 4253290001Sglebius# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 4254290001Sglebius#endif /* PATH_SEPARATOR_2 */ 4255290001Sglebius 4256290001Sglebius#ifndef FOPEN_WB 4257290001Sglebius# define FOPEN_WB "w" 4258290001Sglebius#endif 4259290001Sglebius#ifndef _O_BINARY 4260290001Sglebius# define _O_BINARY 0 4261290001Sglebius#endif 4262290001Sglebius 4263290001Sglebius#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4264290001Sglebius#define XFREE(stale) do { \ 4265290001Sglebius if (stale) { free ((void *) stale); stale = 0; } \ 4266290001Sglebius} while (0) 4267290001Sglebius 4268290001Sglebius#if defined(LT_DEBUGWRAPPER) 4269290001Sglebiusstatic int lt_debug = 1; 4270290001Sglebius#else 4271290001Sglebiusstatic int lt_debug = 0; 4272290001Sglebius#endif 4273290001Sglebius 4274290001Sglebiusconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 4275290001Sglebius 4276290001Sglebiusvoid *xmalloc (size_t num); 4277290001Sglebiuschar *xstrdup (const char *string); 4278290001Sglebiusconst char *base_name (const char *name); 4279290001Sglebiuschar *find_executable (const char *wrapper); 4280290001Sglebiuschar *chase_symlinks (const char *pathspec); 4281290001Sglebiusint make_executable (const char *path); 4282290001Sglebiusint check_executable (const char *path); 4283290001Sglebiuschar *strendzap (char *str, const char *pat); 4284290001Sglebiusvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 4285290001Sglebiusvoid lt_fatal (const char *file, int line, const char *message, ...); 4286290001Sglebiusstatic const char *nonnull (const char *s); 4287290001Sglebiusstatic const char *nonempty (const char *s); 4288290001Sglebiusvoid lt_setenv (const char *name, const char *value); 4289290001Sglebiuschar *lt_extend_str (const char *orig_value, const char *add, int to_end); 4290290001Sglebiusvoid lt_update_exe_path (const char *name, const char *value); 4291290001Sglebiusvoid lt_update_lib_path (const char *name, const char *value); 4292290001Sglebiuschar **prepare_spawn (char **argv); 4293290001Sglebiusvoid lt_dump_script (FILE *f); 4294290001SglebiusEOF 4295290001Sglebius 4296290001Sglebius cat <<EOF 4297290001Sglebiusvolatile const char * MAGIC_EXE = "$magic_exe"; 4298290001Sglebiusconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 4299290001SglebiusEOF 4300290001Sglebius 4301290001Sglebius if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4302290001Sglebius func_to_host_path "$temp_rpath" 4303290001Sglebius cat <<EOF 4304290001Sglebiusconst char * LIB_PATH_VALUE = "$func_to_host_path_result"; 4305290001SglebiusEOF 4306290001Sglebius else 4307290001Sglebius cat <<"EOF" 4308290001Sglebiusconst char * LIB_PATH_VALUE = ""; 4309290001SglebiusEOF 4310290001Sglebius fi 4311290001Sglebius 4312290001Sglebius if test -n "$dllsearchpath"; then 4313290001Sglebius func_to_host_path "$dllsearchpath:" 4314290001Sglebius cat <<EOF 4315290001Sglebiusconst char * EXE_PATH_VARNAME = "PATH"; 4316290001Sglebiusconst char * EXE_PATH_VALUE = "$func_to_host_path_result"; 4317290001SglebiusEOF 4318290001Sglebius else 4319290001Sglebius cat <<"EOF" 4320290001Sglebiusconst char * EXE_PATH_VARNAME = ""; 4321290001Sglebiusconst char * EXE_PATH_VALUE = ""; 4322290001SglebiusEOF 4323290001Sglebius fi 4324290001Sglebius 4325290001Sglebius if test "$fast_install" = yes; then 4326290001Sglebius cat <<EOF 4327290001Sglebiusconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 4328290001SglebiusEOF 4329290001Sglebius else 4330290001Sglebius cat <<EOF 4331290001Sglebiusconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 4332290001SglebiusEOF 4333290001Sglebius fi 4334290001Sglebius 4335290001Sglebius 4336290001Sglebius cat <<"EOF" 4337290001Sglebius 4338290001Sglebius#define LTWRAPPER_OPTION_PREFIX "--lt-" 4339290001Sglebius 4340290001Sglebiusstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 4341290001Sglebiusstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 4342290001Sglebiusstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 4343290001Sglebius 4344290001Sglebiusint 4345290001Sglebiusmain (int argc, char *argv[]) 4346290001Sglebius{ 4347290001Sglebius char **newargz; 4348290001Sglebius int newargc; 4349290001Sglebius char *tmp_pathspec; 4350290001Sglebius char *actual_cwrapper_path; 4351290001Sglebius char *actual_cwrapper_name; 4352290001Sglebius char *target_name; 4353290001Sglebius char *lt_argv_zero; 4354290001Sglebius intptr_t rval = 127; 4355290001Sglebius 4356290001Sglebius int i; 4357290001Sglebius 4358290001Sglebius program_name = (char *) xstrdup (base_name (argv[0])); 4359290001Sglebius newargz = XMALLOC (char *, argc + 1); 4360290001Sglebius 4361290001Sglebius /* very simple arg parsing; don't want to rely on getopt 4362290001Sglebius * also, copy all non cwrapper options to newargz, except 4363290001Sglebius * argz[0], which is handled differently 4364290001Sglebius */ 4365290001Sglebius newargc=0; 4366290001Sglebius for (i = 1; i < argc; i++) 4367290001Sglebius { 4368290001Sglebius if (strcmp (argv[i], dumpscript_opt) == 0) 4369290001Sglebius { 4370290001SglebiusEOF 4371290001Sglebius case "$host" in 4372290001Sglebius *mingw* | *cygwin* ) 4373290001Sglebius # make stdout use "unix" line endings 4374290001Sglebius echo " setmode(1,_O_BINARY);" 4375290001Sglebius ;; 4376290001Sglebius esac 4377290001Sglebius 4378290001Sglebius cat <<"EOF" 4379290001Sglebius lt_dump_script (stdout); 4380290001Sglebius return 0; 4381290001Sglebius } 4382290001Sglebius if (strcmp (argv[i], debug_opt) == 0) 4383290001Sglebius { 4384290001Sglebius lt_debug = 1; 4385290001Sglebius continue; 4386290001Sglebius } 4387290001Sglebius if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 4388290001Sglebius { 4389290001Sglebius /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 4390290001Sglebius namespace, but it is not one of the ones we know about and 4391290001Sglebius have already dealt with, above (inluding dump-script), then 4392290001Sglebius report an error. Otherwise, targets might begin to believe 4393290001Sglebius they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 4394290001Sglebius namespace. The first time any user complains about this, we'll 4395290001Sglebius need to make LTWRAPPER_OPTION_PREFIX a configure-time option 4396290001Sglebius or a configure.ac-settable value. 4397290001Sglebius */ 4398290001Sglebius lt_fatal (__FILE__, __LINE__, 4399290001Sglebius "unrecognized %s option: '%s'", 4400290001Sglebius ltwrapper_option_prefix, argv[i]); 4401290001Sglebius } 4402290001Sglebius /* otherwise ... */ 4403290001Sglebius newargz[++newargc] = xstrdup (argv[i]); 4404290001Sglebius } 4405290001Sglebius newargz[++newargc] = NULL; 4406290001Sglebius 4407290001SglebiusEOF 4408290001Sglebius cat <<EOF 4409290001Sglebius /* The GNU banner must be the first non-error debug message */ 4410290001Sglebius lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 4411290001SglebiusEOF 4412290001Sglebius cat <<"EOF" 4413290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 4414290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 4415290001Sglebius 4416290001Sglebius tmp_pathspec = find_executable (argv[0]); 4417290001Sglebius if (tmp_pathspec == NULL) 4418290001Sglebius lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 4419290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4420290001Sglebius "(main) found exe (before symlink chase) at: %s\n", 4421290001Sglebius tmp_pathspec); 4422290001Sglebius 4423290001Sglebius actual_cwrapper_path = chase_symlinks (tmp_pathspec); 4424290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4425290001Sglebius "(main) found exe (after symlink chase) at: %s\n", 4426290001Sglebius actual_cwrapper_path); 4427290001Sglebius XFREE (tmp_pathspec); 4428290001Sglebius 4429290001Sglebius actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 4430290001Sglebius strendzap (actual_cwrapper_path, actual_cwrapper_name); 4431290001Sglebius 4432290001Sglebius /* wrapper name transforms */ 4433290001Sglebius strendzap (actual_cwrapper_name, ".exe"); 4434290001Sglebius tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 4435290001Sglebius XFREE (actual_cwrapper_name); 4436290001Sglebius actual_cwrapper_name = tmp_pathspec; 4437290001Sglebius tmp_pathspec = 0; 4438290001Sglebius 4439290001Sglebius /* target_name transforms -- use actual target program name; might have lt- prefix */ 4440290001Sglebius target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 4441290001Sglebius strendzap (target_name, ".exe"); 4442290001Sglebius tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 4443290001Sglebius XFREE (target_name); 4444290001Sglebius target_name = tmp_pathspec; 4445290001Sglebius tmp_pathspec = 0; 4446290001Sglebius 4447290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4448290001Sglebius "(main) libtool target name: %s\n", 4449290001Sglebius target_name); 4450290001SglebiusEOF 4451290001Sglebius 4452290001Sglebius cat <<EOF 4453290001Sglebius newargz[0] = 4454290001Sglebius XMALLOC (char, (strlen (actual_cwrapper_path) + 4455290001Sglebius strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 4456290001Sglebius strcpy (newargz[0], actual_cwrapper_path); 4457290001Sglebius strcat (newargz[0], "$objdir"); 4458290001Sglebius strcat (newargz[0], "/"); 4459290001SglebiusEOF 4460290001Sglebius 4461290001Sglebius cat <<"EOF" 4462290001Sglebius /* stop here, and copy so we don't have to do this twice */ 4463290001Sglebius tmp_pathspec = xstrdup (newargz[0]); 4464290001Sglebius 4465290001Sglebius /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 4466290001Sglebius strcat (newargz[0], actual_cwrapper_name); 4467290001Sglebius 4468290001Sglebius /* DO want the lt- prefix here if it exists, so use target_name */ 4469290001Sglebius lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 4470290001Sglebius XFREE (tmp_pathspec); 4471290001Sglebius tmp_pathspec = NULL; 4472290001SglebiusEOF 4473290001Sglebius 4474290001Sglebius case $host_os in 4475290001Sglebius mingw*) 4476290001Sglebius cat <<"EOF" 4477290001Sglebius { 4478290001Sglebius char* p; 4479290001Sglebius while ((p = strchr (newargz[0], '\\')) != NULL) 4480290001Sglebius { 4481290001Sglebius *p = '/'; 4482290001Sglebius } 4483290001Sglebius while ((p = strchr (lt_argv_zero, '\\')) != NULL) 4484290001Sglebius { 4485290001Sglebius *p = '/'; 4486290001Sglebius } 4487290001Sglebius } 4488290001SglebiusEOF 4489290001Sglebius ;; 4490290001Sglebius esac 4491290001Sglebius 4492290001Sglebius cat <<"EOF" 4493290001Sglebius XFREE (target_name); 4494290001Sglebius XFREE (actual_cwrapper_path); 4495290001Sglebius XFREE (actual_cwrapper_name); 4496290001Sglebius 4497290001Sglebius lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 4498290001Sglebius lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 4499290001Sglebius /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 4500290001Sglebius be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 4501290001Sglebius because on Windows, both *_VARNAMEs are PATH but uninstalled 4502290001Sglebius libraries must come first. */ 4503290001Sglebius lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 4504290001Sglebius lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 4505290001Sglebius 4506290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 4507290001Sglebius nonnull (lt_argv_zero)); 4508290001Sglebius for (i = 0; i < newargc; i++) 4509290001Sglebius { 4510290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 4511290001Sglebius i, nonnull (newargz[i])); 4512290001Sglebius } 4513290001Sglebius 4514290001SglebiusEOF 4515290001Sglebius 4516290001Sglebius case $host_os in 4517290001Sglebius mingw*) 4518290001Sglebius cat <<"EOF" 4519290001Sglebius /* execv doesn't actually work on mingw as expected on unix */ 4520290001Sglebius newargz = prepare_spawn (newargz); 4521290001Sglebius rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 4522290001Sglebius if (rval == -1) 4523290001Sglebius { 4524290001Sglebius /* failed to start process */ 4525290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4526290001Sglebius "(main) failed to launch target \"%s\": %s\n", 4527290001Sglebius lt_argv_zero, nonnull (strerror (errno))); 4528290001Sglebius return 127; 4529290001Sglebius } 4530290001Sglebius return rval; 4531290001SglebiusEOF 4532290001Sglebius ;; 4533290001Sglebius *) 4534290001Sglebius cat <<"EOF" 4535290001Sglebius execv (lt_argv_zero, newargz); 4536290001Sglebius return rval; /* =127, but avoids unused variable warning */ 4537290001SglebiusEOF 4538290001Sglebius ;; 4539290001Sglebius esac 4540290001Sglebius 4541290001Sglebius cat <<"EOF" 4542290001Sglebius} 4543290001Sglebius 4544290001Sglebiusvoid * 4545290001Sglebiusxmalloc (size_t num) 4546290001Sglebius{ 4547290001Sglebius void *p = (void *) malloc (num); 4548290001Sglebius if (!p) 4549290001Sglebius lt_fatal (__FILE__, __LINE__, "memory exhausted"); 4550290001Sglebius 4551290001Sglebius return p; 4552290001Sglebius} 4553290001Sglebius 4554290001Sglebiuschar * 4555290001Sglebiusxstrdup (const char *string) 4556290001Sglebius{ 4557290001Sglebius return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 4558290001Sglebius string) : NULL; 4559290001Sglebius} 4560290001Sglebius 4561290001Sglebiusconst char * 4562290001Sglebiusbase_name (const char *name) 4563290001Sglebius{ 4564290001Sglebius const char *base; 4565290001Sglebius 4566290001Sglebius#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4567290001Sglebius /* Skip over the disk name in MSDOS pathnames. */ 4568290001Sglebius if (isalpha ((unsigned char) name[0]) && name[1] == ':') 4569290001Sglebius name += 2; 4570290001Sglebius#endif 4571290001Sglebius 4572290001Sglebius for (base = name; *name; name++) 4573290001Sglebius if (IS_DIR_SEPARATOR (*name)) 4574290001Sglebius base = name + 1; 4575290001Sglebius return base; 4576290001Sglebius} 4577290001Sglebius 4578290001Sglebiusint 4579290001Sglebiuscheck_executable (const char *path) 4580290001Sglebius{ 4581290001Sglebius struct stat st; 4582290001Sglebius 4583290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 4584290001Sglebius nonempty (path)); 4585290001Sglebius if ((!path) || (!*path)) 4586290001Sglebius return 0; 4587290001Sglebius 4588290001Sglebius if ((stat (path, &st) >= 0) 4589290001Sglebius && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 4590290001Sglebius return 1; 4591290001Sglebius else 4592290001Sglebius return 0; 4593290001Sglebius} 4594290001Sglebius 4595290001Sglebiusint 4596290001Sglebiusmake_executable (const char *path) 4597290001Sglebius{ 4598290001Sglebius int rval = 0; 4599290001Sglebius struct stat st; 4600290001Sglebius 4601290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 4602290001Sglebius nonempty (path)); 4603290001Sglebius if ((!path) || (!*path)) 4604290001Sglebius return 0; 4605290001Sglebius 4606290001Sglebius if (stat (path, &st) >= 0) 4607290001Sglebius { 4608290001Sglebius rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 4609290001Sglebius } 4610290001Sglebius return rval; 4611290001Sglebius} 4612290001Sglebius 4613290001Sglebius/* Searches for the full path of the wrapper. Returns 4614290001Sglebius newly allocated full path name if found, NULL otherwise 4615290001Sglebius Does not chase symlinks, even on platforms that support them. 4616290001Sglebius*/ 4617290001Sglebiuschar * 4618290001Sglebiusfind_executable (const char *wrapper) 4619290001Sglebius{ 4620290001Sglebius int has_slash = 0; 4621290001Sglebius const char *p; 4622290001Sglebius const char *p_next; 4623290001Sglebius /* static buffer for getcwd */ 4624290001Sglebius char tmp[LT_PATHMAX + 1]; 4625290001Sglebius int tmp_len; 4626290001Sglebius char *concat_name; 4627290001Sglebius 4628290001Sglebius lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 4629290001Sglebius nonempty (wrapper)); 4630290001Sglebius 4631290001Sglebius if ((wrapper == NULL) || (*wrapper == '\0')) 4632290001Sglebius return NULL; 4633290001Sglebius 4634290001Sglebius /* Absolute path? */ 4635290001Sglebius#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4636290001Sglebius if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 4637290001Sglebius { 4638290001Sglebius concat_name = xstrdup (wrapper); 4639290001Sglebius if (check_executable (concat_name)) 4640290001Sglebius return concat_name; 4641290001Sglebius XFREE (concat_name); 4642290001Sglebius } 4643290001Sglebius else 4644290001Sglebius { 4645290001Sglebius#endif 4646290001Sglebius if (IS_DIR_SEPARATOR (wrapper[0])) 4647290001Sglebius { 4648290001Sglebius concat_name = xstrdup (wrapper); 4649290001Sglebius if (check_executable (concat_name)) 4650290001Sglebius return concat_name; 4651290001Sglebius XFREE (concat_name); 4652290001Sglebius } 4653290001Sglebius#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4654290001Sglebius } 4655290001Sglebius#endif 4656290001Sglebius 4657290001Sglebius for (p = wrapper; *p; p++) 4658290001Sglebius if (*p == '/') 4659290001Sglebius { 4660290001Sglebius has_slash = 1; 4661290001Sglebius break; 4662290001Sglebius } 4663290001Sglebius if (!has_slash) 4664290001Sglebius { 4665290001Sglebius /* no slashes; search PATH */ 4666290001Sglebius const char *path = getenv ("PATH"); 4667290001Sglebius if (path != NULL) 4668290001Sglebius { 4669290001Sglebius for (p = path; *p; p = p_next) 4670290001Sglebius { 4671290001Sglebius const char *q; 4672290001Sglebius size_t p_len; 4673290001Sglebius for (q = p; *q; q++) 4674290001Sglebius if (IS_PATH_SEPARATOR (*q)) 4675290001Sglebius break; 4676290001Sglebius p_len = q - p; 4677290001Sglebius p_next = (*q == '\0' ? q : q + 1); 4678290001Sglebius if (p_len == 0) 4679290001Sglebius { 4680290001Sglebius /* empty path: current directory */ 4681290001Sglebius if (getcwd (tmp, LT_PATHMAX) == NULL) 4682290001Sglebius lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4683290001Sglebius nonnull (strerror (errno))); 4684290001Sglebius tmp_len = strlen (tmp); 4685290001Sglebius concat_name = 4686290001Sglebius XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4687290001Sglebius memcpy (concat_name, tmp, tmp_len); 4688290001Sglebius concat_name[tmp_len] = '/'; 4689290001Sglebius strcpy (concat_name + tmp_len + 1, wrapper); 4690290001Sglebius } 4691290001Sglebius else 4692290001Sglebius { 4693290001Sglebius concat_name = 4694290001Sglebius XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 4695290001Sglebius memcpy (concat_name, p, p_len); 4696290001Sglebius concat_name[p_len] = '/'; 4697290001Sglebius strcpy (concat_name + p_len + 1, wrapper); 4698290001Sglebius } 4699290001Sglebius if (check_executable (concat_name)) 4700290001Sglebius return concat_name; 4701290001Sglebius XFREE (concat_name); 4702290001Sglebius } 4703290001Sglebius } 4704290001Sglebius /* not found in PATH; assume curdir */ 4705290001Sglebius } 4706290001Sglebius /* Relative path | not found in path: prepend cwd */ 4707290001Sglebius if (getcwd (tmp, LT_PATHMAX) == NULL) 4708290001Sglebius lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4709290001Sglebius nonnull (strerror (errno))); 4710290001Sglebius tmp_len = strlen (tmp); 4711290001Sglebius concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4712290001Sglebius memcpy (concat_name, tmp, tmp_len); 4713290001Sglebius concat_name[tmp_len] = '/'; 4714290001Sglebius strcpy (concat_name + tmp_len + 1, wrapper); 4715290001Sglebius 4716290001Sglebius if (check_executable (concat_name)) 4717290001Sglebius return concat_name; 4718290001Sglebius XFREE (concat_name); 4719290001Sglebius return NULL; 4720290001Sglebius} 4721290001Sglebius 4722290001Sglebiuschar * 4723290001Sglebiuschase_symlinks (const char *pathspec) 4724290001Sglebius{ 4725290001Sglebius#ifndef S_ISLNK 4726290001Sglebius return xstrdup (pathspec); 4727290001Sglebius#else 4728290001Sglebius char buf[LT_PATHMAX]; 4729290001Sglebius struct stat s; 4730290001Sglebius char *tmp_pathspec = xstrdup (pathspec); 4731290001Sglebius char *p; 4732290001Sglebius int has_symlinks = 0; 4733290001Sglebius while (strlen (tmp_pathspec) && !has_symlinks) 4734290001Sglebius { 4735290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4736290001Sglebius "checking path component for symlinks: %s\n", 4737290001Sglebius tmp_pathspec); 4738290001Sglebius if (lstat (tmp_pathspec, &s) == 0) 4739290001Sglebius { 4740290001Sglebius if (S_ISLNK (s.st_mode) != 0) 4741290001Sglebius { 4742290001Sglebius has_symlinks = 1; 4743290001Sglebius break; 4744290001Sglebius } 4745290001Sglebius 4746290001Sglebius /* search backwards for last DIR_SEPARATOR */ 4747290001Sglebius p = tmp_pathspec + strlen (tmp_pathspec) - 1; 4748290001Sglebius while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4749290001Sglebius p--; 4750290001Sglebius if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4751290001Sglebius { 4752290001Sglebius /* no more DIR_SEPARATORS left */ 4753290001Sglebius break; 4754290001Sglebius } 4755290001Sglebius *p = '\0'; 4756290001Sglebius } 4757290001Sglebius else 4758290001Sglebius { 4759290001Sglebius lt_fatal (__FILE__, __LINE__, 4760290001Sglebius "error accessing file \"%s\": %s", 4761290001Sglebius tmp_pathspec, nonnull (strerror (errno))); 4762290001Sglebius } 4763290001Sglebius } 4764290001Sglebius XFREE (tmp_pathspec); 4765290001Sglebius 4766290001Sglebius if (!has_symlinks) 4767290001Sglebius { 4768290001Sglebius return xstrdup (pathspec); 4769290001Sglebius } 4770290001Sglebius 4771290001Sglebius tmp_pathspec = realpath (pathspec, buf); 4772290001Sglebius if (tmp_pathspec == 0) 4773290001Sglebius { 4774290001Sglebius lt_fatal (__FILE__, __LINE__, 4775290001Sglebius "could not follow symlinks for %s", pathspec); 4776290001Sglebius } 4777290001Sglebius return xstrdup (tmp_pathspec); 4778290001Sglebius#endif 4779290001Sglebius} 4780290001Sglebius 4781290001Sglebiuschar * 4782290001Sglebiusstrendzap (char *str, const char *pat) 4783290001Sglebius{ 4784290001Sglebius size_t len, patlen; 4785290001Sglebius 4786290001Sglebius assert (str != NULL); 4787290001Sglebius assert (pat != NULL); 4788290001Sglebius 4789290001Sglebius len = strlen (str); 4790290001Sglebius patlen = strlen (pat); 4791290001Sglebius 4792290001Sglebius if (patlen <= len) 4793290001Sglebius { 4794290001Sglebius str += len - patlen; 4795290001Sglebius if (strcmp (str, pat) == 0) 4796290001Sglebius *str = '\0'; 4797290001Sglebius } 4798290001Sglebius return str; 4799290001Sglebius} 4800290001Sglebius 4801290001Sglebiusvoid 4802290001Sglebiuslt_debugprintf (const char *file, int line, const char *fmt, ...) 4803290001Sglebius{ 4804290001Sglebius va_list args; 4805290001Sglebius if (lt_debug) 4806290001Sglebius { 4807290001Sglebius (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 4808290001Sglebius va_start (args, fmt); 4809290001Sglebius (void) vfprintf (stderr, fmt, args); 4810290001Sglebius va_end (args); 4811290001Sglebius } 4812290001Sglebius} 4813290001Sglebius 4814290001Sglebiusstatic void 4815290001Sglebiuslt_error_core (int exit_status, const char *file, 4816290001Sglebius int line, const char *mode, 4817290001Sglebius const char *message, va_list ap) 4818290001Sglebius{ 4819290001Sglebius fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 4820290001Sglebius vfprintf (stderr, message, ap); 4821290001Sglebius fprintf (stderr, ".\n"); 4822290001Sglebius 4823290001Sglebius if (exit_status >= 0) 4824290001Sglebius exit (exit_status); 4825290001Sglebius} 4826290001Sglebius 4827290001Sglebiusvoid 4828290001Sglebiuslt_fatal (const char *file, int line, const char *message, ...) 4829290001Sglebius{ 4830290001Sglebius va_list ap; 4831290001Sglebius va_start (ap, message); 4832290001Sglebius lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 4833290001Sglebius va_end (ap); 4834290001Sglebius} 4835290001Sglebius 4836290001Sglebiusstatic const char * 4837290001Sglebiusnonnull (const char *s) 4838290001Sglebius{ 4839290001Sglebius return s ? s : "(null)"; 4840290001Sglebius} 4841290001Sglebius 4842290001Sglebiusstatic const char * 4843290001Sglebiusnonempty (const char *s) 4844290001Sglebius{ 4845290001Sglebius return (s && !*s) ? "(empty)" : nonnull (s); 4846290001Sglebius} 4847290001Sglebius 4848290001Sglebiusvoid 4849290001Sglebiuslt_setenv (const char *name, const char *value) 4850290001Sglebius{ 4851290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4852290001Sglebius "(lt_setenv) setting '%s' to '%s'\n", 4853290001Sglebius nonnull (name), nonnull (value)); 4854290001Sglebius { 4855290001Sglebius#ifdef HAVE_SETENV 4856290001Sglebius /* always make a copy, for consistency with !HAVE_SETENV */ 4857290001Sglebius char *str = xstrdup (value); 4858290001Sglebius setenv (name, str, 1); 4859290001Sglebius#else 4860290001Sglebius int len = strlen (name) + 1 + strlen (value) + 1; 4861290001Sglebius char *str = XMALLOC (char, len); 4862290001Sglebius sprintf (str, "%s=%s", name, value); 4863290001Sglebius if (putenv (str) != EXIT_SUCCESS) 4864290001Sglebius { 4865290001Sglebius XFREE (str); 4866290001Sglebius } 4867290001Sglebius#endif 4868290001Sglebius } 4869290001Sglebius} 4870290001Sglebius 4871290001Sglebiuschar * 4872290001Sglebiuslt_extend_str (const char *orig_value, const char *add, int to_end) 4873290001Sglebius{ 4874290001Sglebius char *new_value; 4875290001Sglebius if (orig_value && *orig_value) 4876290001Sglebius { 4877290001Sglebius int orig_value_len = strlen (orig_value); 4878290001Sglebius int add_len = strlen (add); 4879290001Sglebius new_value = XMALLOC (char, add_len + orig_value_len + 1); 4880290001Sglebius if (to_end) 4881290001Sglebius { 4882290001Sglebius strcpy (new_value, orig_value); 4883290001Sglebius strcpy (new_value + orig_value_len, add); 4884290001Sglebius } 4885290001Sglebius else 4886290001Sglebius { 4887290001Sglebius strcpy (new_value, add); 4888290001Sglebius strcpy (new_value + add_len, orig_value); 4889290001Sglebius } 4890290001Sglebius } 4891290001Sglebius else 4892290001Sglebius { 4893290001Sglebius new_value = xstrdup (add); 4894290001Sglebius } 4895290001Sglebius return new_value; 4896290001Sglebius} 4897290001Sglebius 4898290001Sglebiusvoid 4899290001Sglebiuslt_update_exe_path (const char *name, const char *value) 4900290001Sglebius{ 4901290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4902290001Sglebius "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 4903290001Sglebius nonnull (name), nonnull (value)); 4904290001Sglebius 4905290001Sglebius if (name && *name && value && *value) 4906290001Sglebius { 4907290001Sglebius char *new_value = lt_extend_str (getenv (name), value, 0); 4908290001Sglebius /* some systems can't cope with a ':'-terminated path #' */ 4909290001Sglebius int len = strlen (new_value); 4910290001Sglebius while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 4911290001Sglebius { 4912290001Sglebius new_value[len-1] = '\0'; 4913290001Sglebius } 4914290001Sglebius lt_setenv (name, new_value); 4915290001Sglebius XFREE (new_value); 4916290001Sglebius } 4917290001Sglebius} 4918290001Sglebius 4919290001Sglebiusvoid 4920290001Sglebiuslt_update_lib_path (const char *name, const char *value) 4921290001Sglebius{ 4922290001Sglebius lt_debugprintf (__FILE__, __LINE__, 4923290001Sglebius "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 4924290001Sglebius nonnull (name), nonnull (value)); 4925290001Sglebius 4926290001Sglebius if (name && *name && value && *value) 4927290001Sglebius { 4928290001Sglebius char *new_value = lt_extend_str (getenv (name), value, 0); 4929290001Sglebius lt_setenv (name, new_value); 4930290001Sglebius XFREE (new_value); 4931290001Sglebius } 4932290001Sglebius} 4933290001Sglebius 4934290001SglebiusEOF 4935290001Sglebius case $host_os in 4936290001Sglebius mingw*) 4937290001Sglebius cat <<"EOF" 4938290001Sglebius 4939290001Sglebius/* Prepares an argument vector before calling spawn(). 4940290001Sglebius Note that spawn() does not by itself call the command interpreter 4941290001Sglebius (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 4942290001Sglebius ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 4943290001Sglebius GetVersionEx(&v); 4944290001Sglebius v.dwPlatformId == VER_PLATFORM_WIN32_NT; 4945290001Sglebius }) ? "cmd.exe" : "command.com"). 4946290001Sglebius Instead it simply concatenates the arguments, separated by ' ', and calls 4947290001Sglebius CreateProcess(). We must quote the arguments since Win32 CreateProcess() 4948290001Sglebius interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 4949290001Sglebius special way: 4950290001Sglebius - Space and tab are interpreted as delimiters. They are not treated as 4951290001Sglebius delimiters if they are surrounded by double quotes: "...". 4952290001Sglebius - Unescaped double quotes are removed from the input. Their only effect is 4953290001Sglebius that within double quotes, space and tab are treated like normal 4954290001Sglebius characters. 4955290001Sglebius - Backslashes not followed by double quotes are not special. 4956290001Sglebius - But 2*n+1 backslashes followed by a double quote become 4957290001Sglebius n backslashes followed by a double quote (n >= 0): 4958290001Sglebius \" -> " 4959290001Sglebius \\\" -> \" 4960290001Sglebius \\\\\" -> \\" 4961290001Sglebius */ 4962290001Sglebius#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" 4963290001Sglebius#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" 4964290001Sglebiuschar ** 4965290001Sglebiusprepare_spawn (char **argv) 4966290001Sglebius{ 4967290001Sglebius size_t argc; 4968290001Sglebius char **new_argv; 4969290001Sglebius size_t i; 4970290001Sglebius 4971290001Sglebius /* Count number of arguments. */ 4972290001Sglebius for (argc = 0; argv[argc] != NULL; argc++) 4973290001Sglebius ; 4974290001Sglebius 4975290001Sglebius /* Allocate new argument vector. */ 4976290001Sglebius new_argv = XMALLOC (char *, argc + 1); 4977290001Sglebius 4978290001Sglebius /* Put quoted arguments into the new argument vector. */ 4979290001Sglebius for (i = 0; i < argc; i++) 4980290001Sglebius { 4981290001Sglebius const char *string = argv[i]; 4982290001Sglebius 4983290001Sglebius if (string[0] == '\0') 4984290001Sglebius new_argv[i] = xstrdup ("\"\""); 4985290001Sglebius else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 4986290001Sglebius { 4987290001Sglebius int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 4988290001Sglebius size_t length; 4989290001Sglebius unsigned int backslashes; 4990290001Sglebius const char *s; 4991290001Sglebius char *quoted_string; 4992290001Sglebius char *p; 4993290001Sglebius 4994290001Sglebius length = 0; 4995290001Sglebius backslashes = 0; 4996290001Sglebius if (quote_around) 4997290001Sglebius length++; 4998290001Sglebius for (s = string; *s != '\0'; s++) 4999290001Sglebius { 5000290001Sglebius char c = *s; 5001290001Sglebius if (c == '"') 5002290001Sglebius length += backslashes + 1; 5003290001Sglebius length++; 5004290001Sglebius if (c == '\\') 5005290001Sglebius backslashes++; 5006290001Sglebius else 5007290001Sglebius backslashes = 0; 5008290001Sglebius } 5009290001Sglebius if (quote_around) 5010290001Sglebius length += backslashes + 1; 5011290001Sglebius 5012290001Sglebius quoted_string = XMALLOC (char, length + 1); 5013290001Sglebius 5014290001Sglebius p = quoted_string; 5015290001Sglebius backslashes = 0; 5016290001Sglebius if (quote_around) 5017290001Sglebius *p++ = '"'; 5018290001Sglebius for (s = string; *s != '\0'; s++) 5019290001Sglebius { 5020290001Sglebius char c = *s; 5021290001Sglebius if (c == '"') 5022290001Sglebius { 5023290001Sglebius unsigned int j; 5024290001Sglebius for (j = backslashes + 1; j > 0; j--) 5025290001Sglebius *p++ = '\\'; 5026290001Sglebius } 5027290001Sglebius *p++ = c; 5028290001Sglebius if (c == '\\') 5029290001Sglebius backslashes++; 5030290001Sglebius else 5031290001Sglebius backslashes = 0; 5032290001Sglebius } 5033290001Sglebius if (quote_around) 5034290001Sglebius { 5035290001Sglebius unsigned int j; 5036290001Sglebius for (j = backslashes; j > 0; j--) 5037290001Sglebius *p++ = '\\'; 5038290001Sglebius *p++ = '"'; 5039290001Sglebius } 5040290001Sglebius *p = '\0'; 5041290001Sglebius 5042290001Sglebius new_argv[i] = quoted_string; 5043290001Sglebius } 5044290001Sglebius else 5045290001Sglebius new_argv[i] = (char *) string; 5046290001Sglebius } 5047290001Sglebius new_argv[argc] = NULL; 5048290001Sglebius 5049290001Sglebius return new_argv; 5050290001Sglebius} 5051290001SglebiusEOF 5052290001Sglebius ;; 5053290001Sglebius esac 5054290001Sglebius 5055290001Sglebius cat <<"EOF" 5056290001Sglebiusvoid lt_dump_script (FILE* f) 5057290001Sglebius{ 5058290001SglebiusEOF 5059290001Sglebius func_emit_wrapper yes | 5060290001Sglebius $SED -e 's/\([\\"]\)/\\\1/g' \ 5061290001Sglebius -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' 5062290001Sglebius 5063290001Sglebius cat <<"EOF" 5064290001Sglebius} 5065290001SglebiusEOF 5066290001Sglebius} 5067290001Sglebius# end: func_emit_cwrapperexe_src 5068290001Sglebius 5069290001Sglebius# func_win32_import_lib_p ARG 5070290001Sglebius# True if ARG is an import lib, as indicated by $file_magic_cmd 5071290001Sglebiusfunc_win32_import_lib_p () 5072290001Sglebius{ 5073290001Sglebius $opt_debug 5074290001Sglebius case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 5075290001Sglebius *import*) : ;; 5076290001Sglebius *) false ;; 5077290001Sglebius esac 5078290001Sglebius} 5079290001Sglebius 5080290001Sglebius# func_mode_link arg... 5081290001Sglebiusfunc_mode_link () 5082290001Sglebius{ 5083290001Sglebius $opt_debug 5084181834Sroberto case $host in 5085290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5086181834Sroberto # It is impossible to link a dll without this setting, and 5087181834Sroberto # we shouldn't force the makefile maintainer to figure out 5088181834Sroberto # which system we are compiling for in order to pass an extra 5089181834Sroberto # flag for every libtool invocation. 5090181834Sroberto # allow_undefined=no 5091181834Sroberto 5092181834Sroberto # FIXME: Unfortunately, there are problems with the above when trying 5093181834Sroberto # to make a dll which has undefined symbols, in which case not 5094181834Sroberto # even a static library is built. For now, we need to specify 5095181834Sroberto # -no-undefined on the libtool link line when we can be certain 5096181834Sroberto # that all symbols are satisfied, otherwise we get a static library. 5097181834Sroberto allow_undefined=yes 5098181834Sroberto ;; 5099181834Sroberto *) 5100181834Sroberto allow_undefined=yes 5101181834Sroberto ;; 5102181834Sroberto esac 5103290001Sglebius libtool_args=$nonopt 5104181834Sroberto base_compile="$nonopt $@" 5105290001Sglebius compile_command=$nonopt 5106290001Sglebius finalize_command=$nonopt 5107181834Sroberto 5108181834Sroberto compile_rpath= 5109181834Sroberto finalize_rpath= 5110181834Sroberto compile_shlibpath= 5111181834Sroberto finalize_shlibpath= 5112181834Sroberto convenience= 5113181834Sroberto old_convenience= 5114181834Sroberto deplibs= 5115181834Sroberto old_deplibs= 5116181834Sroberto compiler_flags= 5117181834Sroberto linker_flags= 5118181834Sroberto dllsearchpath= 5119181834Sroberto lib_search_path=`pwd` 5120181834Sroberto inst_prefix_dir= 5121290001Sglebius new_inherited_linker_flags= 5122181834Sroberto 5123181834Sroberto avoid_version=no 5124290001Sglebius bindir= 5125181834Sroberto dlfiles= 5126181834Sroberto dlprefiles= 5127181834Sroberto dlself=no 5128181834Sroberto export_dynamic=no 5129181834Sroberto export_symbols= 5130181834Sroberto export_symbols_regex= 5131181834Sroberto generated= 5132181834Sroberto libobjs= 5133181834Sroberto ltlibs= 5134181834Sroberto module=no 5135181834Sroberto no_install=no 5136181834Sroberto objs= 5137181834Sroberto non_pic_objects= 5138181834Sroberto precious_files_regex= 5139181834Sroberto prefer_static_libs=no 5140181834Sroberto preload=no 5141181834Sroberto prev= 5142181834Sroberto prevarg= 5143181834Sroberto release= 5144181834Sroberto rpath= 5145181834Sroberto xrpath= 5146181834Sroberto perm_rpath= 5147181834Sroberto temp_rpath= 5148181834Sroberto thread_safe=no 5149181834Sroberto vinfo= 5150181834Sroberto vinfo_number=no 5151290001Sglebius weak_libs= 5152290001Sglebius single_module="${wl}-single_module" 5153181834Sroberto func_infer_tag $base_compile 5154181834Sroberto 5155181834Sroberto # We need to know -static, to get the right output filenames. 5156181834Sroberto for arg 5157181834Sroberto do 5158181834Sroberto case $arg in 5159290001Sglebius -shared) 5160290001Sglebius test "$build_libtool_libs" != yes && \ 5161290001Sglebius func_fatal_configuration "can not build a shared library" 5162290001Sglebius build_old_libs=no 5163290001Sglebius break 5164290001Sglebius ;; 5165290001Sglebius -all-static | -static | -static-libtool-libs) 5166290001Sglebius case $arg in 5167290001Sglebius -all-static) 5168181834Sroberto if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 5169290001Sglebius func_warning "complete static linking is impossible in this configuration" 5170181834Sroberto fi 5171181834Sroberto if test -n "$link_static_flag"; then 5172181834Sroberto dlopen_self=$dlopen_self_static 5173181834Sroberto fi 5174181834Sroberto prefer_static_libs=yes 5175290001Sglebius ;; 5176290001Sglebius -static) 5177181834Sroberto if test -z "$pic_flag" && test -n "$link_static_flag"; then 5178181834Sroberto dlopen_self=$dlopen_self_static 5179181834Sroberto fi 5180181834Sroberto prefer_static_libs=built 5181290001Sglebius ;; 5182290001Sglebius -static-libtool-libs) 5183290001Sglebius if test -z "$pic_flag" && test -n "$link_static_flag"; then 5184290001Sglebius dlopen_self=$dlopen_self_static 5185290001Sglebius fi 5186290001Sglebius prefer_static_libs=yes 5187290001Sglebius ;; 5188290001Sglebius esac 5189181834Sroberto build_libtool_libs=no 5190181834Sroberto build_old_libs=yes 5191181834Sroberto break 5192181834Sroberto ;; 5193181834Sroberto esac 5194181834Sroberto done 5195181834Sroberto 5196181834Sroberto # See if our shared archives depend on static archives. 5197181834Sroberto test -n "$old_archive_from_new_cmds" && build_old_libs=yes 5198181834Sroberto 5199181834Sroberto # Go through the arguments, transforming them on the way. 5200181834Sroberto while test "$#" -gt 0; do 5201181834Sroberto arg="$1" 5202181834Sroberto shift 5203290001Sglebius func_quote_for_eval "$arg" 5204290001Sglebius qarg=$func_quote_for_eval_unquoted_result 5205290001Sglebius func_append libtool_args " $func_quote_for_eval_result" 5206181834Sroberto 5207181834Sroberto # If the previous option needs an argument, assign it. 5208181834Sroberto if test -n "$prev"; then 5209181834Sroberto case $prev in 5210181834Sroberto output) 5211290001Sglebius func_append compile_command " @OUTPUT@" 5212290001Sglebius func_append finalize_command " @OUTPUT@" 5213181834Sroberto ;; 5214181834Sroberto esac 5215181834Sroberto 5216181834Sroberto case $prev in 5217290001Sglebius bindir) 5218290001Sglebius bindir="$arg" 5219290001Sglebius prev= 5220290001Sglebius continue 5221290001Sglebius ;; 5222181834Sroberto dlfiles|dlprefiles) 5223181834Sroberto if test "$preload" = no; then 5224181834Sroberto # Add the symbol object into the linking commands. 5225290001Sglebius func_append compile_command " @SYMFILE@" 5226290001Sglebius func_append finalize_command " @SYMFILE@" 5227181834Sroberto preload=yes 5228181834Sroberto fi 5229181834Sroberto case $arg in 5230181834Sroberto *.la | *.lo) ;; # We handle these cases below. 5231181834Sroberto force) 5232181834Sroberto if test "$dlself" = no; then 5233181834Sroberto dlself=needless 5234181834Sroberto export_dynamic=yes 5235181834Sroberto fi 5236181834Sroberto prev= 5237181834Sroberto continue 5238181834Sroberto ;; 5239181834Sroberto self) 5240181834Sroberto if test "$prev" = dlprefiles; then 5241181834Sroberto dlself=yes 5242181834Sroberto elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 5243181834Sroberto dlself=yes 5244181834Sroberto else 5245181834Sroberto dlself=needless 5246181834Sroberto export_dynamic=yes 5247181834Sroberto fi 5248181834Sroberto prev= 5249181834Sroberto continue 5250181834Sroberto ;; 5251181834Sroberto *) 5252181834Sroberto if test "$prev" = dlfiles; then 5253290001Sglebius func_append dlfiles " $arg" 5254181834Sroberto else 5255290001Sglebius func_append dlprefiles " $arg" 5256181834Sroberto fi 5257181834Sroberto prev= 5258181834Sroberto continue 5259181834Sroberto ;; 5260181834Sroberto esac 5261181834Sroberto ;; 5262181834Sroberto expsyms) 5263181834Sroberto export_symbols="$arg" 5264290001Sglebius test -f "$arg" \ 5265290001Sglebius || func_fatal_error "symbol file \`$arg' does not exist" 5266181834Sroberto prev= 5267181834Sroberto continue 5268181834Sroberto ;; 5269181834Sroberto expsyms_regex) 5270181834Sroberto export_symbols_regex="$arg" 5271181834Sroberto prev= 5272181834Sroberto continue 5273181834Sroberto ;; 5274290001Sglebius framework) 5275290001Sglebius case $host in 5276290001Sglebius *-*-darwin*) 5277290001Sglebius case "$deplibs " in 5278290001Sglebius *" $qarg.ltframework "*) ;; 5279290001Sglebius *) func_append deplibs " $qarg.ltframework" # this is fixed later 5280290001Sglebius ;; 5281290001Sglebius esac 5282290001Sglebius ;; 5283290001Sglebius esac 5284181834Sroberto prev= 5285181834Sroberto continue 5286181834Sroberto ;; 5287290001Sglebius inst_prefix) 5288290001Sglebius inst_prefix_dir="$arg" 5289181834Sroberto prev= 5290181834Sroberto continue 5291181834Sroberto ;; 5292181834Sroberto objectlist) 5293181834Sroberto if test -f "$arg"; then 5294181834Sroberto save_arg=$arg 5295181834Sroberto moreargs= 5296290001Sglebius for fil in `cat "$save_arg"` 5297181834Sroberto do 5298290001Sglebius# func_append moreargs " $fil" 5299181834Sroberto arg=$fil 5300181834Sroberto # A libtool-controlled object. 5301181834Sroberto 5302181834Sroberto # Check to see that this really is a libtool object. 5303290001Sglebius if func_lalib_unsafe_p "$arg"; then 5304181834Sroberto pic_object= 5305181834Sroberto non_pic_object= 5306181834Sroberto 5307181834Sroberto # Read the .lo file 5308290001Sglebius func_source "$arg" 5309181834Sroberto 5310290001Sglebius if test -z "$pic_object" || 5311181834Sroberto test -z "$non_pic_object" || 5312290001Sglebius test "$pic_object" = none && 5313181834Sroberto test "$non_pic_object" = none; then 5314290001Sglebius func_fatal_error "cannot find name of object for \`$arg'" 5315181834Sroberto fi 5316181834Sroberto 5317181834Sroberto # Extract subdirectory from the argument. 5318290001Sglebius func_dirname "$arg" "/" "" 5319290001Sglebius xdir="$func_dirname_result" 5320181834Sroberto 5321181834Sroberto if test "$pic_object" != none; then 5322181834Sroberto # Prepend the subdirectory the object is found in. 5323181834Sroberto pic_object="$xdir$pic_object" 5324181834Sroberto 5325181834Sroberto if test "$prev" = dlfiles; then 5326181834Sroberto if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 5327290001Sglebius func_append dlfiles " $pic_object" 5328181834Sroberto prev= 5329181834Sroberto continue 5330181834Sroberto else 5331181834Sroberto # If libtool objects are unsupported, then we need to preload. 5332181834Sroberto prev=dlprefiles 5333181834Sroberto fi 5334181834Sroberto fi 5335181834Sroberto 5336181834Sroberto # CHECK ME: I think I busted this. -Ossama 5337181834Sroberto if test "$prev" = dlprefiles; then 5338181834Sroberto # Preload the old-style object. 5339290001Sglebius func_append dlprefiles " $pic_object" 5340181834Sroberto prev= 5341181834Sroberto fi 5342181834Sroberto 5343181834Sroberto # A PIC object. 5344290001Sglebius func_append libobjs " $pic_object" 5345181834Sroberto arg="$pic_object" 5346181834Sroberto fi 5347181834Sroberto 5348181834Sroberto # Non-PIC object. 5349181834Sroberto if test "$non_pic_object" != none; then 5350181834Sroberto # Prepend the subdirectory the object is found in. 5351181834Sroberto non_pic_object="$xdir$non_pic_object" 5352181834Sroberto 5353181834Sroberto # A standard non-PIC object 5354290001Sglebius func_append non_pic_objects " $non_pic_object" 5355181834Sroberto if test -z "$pic_object" || test "$pic_object" = none ; then 5356181834Sroberto arg="$non_pic_object" 5357181834Sroberto fi 5358181834Sroberto else 5359181834Sroberto # If the PIC object exists, use it instead. 5360181834Sroberto # $xdir was prepended to $pic_object above. 5361181834Sroberto non_pic_object="$pic_object" 5362290001Sglebius func_append non_pic_objects " $non_pic_object" 5363181834Sroberto fi 5364181834Sroberto else 5365181834Sroberto # Only an error if not doing a dry-run. 5366290001Sglebius if $opt_dry_run; then 5367181834Sroberto # Extract subdirectory from the argument. 5368290001Sglebius func_dirname "$arg" "/" "" 5369290001Sglebius xdir="$func_dirname_result" 5370181834Sroberto 5371290001Sglebius func_lo2o "$arg" 5372290001Sglebius pic_object=$xdir$objdir/$func_lo2o_result 5373290001Sglebius non_pic_object=$xdir$func_lo2o_result 5374290001Sglebius func_append libobjs " $pic_object" 5375290001Sglebius func_append non_pic_objects " $non_pic_object" 5376290001Sglebius else 5377290001Sglebius func_fatal_error "\`$arg' is not a valid libtool object" 5378181834Sroberto fi 5379181834Sroberto fi 5380181834Sroberto done 5381181834Sroberto else 5382290001Sglebius func_fatal_error "link input file \`$arg' does not exist" 5383181834Sroberto fi 5384181834Sroberto arg=$save_arg 5385181834Sroberto prev= 5386181834Sroberto continue 5387181834Sroberto ;; 5388290001Sglebius precious_regex) 5389290001Sglebius precious_files_regex="$arg" 5390290001Sglebius prev= 5391290001Sglebius continue 5392290001Sglebius ;; 5393290001Sglebius release) 5394290001Sglebius release="-$arg" 5395290001Sglebius prev= 5396290001Sglebius continue 5397290001Sglebius ;; 5398181834Sroberto rpath | xrpath) 5399181834Sroberto # We need an absolute path. 5400181834Sroberto case $arg in 5401181834Sroberto [\\/]* | [A-Za-z]:[\\/]*) ;; 5402181834Sroberto *) 5403290001Sglebius func_fatal_error "only absolute run-paths are allowed" 5404181834Sroberto ;; 5405181834Sroberto esac 5406181834Sroberto if test "$prev" = rpath; then 5407181834Sroberto case "$rpath " in 5408181834Sroberto *" $arg "*) ;; 5409290001Sglebius *) func_append rpath " $arg" ;; 5410181834Sroberto esac 5411181834Sroberto else 5412181834Sroberto case "$xrpath " in 5413181834Sroberto *" $arg "*) ;; 5414290001Sglebius *) func_append xrpath " $arg" ;; 5415181834Sroberto esac 5416181834Sroberto fi 5417181834Sroberto prev= 5418181834Sroberto continue 5419181834Sroberto ;; 5420290001Sglebius shrext) 5421290001Sglebius shrext_cmds="$arg" 5422181834Sroberto prev= 5423181834Sroberto continue 5424181834Sroberto ;; 5425290001Sglebius weak) 5426290001Sglebius func_append weak_libs " $arg" 5427181834Sroberto prev= 5428181834Sroberto continue 5429181834Sroberto ;; 5430181834Sroberto xcclinker) 5431290001Sglebius func_append linker_flags " $qarg" 5432290001Sglebius func_append compiler_flags " $qarg" 5433181834Sroberto prev= 5434290001Sglebius func_append compile_command " $qarg" 5435290001Sglebius func_append finalize_command " $qarg" 5436181834Sroberto continue 5437181834Sroberto ;; 5438290001Sglebius xcompiler) 5439290001Sglebius func_append compiler_flags " $qarg" 5440181834Sroberto prev= 5441290001Sglebius func_append compile_command " $qarg" 5442290001Sglebius func_append finalize_command " $qarg" 5443181834Sroberto continue 5444181834Sroberto ;; 5445290001Sglebius xlinker) 5446290001Sglebius func_append linker_flags " $qarg" 5447290001Sglebius func_append compiler_flags " $wl$qarg" 5448181834Sroberto prev= 5449290001Sglebius func_append compile_command " $wl$qarg" 5450290001Sglebius func_append finalize_command " $wl$qarg" 5451181834Sroberto continue 5452181834Sroberto ;; 5453181834Sroberto *) 5454181834Sroberto eval "$prev=\"\$arg\"" 5455181834Sroberto prev= 5456181834Sroberto continue 5457181834Sroberto ;; 5458181834Sroberto esac 5459181834Sroberto fi # test -n "$prev" 5460181834Sroberto 5461181834Sroberto prevarg="$arg" 5462181834Sroberto 5463181834Sroberto case $arg in 5464181834Sroberto -all-static) 5465181834Sroberto if test -n "$link_static_flag"; then 5466290001Sglebius # See comment for -static flag below, for more details. 5467290001Sglebius func_append compile_command " $link_static_flag" 5468290001Sglebius func_append finalize_command " $link_static_flag" 5469181834Sroberto fi 5470181834Sroberto continue 5471181834Sroberto ;; 5472181834Sroberto 5473181834Sroberto -allow-undefined) 5474181834Sroberto # FIXME: remove this flag sometime in the future. 5475290001Sglebius func_fatal_error "\`-allow-undefined' must not be used because it is the default" 5476181834Sroberto ;; 5477181834Sroberto 5478181834Sroberto -avoid-version) 5479181834Sroberto avoid_version=yes 5480181834Sroberto continue 5481181834Sroberto ;; 5482181834Sroberto 5483290001Sglebius -bindir) 5484290001Sglebius prev=bindir 5485290001Sglebius continue 5486290001Sglebius ;; 5487290001Sglebius 5488181834Sroberto -dlopen) 5489181834Sroberto prev=dlfiles 5490181834Sroberto continue 5491181834Sroberto ;; 5492181834Sroberto 5493181834Sroberto -dlpreopen) 5494181834Sroberto prev=dlprefiles 5495181834Sroberto continue 5496181834Sroberto ;; 5497181834Sroberto 5498181834Sroberto -export-dynamic) 5499181834Sroberto export_dynamic=yes 5500181834Sroberto continue 5501181834Sroberto ;; 5502181834Sroberto 5503181834Sroberto -export-symbols | -export-symbols-regex) 5504181834Sroberto if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 5505290001Sglebius func_fatal_error "more than one -exported-symbols argument is not allowed" 5506181834Sroberto fi 5507181834Sroberto if test "X$arg" = "X-export-symbols"; then 5508181834Sroberto prev=expsyms 5509181834Sroberto else 5510181834Sroberto prev=expsyms_regex 5511181834Sroberto fi 5512181834Sroberto continue 5513181834Sroberto ;; 5514181834Sroberto 5515290001Sglebius -framework) 5516290001Sglebius prev=framework 5517181834Sroberto continue 5518181834Sroberto ;; 5519181834Sroberto 5520181834Sroberto -inst-prefix-dir) 5521181834Sroberto prev=inst_prefix 5522181834Sroberto continue 5523181834Sroberto ;; 5524181834Sroberto 5525181834Sroberto # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 5526181834Sroberto # so, if we see these flags be careful not to treat them like -L 5527181834Sroberto -L[A-Z][A-Z]*:*) 5528181834Sroberto case $with_gcc/$host in 5529181834Sroberto no/*-*-irix* | /*-*-irix*) 5530290001Sglebius func_append compile_command " $arg" 5531290001Sglebius func_append finalize_command " $arg" 5532181834Sroberto ;; 5533181834Sroberto esac 5534181834Sroberto continue 5535181834Sroberto ;; 5536181834Sroberto 5537181834Sroberto -L*) 5538290001Sglebius func_stripname "-L" '' "$arg" 5539290001Sglebius if test -z "$func_stripname_result"; then 5540290001Sglebius if test "$#" -gt 0; then 5541290001Sglebius func_fatal_error "require no space between \`-L' and \`$1'" 5542290001Sglebius else 5543290001Sglebius func_fatal_error "need path for \`-L' option" 5544290001Sglebius fi 5545290001Sglebius fi 5546290001Sglebius func_resolve_sysroot "$func_stripname_result" 5547290001Sglebius dir=$func_resolve_sysroot_result 5548181834Sroberto # We need an absolute path. 5549181834Sroberto case $dir in 5550181834Sroberto [\\/]* | [A-Za-z]:[\\/]*) ;; 5551181834Sroberto *) 5552181834Sroberto absdir=`cd "$dir" && pwd` 5553290001Sglebius test -z "$absdir" && \ 5554290001Sglebius func_fatal_error "cannot determine absolute directory name of \`$dir'" 5555181834Sroberto dir="$absdir" 5556181834Sroberto ;; 5557181834Sroberto esac 5558181834Sroberto case "$deplibs " in 5559290001Sglebius *" -L$dir "* | *" $arg "*) 5560290001Sglebius # Will only happen for absolute or sysroot arguments 5561290001Sglebius ;; 5562181834Sroberto *) 5563290001Sglebius # Preserve sysroot, but never include relative directories 5564290001Sglebius case $dir in 5565290001Sglebius [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 5566290001Sglebius *) func_append deplibs " -L$dir" ;; 5567290001Sglebius esac 5568290001Sglebius func_append lib_search_path " $dir" 5569181834Sroberto ;; 5570181834Sroberto esac 5571181834Sroberto case $host in 5572290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5573290001Sglebius testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 5574181834Sroberto case :$dllsearchpath: in 5575181834Sroberto *":$dir:"*) ;; 5576290001Sglebius ::) dllsearchpath=$dir;; 5577290001Sglebius *) func_append dllsearchpath ":$dir";; 5578181834Sroberto esac 5579181834Sroberto case :$dllsearchpath: in 5580181834Sroberto *":$testbindir:"*) ;; 5581290001Sglebius ::) dllsearchpath=$testbindir;; 5582290001Sglebius *) func_append dllsearchpath ":$testbindir";; 5583181834Sroberto esac 5584181834Sroberto ;; 5585181834Sroberto esac 5586181834Sroberto continue 5587181834Sroberto ;; 5588181834Sroberto 5589181834Sroberto -l*) 5590181834Sroberto if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 5591181834Sroberto case $host in 5592290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 5593181834Sroberto # These systems don't actually have a C or math library (as such) 5594181834Sroberto continue 5595181834Sroberto ;; 5596181834Sroberto *-*-os2*) 5597181834Sroberto # These systems don't actually have a C library (as such) 5598181834Sroberto test "X$arg" = "X-lc" && continue 5599181834Sroberto ;; 5600181834Sroberto *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5601181834Sroberto # Do not include libc due to us having libc/libc_r. 5602181834Sroberto test "X$arg" = "X-lc" && continue 5603181834Sroberto ;; 5604181834Sroberto *-*-rhapsody* | *-*-darwin1.[012]) 5605181834Sroberto # Rhapsody C and math libraries are in the System framework 5606290001Sglebius func_append deplibs " System.ltframework" 5607181834Sroberto continue 5608181834Sroberto ;; 5609181834Sroberto *-*-sco3.2v5* | *-*-sco5v6*) 5610181834Sroberto # Causes problems with __ctype 5611181834Sroberto test "X$arg" = "X-lc" && continue 5612181834Sroberto ;; 5613181834Sroberto *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 5614181834Sroberto # Compiler inserts libc in the correct place for threads to work 5615181834Sroberto test "X$arg" = "X-lc" && continue 5616181834Sroberto ;; 5617181834Sroberto esac 5618181834Sroberto elif test "X$arg" = "X-lc_r"; then 5619181834Sroberto case $host in 5620181834Sroberto *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5621181834Sroberto # Do not include libc_r directly, use -pthread flag. 5622181834Sroberto continue 5623181834Sroberto ;; 5624181834Sroberto esac 5625181834Sroberto fi 5626290001Sglebius func_append deplibs " $arg" 5627181834Sroberto continue 5628181834Sroberto ;; 5629181834Sroberto 5630290001Sglebius -module) 5631290001Sglebius module=yes 5632290001Sglebius continue 5633290001Sglebius ;; 5634290001Sglebius 5635181834Sroberto # Tru64 UNIX uses -model [arg] to determine the layout of C++ 5636181834Sroberto # classes, name mangling, and exception handling. 5637290001Sglebius # Darwin uses the -arch flag to determine output architecture. 5638290001Sglebius -model|-arch|-isysroot|--sysroot) 5639290001Sglebius func_append compiler_flags " $arg" 5640290001Sglebius func_append compile_command " $arg" 5641290001Sglebius func_append finalize_command " $arg" 5642181834Sroberto prev=xcompiler 5643181834Sroberto continue 5644181834Sroberto ;; 5645181834Sroberto 5646290001Sglebius -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 5647290001Sglebius func_append compiler_flags " $arg" 5648290001Sglebius func_append compile_command " $arg" 5649290001Sglebius func_append finalize_command " $arg" 5650290001Sglebius case "$new_inherited_linker_flags " in 5651290001Sglebius *" $arg "*) ;; 5652290001Sglebius * ) func_append new_inherited_linker_flags " $arg" ;; 5653290001Sglebius esac 5654181834Sroberto continue 5655181834Sroberto ;; 5656181834Sroberto 5657290001Sglebius -multi_module) 5658290001Sglebius single_module="${wl}-multi_module" 5659181834Sroberto continue 5660181834Sroberto ;; 5661181834Sroberto 5662181834Sroberto -no-fast-install) 5663181834Sroberto fast_install=no 5664181834Sroberto continue 5665181834Sroberto ;; 5666181834Sroberto 5667181834Sroberto -no-install) 5668181834Sroberto case $host in 5669290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 5670181834Sroberto # The PATH hackery in wrapper scripts is required on Windows 5671290001Sglebius # and Darwin in order for the loader to find any dlls it needs. 5672290001Sglebius func_warning "\`-no-install' is ignored for $host" 5673290001Sglebius func_warning "assuming \`-no-fast-install' instead" 5674181834Sroberto fast_install=no 5675181834Sroberto ;; 5676181834Sroberto *) no_install=yes ;; 5677181834Sroberto esac 5678181834Sroberto continue 5679181834Sroberto ;; 5680181834Sroberto 5681181834Sroberto -no-undefined) 5682181834Sroberto allow_undefined=no 5683181834Sroberto continue 5684181834Sroberto ;; 5685181834Sroberto 5686181834Sroberto -objectlist) 5687181834Sroberto prev=objectlist 5688181834Sroberto continue 5689181834Sroberto ;; 5690181834Sroberto 5691181834Sroberto -o) prev=output ;; 5692181834Sroberto 5693181834Sroberto -precious-files-regex) 5694181834Sroberto prev=precious_regex 5695181834Sroberto continue 5696181834Sroberto ;; 5697181834Sroberto 5698181834Sroberto -release) 5699181834Sroberto prev=release 5700181834Sroberto continue 5701181834Sroberto ;; 5702181834Sroberto 5703181834Sroberto -rpath) 5704181834Sroberto prev=rpath 5705181834Sroberto continue 5706181834Sroberto ;; 5707181834Sroberto 5708181834Sroberto -R) 5709181834Sroberto prev=xrpath 5710181834Sroberto continue 5711181834Sroberto ;; 5712181834Sroberto 5713181834Sroberto -R*) 5714290001Sglebius func_stripname '-R' '' "$arg" 5715290001Sglebius dir=$func_stripname_result 5716181834Sroberto # We need an absolute path. 5717181834Sroberto case $dir in 5718181834Sroberto [\\/]* | [A-Za-z]:[\\/]*) ;; 5719290001Sglebius =*) 5720290001Sglebius func_stripname '=' '' "$dir" 5721290001Sglebius dir=$lt_sysroot$func_stripname_result 5722290001Sglebius ;; 5723181834Sroberto *) 5724290001Sglebius func_fatal_error "only absolute run-paths are allowed" 5725181834Sroberto ;; 5726181834Sroberto esac 5727181834Sroberto case "$xrpath " in 5728181834Sroberto *" $dir "*) ;; 5729290001Sglebius *) func_append xrpath " $dir" ;; 5730181834Sroberto esac 5731181834Sroberto continue 5732181834Sroberto ;; 5733181834Sroberto 5734290001Sglebius -shared) 5735290001Sglebius # The effects of -shared are defined in a previous loop. 5736290001Sglebius continue 5737290001Sglebius ;; 5738290001Sglebius 5739290001Sglebius -shrext) 5740290001Sglebius prev=shrext 5741290001Sglebius continue 5742290001Sglebius ;; 5743290001Sglebius 5744290001Sglebius -static | -static-libtool-libs) 5745181834Sroberto # The effects of -static are defined in a previous loop. 5746181834Sroberto # We used to do the same as -all-static on platforms that 5747181834Sroberto # didn't have a PIC flag, but the assumption that the effects 5748181834Sroberto # would be equivalent was wrong. It would break on at least 5749181834Sroberto # Digital Unix and AIX. 5750181834Sroberto continue 5751181834Sroberto ;; 5752181834Sroberto 5753181834Sroberto -thread-safe) 5754181834Sroberto thread_safe=yes 5755181834Sroberto continue 5756181834Sroberto ;; 5757181834Sroberto 5758181834Sroberto -version-info) 5759181834Sroberto prev=vinfo 5760181834Sroberto continue 5761181834Sroberto ;; 5762290001Sglebius 5763181834Sroberto -version-number) 5764181834Sroberto prev=vinfo 5765181834Sroberto vinfo_number=yes 5766181834Sroberto continue 5767181834Sroberto ;; 5768181834Sroberto 5769290001Sglebius -weak) 5770290001Sglebius prev=weak 5771290001Sglebius continue 5772290001Sglebius ;; 5773290001Sglebius 5774181834Sroberto -Wc,*) 5775290001Sglebius func_stripname '-Wc,' '' "$arg" 5776290001Sglebius args=$func_stripname_result 5777181834Sroberto arg= 5778181834Sroberto save_ifs="$IFS"; IFS=',' 5779181834Sroberto for flag in $args; do 5780181834Sroberto IFS="$save_ifs" 5781290001Sglebius func_quote_for_eval "$flag" 5782290001Sglebius func_append arg " $func_quote_for_eval_result" 5783290001Sglebius func_append compiler_flags " $func_quote_for_eval_result" 5784181834Sroberto done 5785181834Sroberto IFS="$save_ifs" 5786290001Sglebius func_stripname ' ' '' "$arg" 5787290001Sglebius arg=$func_stripname_result 5788181834Sroberto ;; 5789181834Sroberto 5790181834Sroberto -Wl,*) 5791290001Sglebius func_stripname '-Wl,' '' "$arg" 5792290001Sglebius args=$func_stripname_result 5793181834Sroberto arg= 5794181834Sroberto save_ifs="$IFS"; IFS=',' 5795181834Sroberto for flag in $args; do 5796181834Sroberto IFS="$save_ifs" 5797290001Sglebius func_quote_for_eval "$flag" 5798290001Sglebius func_append arg " $wl$func_quote_for_eval_result" 5799290001Sglebius func_append compiler_flags " $wl$func_quote_for_eval_result" 5800290001Sglebius func_append linker_flags " $func_quote_for_eval_result" 5801181834Sroberto done 5802181834Sroberto IFS="$save_ifs" 5803290001Sglebius func_stripname ' ' '' "$arg" 5804290001Sglebius arg=$func_stripname_result 5805181834Sroberto ;; 5806181834Sroberto 5807181834Sroberto -Xcompiler) 5808181834Sroberto prev=xcompiler 5809181834Sroberto continue 5810181834Sroberto ;; 5811181834Sroberto 5812181834Sroberto -Xlinker) 5813181834Sroberto prev=xlinker 5814181834Sroberto continue 5815181834Sroberto ;; 5816181834Sroberto 5817181834Sroberto -XCClinker) 5818181834Sroberto prev=xcclinker 5819181834Sroberto continue 5820181834Sroberto ;; 5821181834Sroberto 5822290001Sglebius # -msg_* for osf cc 5823290001Sglebius -msg_*) 5824290001Sglebius func_quote_for_eval "$arg" 5825290001Sglebius arg="$func_quote_for_eval_result" 5826290001Sglebius ;; 5827290001Sglebius 5828290001Sglebius # Flags to be passed through unchanged, with rationale: 5829290001Sglebius # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 5830290001Sglebius # -r[0-9][0-9]* specify processor for the SGI compiler 5831290001Sglebius # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 5832290001Sglebius # +DA*, +DD* enable 64-bit mode for the HP compiler 5833290001Sglebius # -q* compiler args for the IBM compiler 5834290001Sglebius # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 5835290001Sglebius # -F/path path to uninstalled frameworks, gcc on darwin 5836290001Sglebius # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 5837290001Sglebius # @file GCC response files 5838290001Sglebius # -tp=* Portland pgcc target processor selection 5839290001Sglebius # --sysroot=* for sysroot support 5840290001Sglebius # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 5841290001Sglebius -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 5842290001Sglebius -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 5843290001Sglebius -O*|-flto*|-fwhopr*|-fuse-linker-plugin) 5844290001Sglebius func_quote_for_eval "$arg" 5845290001Sglebius arg="$func_quote_for_eval_result" 5846290001Sglebius func_append compile_command " $arg" 5847290001Sglebius func_append finalize_command " $arg" 5848290001Sglebius func_append compiler_flags " $arg" 5849290001Sglebius continue 5850290001Sglebius ;; 5851290001Sglebius 5852181834Sroberto # Some other compiler flag. 5853181834Sroberto -* | +*) 5854290001Sglebius func_quote_for_eval "$arg" 5855290001Sglebius arg="$func_quote_for_eval_result" 5856181834Sroberto ;; 5857181834Sroberto 5858181834Sroberto *.$objext) 5859181834Sroberto # A standard object. 5860290001Sglebius func_append objs " $arg" 5861181834Sroberto ;; 5862181834Sroberto 5863181834Sroberto *.lo) 5864181834Sroberto # A libtool-controlled object. 5865181834Sroberto 5866181834Sroberto # Check to see that this really is a libtool object. 5867290001Sglebius if func_lalib_unsafe_p "$arg"; then 5868181834Sroberto pic_object= 5869181834Sroberto non_pic_object= 5870181834Sroberto 5871181834Sroberto # Read the .lo file 5872290001Sglebius func_source "$arg" 5873181834Sroberto 5874290001Sglebius if test -z "$pic_object" || 5875181834Sroberto test -z "$non_pic_object" || 5876290001Sglebius test "$pic_object" = none && 5877181834Sroberto test "$non_pic_object" = none; then 5878290001Sglebius func_fatal_error "cannot find name of object for \`$arg'" 5879181834Sroberto fi 5880181834Sroberto 5881181834Sroberto # Extract subdirectory from the argument. 5882290001Sglebius func_dirname "$arg" "/" "" 5883290001Sglebius xdir="$func_dirname_result" 5884181834Sroberto 5885181834Sroberto if test "$pic_object" != none; then 5886181834Sroberto # Prepend the subdirectory the object is found in. 5887181834Sroberto pic_object="$xdir$pic_object" 5888181834Sroberto 5889181834Sroberto if test "$prev" = dlfiles; then 5890181834Sroberto if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 5891290001Sglebius func_append dlfiles " $pic_object" 5892181834Sroberto prev= 5893181834Sroberto continue 5894181834Sroberto else 5895181834Sroberto # If libtool objects are unsupported, then we need to preload. 5896181834Sroberto prev=dlprefiles 5897181834Sroberto fi 5898181834Sroberto fi 5899181834Sroberto 5900181834Sroberto # CHECK ME: I think I busted this. -Ossama 5901181834Sroberto if test "$prev" = dlprefiles; then 5902181834Sroberto # Preload the old-style object. 5903290001Sglebius func_append dlprefiles " $pic_object" 5904181834Sroberto prev= 5905181834Sroberto fi 5906181834Sroberto 5907181834Sroberto # A PIC object. 5908290001Sglebius func_append libobjs " $pic_object" 5909181834Sroberto arg="$pic_object" 5910181834Sroberto fi 5911181834Sroberto 5912181834Sroberto # Non-PIC object. 5913181834Sroberto if test "$non_pic_object" != none; then 5914181834Sroberto # Prepend the subdirectory the object is found in. 5915181834Sroberto non_pic_object="$xdir$non_pic_object" 5916181834Sroberto 5917181834Sroberto # A standard non-PIC object 5918290001Sglebius func_append non_pic_objects " $non_pic_object" 5919181834Sroberto if test -z "$pic_object" || test "$pic_object" = none ; then 5920181834Sroberto arg="$non_pic_object" 5921181834Sroberto fi 5922181834Sroberto else 5923181834Sroberto # If the PIC object exists, use it instead. 5924181834Sroberto # $xdir was prepended to $pic_object above. 5925181834Sroberto non_pic_object="$pic_object" 5926290001Sglebius func_append non_pic_objects " $non_pic_object" 5927181834Sroberto fi 5928181834Sroberto else 5929181834Sroberto # Only an error if not doing a dry-run. 5930290001Sglebius if $opt_dry_run; then 5931181834Sroberto # Extract subdirectory from the argument. 5932290001Sglebius func_dirname "$arg" "/" "" 5933290001Sglebius xdir="$func_dirname_result" 5934181834Sroberto 5935290001Sglebius func_lo2o "$arg" 5936290001Sglebius pic_object=$xdir$objdir/$func_lo2o_result 5937290001Sglebius non_pic_object=$xdir$func_lo2o_result 5938290001Sglebius func_append libobjs " $pic_object" 5939290001Sglebius func_append non_pic_objects " $non_pic_object" 5940290001Sglebius else 5941290001Sglebius func_fatal_error "\`$arg' is not a valid libtool object" 5942181834Sroberto fi 5943181834Sroberto fi 5944181834Sroberto ;; 5945181834Sroberto 5946181834Sroberto *.$libext) 5947181834Sroberto # An archive. 5948290001Sglebius func_append deplibs " $arg" 5949290001Sglebius func_append old_deplibs " $arg" 5950181834Sroberto continue 5951181834Sroberto ;; 5952181834Sroberto 5953181834Sroberto *.la) 5954181834Sroberto # A libtool-controlled library. 5955181834Sroberto 5956290001Sglebius func_resolve_sysroot "$arg" 5957181834Sroberto if test "$prev" = dlfiles; then 5958181834Sroberto # This library was specified with -dlopen. 5959290001Sglebius func_append dlfiles " $func_resolve_sysroot_result" 5960181834Sroberto prev= 5961181834Sroberto elif test "$prev" = dlprefiles; then 5962181834Sroberto # The library was specified with -dlpreopen. 5963290001Sglebius func_append dlprefiles " $func_resolve_sysroot_result" 5964181834Sroberto prev= 5965181834Sroberto else 5966290001Sglebius func_append deplibs " $func_resolve_sysroot_result" 5967181834Sroberto fi 5968181834Sroberto continue 5969181834Sroberto ;; 5970181834Sroberto 5971181834Sroberto # Some other compiler argument. 5972181834Sroberto *) 5973181834Sroberto # Unknown arguments in both finalize_command and compile_command need 5974181834Sroberto # to be aesthetically quoted because they are evaled later. 5975290001Sglebius func_quote_for_eval "$arg" 5976290001Sglebius arg="$func_quote_for_eval_result" 5977181834Sroberto ;; 5978181834Sroberto esac # arg 5979181834Sroberto 5980181834Sroberto # Now actually substitute the argument into the commands. 5981181834Sroberto if test -n "$arg"; then 5982290001Sglebius func_append compile_command " $arg" 5983290001Sglebius func_append finalize_command " $arg" 5984181834Sroberto fi 5985181834Sroberto done # argument parsing loop 5986181834Sroberto 5987290001Sglebius test -n "$prev" && \ 5988290001Sglebius func_fatal_help "the \`$prevarg' option requires an argument" 5989181834Sroberto 5990181834Sroberto if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 5991181834Sroberto eval arg=\"$export_dynamic_flag_spec\" 5992290001Sglebius func_append compile_command " $arg" 5993290001Sglebius func_append finalize_command " $arg" 5994181834Sroberto fi 5995181834Sroberto 5996181834Sroberto oldlibs= 5997181834Sroberto # calculate the name of the file, without its directory 5998290001Sglebius func_basename "$output" 5999290001Sglebius outputname="$func_basename_result" 6000181834Sroberto libobjs_save="$libobjs" 6001181834Sroberto 6002181834Sroberto if test -n "$shlibpath_var"; then 6003181834Sroberto # get the directories listed in $shlibpath_var 6004290001Sglebius eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 6005181834Sroberto else 6006181834Sroberto shlib_search_path= 6007181834Sroberto fi 6008181834Sroberto eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 6009181834Sroberto eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 6010181834Sroberto 6011290001Sglebius func_dirname "$output" "/" "" 6012290001Sglebius output_objdir="$func_dirname_result$objdir" 6013290001Sglebius func_to_tool_file "$output_objdir/" 6014290001Sglebius tool_output_objdir=$func_to_tool_file_result 6015181834Sroberto # Create the object directory. 6016290001Sglebius func_mkdir_p "$output_objdir" 6017181834Sroberto 6018181834Sroberto # Determine the type of output 6019181834Sroberto case $output in 6020181834Sroberto "") 6021290001Sglebius func_fatal_help "you must specify an output file" 6022181834Sroberto ;; 6023181834Sroberto *.$libext) linkmode=oldlib ;; 6024181834Sroberto *.lo | *.$objext) linkmode=obj ;; 6025181834Sroberto *.la) linkmode=lib ;; 6026181834Sroberto *) linkmode=prog ;; # Anything else should be a program. 6027181834Sroberto esac 6028181834Sroberto 6029181834Sroberto specialdeplibs= 6030181834Sroberto 6031181834Sroberto libs= 6032181834Sroberto # Find all interdependent deplibs by searching for libraries 6033181834Sroberto # that are linked more than once (e.g. -la -lb -la) 6034181834Sroberto for deplib in $deplibs; do 6035290001Sglebius if $opt_preserve_dup_deps ; then 6036181834Sroberto case "$libs " in 6037290001Sglebius *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6038181834Sroberto esac 6039181834Sroberto fi 6040290001Sglebius func_append libs " $deplib" 6041181834Sroberto done 6042181834Sroberto 6043181834Sroberto if test "$linkmode" = lib; then 6044181834Sroberto libs="$predeps $libs $compiler_lib_search_path $postdeps" 6045181834Sroberto 6046181834Sroberto # Compute libraries that are listed more than once in $predeps 6047181834Sroberto # $postdeps and mark them as special (i.e., whose duplicates are 6048181834Sroberto # not to be eliminated). 6049181834Sroberto pre_post_deps= 6050290001Sglebius if $opt_duplicate_compiler_generated_deps; then 6051181834Sroberto for pre_post_dep in $predeps $postdeps; do 6052181834Sroberto case "$pre_post_deps " in 6053290001Sglebius *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 6054181834Sroberto esac 6055290001Sglebius func_append pre_post_deps " $pre_post_dep" 6056181834Sroberto done 6057181834Sroberto fi 6058181834Sroberto pre_post_deps= 6059181834Sroberto fi 6060181834Sroberto 6061181834Sroberto deplibs= 6062181834Sroberto newdependency_libs= 6063181834Sroberto newlib_search_path= 6064181834Sroberto need_relink=no # whether we're linking any uninstalled libtool libraries 6065181834Sroberto notinst_deplibs= # not-installed libtool libraries 6066290001Sglebius notinst_path= # paths that contain not-installed libtool libraries 6067290001Sglebius 6068181834Sroberto case $linkmode in 6069181834Sroberto lib) 6070290001Sglebius passes="conv dlpreopen link" 6071181834Sroberto for file in $dlfiles $dlprefiles; do 6072181834Sroberto case $file in 6073181834Sroberto *.la) ;; 6074181834Sroberto *) 6075290001Sglebius func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 6076181834Sroberto ;; 6077181834Sroberto esac 6078181834Sroberto done 6079181834Sroberto ;; 6080181834Sroberto prog) 6081181834Sroberto compile_deplibs= 6082181834Sroberto finalize_deplibs= 6083181834Sroberto alldeplibs=no 6084181834Sroberto newdlfiles= 6085181834Sroberto newdlprefiles= 6086181834Sroberto passes="conv scan dlopen dlpreopen link" 6087181834Sroberto ;; 6088181834Sroberto *) passes="conv" 6089181834Sroberto ;; 6090181834Sroberto esac 6091290001Sglebius 6092181834Sroberto for pass in $passes; do 6093290001Sglebius # The preopen pass in lib mode reverses $deplibs; put it back here 6094290001Sglebius # so that -L comes before libs that need it for instance... 6095290001Sglebius if test "$linkmode,$pass" = "lib,link"; then 6096290001Sglebius ## FIXME: Find the place where the list is rebuilt in the wrong 6097290001Sglebius ## order, and fix it there properly 6098290001Sglebius tmp_deplibs= 6099290001Sglebius for deplib in $deplibs; do 6100290001Sglebius tmp_deplibs="$deplib $tmp_deplibs" 6101290001Sglebius done 6102290001Sglebius deplibs="$tmp_deplibs" 6103290001Sglebius fi 6104290001Sglebius 6105181834Sroberto if test "$linkmode,$pass" = "lib,link" || 6106181834Sroberto test "$linkmode,$pass" = "prog,scan"; then 6107181834Sroberto libs="$deplibs" 6108181834Sroberto deplibs= 6109181834Sroberto fi 6110181834Sroberto if test "$linkmode" = prog; then 6111181834Sroberto case $pass in 6112181834Sroberto dlopen) libs="$dlfiles" ;; 6113181834Sroberto dlpreopen) libs="$dlprefiles" ;; 6114181834Sroberto link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 6115181834Sroberto esac 6116181834Sroberto fi 6117290001Sglebius if test "$linkmode,$pass" = "lib,dlpreopen"; then 6118290001Sglebius # Collect and forward deplibs of preopened libtool libs 6119290001Sglebius for lib in $dlprefiles; do 6120290001Sglebius # Ignore non-libtool-libs 6121290001Sglebius dependency_libs= 6122290001Sglebius func_resolve_sysroot "$lib" 6123290001Sglebius case $lib in 6124290001Sglebius *.la) func_source "$func_resolve_sysroot_result" ;; 6125290001Sglebius esac 6126290001Sglebius 6127290001Sglebius # Collect preopened libtool deplibs, except any this library 6128290001Sglebius # has declared as weak libs 6129290001Sglebius for deplib in $dependency_libs; do 6130290001Sglebius func_basename "$deplib" 6131290001Sglebius deplib_base=$func_basename_result 6132290001Sglebius case " $weak_libs " in 6133290001Sglebius *" $deplib_base "*) ;; 6134290001Sglebius *) func_append deplibs " $deplib" ;; 6135290001Sglebius esac 6136290001Sglebius done 6137290001Sglebius done 6138290001Sglebius libs="$dlprefiles" 6139290001Sglebius fi 6140181834Sroberto if test "$pass" = dlopen; then 6141181834Sroberto # Collect dlpreopened libraries 6142181834Sroberto save_deplibs="$deplibs" 6143181834Sroberto deplibs= 6144181834Sroberto fi 6145290001Sglebius 6146181834Sroberto for deplib in $libs; do 6147181834Sroberto lib= 6148181834Sroberto found=no 6149181834Sroberto case $deplib in 6150290001Sglebius -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 6151181834Sroberto if test "$linkmode,$pass" = "prog,link"; then 6152181834Sroberto compile_deplibs="$deplib $compile_deplibs" 6153181834Sroberto finalize_deplibs="$deplib $finalize_deplibs" 6154181834Sroberto else 6155290001Sglebius func_append compiler_flags " $deplib" 6156290001Sglebius if test "$linkmode" = lib ; then 6157290001Sglebius case "$new_inherited_linker_flags " in 6158290001Sglebius *" $deplib "*) ;; 6159290001Sglebius * ) func_append new_inherited_linker_flags " $deplib" ;; 6160290001Sglebius esac 6161290001Sglebius fi 6162181834Sroberto fi 6163181834Sroberto continue 6164181834Sroberto ;; 6165181834Sroberto -l*) 6166181834Sroberto if test "$linkmode" != lib && test "$linkmode" != prog; then 6167290001Sglebius func_warning "\`-l' is ignored for archives/objects" 6168181834Sroberto continue 6169181834Sroberto fi 6170290001Sglebius func_stripname '-l' '' "$deplib" 6171290001Sglebius name=$func_stripname_result 6172290001Sglebius if test "$linkmode" = lib; then 6173290001Sglebius searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 6174290001Sglebius else 6175290001Sglebius searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 6176290001Sglebius fi 6177290001Sglebius for searchdir in $searchdirs; do 6178181834Sroberto for search_ext in .la $std_shrext .so .a; do 6179181834Sroberto # Search the libtool library 6180181834Sroberto lib="$searchdir/lib${name}${search_ext}" 6181181834Sroberto if test -f "$lib"; then 6182181834Sroberto if test "$search_ext" = ".la"; then 6183181834Sroberto found=yes 6184181834Sroberto else 6185181834Sroberto found=no 6186181834Sroberto fi 6187181834Sroberto break 2 6188181834Sroberto fi 6189181834Sroberto done 6190181834Sroberto done 6191181834Sroberto if test "$found" != yes; then 6192181834Sroberto # deplib doesn't seem to be a libtool library 6193181834Sroberto if test "$linkmode,$pass" = "prog,link"; then 6194181834Sroberto compile_deplibs="$deplib $compile_deplibs" 6195181834Sroberto finalize_deplibs="$deplib $finalize_deplibs" 6196181834Sroberto else 6197181834Sroberto deplibs="$deplib $deplibs" 6198181834Sroberto test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6199181834Sroberto fi 6200181834Sroberto continue 6201181834Sroberto else # deplib is a libtool library 6202181834Sroberto # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 6203181834Sroberto # We need to do some special things here, and not later. 6204181834Sroberto if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6205181834Sroberto case " $predeps $postdeps " in 6206181834Sroberto *" $deplib "*) 6207290001Sglebius if func_lalib_p "$lib"; then 6208181834Sroberto library_names= 6209181834Sroberto old_library= 6210290001Sglebius func_source "$lib" 6211181834Sroberto for l in $old_library $library_names; do 6212181834Sroberto ll="$l" 6213181834Sroberto done 6214181834Sroberto if test "X$ll" = "X$old_library" ; then # only static version available 6215181834Sroberto found=no 6216290001Sglebius func_dirname "$lib" "" "." 6217290001Sglebius ladir="$func_dirname_result" 6218181834Sroberto lib=$ladir/$old_library 6219181834Sroberto if test "$linkmode,$pass" = "prog,link"; then 6220181834Sroberto compile_deplibs="$deplib $compile_deplibs" 6221181834Sroberto finalize_deplibs="$deplib $finalize_deplibs" 6222181834Sroberto else 6223181834Sroberto deplibs="$deplib $deplibs" 6224181834Sroberto test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6225181834Sroberto fi 6226181834Sroberto continue 6227181834Sroberto fi 6228181834Sroberto fi 6229290001Sglebius ;; 6230181834Sroberto *) ;; 6231181834Sroberto esac 6232181834Sroberto fi 6233181834Sroberto fi 6234181834Sroberto ;; # -l 6235290001Sglebius *.ltframework) 6236290001Sglebius if test "$linkmode,$pass" = "prog,link"; then 6237290001Sglebius compile_deplibs="$deplib $compile_deplibs" 6238290001Sglebius finalize_deplibs="$deplib $finalize_deplibs" 6239290001Sglebius else 6240290001Sglebius deplibs="$deplib $deplibs" 6241290001Sglebius if test "$linkmode" = lib ; then 6242290001Sglebius case "$new_inherited_linker_flags " in 6243290001Sglebius *" $deplib "*) ;; 6244290001Sglebius * ) func_append new_inherited_linker_flags " $deplib" ;; 6245290001Sglebius esac 6246290001Sglebius fi 6247290001Sglebius fi 6248290001Sglebius continue 6249290001Sglebius ;; 6250181834Sroberto -L*) 6251181834Sroberto case $linkmode in 6252181834Sroberto lib) 6253181834Sroberto deplibs="$deplib $deplibs" 6254181834Sroberto test "$pass" = conv && continue 6255181834Sroberto newdependency_libs="$deplib $newdependency_libs" 6256290001Sglebius func_stripname '-L' '' "$deplib" 6257290001Sglebius func_resolve_sysroot "$func_stripname_result" 6258290001Sglebius func_append newlib_search_path " $func_resolve_sysroot_result" 6259181834Sroberto ;; 6260181834Sroberto prog) 6261181834Sroberto if test "$pass" = conv; then 6262181834Sroberto deplibs="$deplib $deplibs" 6263181834Sroberto continue 6264181834Sroberto fi 6265181834Sroberto if test "$pass" = scan; then 6266181834Sroberto deplibs="$deplib $deplibs" 6267181834Sroberto else 6268181834Sroberto compile_deplibs="$deplib $compile_deplibs" 6269181834Sroberto finalize_deplibs="$deplib $finalize_deplibs" 6270181834Sroberto fi 6271290001Sglebius func_stripname '-L' '' "$deplib" 6272290001Sglebius func_resolve_sysroot "$func_stripname_result" 6273290001Sglebius func_append newlib_search_path " $func_resolve_sysroot_result" 6274181834Sroberto ;; 6275181834Sroberto *) 6276290001Sglebius func_warning "\`-L' is ignored for archives/objects" 6277181834Sroberto ;; 6278181834Sroberto esac # linkmode 6279181834Sroberto continue 6280181834Sroberto ;; # -L 6281181834Sroberto -R*) 6282181834Sroberto if test "$pass" = link; then 6283290001Sglebius func_stripname '-R' '' "$deplib" 6284290001Sglebius func_resolve_sysroot "$func_stripname_result" 6285290001Sglebius dir=$func_resolve_sysroot_result 6286181834Sroberto # Make sure the xrpath contains only unique directories. 6287181834Sroberto case "$xrpath " in 6288181834Sroberto *" $dir "*) ;; 6289290001Sglebius *) func_append xrpath " $dir" ;; 6290181834Sroberto esac 6291181834Sroberto fi 6292181834Sroberto deplibs="$deplib $deplibs" 6293181834Sroberto continue 6294181834Sroberto ;; 6295290001Sglebius *.la) 6296290001Sglebius func_resolve_sysroot "$deplib" 6297290001Sglebius lib=$func_resolve_sysroot_result 6298290001Sglebius ;; 6299181834Sroberto *.$libext) 6300181834Sroberto if test "$pass" = conv; then 6301181834Sroberto deplibs="$deplib $deplibs" 6302181834Sroberto continue 6303181834Sroberto fi 6304181834Sroberto case $linkmode in 6305181834Sroberto lib) 6306290001Sglebius # Linking convenience modules into shared libraries is allowed, 6307290001Sglebius # but linking other static libraries is non-portable. 6308290001Sglebius case " $dlpreconveniencelibs " in 6309290001Sglebius *" $deplib "*) ;; 6310290001Sglebius *) 6311290001Sglebius valid_a_lib=no 6312290001Sglebius case $deplibs_check_method in 6313290001Sglebius match_pattern*) 6314290001Sglebius set dummy $deplibs_check_method; shift 6315290001Sglebius match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 6316290001Sglebius if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 6317181834Sroberto | $EGREP "$match_pattern_regex" > /dev/null; then 6318290001Sglebius valid_a_lib=yes 6319290001Sglebius fi 6320290001Sglebius ;; 6321290001Sglebius pass_all) 6322181834Sroberto valid_a_lib=yes 6323181834Sroberto ;; 6324290001Sglebius esac 6325290001Sglebius if test "$valid_a_lib" != yes; then 6326290001Sglebius echo 6327290001Sglebius $ECHO "*** Warning: Trying to link with static lib archive $deplib." 6328290001Sglebius echo "*** I have the capability to make that library automatically link in when" 6329290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 6330290001Sglebius echo "*** shared version of the library, which you do not appear to have" 6331290001Sglebius echo "*** because the file extensions .$libext of this argument makes me believe" 6332290001Sglebius echo "*** that it is just a static archive that I should not use here." 6333290001Sglebius else 6334290001Sglebius echo 6335290001Sglebius $ECHO "*** Warning: Linking the shared library $output against the" 6336290001Sglebius $ECHO "*** static library $deplib is not portable!" 6337290001Sglebius deplibs="$deplib $deplibs" 6338290001Sglebius fi 6339290001Sglebius ;; 6340290001Sglebius esac 6341181834Sroberto continue 6342181834Sroberto ;; 6343181834Sroberto prog) 6344181834Sroberto if test "$pass" != link; then 6345181834Sroberto deplibs="$deplib $deplibs" 6346181834Sroberto else 6347181834Sroberto compile_deplibs="$deplib $compile_deplibs" 6348181834Sroberto finalize_deplibs="$deplib $finalize_deplibs" 6349181834Sroberto fi 6350181834Sroberto continue 6351181834Sroberto ;; 6352181834Sroberto esac # linkmode 6353181834Sroberto ;; # *.$libext 6354181834Sroberto *.lo | *.$objext) 6355181834Sroberto if test "$pass" = conv; then 6356181834Sroberto deplibs="$deplib $deplibs" 6357181834Sroberto elif test "$linkmode" = prog; then 6358181834Sroberto if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 6359181834Sroberto # If there is no dlopen support or we're linking statically, 6360181834Sroberto # we need to preload. 6361290001Sglebius func_append newdlprefiles " $deplib" 6362181834Sroberto compile_deplibs="$deplib $compile_deplibs" 6363181834Sroberto finalize_deplibs="$deplib $finalize_deplibs" 6364181834Sroberto else 6365290001Sglebius func_append newdlfiles " $deplib" 6366181834Sroberto fi 6367181834Sroberto fi 6368181834Sroberto continue 6369181834Sroberto ;; 6370181834Sroberto %DEPLIBS%) 6371181834Sroberto alldeplibs=yes 6372181834Sroberto continue 6373181834Sroberto ;; 6374181834Sroberto esac # case $deplib 6375290001Sglebius 6376181834Sroberto if test "$found" = yes || test -f "$lib"; then : 6377181834Sroberto else 6378290001Sglebius func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 6379181834Sroberto fi 6380181834Sroberto 6381181834Sroberto # Check to see that this really is a libtool archive. 6382290001Sglebius func_lalib_unsafe_p "$lib" \ 6383290001Sglebius || func_fatal_error "\`$lib' is not a valid libtool archive" 6384181834Sroberto 6385290001Sglebius func_dirname "$lib" "" "." 6386290001Sglebius ladir="$func_dirname_result" 6387181834Sroberto 6388181834Sroberto dlname= 6389181834Sroberto dlopen= 6390181834Sroberto dlpreopen= 6391181834Sroberto libdir= 6392181834Sroberto library_names= 6393181834Sroberto old_library= 6394290001Sglebius inherited_linker_flags= 6395181834Sroberto # If the library was installed with an old release of libtool, 6396181834Sroberto # it will not redefine variables installed, or shouldnotlink 6397181834Sroberto installed=yes 6398181834Sroberto shouldnotlink=no 6399181834Sroberto avoidtemprpath= 6400181834Sroberto 6401181834Sroberto 6402181834Sroberto # Read the .la file 6403290001Sglebius func_source "$lib" 6404181834Sroberto 6405290001Sglebius # Convert "-framework foo" to "foo.ltframework" 6406290001Sglebius if test -n "$inherited_linker_flags"; then 6407290001Sglebius tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 6408290001Sglebius for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 6409290001Sglebius case " $new_inherited_linker_flags " in 6410290001Sglebius *" $tmp_inherited_linker_flag "*) ;; 6411290001Sglebius *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 6412290001Sglebius esac 6413290001Sglebius done 6414290001Sglebius fi 6415290001Sglebius dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 6416181834Sroberto if test "$linkmode,$pass" = "lib,link" || 6417181834Sroberto test "$linkmode,$pass" = "prog,scan" || 6418181834Sroberto { test "$linkmode" != prog && test "$linkmode" != lib; }; then 6419290001Sglebius test -n "$dlopen" && func_append dlfiles " $dlopen" 6420290001Sglebius test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 6421181834Sroberto fi 6422181834Sroberto 6423181834Sroberto if test "$pass" = conv; then 6424181834Sroberto # Only check for convenience libraries 6425181834Sroberto deplibs="$lib $deplibs" 6426181834Sroberto if test -z "$libdir"; then 6427181834Sroberto if test -z "$old_library"; then 6428290001Sglebius func_fatal_error "cannot find name of link library for \`$lib'" 6429181834Sroberto fi 6430181834Sroberto # It is a libtool convenience library, so add in its objects. 6431290001Sglebius func_append convenience " $ladir/$objdir/$old_library" 6432290001Sglebius func_append old_convenience " $ladir/$objdir/$old_library" 6433181834Sroberto elif test "$linkmode" != prog && test "$linkmode" != lib; then 6434290001Sglebius func_fatal_error "\`$lib' is not a convenience library" 6435181834Sroberto fi 6436290001Sglebius tmp_libs= 6437290001Sglebius for deplib in $dependency_libs; do 6438290001Sglebius deplibs="$deplib $deplibs" 6439290001Sglebius if $opt_preserve_dup_deps ; then 6440290001Sglebius case "$tmp_libs " in 6441290001Sglebius *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6442290001Sglebius esac 6443290001Sglebius fi 6444290001Sglebius func_append tmp_libs " $deplib" 6445290001Sglebius done 6446181834Sroberto continue 6447181834Sroberto fi # $pass = conv 6448181834Sroberto 6449181834Sroberto 6450181834Sroberto # Get the name of the library we link against. 6451181834Sroberto linklib= 6452290001Sglebius if test -n "$old_library" && 6453290001Sglebius { test "$prefer_static_libs" = yes || 6454290001Sglebius test "$prefer_static_libs,$installed" = "built,no"; }; then 6455290001Sglebius linklib=$old_library 6456290001Sglebius else 6457290001Sglebius for l in $old_library $library_names; do 6458290001Sglebius linklib="$l" 6459290001Sglebius done 6460290001Sglebius fi 6461181834Sroberto if test -z "$linklib"; then 6462290001Sglebius func_fatal_error "cannot find name of link library for \`$lib'" 6463181834Sroberto fi 6464181834Sroberto 6465181834Sroberto # This library was specified with -dlopen. 6466181834Sroberto if test "$pass" = dlopen; then 6467181834Sroberto if test -z "$libdir"; then 6468290001Sglebius func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 6469181834Sroberto fi 6470181834Sroberto if test -z "$dlname" || 6471181834Sroberto test "$dlopen_support" != yes || 6472181834Sroberto test "$build_libtool_libs" = no; then 6473181834Sroberto # If there is no dlname, no dlopen support or we're linking 6474181834Sroberto # statically, we need to preload. We also need to preload any 6475181834Sroberto # dependent libraries so libltdl's deplib preloader doesn't 6476181834Sroberto # bomb out in the load deplibs phase. 6477290001Sglebius func_append dlprefiles " $lib $dependency_libs" 6478181834Sroberto else 6479290001Sglebius func_append newdlfiles " $lib" 6480181834Sroberto fi 6481181834Sroberto continue 6482181834Sroberto fi # $pass = dlopen 6483181834Sroberto 6484181834Sroberto # We need an absolute path. 6485181834Sroberto case $ladir in 6486181834Sroberto [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 6487181834Sroberto *) 6488181834Sroberto abs_ladir=`cd "$ladir" && pwd` 6489181834Sroberto if test -z "$abs_ladir"; then 6490290001Sglebius func_warning "cannot determine absolute directory name of \`$ladir'" 6491290001Sglebius func_warning "passing it literally to the linker, although it might fail" 6492181834Sroberto abs_ladir="$ladir" 6493181834Sroberto fi 6494181834Sroberto ;; 6495181834Sroberto esac 6496290001Sglebius func_basename "$lib" 6497290001Sglebius laname="$func_basename_result" 6498181834Sroberto 6499181834Sroberto # Find the relevant object directory and library name. 6500181834Sroberto if test "X$installed" = Xyes; then 6501290001Sglebius if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6502290001Sglebius func_warning "library \`$lib' was moved." 6503181834Sroberto dir="$ladir" 6504181834Sroberto absdir="$abs_ladir" 6505181834Sroberto libdir="$abs_ladir" 6506181834Sroberto else 6507290001Sglebius dir="$lt_sysroot$libdir" 6508290001Sglebius absdir="$lt_sysroot$libdir" 6509181834Sroberto fi 6510181834Sroberto test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 6511181834Sroberto else 6512181834Sroberto if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6513181834Sroberto dir="$ladir" 6514181834Sroberto absdir="$abs_ladir" 6515181834Sroberto # Remove this search path later 6516290001Sglebius func_append notinst_path " $abs_ladir" 6517181834Sroberto else 6518181834Sroberto dir="$ladir/$objdir" 6519181834Sroberto absdir="$abs_ladir/$objdir" 6520181834Sroberto # Remove this search path later 6521290001Sglebius func_append notinst_path " $abs_ladir" 6522181834Sroberto fi 6523181834Sroberto fi # $installed = yes 6524290001Sglebius func_stripname 'lib' '.la' "$laname" 6525290001Sglebius name=$func_stripname_result 6526181834Sroberto 6527181834Sroberto # This library was specified with -dlpreopen. 6528181834Sroberto if test "$pass" = dlpreopen; then 6529290001Sglebius if test -z "$libdir" && test "$linkmode" = prog; then 6530290001Sglebius func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 6531181834Sroberto fi 6532290001Sglebius case "$host" in 6533290001Sglebius # special handling for platforms with PE-DLLs. 6534290001Sglebius *cygwin* | *mingw* | *cegcc* ) 6535290001Sglebius # Linker will automatically link against shared library if both 6536290001Sglebius # static and shared are present. Therefore, ensure we extract 6537290001Sglebius # symbols from the import library if a shared library is present 6538290001Sglebius # (otherwise, the dlopen module name will be incorrect). We do 6539290001Sglebius # this by putting the import library name into $newdlprefiles. 6540290001Sglebius # We recover the dlopen module name by 'saving' the la file 6541290001Sglebius # name in a special purpose variable, and (later) extracting the 6542290001Sglebius # dlname from the la file. 6543290001Sglebius if test -n "$dlname"; then 6544290001Sglebius func_tr_sh "$dir/$linklib" 6545290001Sglebius eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 6546290001Sglebius func_append newdlprefiles " $dir/$linklib" 6547290001Sglebius else 6548290001Sglebius func_append newdlprefiles " $dir/$old_library" 6549290001Sglebius # Keep a list of preopened convenience libraries to check 6550290001Sglebius # that they are being used correctly in the link pass. 6551290001Sglebius test -z "$libdir" && \ 6552290001Sglebius func_append dlpreconveniencelibs " $dir/$old_library" 6553290001Sglebius fi 6554290001Sglebius ;; 6555290001Sglebius * ) 6556290001Sglebius # Prefer using a static library (so that no silly _DYNAMIC symbols 6557290001Sglebius # are required to link). 6558290001Sglebius if test -n "$old_library"; then 6559290001Sglebius func_append newdlprefiles " $dir/$old_library" 6560290001Sglebius # Keep a list of preopened convenience libraries to check 6561290001Sglebius # that they are being used correctly in the link pass. 6562290001Sglebius test -z "$libdir" && \ 6563290001Sglebius func_append dlpreconveniencelibs " $dir/$old_library" 6564290001Sglebius # Otherwise, use the dlname, so that lt_dlopen finds it. 6565290001Sglebius elif test -n "$dlname"; then 6566290001Sglebius func_append newdlprefiles " $dir/$dlname" 6567290001Sglebius else 6568290001Sglebius func_append newdlprefiles " $dir/$linklib" 6569290001Sglebius fi 6570290001Sglebius ;; 6571290001Sglebius esac 6572181834Sroberto fi # $pass = dlpreopen 6573181834Sroberto 6574181834Sroberto if test -z "$libdir"; then 6575181834Sroberto # Link the convenience library 6576181834Sroberto if test "$linkmode" = lib; then 6577181834Sroberto deplibs="$dir/$old_library $deplibs" 6578181834Sroberto elif test "$linkmode,$pass" = "prog,link"; then 6579181834Sroberto compile_deplibs="$dir/$old_library $compile_deplibs" 6580181834Sroberto finalize_deplibs="$dir/$old_library $finalize_deplibs" 6581181834Sroberto else 6582181834Sroberto deplibs="$lib $deplibs" # used for prog,scan pass 6583181834Sroberto fi 6584181834Sroberto continue 6585181834Sroberto fi 6586181834Sroberto 6587181834Sroberto 6588181834Sroberto if test "$linkmode" = prog && test "$pass" != link; then 6589290001Sglebius func_append newlib_search_path " $ladir" 6590181834Sroberto deplibs="$lib $deplibs" 6591181834Sroberto 6592181834Sroberto linkalldeplibs=no 6593181834Sroberto if test "$link_all_deplibs" != no || test -z "$library_names" || 6594181834Sroberto test "$build_libtool_libs" = no; then 6595181834Sroberto linkalldeplibs=yes 6596181834Sroberto fi 6597181834Sroberto 6598181834Sroberto tmp_libs= 6599181834Sroberto for deplib in $dependency_libs; do 6600181834Sroberto case $deplib in 6601290001Sglebius -L*) func_stripname '-L' '' "$deplib" 6602290001Sglebius func_resolve_sysroot "$func_stripname_result" 6603290001Sglebius func_append newlib_search_path " $func_resolve_sysroot_result" 6604290001Sglebius ;; 6605181834Sroberto esac 6606181834Sroberto # Need to link against all dependency_libs? 6607181834Sroberto if test "$linkalldeplibs" = yes; then 6608181834Sroberto deplibs="$deplib $deplibs" 6609181834Sroberto else 6610181834Sroberto # Need to hardcode shared library paths 6611181834Sroberto # or/and link against static libraries 6612181834Sroberto newdependency_libs="$deplib $newdependency_libs" 6613181834Sroberto fi 6614290001Sglebius if $opt_preserve_dup_deps ; then 6615181834Sroberto case "$tmp_libs " in 6616290001Sglebius *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6617181834Sroberto esac 6618181834Sroberto fi 6619290001Sglebius func_append tmp_libs " $deplib" 6620181834Sroberto done # for deplib 6621181834Sroberto continue 6622181834Sroberto fi # $linkmode = prog... 6623181834Sroberto 6624181834Sroberto if test "$linkmode,$pass" = "prog,link"; then 6625181834Sroberto if test -n "$library_names" && 6626290001Sglebius { { test "$prefer_static_libs" = no || 6627290001Sglebius test "$prefer_static_libs,$installed" = "built,yes"; } || 6628290001Sglebius test -z "$old_library"; }; then 6629181834Sroberto # We need to hardcode the library path 6630181834Sroberto if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 6631181834Sroberto # Make sure the rpath contains only unique directories. 6632290001Sglebius case "$temp_rpath:" in 6633290001Sglebius *"$absdir:"*) ;; 6634290001Sglebius *) func_append temp_rpath "$absdir:" ;; 6635181834Sroberto esac 6636181834Sroberto fi 6637181834Sroberto 6638181834Sroberto # Hardcode the library path. 6639181834Sroberto # Skip directories that are in the system default run-time 6640181834Sroberto # search path. 6641181834Sroberto case " $sys_lib_dlsearch_path " in 6642181834Sroberto *" $absdir "*) ;; 6643181834Sroberto *) 6644181834Sroberto case "$compile_rpath " in 6645181834Sroberto *" $absdir "*) ;; 6646290001Sglebius *) func_append compile_rpath " $absdir" ;; 6647181834Sroberto esac 6648181834Sroberto ;; 6649181834Sroberto esac 6650181834Sroberto case " $sys_lib_dlsearch_path " in 6651181834Sroberto *" $libdir "*) ;; 6652181834Sroberto *) 6653181834Sroberto case "$finalize_rpath " in 6654181834Sroberto *" $libdir "*) ;; 6655290001Sglebius *) func_append finalize_rpath " $libdir" ;; 6656181834Sroberto esac 6657181834Sroberto ;; 6658181834Sroberto esac 6659181834Sroberto fi # $linkmode,$pass = prog,link... 6660181834Sroberto 6661181834Sroberto if test "$alldeplibs" = yes && 6662181834Sroberto { test "$deplibs_check_method" = pass_all || 6663181834Sroberto { test "$build_libtool_libs" = yes && 6664181834Sroberto test -n "$library_names"; }; }; then 6665181834Sroberto # We only need to search for static libraries 6666181834Sroberto continue 6667181834Sroberto fi 6668181834Sroberto fi 6669181834Sroberto 6670181834Sroberto link_static=no # Whether the deplib will be linked statically 6671181834Sroberto use_static_libs=$prefer_static_libs 6672290001Sglebius if test "$use_static_libs" = built && test "$installed" = yes; then 6673181834Sroberto use_static_libs=no 6674181834Sroberto fi 6675181834Sroberto if test -n "$library_names" && 6676181834Sroberto { test "$use_static_libs" = no || test -z "$old_library"; }; then 6677290001Sglebius case $host in 6678290001Sglebius *cygwin* | *mingw* | *cegcc*) 6679290001Sglebius # No point in relinking DLLs because paths are not encoded 6680290001Sglebius func_append notinst_deplibs " $lib" 6681290001Sglebius need_relink=no 6682290001Sglebius ;; 6683290001Sglebius *) 6684290001Sglebius if test "$installed" = no; then 6685290001Sglebius func_append notinst_deplibs " $lib" 6686290001Sglebius need_relink=yes 6687290001Sglebius fi 6688290001Sglebius ;; 6689290001Sglebius esac 6690181834Sroberto # This is a shared library 6691181834Sroberto 6692290001Sglebius # Warn about portability, can't link against -module's on some 6693290001Sglebius # systems (darwin). Don't bleat about dlopened modules though! 6694290001Sglebius dlopenmodule="" 6695290001Sglebius for dlpremoduletest in $dlprefiles; do 6696290001Sglebius if test "X$dlpremoduletest" = "X$lib"; then 6697290001Sglebius dlopenmodule="$dlpremoduletest" 6698290001Sglebius break 6699290001Sglebius fi 6700290001Sglebius done 6701290001Sglebius if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 6702290001Sglebius echo 6703181834Sroberto if test "$linkmode" = prog; then 6704290001Sglebius $ECHO "*** Warning: Linking the executable $output against the loadable module" 6705181834Sroberto else 6706290001Sglebius $ECHO "*** Warning: Linking the shared library $output against the loadable module" 6707181834Sroberto fi 6708290001Sglebius $ECHO "*** $linklib is not portable!" 6709181834Sroberto fi 6710181834Sroberto if test "$linkmode" = lib && 6711181834Sroberto test "$hardcode_into_libs" = yes; then 6712181834Sroberto # Hardcode the library path. 6713181834Sroberto # Skip directories that are in the system default run-time 6714181834Sroberto # search path. 6715181834Sroberto case " $sys_lib_dlsearch_path " in 6716181834Sroberto *" $absdir "*) ;; 6717181834Sroberto *) 6718181834Sroberto case "$compile_rpath " in 6719181834Sroberto *" $absdir "*) ;; 6720290001Sglebius *) func_append compile_rpath " $absdir" ;; 6721181834Sroberto esac 6722181834Sroberto ;; 6723181834Sroberto esac 6724181834Sroberto case " $sys_lib_dlsearch_path " in 6725181834Sroberto *" $libdir "*) ;; 6726181834Sroberto *) 6727181834Sroberto case "$finalize_rpath " in 6728181834Sroberto *" $libdir "*) ;; 6729290001Sglebius *) func_append finalize_rpath " $libdir" ;; 6730181834Sroberto esac 6731181834Sroberto ;; 6732181834Sroberto esac 6733181834Sroberto fi 6734181834Sroberto 6735181834Sroberto if test -n "$old_archive_from_expsyms_cmds"; then 6736181834Sroberto # figure out the soname 6737181834Sroberto set dummy $library_names 6738290001Sglebius shift 6739290001Sglebius realname="$1" 6740290001Sglebius shift 6741290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 6742181834Sroberto # use dlname if we got it. it's perfectly good, no? 6743181834Sroberto if test -n "$dlname"; then 6744181834Sroberto soname="$dlname" 6745181834Sroberto elif test -n "$soname_spec"; then 6746181834Sroberto # bleh windows 6747181834Sroberto case $host in 6748290001Sglebius *cygwin* | mingw* | *cegcc*) 6749290001Sglebius func_arith $current - $age 6750290001Sglebius major=$func_arith_result 6751181834Sroberto versuffix="-$major" 6752181834Sroberto ;; 6753181834Sroberto esac 6754181834Sroberto eval soname=\"$soname_spec\" 6755181834Sroberto else 6756181834Sroberto soname="$realname" 6757181834Sroberto fi 6758181834Sroberto 6759181834Sroberto # Make a new name for the extract_expsyms_cmds to use 6760181834Sroberto soroot="$soname" 6761290001Sglebius func_basename "$soroot" 6762290001Sglebius soname="$func_basename_result" 6763290001Sglebius func_stripname 'lib' '.dll' "$soname" 6764290001Sglebius newlib=libimp-$func_stripname_result.a 6765181834Sroberto 6766181834Sroberto # If the library has no export list, then create one now 6767181834Sroberto if test -f "$output_objdir/$soname-def"; then : 6768181834Sroberto else 6769290001Sglebius func_verbose "extracting exported symbol list from \`$soname'" 6770290001Sglebius func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 6771181834Sroberto fi 6772181834Sroberto 6773181834Sroberto # Create $newlib 6774181834Sroberto if test -f "$output_objdir/$newlib"; then :; else 6775290001Sglebius func_verbose "generating import library for \`$soname'" 6776290001Sglebius func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 6777181834Sroberto fi 6778181834Sroberto # make sure the library variables are pointing to the new library 6779181834Sroberto dir=$output_objdir 6780181834Sroberto linklib=$newlib 6781181834Sroberto fi # test -n "$old_archive_from_expsyms_cmds" 6782181834Sroberto 6783290001Sglebius if test "$linkmode" = prog || test "$opt_mode" != relink; then 6784181834Sroberto add_shlibpath= 6785181834Sroberto add_dir= 6786181834Sroberto add= 6787181834Sroberto lib_linked=yes 6788181834Sroberto case $hardcode_action in 6789181834Sroberto immediate | unsupported) 6790181834Sroberto if test "$hardcode_direct" = no; then 6791181834Sroberto add="$dir/$linklib" 6792181834Sroberto case $host in 6793181834Sroberto *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 6794181834Sroberto *-*-sysv4*uw2*) add_dir="-L$dir" ;; 6795181834Sroberto *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 6796181834Sroberto *-*-unixware7*) add_dir="-L$dir" ;; 6797181834Sroberto *-*-darwin* ) 6798290001Sglebius # if the lib is a (non-dlopened) module then we can not 6799290001Sglebius # link against it, someone is ignoring the earlier warnings 6800181834Sroberto if /usr/bin/file -L $add 2> /dev/null | 6801290001Sglebius $GREP ": [^:]* bundle" >/dev/null ; then 6802290001Sglebius if test "X$dlopenmodule" != "X$lib"; then 6803290001Sglebius $ECHO "*** Warning: lib $linklib is a module, not a shared library" 6804290001Sglebius if test -z "$old_library" ; then 6805290001Sglebius echo 6806290001Sglebius echo "*** And there doesn't seem to be a static archive available" 6807290001Sglebius echo "*** The link will probably fail, sorry" 6808290001Sglebius else 6809290001Sglebius add="$dir/$old_library" 6810290001Sglebius fi 6811290001Sglebius elif test -n "$old_library"; then 6812290001Sglebius add="$dir/$old_library" 6813181834Sroberto fi 6814181834Sroberto fi 6815181834Sroberto esac 6816181834Sroberto elif test "$hardcode_minus_L" = no; then 6817181834Sroberto case $host in 6818181834Sroberto *-*-sunos*) add_shlibpath="$dir" ;; 6819181834Sroberto esac 6820181834Sroberto add_dir="-L$dir" 6821181834Sroberto add="-l$name" 6822181834Sroberto elif test "$hardcode_shlibpath_var" = no; then 6823181834Sroberto add_shlibpath="$dir" 6824181834Sroberto add="-l$name" 6825181834Sroberto else 6826181834Sroberto lib_linked=no 6827181834Sroberto fi 6828181834Sroberto ;; 6829181834Sroberto relink) 6830290001Sglebius if test "$hardcode_direct" = yes && 6831290001Sglebius test "$hardcode_direct_absolute" = no; then 6832181834Sroberto add="$dir/$linklib" 6833181834Sroberto elif test "$hardcode_minus_L" = yes; then 6834181834Sroberto add_dir="-L$dir" 6835181834Sroberto # Try looking first in the location we're being installed to. 6836181834Sroberto if test -n "$inst_prefix_dir"; then 6837181834Sroberto case $libdir in 6838181834Sroberto [\\/]*) 6839290001Sglebius func_append add_dir " -L$inst_prefix_dir$libdir" 6840181834Sroberto ;; 6841181834Sroberto esac 6842181834Sroberto fi 6843181834Sroberto add="-l$name" 6844181834Sroberto elif test "$hardcode_shlibpath_var" = yes; then 6845181834Sroberto add_shlibpath="$dir" 6846181834Sroberto add="-l$name" 6847181834Sroberto else 6848181834Sroberto lib_linked=no 6849181834Sroberto fi 6850181834Sroberto ;; 6851181834Sroberto *) lib_linked=no ;; 6852181834Sroberto esac 6853181834Sroberto 6854181834Sroberto if test "$lib_linked" != yes; then 6855290001Sglebius func_fatal_configuration "unsupported hardcode properties" 6856181834Sroberto fi 6857181834Sroberto 6858181834Sroberto if test -n "$add_shlibpath"; then 6859181834Sroberto case :$compile_shlibpath: in 6860181834Sroberto *":$add_shlibpath:"*) ;; 6861290001Sglebius *) func_append compile_shlibpath "$add_shlibpath:" ;; 6862181834Sroberto esac 6863181834Sroberto fi 6864181834Sroberto if test "$linkmode" = prog; then 6865181834Sroberto test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 6866181834Sroberto test -n "$add" && compile_deplibs="$add $compile_deplibs" 6867181834Sroberto else 6868181834Sroberto test -n "$add_dir" && deplibs="$add_dir $deplibs" 6869181834Sroberto test -n "$add" && deplibs="$add $deplibs" 6870290001Sglebius if test "$hardcode_direct" != yes && 6871290001Sglebius test "$hardcode_minus_L" != yes && 6872181834Sroberto test "$hardcode_shlibpath_var" = yes; then 6873181834Sroberto case :$finalize_shlibpath: in 6874181834Sroberto *":$libdir:"*) ;; 6875290001Sglebius *) func_append finalize_shlibpath "$libdir:" ;; 6876181834Sroberto esac 6877181834Sroberto fi 6878181834Sroberto fi 6879181834Sroberto fi 6880181834Sroberto 6881290001Sglebius if test "$linkmode" = prog || test "$opt_mode" = relink; then 6882181834Sroberto add_shlibpath= 6883181834Sroberto add_dir= 6884181834Sroberto add= 6885181834Sroberto # Finalize command for both is simple: just hardcode it. 6886290001Sglebius if test "$hardcode_direct" = yes && 6887290001Sglebius test "$hardcode_direct_absolute" = no; then 6888181834Sroberto add="$libdir/$linklib" 6889181834Sroberto elif test "$hardcode_minus_L" = yes; then 6890181834Sroberto add_dir="-L$libdir" 6891181834Sroberto add="-l$name" 6892181834Sroberto elif test "$hardcode_shlibpath_var" = yes; then 6893181834Sroberto case :$finalize_shlibpath: in 6894181834Sroberto *":$libdir:"*) ;; 6895290001Sglebius *) func_append finalize_shlibpath "$libdir:" ;; 6896181834Sroberto esac 6897181834Sroberto add="-l$name" 6898181834Sroberto elif test "$hardcode_automatic" = yes; then 6899181834Sroberto if test -n "$inst_prefix_dir" && 6900181834Sroberto test -f "$inst_prefix_dir$libdir/$linklib" ; then 6901290001Sglebius add="$inst_prefix_dir$libdir/$linklib" 6902181834Sroberto else 6903290001Sglebius add="$libdir/$linklib" 6904181834Sroberto fi 6905181834Sroberto else 6906181834Sroberto # We cannot seem to hardcode it, guess we'll fake it. 6907181834Sroberto add_dir="-L$libdir" 6908181834Sroberto # Try looking first in the location we're being installed to. 6909181834Sroberto if test -n "$inst_prefix_dir"; then 6910181834Sroberto case $libdir in 6911181834Sroberto [\\/]*) 6912290001Sglebius func_append add_dir " -L$inst_prefix_dir$libdir" 6913181834Sroberto ;; 6914181834Sroberto esac 6915181834Sroberto fi 6916181834Sroberto add="-l$name" 6917181834Sroberto fi 6918181834Sroberto 6919181834Sroberto if test "$linkmode" = prog; then 6920181834Sroberto test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 6921181834Sroberto test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 6922181834Sroberto else 6923181834Sroberto test -n "$add_dir" && deplibs="$add_dir $deplibs" 6924181834Sroberto test -n "$add" && deplibs="$add $deplibs" 6925181834Sroberto fi 6926181834Sroberto fi 6927181834Sroberto elif test "$linkmode" = prog; then 6928181834Sroberto # Here we assume that one of hardcode_direct or hardcode_minus_L 6929181834Sroberto # is not unsupported. This is valid on all known static and 6930181834Sroberto # shared platforms. 6931181834Sroberto if test "$hardcode_direct" != unsupported; then 6932181834Sroberto test -n "$old_library" && linklib="$old_library" 6933181834Sroberto compile_deplibs="$dir/$linklib $compile_deplibs" 6934181834Sroberto finalize_deplibs="$dir/$linklib $finalize_deplibs" 6935181834Sroberto else 6936181834Sroberto compile_deplibs="-l$name -L$dir $compile_deplibs" 6937181834Sroberto finalize_deplibs="-l$name -L$dir $finalize_deplibs" 6938181834Sroberto fi 6939181834Sroberto elif test "$build_libtool_libs" = yes; then 6940181834Sroberto # Not a shared library 6941181834Sroberto if test "$deplibs_check_method" != pass_all; then 6942181834Sroberto # We're trying link a shared library against a static one 6943181834Sroberto # but the system doesn't support it. 6944181834Sroberto 6945181834Sroberto # Just print a warning and add the library to dependency_libs so 6946181834Sroberto # that the program can be linked against the static library. 6947290001Sglebius echo 6948290001Sglebius $ECHO "*** Warning: This system can not link to static lib archive $lib." 6949290001Sglebius echo "*** I have the capability to make that library automatically link in when" 6950290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 6951290001Sglebius echo "*** shared version of the library, which you do not appear to have." 6952181834Sroberto if test "$module" = yes; then 6953290001Sglebius echo "*** But as you try to build a module library, libtool will still create " 6954290001Sglebius echo "*** a static module, that should work as long as the dlopening application" 6955290001Sglebius echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 6956181834Sroberto if test -z "$global_symbol_pipe"; then 6957290001Sglebius echo 6958290001Sglebius echo "*** However, this would only work if libtool was able to extract symbol" 6959290001Sglebius echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 6960290001Sglebius echo "*** not find such a program. So, this module is probably useless." 6961290001Sglebius echo "*** \`nm' from GNU binutils and a full rebuild may help." 6962181834Sroberto fi 6963181834Sroberto if test "$build_old_libs" = no; then 6964181834Sroberto build_libtool_libs=module 6965181834Sroberto build_old_libs=yes 6966181834Sroberto else 6967181834Sroberto build_libtool_libs=no 6968181834Sroberto fi 6969181834Sroberto fi 6970181834Sroberto else 6971181834Sroberto deplibs="$dir/$old_library $deplibs" 6972181834Sroberto link_static=yes 6973181834Sroberto fi 6974181834Sroberto fi # link shared/static library? 6975181834Sroberto 6976181834Sroberto if test "$linkmode" = lib; then 6977181834Sroberto if test -n "$dependency_libs" && 6978181834Sroberto { test "$hardcode_into_libs" != yes || 6979181834Sroberto test "$build_old_libs" = yes || 6980181834Sroberto test "$link_static" = yes; }; then 6981181834Sroberto # Extract -R from dependency_libs 6982181834Sroberto temp_deplibs= 6983181834Sroberto for libdir in $dependency_libs; do 6984181834Sroberto case $libdir in 6985290001Sglebius -R*) func_stripname '-R' '' "$libdir" 6986290001Sglebius temp_xrpath=$func_stripname_result 6987181834Sroberto case " $xrpath " in 6988181834Sroberto *" $temp_xrpath "*) ;; 6989290001Sglebius *) func_append xrpath " $temp_xrpath";; 6990181834Sroberto esac;; 6991290001Sglebius *) func_append temp_deplibs " $libdir";; 6992181834Sroberto esac 6993181834Sroberto done 6994181834Sroberto dependency_libs="$temp_deplibs" 6995181834Sroberto fi 6996181834Sroberto 6997290001Sglebius func_append newlib_search_path " $absdir" 6998181834Sroberto # Link against this library 6999181834Sroberto test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 7000181834Sroberto # ... and its dependency_libs 7001181834Sroberto tmp_libs= 7002181834Sroberto for deplib in $dependency_libs; do 7003181834Sroberto newdependency_libs="$deplib $newdependency_libs" 7004290001Sglebius case $deplib in 7005290001Sglebius -L*) func_stripname '-L' '' "$deplib" 7006290001Sglebius func_resolve_sysroot "$func_stripname_result";; 7007290001Sglebius *) func_resolve_sysroot "$deplib" ;; 7008290001Sglebius esac 7009290001Sglebius if $opt_preserve_dup_deps ; then 7010181834Sroberto case "$tmp_libs " in 7011290001Sglebius *" $func_resolve_sysroot_result "*) 7012290001Sglebius func_append specialdeplibs " $func_resolve_sysroot_result" ;; 7013181834Sroberto esac 7014181834Sroberto fi 7015290001Sglebius func_append tmp_libs " $func_resolve_sysroot_result" 7016181834Sroberto done 7017181834Sroberto 7018181834Sroberto if test "$link_all_deplibs" != no; then 7019181834Sroberto # Add the search paths of all dependency libraries 7020181834Sroberto for deplib in $dependency_libs; do 7021290001Sglebius path= 7022181834Sroberto case $deplib in 7023181834Sroberto -L*) path="$deplib" ;; 7024181834Sroberto *.la) 7025290001Sglebius func_resolve_sysroot "$deplib" 7026290001Sglebius deplib=$func_resolve_sysroot_result 7027290001Sglebius func_dirname "$deplib" "" "." 7028290001Sglebius dir=$func_dirname_result 7029181834Sroberto # We need an absolute path. 7030181834Sroberto case $dir in 7031181834Sroberto [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 7032181834Sroberto *) 7033181834Sroberto absdir=`cd "$dir" && pwd` 7034181834Sroberto if test -z "$absdir"; then 7035290001Sglebius func_warning "cannot determine absolute directory name of \`$dir'" 7036181834Sroberto absdir="$dir" 7037181834Sroberto fi 7038181834Sroberto ;; 7039181834Sroberto esac 7040290001Sglebius if $GREP "^installed=no" $deplib > /dev/null; then 7041181834Sroberto case $host in 7042181834Sroberto *-*-darwin*) 7043290001Sglebius depdepl= 7044181834Sroberto eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 7045181834Sroberto if test -n "$deplibrary_names" ; then 7046181834Sroberto for tmp in $deplibrary_names ; do 7047181834Sroberto depdepl=$tmp 7048181834Sroberto done 7049290001Sglebius if test -f "$absdir/$objdir/$depdepl" ; then 7050290001Sglebius depdepl="$absdir/$objdir/$depdepl" 7051290001Sglebius darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7052290001Sglebius if test -z "$darwin_install_name"; then 7053290001Sglebius darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7054290001Sglebius fi 7055290001Sglebius func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 7056290001Sglebius func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" 7057290001Sglebius path= 7058181834Sroberto fi 7059181834Sroberto fi 7060181834Sroberto ;; 7061181834Sroberto *) 7062290001Sglebius path="-L$absdir/$objdir" 7063181834Sroberto ;; 7064181834Sroberto esac 7065290001Sglebius else 7066290001Sglebius eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 7067290001Sglebius test -z "$libdir" && \ 7068290001Sglebius func_fatal_error "\`$deplib' is not a valid libtool archive" 7069290001Sglebius test "$absdir" != "$libdir" && \ 7070290001Sglebius func_warning "\`$deplib' seems to be moved" 7071290001Sglebius 7072290001Sglebius path="-L$absdir" 7073290001Sglebius fi 7074181834Sroberto ;; 7075181834Sroberto esac 7076181834Sroberto case " $deplibs " in 7077181834Sroberto *" $path "*) ;; 7078181834Sroberto *) deplibs="$path $deplibs" ;; 7079181834Sroberto esac 7080181834Sroberto done 7081181834Sroberto fi # link_all_deplibs != no 7082181834Sroberto fi # linkmode = lib 7083181834Sroberto done # for deplib in $libs 7084290001Sglebius if test "$pass" = link; then 7085290001Sglebius if test "$linkmode" = "prog"; then 7086290001Sglebius compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 7087290001Sglebius finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 7088290001Sglebius else 7089290001Sglebius compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7090290001Sglebius fi 7091290001Sglebius fi 7092181834Sroberto dependency_libs="$newdependency_libs" 7093181834Sroberto if test "$pass" = dlpreopen; then 7094181834Sroberto # Link the dlpreopened libraries before other libraries 7095181834Sroberto for deplib in $save_deplibs; do 7096181834Sroberto deplibs="$deplib $deplibs" 7097181834Sroberto done 7098181834Sroberto fi 7099181834Sroberto if test "$pass" != dlopen; then 7100181834Sroberto if test "$pass" != conv; then 7101181834Sroberto # Make sure lib_search_path contains only unique directories. 7102181834Sroberto lib_search_path= 7103181834Sroberto for dir in $newlib_search_path; do 7104181834Sroberto case "$lib_search_path " in 7105181834Sroberto *" $dir "*) ;; 7106290001Sglebius *) func_append lib_search_path " $dir" ;; 7107181834Sroberto esac 7108181834Sroberto done 7109181834Sroberto newlib_search_path= 7110181834Sroberto fi 7111181834Sroberto 7112181834Sroberto if test "$linkmode,$pass" != "prog,link"; then 7113181834Sroberto vars="deplibs" 7114181834Sroberto else 7115181834Sroberto vars="compile_deplibs finalize_deplibs" 7116181834Sroberto fi 7117181834Sroberto for var in $vars dependency_libs; do 7118181834Sroberto # Add libraries to $var in reverse order 7119181834Sroberto eval tmp_libs=\"\$$var\" 7120181834Sroberto new_libs= 7121181834Sroberto for deplib in $tmp_libs; do 7122181834Sroberto # FIXME: Pedantically, this is the right thing to do, so 7123181834Sroberto # that some nasty dependency loop isn't accidentally 7124181834Sroberto # broken: 7125181834Sroberto #new_libs="$deplib $new_libs" 7126181834Sroberto # Pragmatically, this seems to cause very few problems in 7127181834Sroberto # practice: 7128181834Sroberto case $deplib in 7129181834Sroberto -L*) new_libs="$deplib $new_libs" ;; 7130181834Sroberto -R*) ;; 7131181834Sroberto *) 7132181834Sroberto # And here is the reason: when a library appears more 7133181834Sroberto # than once as an explicit dependence of a library, or 7134181834Sroberto # is implicitly linked in more than once by the 7135181834Sroberto # compiler, it is considered special, and multiple 7136181834Sroberto # occurrences thereof are not removed. Compare this 7137181834Sroberto # with having the same library being listed as a 7138181834Sroberto # dependency of multiple other libraries: in this case, 7139181834Sroberto # we know (pedantically, we assume) the library does not 7140181834Sroberto # need to be listed more than once, so we keep only the 7141181834Sroberto # last copy. This is not always right, but it is rare 7142181834Sroberto # enough that we require users that really mean to play 7143181834Sroberto # such unportable linking tricks to link the library 7144181834Sroberto # using -Wl,-lname, so that libtool does not consider it 7145181834Sroberto # for duplicate removal. 7146181834Sroberto case " $specialdeplibs " in 7147181834Sroberto *" $deplib "*) new_libs="$deplib $new_libs" ;; 7148181834Sroberto *) 7149181834Sroberto case " $new_libs " in 7150181834Sroberto *" $deplib "*) ;; 7151181834Sroberto *) new_libs="$deplib $new_libs" ;; 7152181834Sroberto esac 7153181834Sroberto ;; 7154181834Sroberto esac 7155181834Sroberto ;; 7156181834Sroberto esac 7157181834Sroberto done 7158181834Sroberto tmp_libs= 7159181834Sroberto for deplib in $new_libs; do 7160181834Sroberto case $deplib in 7161181834Sroberto -L*) 7162181834Sroberto case " $tmp_libs " in 7163181834Sroberto *" $deplib "*) ;; 7164290001Sglebius *) func_append tmp_libs " $deplib" ;; 7165181834Sroberto esac 7166181834Sroberto ;; 7167290001Sglebius *) func_append tmp_libs " $deplib" ;; 7168181834Sroberto esac 7169181834Sroberto done 7170181834Sroberto eval $var=\"$tmp_libs\" 7171181834Sroberto done # for var 7172181834Sroberto fi 7173181834Sroberto # Last step: remove runtime libs from dependency_libs 7174181834Sroberto # (they stay in deplibs) 7175181834Sroberto tmp_libs= 7176181834Sroberto for i in $dependency_libs ; do 7177181834Sroberto case " $predeps $postdeps $compiler_lib_search_path " in 7178181834Sroberto *" $i "*) 7179181834Sroberto i="" 7180181834Sroberto ;; 7181181834Sroberto esac 7182181834Sroberto if test -n "$i" ; then 7183290001Sglebius func_append tmp_libs " $i" 7184181834Sroberto fi 7185181834Sroberto done 7186181834Sroberto dependency_libs=$tmp_libs 7187181834Sroberto done # for pass 7188181834Sroberto if test "$linkmode" = prog; then 7189181834Sroberto dlfiles="$newdlfiles" 7190290001Sglebius fi 7191290001Sglebius if test "$linkmode" = prog || test "$linkmode" = lib; then 7192181834Sroberto dlprefiles="$newdlprefiles" 7193181834Sroberto fi 7194181834Sroberto 7195181834Sroberto case $linkmode in 7196181834Sroberto oldlib) 7197181834Sroberto if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7198290001Sglebius func_warning "\`-dlopen' is ignored for archives" 7199181834Sroberto fi 7200181834Sroberto 7201290001Sglebius case " $deplibs" in 7202290001Sglebius *\ -l* | *\ -L*) 7203290001Sglebius func_warning "\`-l' and \`-L' are ignored for archives" ;; 7204290001Sglebius esac 7205181834Sroberto 7206290001Sglebius test -n "$rpath" && \ 7207290001Sglebius func_warning "\`-rpath' is ignored for archives" 7208181834Sroberto 7209290001Sglebius test -n "$xrpath" && \ 7210290001Sglebius func_warning "\`-R' is ignored for archives" 7211181834Sroberto 7212290001Sglebius test -n "$vinfo" && \ 7213290001Sglebius func_warning "\`-version-info/-version-number' is ignored for archives" 7214181834Sroberto 7215290001Sglebius test -n "$release" && \ 7216290001Sglebius func_warning "\`-release' is ignored for archives" 7217181834Sroberto 7218290001Sglebius test -n "$export_symbols$export_symbols_regex" && \ 7219290001Sglebius func_warning "\`-export-symbols' is ignored for archives" 7220290001Sglebius 7221181834Sroberto # Now set the variables for building old libraries. 7222181834Sroberto build_libtool_libs=no 7223181834Sroberto oldlibs="$output" 7224290001Sglebius func_append objs "$old_deplibs" 7225181834Sroberto ;; 7226181834Sroberto 7227181834Sroberto lib) 7228181834Sroberto # Make sure we only generate libraries of the form `libNAME.la'. 7229181834Sroberto case $outputname in 7230181834Sroberto lib*) 7231290001Sglebius func_stripname 'lib' '.la' "$outputname" 7232290001Sglebius name=$func_stripname_result 7233181834Sroberto eval shared_ext=\"$shrext_cmds\" 7234181834Sroberto eval libname=\"$libname_spec\" 7235181834Sroberto ;; 7236181834Sroberto *) 7237290001Sglebius test "$module" = no && \ 7238290001Sglebius func_fatal_help "libtool library \`$output' must begin with \`lib'" 7239290001Sglebius 7240181834Sroberto if test "$need_lib_prefix" != no; then 7241181834Sroberto # Add the "lib" prefix for modules if required 7242290001Sglebius func_stripname '' '.la' "$outputname" 7243290001Sglebius name=$func_stripname_result 7244181834Sroberto eval shared_ext=\"$shrext_cmds\" 7245181834Sroberto eval libname=\"$libname_spec\" 7246181834Sroberto else 7247290001Sglebius func_stripname '' '.la' "$outputname" 7248290001Sglebius libname=$func_stripname_result 7249181834Sroberto fi 7250181834Sroberto ;; 7251181834Sroberto esac 7252181834Sroberto 7253181834Sroberto if test -n "$objs"; then 7254181834Sroberto if test "$deplibs_check_method" != pass_all; then 7255290001Sglebius func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 7256181834Sroberto else 7257290001Sglebius echo 7258290001Sglebius $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 7259290001Sglebius $ECHO "*** objects $objs is not portable!" 7260290001Sglebius func_append libobjs " $objs" 7261181834Sroberto fi 7262181834Sroberto fi 7263181834Sroberto 7264290001Sglebius test "$dlself" != no && \ 7265290001Sglebius func_warning "\`-dlopen self' is ignored for libtool libraries" 7266181834Sroberto 7267181834Sroberto set dummy $rpath 7268290001Sglebius shift 7269290001Sglebius test "$#" -gt 1 && \ 7270290001Sglebius func_warning "ignoring multiple \`-rpath's for a libtool library" 7271181834Sroberto 7272290001Sglebius install_libdir="$1" 7273290001Sglebius 7274181834Sroberto oldlibs= 7275181834Sroberto if test -z "$rpath"; then 7276181834Sroberto if test "$build_libtool_libs" = yes; then 7277181834Sroberto # Building a libtool convenience library. 7278181834Sroberto # Some compilers have problems with a `.al' extension so 7279181834Sroberto # convenience libraries should have the same extension an 7280181834Sroberto # archive normally would. 7281181834Sroberto oldlibs="$output_objdir/$libname.$libext $oldlibs" 7282181834Sroberto build_libtool_libs=convenience 7283181834Sroberto build_old_libs=yes 7284181834Sroberto fi 7285181834Sroberto 7286290001Sglebius test -n "$vinfo" && \ 7287290001Sglebius func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 7288181834Sroberto 7289290001Sglebius test -n "$release" && \ 7290290001Sglebius func_warning "\`-release' is ignored for convenience libraries" 7291181834Sroberto else 7292181834Sroberto 7293181834Sroberto # Parse the version information argument. 7294181834Sroberto save_ifs="$IFS"; IFS=':' 7295181834Sroberto set dummy $vinfo 0 0 0 7296290001Sglebius shift 7297181834Sroberto IFS="$save_ifs" 7298181834Sroberto 7299290001Sglebius test -n "$7" && \ 7300290001Sglebius func_fatal_help "too many parameters to \`-version-info'" 7301181834Sroberto 7302181834Sroberto # convert absolute version numbers to libtool ages 7303181834Sroberto # this retains compatibility with .la files and attempts 7304181834Sroberto # to make the code below a bit more comprehensible 7305181834Sroberto 7306181834Sroberto case $vinfo_number in 7307181834Sroberto yes) 7308290001Sglebius number_major="$1" 7309290001Sglebius number_minor="$2" 7310290001Sglebius number_revision="$3" 7311181834Sroberto # 7312181834Sroberto # There are really only two kinds -- those that 7313181834Sroberto # use the current revision as the major version 7314181834Sroberto # and those that subtract age and use age as 7315181834Sroberto # a minor version. But, then there is irix 7316181834Sroberto # which has an extra 1 added just for fun 7317181834Sroberto # 7318181834Sroberto case $version_type in 7319290001Sglebius darwin|linux|osf|windows|none) 7320290001Sglebius func_arith $number_major + $number_minor 7321290001Sglebius current=$func_arith_result 7322181834Sroberto age="$number_minor" 7323181834Sroberto revision="$number_revision" 7324181834Sroberto ;; 7325290001Sglebius freebsd-aout|freebsd-elf|qnx|sunos) 7326181834Sroberto current="$number_major" 7327181834Sroberto revision="$number_minor" 7328181834Sroberto age="0" 7329181834Sroberto ;; 7330181834Sroberto irix|nonstopux) 7331290001Sglebius func_arith $number_major + $number_minor 7332290001Sglebius current=$func_arith_result 7333181834Sroberto age="$number_minor" 7334181834Sroberto revision="$number_minor" 7335290001Sglebius lt_irix_increment=no 7336181834Sroberto ;; 7337181834Sroberto esac 7338181834Sroberto ;; 7339181834Sroberto no) 7340290001Sglebius current="$1" 7341290001Sglebius revision="$2" 7342290001Sglebius age="$3" 7343181834Sroberto ;; 7344181834Sroberto esac 7345181834Sroberto 7346181834Sroberto # Check that each of the things are valid numbers. 7347181834Sroberto case $current in 7348181834Sroberto 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]) ;; 7349181834Sroberto *) 7350290001Sglebius func_error "CURRENT \`$current' must be a nonnegative integer" 7351290001Sglebius func_fatal_error "\`$vinfo' is not valid version information" 7352181834Sroberto ;; 7353181834Sroberto esac 7354181834Sroberto 7355181834Sroberto case $revision in 7356181834Sroberto 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]) ;; 7357181834Sroberto *) 7358290001Sglebius func_error "REVISION \`$revision' must be a nonnegative integer" 7359290001Sglebius func_fatal_error "\`$vinfo' is not valid version information" 7360181834Sroberto ;; 7361181834Sroberto esac 7362181834Sroberto 7363181834Sroberto case $age in 7364181834Sroberto 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]) ;; 7365181834Sroberto *) 7366290001Sglebius func_error "AGE \`$age' must be a nonnegative integer" 7367290001Sglebius func_fatal_error "\`$vinfo' is not valid version information" 7368181834Sroberto ;; 7369181834Sroberto esac 7370181834Sroberto 7371181834Sroberto if test "$age" -gt "$current"; then 7372290001Sglebius func_error "AGE \`$age' is greater than the current interface number \`$current'" 7373290001Sglebius func_fatal_error "\`$vinfo' is not valid version information" 7374181834Sroberto fi 7375181834Sroberto 7376181834Sroberto # Calculate the version variables. 7377181834Sroberto major= 7378181834Sroberto versuffix= 7379181834Sroberto verstring= 7380181834Sroberto case $version_type in 7381181834Sroberto none) ;; 7382181834Sroberto 7383181834Sroberto darwin) 7384181834Sroberto # Like Linux, but with the current version available in 7385181834Sroberto # verstring for coding it into the library header 7386290001Sglebius func_arith $current - $age 7387290001Sglebius major=.$func_arith_result 7388181834Sroberto versuffix="$major.$age.$revision" 7389181834Sroberto # Darwin ld doesn't like 0 for these options... 7390290001Sglebius func_arith $current + 1 7391290001Sglebius minor_current=$func_arith_result 7392290001Sglebius xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 7393290001Sglebius verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 7394181834Sroberto ;; 7395181834Sroberto 7396181834Sroberto freebsd-aout) 7397181834Sroberto major=".$current" 7398181834Sroberto versuffix=".$current.$revision"; 7399181834Sroberto ;; 7400181834Sroberto 7401181834Sroberto freebsd-elf) 7402181834Sroberto major=".$current" 7403290001Sglebius versuffix=".$current" 7404181834Sroberto ;; 7405181834Sroberto 7406181834Sroberto irix | nonstopux) 7407290001Sglebius if test "X$lt_irix_increment" = "Xno"; then 7408290001Sglebius func_arith $current - $age 7409290001Sglebius else 7410290001Sglebius func_arith $current - $age + 1 7411290001Sglebius fi 7412290001Sglebius major=$func_arith_result 7413181834Sroberto 7414181834Sroberto case $version_type in 7415181834Sroberto nonstopux) verstring_prefix=nonstopux ;; 7416181834Sroberto *) verstring_prefix=sgi ;; 7417181834Sroberto esac 7418181834Sroberto verstring="$verstring_prefix$major.$revision" 7419181834Sroberto 7420181834Sroberto # Add in all the interfaces that we are compatible with. 7421181834Sroberto loop=$revision 7422181834Sroberto while test "$loop" -ne 0; do 7423290001Sglebius func_arith $revision - $loop 7424290001Sglebius iface=$func_arith_result 7425290001Sglebius func_arith $loop - 1 7426290001Sglebius loop=$func_arith_result 7427181834Sroberto verstring="$verstring_prefix$major.$iface:$verstring" 7428181834Sroberto done 7429181834Sroberto 7430181834Sroberto # Before this point, $major must not contain `.'. 7431181834Sroberto major=.$major 7432181834Sroberto versuffix="$major.$revision" 7433181834Sroberto ;; 7434181834Sroberto 7435181834Sroberto linux) 7436290001Sglebius func_arith $current - $age 7437290001Sglebius major=.$func_arith_result 7438181834Sroberto versuffix="$major.$age.$revision" 7439181834Sroberto ;; 7440181834Sroberto 7441181834Sroberto osf) 7442290001Sglebius func_arith $current - $age 7443290001Sglebius major=.$func_arith_result 7444181834Sroberto versuffix=".$current.$age.$revision" 7445181834Sroberto verstring="$current.$age.$revision" 7446181834Sroberto 7447181834Sroberto # Add in all the interfaces that we are compatible with. 7448181834Sroberto loop=$age 7449181834Sroberto while test "$loop" -ne 0; do 7450290001Sglebius func_arith $current - $loop 7451290001Sglebius iface=$func_arith_result 7452290001Sglebius func_arith $loop - 1 7453290001Sglebius loop=$func_arith_result 7454181834Sroberto verstring="$verstring:${iface}.0" 7455181834Sroberto done 7456181834Sroberto 7457181834Sroberto # Make executables depend on our current version. 7458290001Sglebius func_append verstring ":${current}.0" 7459181834Sroberto ;; 7460181834Sroberto 7461290001Sglebius qnx) 7462290001Sglebius major=".$current" 7463290001Sglebius versuffix=".$current" 7464290001Sglebius ;; 7465290001Sglebius 7466181834Sroberto sunos) 7467181834Sroberto major=".$current" 7468181834Sroberto versuffix=".$current.$revision" 7469181834Sroberto ;; 7470181834Sroberto 7471181834Sroberto windows) 7472181834Sroberto # Use '-' rather than '.', since we only want one 7473181834Sroberto # extension on DOS 8.3 filesystems. 7474290001Sglebius func_arith $current - $age 7475290001Sglebius major=$func_arith_result 7476181834Sroberto versuffix="-$major" 7477181834Sroberto ;; 7478181834Sroberto 7479181834Sroberto *) 7480290001Sglebius func_fatal_configuration "unknown library version type \`$version_type'" 7481181834Sroberto ;; 7482181834Sroberto esac 7483181834Sroberto 7484181834Sroberto # Clear the version info if we defaulted, and they specified a release. 7485181834Sroberto if test -z "$vinfo" && test -n "$release"; then 7486181834Sroberto major= 7487181834Sroberto case $version_type in 7488181834Sroberto darwin) 7489181834Sroberto # we can't check for "0.0" in archive_cmds due to quoting 7490181834Sroberto # problems, so we reset it completely 7491181834Sroberto verstring= 7492181834Sroberto ;; 7493181834Sroberto *) 7494181834Sroberto verstring="0.0" 7495181834Sroberto ;; 7496181834Sroberto esac 7497181834Sroberto if test "$need_version" = no; then 7498181834Sroberto versuffix= 7499181834Sroberto else 7500181834Sroberto versuffix=".0.0" 7501181834Sroberto fi 7502181834Sroberto fi 7503181834Sroberto 7504181834Sroberto # Remove version info from name if versioning should be avoided 7505181834Sroberto if test "$avoid_version" = yes && test "$need_version" = no; then 7506181834Sroberto major= 7507181834Sroberto versuffix= 7508181834Sroberto verstring="" 7509181834Sroberto fi 7510181834Sroberto 7511181834Sroberto # Check to see if the archive will have undefined symbols. 7512181834Sroberto if test "$allow_undefined" = yes; then 7513181834Sroberto if test "$allow_undefined_flag" = unsupported; then 7514290001Sglebius func_warning "undefined symbols not allowed in $host shared libraries" 7515181834Sroberto build_libtool_libs=no 7516181834Sroberto build_old_libs=yes 7517181834Sroberto fi 7518181834Sroberto else 7519181834Sroberto # Don't allow undefined symbols. 7520181834Sroberto allow_undefined_flag="$no_undefined_flag" 7521181834Sroberto fi 7522290001Sglebius 7523181834Sroberto fi 7524181834Sroberto 7525290001Sglebius func_generate_dlsyms "$libname" "$libname" "yes" 7526290001Sglebius func_append libobjs " $symfileobj" 7527290001Sglebius test "X$libobjs" = "X " && libobjs= 7528290001Sglebius 7529290001Sglebius if test "$opt_mode" != relink; then 7530181834Sroberto # Remove our outputs, but don't remove object files since they 7531181834Sroberto # may have been created when compiling PIC objects. 7532181834Sroberto removelist= 7533290001Sglebius tempremovelist=`$ECHO "$output_objdir/*"` 7534181834Sroberto for p in $tempremovelist; do 7535181834Sroberto case $p in 7536290001Sglebius *.$objext | *.gcno) 7537181834Sroberto ;; 7538181834Sroberto $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 7539181834Sroberto if test "X$precious_files_regex" != "X"; then 7540290001Sglebius if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 7541290001Sglebius then 7542181834Sroberto continue 7543181834Sroberto fi 7544181834Sroberto fi 7545290001Sglebius func_append removelist " $p" 7546181834Sroberto ;; 7547181834Sroberto *) ;; 7548181834Sroberto esac 7549181834Sroberto done 7550290001Sglebius test -n "$removelist" && \ 7551290001Sglebius func_show_eval "${RM}r \$removelist" 7552181834Sroberto fi 7553181834Sroberto 7554181834Sroberto # Now set the variables for building old libraries. 7555181834Sroberto if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 7556290001Sglebius func_append oldlibs " $output_objdir/$libname.$libext" 7557181834Sroberto 7558181834Sroberto # Transform .lo files to .o files. 7559290001Sglebius oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 7560181834Sroberto fi 7561181834Sroberto 7562181834Sroberto # Eliminate all temporary directories. 7563290001Sglebius #for path in $notinst_path; do 7564290001Sglebius # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 7565290001Sglebius # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 7566290001Sglebius # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 7567290001Sglebius #done 7568181834Sroberto 7569181834Sroberto if test -n "$xrpath"; then 7570181834Sroberto # If the user specified any rpath flags, then add them. 7571181834Sroberto temp_xrpath= 7572181834Sroberto for libdir in $xrpath; do 7573290001Sglebius func_replace_sysroot "$libdir" 7574290001Sglebius func_append temp_xrpath " -R$func_replace_sysroot_result" 7575181834Sroberto case "$finalize_rpath " in 7576181834Sroberto *" $libdir "*) ;; 7577290001Sglebius *) func_append finalize_rpath " $libdir" ;; 7578181834Sroberto esac 7579181834Sroberto done 7580181834Sroberto if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 7581181834Sroberto dependency_libs="$temp_xrpath $dependency_libs" 7582181834Sroberto fi 7583181834Sroberto fi 7584181834Sroberto 7585181834Sroberto # Make sure dlfiles contains only unique files that won't be dlpreopened 7586181834Sroberto old_dlfiles="$dlfiles" 7587181834Sroberto dlfiles= 7588181834Sroberto for lib in $old_dlfiles; do 7589181834Sroberto case " $dlprefiles $dlfiles " in 7590181834Sroberto *" $lib "*) ;; 7591290001Sglebius *) func_append dlfiles " $lib" ;; 7592181834Sroberto esac 7593181834Sroberto done 7594181834Sroberto 7595181834Sroberto # Make sure dlprefiles contains only unique files 7596181834Sroberto old_dlprefiles="$dlprefiles" 7597181834Sroberto dlprefiles= 7598181834Sroberto for lib in $old_dlprefiles; do 7599181834Sroberto case "$dlprefiles " in 7600181834Sroberto *" $lib "*) ;; 7601290001Sglebius *) func_append dlprefiles " $lib" ;; 7602181834Sroberto esac 7603181834Sroberto done 7604181834Sroberto 7605181834Sroberto if test "$build_libtool_libs" = yes; then 7606181834Sroberto if test -n "$rpath"; then 7607181834Sroberto case $host in 7608290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 7609181834Sroberto # these systems don't actually have a c library (as such)! 7610181834Sroberto ;; 7611181834Sroberto *-*-rhapsody* | *-*-darwin1.[012]) 7612181834Sroberto # Rhapsody C library is in the System framework 7613290001Sglebius func_append deplibs " System.ltframework" 7614181834Sroberto ;; 7615181834Sroberto *-*-netbsd*) 7616181834Sroberto # Don't link with libc until the a.out ld.so is fixed. 7617181834Sroberto ;; 7618181834Sroberto *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 7619181834Sroberto # Do not include libc due to us having libc/libc_r. 7620181834Sroberto ;; 7621181834Sroberto *-*-sco3.2v5* | *-*-sco5v6*) 7622181834Sroberto # Causes problems with __ctype 7623181834Sroberto ;; 7624181834Sroberto *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 7625181834Sroberto # Compiler inserts libc in the correct place for threads to work 7626181834Sroberto ;; 7627290001Sglebius *) 7628181834Sroberto # Add libc to deplibs on all other systems if necessary. 7629181834Sroberto if test "$build_libtool_need_lc" = "yes"; then 7630290001Sglebius func_append deplibs " -lc" 7631181834Sroberto fi 7632181834Sroberto ;; 7633181834Sroberto esac 7634181834Sroberto fi 7635181834Sroberto 7636181834Sroberto # Transform deplibs into only deplibs that can be linked in shared. 7637181834Sroberto name_save=$name 7638181834Sroberto libname_save=$libname 7639181834Sroberto release_save=$release 7640181834Sroberto versuffix_save=$versuffix 7641181834Sroberto major_save=$major 7642181834Sroberto # I'm not sure if I'm treating the release correctly. I think 7643181834Sroberto # release should show up in the -l (ie -lgmp5) so we don't want to 7644181834Sroberto # add it in twice. Is that correct? 7645181834Sroberto release="" 7646181834Sroberto versuffix="" 7647181834Sroberto major="" 7648181834Sroberto newdeplibs= 7649181834Sroberto droppeddeps=no 7650181834Sroberto case $deplibs_check_method in 7651181834Sroberto pass_all) 7652181834Sroberto # Don't check for shared/static. Everything works. 7653181834Sroberto # This might be a little naive. We might want to check 7654181834Sroberto # whether the library exists or not. But this is on 7655181834Sroberto # osf3 & osf4 and I'm not really sure... Just 7656181834Sroberto # implementing what was already the behavior. 7657181834Sroberto newdeplibs=$deplibs 7658181834Sroberto ;; 7659181834Sroberto test_compile) 7660181834Sroberto # This code stresses the "libraries are programs" paradigm to its 7661181834Sroberto # limits. Maybe even breaks it. We compile a program, linking it 7662181834Sroberto # against the deplibs as a proxy for the library. Then we can check 7663181834Sroberto # whether they linked in statically or dynamically with ldd. 7664290001Sglebius $opt_dry_run || $RM conftest.c 7665181834Sroberto cat > conftest.c <<EOF 7666181834Sroberto int main() { return 0; } 7667181834SrobertoEOF 7668290001Sglebius $opt_dry_run || $RM conftest 7669290001Sglebius if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 7670181834Sroberto ldd_output=`ldd conftest` 7671181834Sroberto for i in $deplibs; do 7672290001Sglebius case $i in 7673290001Sglebius -l*) 7674290001Sglebius func_stripname -l '' "$i" 7675290001Sglebius name=$func_stripname_result 7676181834Sroberto if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7677181834Sroberto case " $predeps $postdeps " in 7678181834Sroberto *" $i "*) 7679290001Sglebius func_append newdeplibs " $i" 7680181834Sroberto i="" 7681181834Sroberto ;; 7682181834Sroberto esac 7683290001Sglebius fi 7684181834Sroberto if test -n "$i" ; then 7685290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 7686290001Sglebius deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7687290001Sglebius set dummy $deplib_matches; shift 7688290001Sglebius deplib_match=$1 7689181834Sroberto if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7690290001Sglebius func_append newdeplibs " $i" 7691181834Sroberto else 7692181834Sroberto droppeddeps=yes 7693290001Sglebius echo 7694290001Sglebius $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7695290001Sglebius echo "*** I have the capability to make that library automatically link in when" 7696290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 7697290001Sglebius echo "*** shared version of the library, which I believe you do not have" 7698290001Sglebius echo "*** because a test_compile did reveal that the linker did not use it for" 7699290001Sglebius echo "*** its dynamic dependency list that programs get resolved with at runtime." 7700181834Sroberto fi 7701181834Sroberto fi 7702290001Sglebius ;; 7703290001Sglebius *) 7704290001Sglebius func_append newdeplibs " $i" 7705290001Sglebius ;; 7706290001Sglebius esac 7707181834Sroberto done 7708181834Sroberto else 7709181834Sroberto # Error occurred in the first compile. Let's try to salvage 7710181834Sroberto # the situation: Compile a separate program for each library. 7711181834Sroberto for i in $deplibs; do 7712290001Sglebius case $i in 7713290001Sglebius -l*) 7714290001Sglebius func_stripname -l '' "$i" 7715290001Sglebius name=$func_stripname_result 7716290001Sglebius $opt_dry_run || $RM conftest 7717290001Sglebius if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 7718181834Sroberto ldd_output=`ldd conftest` 7719181834Sroberto if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7720181834Sroberto case " $predeps $postdeps " in 7721181834Sroberto *" $i "*) 7722290001Sglebius func_append newdeplibs " $i" 7723181834Sroberto i="" 7724181834Sroberto ;; 7725181834Sroberto esac 7726181834Sroberto fi 7727181834Sroberto if test -n "$i" ; then 7728290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 7729290001Sglebius deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7730290001Sglebius set dummy $deplib_matches; shift 7731290001Sglebius deplib_match=$1 7732181834Sroberto if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7733290001Sglebius func_append newdeplibs " $i" 7734181834Sroberto else 7735181834Sroberto droppeddeps=yes 7736290001Sglebius echo 7737290001Sglebius $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7738290001Sglebius echo "*** I have the capability to make that library automatically link in when" 7739290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 7740290001Sglebius echo "*** shared version of the library, which you do not appear to have" 7741290001Sglebius echo "*** because a test_compile did reveal that the linker did not use this one" 7742290001Sglebius echo "*** as a dynamic dependency that programs can get resolved with at runtime." 7743181834Sroberto fi 7744181834Sroberto fi 7745181834Sroberto else 7746181834Sroberto droppeddeps=yes 7747290001Sglebius echo 7748290001Sglebius $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 7749290001Sglebius echo "*** make it link in! You will probably need to install it or some" 7750290001Sglebius echo "*** library that it depends on before this library will be fully" 7751290001Sglebius echo "*** functional. Installing it before continuing would be even better." 7752181834Sroberto fi 7753290001Sglebius ;; 7754290001Sglebius *) 7755290001Sglebius func_append newdeplibs " $i" 7756290001Sglebius ;; 7757290001Sglebius esac 7758181834Sroberto done 7759181834Sroberto fi 7760181834Sroberto ;; 7761181834Sroberto file_magic*) 7762290001Sglebius set dummy $deplibs_check_method; shift 7763290001Sglebius file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7764181834Sroberto for a_deplib in $deplibs; do 7765290001Sglebius case $a_deplib in 7766290001Sglebius -l*) 7767290001Sglebius func_stripname -l '' "$a_deplib" 7768290001Sglebius name=$func_stripname_result 7769181834Sroberto if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7770181834Sroberto case " $predeps $postdeps " in 7771181834Sroberto *" $a_deplib "*) 7772290001Sglebius func_append newdeplibs " $a_deplib" 7773181834Sroberto a_deplib="" 7774181834Sroberto ;; 7775181834Sroberto esac 7776181834Sroberto fi 7777181834Sroberto if test -n "$a_deplib" ; then 7778290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 7779290001Sglebius if test -n "$file_magic_glob"; then 7780290001Sglebius libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 7781290001Sglebius else 7782290001Sglebius libnameglob=$libname 7783290001Sglebius fi 7784290001Sglebius test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` 7785181834Sroberto for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7786290001Sglebius if test "$want_nocaseglob" = yes; then 7787290001Sglebius shopt -s nocaseglob 7788290001Sglebius potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7789290001Sglebius $nocaseglob 7790290001Sglebius else 7791290001Sglebius potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7792290001Sglebius fi 7793181834Sroberto for potent_lib in $potential_libs; do 7794181834Sroberto # Follow soft links. 7795290001Sglebius if ls -lLd "$potent_lib" 2>/dev/null | 7796290001Sglebius $GREP " -> " >/dev/null; then 7797181834Sroberto continue 7798181834Sroberto fi 7799181834Sroberto # The statement above tries to avoid entering an 7800181834Sroberto # endless loop below, in case of cyclic links. 7801181834Sroberto # We might still enter an endless loop, since a link 7802181834Sroberto # loop can be closed while we follow links, 7803181834Sroberto # but so what? 7804181834Sroberto potlib="$potent_lib" 7805181834Sroberto while test -h "$potlib" 2>/dev/null; do 7806181834Sroberto potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 7807181834Sroberto case $potliblink in 7808181834Sroberto [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 7809290001Sglebius *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 7810181834Sroberto esac 7811181834Sroberto done 7812290001Sglebius if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 7813290001Sglebius $SED -e 10q | 7814290001Sglebius $EGREP "$file_magic_regex" > /dev/null; then 7815290001Sglebius func_append newdeplibs " $a_deplib" 7816181834Sroberto a_deplib="" 7817181834Sroberto break 2 7818181834Sroberto fi 7819181834Sroberto done 7820181834Sroberto done 7821181834Sroberto fi 7822181834Sroberto if test -n "$a_deplib" ; then 7823181834Sroberto droppeddeps=yes 7824290001Sglebius echo 7825290001Sglebius $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7826290001Sglebius echo "*** I have the capability to make that library automatically link in when" 7827290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 7828290001Sglebius echo "*** shared version of the library, which you do not appear to have" 7829290001Sglebius echo "*** because I did check the linker path looking for a file starting" 7830181834Sroberto if test -z "$potlib" ; then 7831290001Sglebius $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 7832181834Sroberto else 7833290001Sglebius $ECHO "*** with $libname and none of the candidates passed a file format test" 7834290001Sglebius $ECHO "*** using a file magic. Last file checked: $potlib" 7835181834Sroberto fi 7836181834Sroberto fi 7837290001Sglebius ;; 7838290001Sglebius *) 7839181834Sroberto # Add a -L argument. 7840290001Sglebius func_append newdeplibs " $a_deplib" 7841290001Sglebius ;; 7842290001Sglebius esac 7843181834Sroberto done # Gone through all deplibs. 7844181834Sroberto ;; 7845181834Sroberto match_pattern*) 7846290001Sglebius set dummy $deplibs_check_method; shift 7847290001Sglebius match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7848181834Sroberto for a_deplib in $deplibs; do 7849290001Sglebius case $a_deplib in 7850290001Sglebius -l*) 7851290001Sglebius func_stripname -l '' "$a_deplib" 7852290001Sglebius name=$func_stripname_result 7853181834Sroberto if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7854181834Sroberto case " $predeps $postdeps " in 7855181834Sroberto *" $a_deplib "*) 7856290001Sglebius func_append newdeplibs " $a_deplib" 7857181834Sroberto a_deplib="" 7858181834Sroberto ;; 7859181834Sroberto esac 7860181834Sroberto fi 7861181834Sroberto if test -n "$a_deplib" ; then 7862290001Sglebius libname=`eval "\\$ECHO \"$libname_spec\""` 7863181834Sroberto for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7864181834Sroberto potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 7865181834Sroberto for potent_lib in $potential_libs; do 7866181834Sroberto potlib="$potent_lib" # see symlink-check above in file_magic test 7867290001Sglebius if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 7868290001Sglebius $EGREP "$match_pattern_regex" > /dev/null; then 7869290001Sglebius func_append newdeplibs " $a_deplib" 7870181834Sroberto a_deplib="" 7871181834Sroberto break 2 7872181834Sroberto fi 7873181834Sroberto done 7874181834Sroberto done 7875181834Sroberto fi 7876181834Sroberto if test -n "$a_deplib" ; then 7877181834Sroberto droppeddeps=yes 7878290001Sglebius echo 7879290001Sglebius $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7880290001Sglebius echo "*** I have the capability to make that library automatically link in when" 7881290001Sglebius echo "*** you link to this library. But I can only do this if you have a" 7882290001Sglebius echo "*** shared version of the library, which you do not appear to have" 7883290001Sglebius echo "*** because I did check the linker path looking for a file starting" 7884181834Sroberto if test -z "$potlib" ; then 7885290001Sglebius $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 7886181834Sroberto else 7887290001Sglebius $ECHO "*** with $libname and none of the candidates passed a file format test" 7888290001Sglebius $ECHO "*** using a regex pattern. Last file checked: $potlib" 7889181834Sroberto fi 7890181834Sroberto fi 7891290001Sglebius ;; 7892290001Sglebius *) 7893181834Sroberto # Add a -L argument. 7894290001Sglebius func_append newdeplibs " $a_deplib" 7895290001Sglebius ;; 7896290001Sglebius esac 7897181834Sroberto done # Gone through all deplibs. 7898181834Sroberto ;; 7899181834Sroberto none | unknown | *) 7900181834Sroberto newdeplibs="" 7901290001Sglebius tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 7902181834Sroberto if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7903181834Sroberto for i in $predeps $postdeps ; do 7904181834Sroberto # can't use Xsed below, because $i might contain '/' 7905290001Sglebius tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 7906181834Sroberto done 7907181834Sroberto fi 7908290001Sglebius case $tmp_deplibs in 7909290001Sglebius *[!\ \ ]*) 7910290001Sglebius echo 7911181834Sroberto if test "X$deplibs_check_method" = "Xnone"; then 7912290001Sglebius echo "*** Warning: inter-library dependencies are not supported in this platform." 7913181834Sroberto else 7914290001Sglebius echo "*** Warning: inter-library dependencies are not known to be supported." 7915181834Sroberto fi 7916290001Sglebius echo "*** All declared inter-library dependencies are being dropped." 7917181834Sroberto droppeddeps=yes 7918290001Sglebius ;; 7919290001Sglebius esac 7920181834Sroberto ;; 7921181834Sroberto esac 7922181834Sroberto versuffix=$versuffix_save 7923181834Sroberto major=$major_save 7924181834Sroberto release=$release_save 7925181834Sroberto libname=$libname_save 7926181834Sroberto name=$name_save 7927181834Sroberto 7928181834Sroberto case $host in 7929181834Sroberto *-*-rhapsody* | *-*-darwin1.[012]) 7930290001Sglebius # On Rhapsody replace the C library with the System framework 7931290001Sglebius newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 7932181834Sroberto ;; 7933181834Sroberto esac 7934181834Sroberto 7935181834Sroberto if test "$droppeddeps" = yes; then 7936181834Sroberto if test "$module" = yes; then 7937290001Sglebius echo 7938290001Sglebius echo "*** Warning: libtool could not satisfy all declared inter-library" 7939290001Sglebius $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 7940290001Sglebius echo "*** a static module, that should work as long as the dlopening" 7941290001Sglebius echo "*** application is linked with the -dlopen flag." 7942181834Sroberto if test -z "$global_symbol_pipe"; then 7943290001Sglebius echo 7944290001Sglebius echo "*** However, this would only work if libtool was able to extract symbol" 7945290001Sglebius echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 7946290001Sglebius echo "*** not find such a program. So, this module is probably useless." 7947290001Sglebius echo "*** \`nm' from GNU binutils and a full rebuild may help." 7948181834Sroberto fi 7949181834Sroberto if test "$build_old_libs" = no; then 7950181834Sroberto oldlibs="$output_objdir/$libname.$libext" 7951181834Sroberto build_libtool_libs=module 7952181834Sroberto build_old_libs=yes 7953181834Sroberto else 7954181834Sroberto build_libtool_libs=no 7955181834Sroberto fi 7956181834Sroberto else 7957290001Sglebius echo "*** The inter-library dependencies that have been dropped here will be" 7958290001Sglebius echo "*** automatically added whenever a program is linked with this library" 7959290001Sglebius echo "*** or is declared to -dlopen it." 7960181834Sroberto 7961181834Sroberto if test "$allow_undefined" = no; then 7962290001Sglebius echo 7963290001Sglebius echo "*** Since this library must not contain undefined symbols," 7964290001Sglebius echo "*** because either the platform does not support them or" 7965290001Sglebius echo "*** it was explicitly requested with -no-undefined," 7966290001Sglebius echo "*** libtool will only create a static version of it." 7967181834Sroberto if test "$build_old_libs" = no; then 7968181834Sroberto oldlibs="$output_objdir/$libname.$libext" 7969181834Sroberto build_libtool_libs=module 7970181834Sroberto build_old_libs=yes 7971181834Sroberto else 7972181834Sroberto build_libtool_libs=no 7973181834Sroberto fi 7974181834Sroberto fi 7975181834Sroberto fi 7976181834Sroberto fi 7977181834Sroberto # Done checking deplibs! 7978181834Sroberto deplibs=$newdeplibs 7979181834Sroberto fi 7980290001Sglebius # Time to change all our "foo.ltframework" stuff back to "-framework foo" 7981290001Sglebius case $host in 7982290001Sglebius *-*-darwin*) 7983290001Sglebius newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7984290001Sglebius new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7985290001Sglebius deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7986290001Sglebius ;; 7987290001Sglebius esac 7988181834Sroberto 7989181834Sroberto # move library search paths that coincide with paths to not yet 7990181834Sroberto # installed libraries to the beginning of the library search list 7991181834Sroberto new_libs= 7992181834Sroberto for path in $notinst_path; do 7993181834Sroberto case " $new_libs " in 7994181834Sroberto *" -L$path/$objdir "*) ;; 7995181834Sroberto *) 7996181834Sroberto case " $deplibs " in 7997181834Sroberto *" -L$path/$objdir "*) 7998290001Sglebius func_append new_libs " -L$path/$objdir" ;; 7999181834Sroberto esac 8000181834Sroberto ;; 8001181834Sroberto esac 8002181834Sroberto done 8003181834Sroberto for deplib in $deplibs; do 8004181834Sroberto case $deplib in 8005181834Sroberto -L*) 8006181834Sroberto case " $new_libs " in 8007181834Sroberto *" $deplib "*) ;; 8008290001Sglebius *) func_append new_libs " $deplib" ;; 8009181834Sroberto esac 8010181834Sroberto ;; 8011290001Sglebius *) func_append new_libs " $deplib" ;; 8012181834Sroberto esac 8013181834Sroberto done 8014181834Sroberto deplibs="$new_libs" 8015181834Sroberto 8016181834Sroberto # All the library-specific variables (install_libdir is set above). 8017181834Sroberto library_names= 8018181834Sroberto old_library= 8019181834Sroberto dlname= 8020181834Sroberto 8021181834Sroberto # Test again, we may have decided not to build it any more 8022181834Sroberto if test "$build_libtool_libs" = yes; then 8023181834Sroberto if test "$hardcode_into_libs" = yes; then 8024181834Sroberto # Hardcode the library paths 8025181834Sroberto hardcode_libdirs= 8026181834Sroberto dep_rpath= 8027181834Sroberto rpath="$finalize_rpath" 8028290001Sglebius test "$opt_mode" != relink && rpath="$compile_rpath$rpath" 8029181834Sroberto for libdir in $rpath; do 8030181834Sroberto if test -n "$hardcode_libdir_flag_spec"; then 8031181834Sroberto if test -n "$hardcode_libdir_separator"; then 8032290001Sglebius func_replace_sysroot "$libdir" 8033290001Sglebius libdir=$func_replace_sysroot_result 8034181834Sroberto if test -z "$hardcode_libdirs"; then 8035181834Sroberto hardcode_libdirs="$libdir" 8036181834Sroberto else 8037181834Sroberto # Just accumulate the unique libdirs. 8038181834Sroberto case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8039181834Sroberto *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8040181834Sroberto ;; 8041181834Sroberto *) 8042290001Sglebius func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8043181834Sroberto ;; 8044181834Sroberto esac 8045181834Sroberto fi 8046181834Sroberto else 8047181834Sroberto eval flag=\"$hardcode_libdir_flag_spec\" 8048290001Sglebius func_append dep_rpath " $flag" 8049181834Sroberto fi 8050181834Sroberto elif test -n "$runpath_var"; then 8051181834Sroberto case "$perm_rpath " in 8052181834Sroberto *" $libdir "*) ;; 8053290001Sglebius *) func_apped perm_rpath " $libdir" ;; 8054181834Sroberto esac 8055181834Sroberto fi 8056181834Sroberto done 8057181834Sroberto # Substitute the hardcoded libdirs into the rpath. 8058181834Sroberto if test -n "$hardcode_libdir_separator" && 8059181834Sroberto test -n "$hardcode_libdirs"; then 8060181834Sroberto libdir="$hardcode_libdirs" 8061181834Sroberto if test -n "$hardcode_libdir_flag_spec_ld"; then 8062181834Sroberto eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 8063181834Sroberto else 8064181834Sroberto eval dep_rpath=\"$hardcode_libdir_flag_spec\" 8065181834Sroberto fi 8066181834Sroberto fi 8067181834Sroberto if test -n "$runpath_var" && test -n "$perm_rpath"; then 8068181834Sroberto # We should set the runpath_var. 8069181834Sroberto rpath= 8070181834Sroberto for dir in $perm_rpath; do 8071290001Sglebius func_append rpath "$dir:" 8072181834Sroberto done 8073181834Sroberto eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 8074181834Sroberto fi 8075181834Sroberto test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 8076181834Sroberto fi 8077181834Sroberto 8078181834Sroberto shlibpath="$finalize_shlibpath" 8079290001Sglebius test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 8080181834Sroberto if test -n "$shlibpath"; then 8081181834Sroberto eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 8082181834Sroberto fi 8083181834Sroberto 8084181834Sroberto # Get the real and link names of the library. 8085181834Sroberto eval shared_ext=\"$shrext_cmds\" 8086181834Sroberto eval library_names=\"$library_names_spec\" 8087181834Sroberto set dummy $library_names 8088290001Sglebius shift 8089290001Sglebius realname="$1" 8090290001Sglebius shift 8091181834Sroberto 8092181834Sroberto if test -n "$soname_spec"; then 8093181834Sroberto eval soname=\"$soname_spec\" 8094181834Sroberto else 8095181834Sroberto soname="$realname" 8096181834Sroberto fi 8097181834Sroberto if test -z "$dlname"; then 8098181834Sroberto dlname=$soname 8099181834Sroberto fi 8100181834Sroberto 8101181834Sroberto lib="$output_objdir/$realname" 8102181834Sroberto linknames= 8103181834Sroberto for link 8104181834Sroberto do 8105290001Sglebius func_append linknames " $link" 8106181834Sroberto done 8107181834Sroberto 8108181834Sroberto # Use standard objects if they are pic 8109290001Sglebius test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 8110290001Sglebius test "X$libobjs" = "X " && libobjs= 8111181834Sroberto 8112290001Sglebius delfiles= 8113290001Sglebius if test -n "$export_symbols" && test -n "$include_expsyms"; then 8114290001Sglebius $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 8115290001Sglebius export_symbols="$output_objdir/$libname.uexp" 8116290001Sglebius func_append delfiles " $export_symbols" 8117290001Sglebius fi 8118290001Sglebius 8119290001Sglebius orig_export_symbols= 8120290001Sglebius case $host_os in 8121290001Sglebius cygwin* | mingw* | cegcc*) 8122290001Sglebius if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 8123290001Sglebius # exporting using user supplied symfile 8124290001Sglebius if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 8125290001Sglebius # and it's NOT already a .def file. Must figure out 8126290001Sglebius # which of the given symbols are data symbols and tag 8127290001Sglebius # them as such. So, trigger use of export_symbols_cmds. 8128290001Sglebius # export_symbols gets reassigned inside the "prepare 8129290001Sglebius # the list of exported symbols" if statement, so the 8130290001Sglebius # include_expsyms logic still works. 8131290001Sglebius orig_export_symbols="$export_symbols" 8132290001Sglebius export_symbols= 8133290001Sglebius always_export_symbols=yes 8134290001Sglebius fi 8135290001Sglebius fi 8136290001Sglebius ;; 8137290001Sglebius esac 8138290001Sglebius 8139181834Sroberto # Prepare the list of exported symbols 8140181834Sroberto if test -z "$export_symbols"; then 8141181834Sroberto if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 8142290001Sglebius func_verbose "generating symbol list for \`$libname.la'" 8143181834Sroberto export_symbols="$output_objdir/$libname.exp" 8144290001Sglebius $opt_dry_run || $RM $export_symbols 8145181834Sroberto cmds=$export_symbols_cmds 8146181834Sroberto save_ifs="$IFS"; IFS='~' 8147290001Sglebius for cmd1 in $cmds; do 8148181834Sroberto IFS="$save_ifs" 8149290001Sglebius # Take the normal branch if the nm_file_list_spec branch 8150290001Sglebius # doesn't work or if tool conversion is not needed. 8151290001Sglebius case $nm_file_list_spec~$to_tool_file_cmd in 8152290001Sglebius *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 8153290001Sglebius try_normal_branch=yes 8154290001Sglebius eval cmd=\"$cmd1\" 8155290001Sglebius func_len " $cmd" 8156290001Sglebius len=$func_len_result 8157290001Sglebius ;; 8158290001Sglebius *) 8159290001Sglebius try_normal_branch=no 8160290001Sglebius ;; 8161290001Sglebius esac 8162290001Sglebius if test "$try_normal_branch" = yes \ 8163290001Sglebius && { test "$len" -lt "$max_cmd_len" \ 8164290001Sglebius || test "$max_cmd_len" -le -1; } 8165290001Sglebius then 8166290001Sglebius func_show_eval "$cmd" 'exit $?' 8167290001Sglebius skipped_export=false 8168290001Sglebius elif test -n "$nm_file_list_spec"; then 8169290001Sglebius func_basename "$output" 8170290001Sglebius output_la=$func_basename_result 8171290001Sglebius save_libobjs=$libobjs 8172290001Sglebius save_output=$output 8173290001Sglebius output=${output_objdir}/${output_la}.nm 8174290001Sglebius func_to_tool_file "$output" 8175290001Sglebius libobjs=$nm_file_list_spec$func_to_tool_file_result 8176290001Sglebius func_append delfiles " $output" 8177290001Sglebius func_verbose "creating $NM input file list: $output" 8178290001Sglebius for obj in $save_libobjs; do 8179290001Sglebius func_to_tool_file "$obj" 8180290001Sglebius $ECHO "$func_to_tool_file_result" 8181290001Sglebius done > "$output" 8182290001Sglebius eval cmd=\"$cmd1\" 8183290001Sglebius func_show_eval "$cmd" 'exit $?' 8184290001Sglebius output=$save_output 8185290001Sglebius libobjs=$save_libobjs 8186290001Sglebius skipped_export=false 8187181834Sroberto else 8188290001Sglebius # The command line is too long to execute in one step. 8189290001Sglebius func_verbose "using reloadable object file for export list..." 8190290001Sglebius skipped_export=: 8191181834Sroberto # Break out early, otherwise skipped_export may be 8192181834Sroberto # set to false by a later but shorter cmd. 8193181834Sroberto break 8194181834Sroberto fi 8195181834Sroberto done 8196181834Sroberto IFS="$save_ifs" 8197290001Sglebius if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 8198290001Sglebius func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8199290001Sglebius func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8200181834Sroberto fi 8201181834Sroberto fi 8202181834Sroberto fi 8203181834Sroberto 8204181834Sroberto if test -n "$export_symbols" && test -n "$include_expsyms"; then 8205290001Sglebius tmp_export_symbols="$export_symbols" 8206290001Sglebius test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8207290001Sglebius $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8208181834Sroberto fi 8209181834Sroberto 8210290001Sglebius if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 8211290001Sglebius # The given exports_symbols file has to be filtered, so filter it. 8212290001Sglebius func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8213290001Sglebius # FIXME: $output_objdir/$libname.filter potentially contains lots of 8214290001Sglebius # 's' commands which not all seds can handle. GNU sed should be fine 8215290001Sglebius # though. Also, the filter scales superlinearly with the number of 8216290001Sglebius # global variables. join(1) would be nice here, but unfortunately 8217290001Sglebius # isn't a blessed tool. 8218290001Sglebius $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8219290001Sglebius func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8220290001Sglebius export_symbols=$output_objdir/$libname.def 8221290001Sglebius $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8222290001Sglebius fi 8223290001Sglebius 8224181834Sroberto tmp_deplibs= 8225181834Sroberto for test_deplib in $deplibs; do 8226290001Sglebius case " $convenience " in 8227290001Sglebius *" $test_deplib "*) ;; 8228290001Sglebius *) 8229290001Sglebius func_append tmp_deplibs " $test_deplib" 8230290001Sglebius ;; 8231290001Sglebius esac 8232181834Sroberto done 8233181834Sroberto deplibs="$tmp_deplibs" 8234181834Sroberto 8235181834Sroberto if test -n "$convenience"; then 8236290001Sglebius if test -n "$whole_archive_flag_spec" && 8237290001Sglebius test "$compiler_needs_object" = yes && 8238290001Sglebius test -z "$libobjs"; then 8239290001Sglebius # extract the archives, so we have objects to list. 8240290001Sglebius # TODO: could optimize this to just extract one archive. 8241290001Sglebius whole_archive_flag_spec= 8242290001Sglebius fi 8243181834Sroberto if test -n "$whole_archive_flag_spec"; then 8244181834Sroberto save_libobjs=$libobjs 8245181834Sroberto eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8246290001Sglebius test "X$libobjs" = "X " && libobjs= 8247181834Sroberto else 8248181834Sroberto gentop="$output_objdir/${outputname}x" 8249290001Sglebius func_append generated " $gentop" 8250181834Sroberto 8251181834Sroberto func_extract_archives $gentop $convenience 8252290001Sglebius func_append libobjs " $func_extract_archives_result" 8253290001Sglebius test "X$libobjs" = "X " && libobjs= 8254181834Sroberto fi 8255181834Sroberto fi 8256290001Sglebius 8257181834Sroberto if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 8258181834Sroberto eval flag=\"$thread_safe_flag_spec\" 8259290001Sglebius func_append linker_flags " $flag" 8260181834Sroberto fi 8261181834Sroberto 8262181834Sroberto # Make a backup of the uninstalled library when relinking 8263290001Sglebius if test "$opt_mode" = relink; then 8264290001Sglebius $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 8265181834Sroberto fi 8266181834Sroberto 8267181834Sroberto # Do each of the archive commands. 8268181834Sroberto if test "$module" = yes && test -n "$module_cmds" ; then 8269181834Sroberto if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8270181834Sroberto eval test_cmds=\"$module_expsym_cmds\" 8271181834Sroberto cmds=$module_expsym_cmds 8272181834Sroberto else 8273181834Sroberto eval test_cmds=\"$module_cmds\" 8274181834Sroberto cmds=$module_cmds 8275181834Sroberto fi 8276181834Sroberto else 8277290001Sglebius if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8278290001Sglebius eval test_cmds=\"$archive_expsym_cmds\" 8279290001Sglebius cmds=$archive_expsym_cmds 8280290001Sglebius else 8281290001Sglebius eval test_cmds=\"$archive_cmds\" 8282290001Sglebius cmds=$archive_cmds 8283181834Sroberto fi 8284181834Sroberto fi 8285181834Sroberto 8286181834Sroberto if test "X$skipped_export" != "X:" && 8287290001Sglebius func_len " $test_cmds" && 8288290001Sglebius len=$func_len_result && 8289290001Sglebius test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 8290181834Sroberto : 8291181834Sroberto else 8292290001Sglebius # The command line is too long to link in one step, link piecewise 8293290001Sglebius # or, if using GNU ld and skipped_export is not :, use a linker 8294290001Sglebius # script. 8295181834Sroberto 8296181834Sroberto # Save the value of $output and $libobjs because we want to 8297181834Sroberto # use them later. If we have whole_archive_flag_spec, we 8298181834Sroberto # want to use save_libobjs as it was before 8299181834Sroberto # whole_archive_flag_spec was expanded, because we can't 8300181834Sroberto # assume the linker understands whole_archive_flag_spec. 8301181834Sroberto # This may have to be revisited, in case too many 8302181834Sroberto # convenience libraries get linked in and end up exceeding 8303181834Sroberto # the spec. 8304181834Sroberto if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 8305181834Sroberto save_libobjs=$libobjs 8306181834Sroberto fi 8307181834Sroberto save_output=$output 8308290001Sglebius func_basename "$output" 8309290001Sglebius output_la=$func_basename_result 8310181834Sroberto 8311181834Sroberto # Clear the reloadable object creation command queue and 8312181834Sroberto # initialize k to one. 8313181834Sroberto test_cmds= 8314181834Sroberto concat_cmds= 8315181834Sroberto objlist= 8316181834Sroberto last_robj= 8317181834Sroberto k=1 8318290001Sglebius 8319290001Sglebius if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 8320290001Sglebius output=${output_objdir}/${output_la}.lnkscript 8321290001Sglebius func_verbose "creating GNU ld script: $output" 8322290001Sglebius echo 'INPUT (' > $output 8323290001Sglebius for obj in $save_libobjs 8324290001Sglebius do 8325290001Sglebius func_to_tool_file "$obj" 8326290001Sglebius $ECHO "$func_to_tool_file_result" >> $output 8327290001Sglebius done 8328290001Sglebius echo ')' >> $output 8329290001Sglebius func_append delfiles " $output" 8330290001Sglebius func_to_tool_file "$output" 8331290001Sglebius output=$func_to_tool_file_result 8332290001Sglebius elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 8333290001Sglebius output=${output_objdir}/${output_la}.lnk 8334290001Sglebius func_verbose "creating linker input file list: $output" 8335290001Sglebius : > $output 8336290001Sglebius set x $save_libobjs 8337290001Sglebius shift 8338290001Sglebius firstobj= 8339290001Sglebius if test "$compiler_needs_object" = yes; then 8340290001Sglebius firstobj="$1 " 8341290001Sglebius shift 8342290001Sglebius fi 8343290001Sglebius for obj 8344290001Sglebius do 8345290001Sglebius func_to_tool_file "$obj" 8346290001Sglebius $ECHO "$func_to_tool_file_result" >> $output 8347290001Sglebius done 8348290001Sglebius func_append delfiles " $output" 8349290001Sglebius func_to_tool_file "$output" 8350290001Sglebius output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 8351290001Sglebius else 8352290001Sglebius if test -n "$save_libobjs"; then 8353290001Sglebius func_verbose "creating reloadable object files..." 8354290001Sglebius output=$output_objdir/$output_la-${k}.$objext 8355290001Sglebius eval test_cmds=\"$reload_cmds\" 8356290001Sglebius func_len " $test_cmds" 8357290001Sglebius len0=$func_len_result 8358290001Sglebius len=$len0 8359290001Sglebius 8360290001Sglebius # Loop over the list of objects to be linked. 8361290001Sglebius for obj in $save_libobjs 8362290001Sglebius do 8363290001Sglebius func_len " $obj" 8364290001Sglebius func_arith $len + $func_len_result 8365290001Sglebius len=$func_arith_result 8366290001Sglebius if test "X$objlist" = X || 8367290001Sglebius test "$len" -lt "$max_cmd_len"; then 8368290001Sglebius func_append objlist " $obj" 8369290001Sglebius else 8370290001Sglebius # The command $test_cmds is almost too long, add a 8371290001Sglebius # command to the queue. 8372290001Sglebius if test "$k" -eq 1 ; then 8373290001Sglebius # The first file doesn't have a previous command to add. 8374290001Sglebius reload_objs=$objlist 8375290001Sglebius eval concat_cmds=\"$reload_cmds\" 8376290001Sglebius else 8377290001Sglebius # All subsequent reloadable object files will link in 8378290001Sglebius # the last one created. 8379290001Sglebius reload_objs="$objlist $last_robj" 8380290001Sglebius eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 8381290001Sglebius fi 8382290001Sglebius last_robj=$output_objdir/$output_la-${k}.$objext 8383290001Sglebius func_arith $k + 1 8384290001Sglebius k=$func_arith_result 8385290001Sglebius output=$output_objdir/$output_la-${k}.$objext 8386290001Sglebius objlist=" $obj" 8387290001Sglebius func_len " $last_robj" 8388290001Sglebius func_arith $len0 + $func_len_result 8389290001Sglebius len=$func_arith_result 8390290001Sglebius fi 8391290001Sglebius done 8392290001Sglebius # Handle the remaining objects by creating one last 8393290001Sglebius # reloadable object file. All subsequent reloadable object 8394290001Sglebius # files will link in the last one created. 8395290001Sglebius test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8396290001Sglebius reload_objs="$objlist $last_robj" 8397290001Sglebius eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 8398290001Sglebius if test -n "$last_robj"; then 8399290001Sglebius eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 8400290001Sglebius fi 8401290001Sglebius func_append delfiles " $output" 8402290001Sglebius 8403181834Sroberto else 8404290001Sglebius output= 8405290001Sglebius fi 8406290001Sglebius 8407290001Sglebius if ${skipped_export-false}; then 8408290001Sglebius func_verbose "generating symbol list for \`$libname.la'" 8409290001Sglebius export_symbols="$output_objdir/$libname.exp" 8410290001Sglebius $opt_dry_run || $RM $export_symbols 8411290001Sglebius libobjs=$output 8412290001Sglebius # Append the command to create the export file. 8413290001Sglebius test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8414290001Sglebius eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 8415290001Sglebius if test -n "$last_robj"; then 8416290001Sglebius eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 8417181834Sroberto fi 8418181834Sroberto fi 8419181834Sroberto 8420290001Sglebius test -n "$save_libobjs" && 8421290001Sglebius func_verbose "creating a temporary reloadable object file: $output" 8422181834Sroberto 8423290001Sglebius # Loop through the commands generated above and execute them. 8424290001Sglebius save_ifs="$IFS"; IFS='~' 8425290001Sglebius for cmd in $concat_cmds; do 8426290001Sglebius IFS="$save_ifs" 8427290001Sglebius $opt_silent || { 8428290001Sglebius func_quote_for_expand "$cmd" 8429290001Sglebius eval "func_echo $func_quote_for_expand_result" 8430290001Sglebius } 8431290001Sglebius $opt_dry_run || eval "$cmd" || { 8432290001Sglebius lt_exit=$? 8433181834Sroberto 8434290001Sglebius # Restore the uninstalled library and exit 8435290001Sglebius if test "$opt_mode" = relink; then 8436290001Sglebius ( cd "$output_objdir" && \ 8437290001Sglebius $RM "${realname}T" && \ 8438290001Sglebius $MV "${realname}U" "$realname" ) 8439290001Sglebius fi 8440181834Sroberto 8441290001Sglebius exit $lt_exit 8442290001Sglebius } 8443290001Sglebius done 8444181834Sroberto IFS="$save_ifs" 8445181834Sroberto 8446290001Sglebius if test -n "$export_symbols_regex" && ${skipped_export-false}; then 8447290001Sglebius func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8448290001Sglebius func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8449290001Sglebius fi 8450290001Sglebius fi 8451290001Sglebius 8452290001Sglebius if ${skipped_export-false}; then 8453290001Sglebius if test -n "$export_symbols" && test -n "$include_expsyms"; then 8454290001Sglebius tmp_export_symbols="$export_symbols" 8455290001Sglebius test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8456290001Sglebius $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8457290001Sglebius fi 8458290001Sglebius 8459290001Sglebius if test -n "$orig_export_symbols"; then 8460290001Sglebius # The given exports_symbols file has to be filtered, so filter it. 8461290001Sglebius func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8462290001Sglebius # FIXME: $output_objdir/$libname.filter potentially contains lots of 8463290001Sglebius # 's' commands which not all seds can handle. GNU sed should be fine 8464290001Sglebius # though. Also, the filter scales superlinearly with the number of 8465290001Sglebius # global variables. join(1) would be nice here, but unfortunately 8466290001Sglebius # isn't a blessed tool. 8467290001Sglebius $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8468290001Sglebius func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8469290001Sglebius export_symbols=$output_objdir/$libname.def 8470290001Sglebius $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8471290001Sglebius fi 8472290001Sglebius fi 8473290001Sglebius 8474181834Sroberto libobjs=$output 8475181834Sroberto # Restore the value of output. 8476181834Sroberto output=$save_output 8477181834Sroberto 8478181834Sroberto if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 8479181834Sroberto eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8480290001Sglebius test "X$libobjs" = "X " && libobjs= 8481181834Sroberto fi 8482181834Sroberto # Expand the library linking commands again to reset the 8483181834Sroberto # value of $libobjs for piecewise linking. 8484181834Sroberto 8485181834Sroberto # Do each of the archive commands. 8486181834Sroberto if test "$module" = yes && test -n "$module_cmds" ; then 8487181834Sroberto if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8488181834Sroberto cmds=$module_expsym_cmds 8489181834Sroberto else 8490181834Sroberto cmds=$module_cmds 8491181834Sroberto fi 8492181834Sroberto else 8493290001Sglebius if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8494290001Sglebius cmds=$archive_expsym_cmds 8495290001Sglebius else 8496290001Sglebius cmds=$archive_cmds 8497181834Sroberto fi 8498181834Sroberto fi 8499290001Sglebius fi 8500181834Sroberto 8501290001Sglebius if test -n "$delfiles"; then 8502290001Sglebius # Append the command to remove temporary files to $cmds. 8503290001Sglebius eval cmds=\"\$cmds~\$RM $delfiles\" 8504181834Sroberto fi 8505290001Sglebius 8506290001Sglebius # Add any objects from preloaded convenience libraries 8507290001Sglebius if test -n "$dlprefiles"; then 8508290001Sglebius gentop="$output_objdir/${outputname}x" 8509290001Sglebius func_append generated " $gentop" 8510290001Sglebius 8511290001Sglebius func_extract_archives $gentop $dlprefiles 8512290001Sglebius func_append libobjs " $func_extract_archives_result" 8513290001Sglebius test "X$libobjs" = "X " && libobjs= 8514290001Sglebius fi 8515290001Sglebius 8516181834Sroberto save_ifs="$IFS"; IFS='~' 8517181834Sroberto for cmd in $cmds; do 8518181834Sroberto IFS="$save_ifs" 8519181834Sroberto eval cmd=\"$cmd\" 8520290001Sglebius $opt_silent || { 8521290001Sglebius func_quote_for_expand "$cmd" 8522290001Sglebius eval "func_echo $func_quote_for_expand_result" 8523290001Sglebius } 8524290001Sglebius $opt_dry_run || eval "$cmd" || { 8525181834Sroberto lt_exit=$? 8526181834Sroberto 8527181834Sroberto # Restore the uninstalled library and exit 8528290001Sglebius if test "$opt_mode" = relink; then 8529290001Sglebius ( cd "$output_objdir" && \ 8530290001Sglebius $RM "${realname}T" && \ 8531290001Sglebius $MV "${realname}U" "$realname" ) 8532181834Sroberto fi 8533181834Sroberto 8534181834Sroberto exit $lt_exit 8535181834Sroberto } 8536181834Sroberto done 8537181834Sroberto IFS="$save_ifs" 8538181834Sroberto 8539181834Sroberto # Restore the uninstalled library and exit 8540290001Sglebius if test "$opt_mode" = relink; then 8541290001Sglebius $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 8542181834Sroberto 8543181834Sroberto if test -n "$convenience"; then 8544181834Sroberto if test -z "$whole_archive_flag_spec"; then 8545290001Sglebius func_show_eval '${RM}r "$gentop"' 8546181834Sroberto fi 8547181834Sroberto fi 8548181834Sroberto 8549181834Sroberto exit $EXIT_SUCCESS 8550181834Sroberto fi 8551181834Sroberto 8552181834Sroberto # Create links to the real library. 8553181834Sroberto for linkname in $linknames; do 8554181834Sroberto if test "$realname" != "$linkname"; then 8555290001Sglebius func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 8556181834Sroberto fi 8557181834Sroberto done 8558181834Sroberto 8559181834Sroberto # If -module or -export-dynamic was specified, set the dlname. 8560181834Sroberto if test "$module" = yes || test "$export_dynamic" = yes; then 8561181834Sroberto # On all known operating systems, these are identical. 8562181834Sroberto dlname="$soname" 8563181834Sroberto fi 8564181834Sroberto fi 8565181834Sroberto ;; 8566181834Sroberto 8567181834Sroberto obj) 8568181834Sroberto if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 8569290001Sglebius func_warning "\`-dlopen' is ignored for objects" 8570181834Sroberto fi 8571181834Sroberto 8572290001Sglebius case " $deplibs" in 8573290001Sglebius *\ -l* | *\ -L*) 8574290001Sglebius func_warning "\`-l' and \`-L' are ignored for objects" ;; 8575290001Sglebius esac 8576181834Sroberto 8577290001Sglebius test -n "$rpath" && \ 8578290001Sglebius func_warning "\`-rpath' is ignored for objects" 8579181834Sroberto 8580290001Sglebius test -n "$xrpath" && \ 8581290001Sglebius func_warning "\`-R' is ignored for objects" 8582181834Sroberto 8583290001Sglebius test -n "$vinfo" && \ 8584290001Sglebius func_warning "\`-version-info' is ignored for objects" 8585181834Sroberto 8586290001Sglebius test -n "$release" && \ 8587290001Sglebius func_warning "\`-release' is ignored for objects" 8588290001Sglebius 8589181834Sroberto case $output in 8590181834Sroberto *.lo) 8591290001Sglebius test -n "$objs$old_deplibs" && \ 8592290001Sglebius func_fatal_error "cannot build library object \`$output' from non-libtool objects" 8593290001Sglebius 8594290001Sglebius libobj=$output 8595290001Sglebius func_lo2o "$libobj" 8596290001Sglebius obj=$func_lo2o_result 8597181834Sroberto ;; 8598181834Sroberto *) 8599181834Sroberto libobj= 8600181834Sroberto obj="$output" 8601181834Sroberto ;; 8602181834Sroberto esac 8603181834Sroberto 8604181834Sroberto # Delete the old objects. 8605290001Sglebius $opt_dry_run || $RM $obj $libobj 8606181834Sroberto 8607181834Sroberto # Objects from convenience libraries. This assumes 8608181834Sroberto # single-version convenience libraries. Whenever we create 8609181834Sroberto # different ones for PIC/non-PIC, this we'll have to duplicate 8610181834Sroberto # the extraction. 8611181834Sroberto reload_conv_objs= 8612181834Sroberto gentop= 8613181834Sroberto # reload_cmds runs $LD directly, so let us get rid of 8614290001Sglebius # -Wl from whole_archive_flag_spec and hope we can get by with 8615290001Sglebius # turning comma into space.. 8616181834Sroberto wl= 8617181834Sroberto 8618181834Sroberto if test -n "$convenience"; then 8619181834Sroberto if test -n "$whole_archive_flag_spec"; then 8620290001Sglebius eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 8621290001Sglebius reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 8622181834Sroberto else 8623181834Sroberto gentop="$output_objdir/${obj}x" 8624290001Sglebius func_append generated " $gentop" 8625181834Sroberto 8626181834Sroberto func_extract_archives $gentop $convenience 8627181834Sroberto reload_conv_objs="$reload_objs $func_extract_archives_result" 8628181834Sroberto fi 8629181834Sroberto fi 8630181834Sroberto 8631290001Sglebius # If we're not building shared, we need to use non_pic_objs 8632290001Sglebius test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" 8633290001Sglebius 8634181834Sroberto # Create the old-style object. 8635290001Sglebius reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 8636181834Sroberto 8637181834Sroberto output="$obj" 8638290001Sglebius func_execute_cmds "$reload_cmds" 'exit $?' 8639181834Sroberto 8640181834Sroberto # Exit if we aren't doing a library object file. 8641181834Sroberto if test -z "$libobj"; then 8642181834Sroberto if test -n "$gentop"; then 8643290001Sglebius func_show_eval '${RM}r "$gentop"' 8644181834Sroberto fi 8645181834Sroberto 8646181834Sroberto exit $EXIT_SUCCESS 8647181834Sroberto fi 8648181834Sroberto 8649181834Sroberto if test "$build_libtool_libs" != yes; then 8650181834Sroberto if test -n "$gentop"; then 8651290001Sglebius func_show_eval '${RM}r "$gentop"' 8652181834Sroberto fi 8653181834Sroberto 8654181834Sroberto # Create an invalid libtool object if no PIC, so that we don't 8655181834Sroberto # accidentally link it into a program. 8656181834Sroberto # $show "echo timestamp > $libobj" 8657290001Sglebius # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 8658181834Sroberto exit $EXIT_SUCCESS 8659181834Sroberto fi 8660181834Sroberto 8661181834Sroberto if test -n "$pic_flag" || test "$pic_mode" != default; then 8662181834Sroberto # Only do commands if we really have different PIC objects. 8663181834Sroberto reload_objs="$libobjs $reload_conv_objs" 8664181834Sroberto output="$libobj" 8665290001Sglebius func_execute_cmds "$reload_cmds" 'exit $?' 8666181834Sroberto fi 8667181834Sroberto 8668181834Sroberto if test -n "$gentop"; then 8669290001Sglebius func_show_eval '${RM}r "$gentop"' 8670181834Sroberto fi 8671181834Sroberto 8672181834Sroberto exit $EXIT_SUCCESS 8673181834Sroberto ;; 8674181834Sroberto 8675181834Sroberto prog) 8676181834Sroberto case $host in 8677290001Sglebius *cygwin*) func_stripname '' '.exe' "$output" 8678290001Sglebius output=$func_stripname_result.exe;; 8679181834Sroberto esac 8680290001Sglebius test -n "$vinfo" && \ 8681290001Sglebius func_warning "\`-version-info' is ignored for programs" 8682181834Sroberto 8683290001Sglebius test -n "$release" && \ 8684290001Sglebius func_warning "\`-release' is ignored for programs" 8685181834Sroberto 8686290001Sglebius test "$preload" = yes \ 8687290001Sglebius && test "$dlopen_support" = unknown \ 8688290001Sglebius && test "$dlopen_self" = unknown \ 8689290001Sglebius && test "$dlopen_self_static" = unknown && \ 8690290001Sglebius func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 8691181834Sroberto 8692181834Sroberto case $host in 8693181834Sroberto *-*-rhapsody* | *-*-darwin1.[012]) 8694181834Sroberto # On Rhapsody replace the C library is the System framework 8695290001Sglebius compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 8696290001Sglebius finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 8697181834Sroberto ;; 8698181834Sroberto esac 8699181834Sroberto 8700181834Sroberto case $host in 8701290001Sglebius *-*-darwin*) 8702290001Sglebius # Don't allow lazy linking, it breaks C++ global constructors 8703290001Sglebius # But is supposedly fixed on 10.4 or later (yay!). 8704290001Sglebius if test "$tagname" = CXX ; then 8705290001Sglebius case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 8706290001Sglebius 10.[0123]) 8707290001Sglebius func_append compile_command " ${wl}-bind_at_load" 8708290001Sglebius func_append finalize_command " ${wl}-bind_at_load" 8709290001Sglebius ;; 8710290001Sglebius esac 8711290001Sglebius fi 8712290001Sglebius # Time to change all our "foo.ltframework" stuff back to "-framework foo" 8713290001Sglebius compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8714290001Sglebius finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8715290001Sglebius ;; 8716181834Sroberto esac 8717181834Sroberto 8718181834Sroberto 8719181834Sroberto # move library search paths that coincide with paths to not yet 8720181834Sroberto # installed libraries to the beginning of the library search list 8721181834Sroberto new_libs= 8722181834Sroberto for path in $notinst_path; do 8723181834Sroberto case " $new_libs " in 8724181834Sroberto *" -L$path/$objdir "*) ;; 8725181834Sroberto *) 8726181834Sroberto case " $compile_deplibs " in 8727181834Sroberto *" -L$path/$objdir "*) 8728290001Sglebius func_append new_libs " -L$path/$objdir" ;; 8729181834Sroberto esac 8730181834Sroberto ;; 8731181834Sroberto esac 8732181834Sroberto done 8733181834Sroberto for deplib in $compile_deplibs; do 8734181834Sroberto case $deplib in 8735181834Sroberto -L*) 8736181834Sroberto case " $new_libs " in 8737181834Sroberto *" $deplib "*) ;; 8738290001Sglebius *) func_append new_libs " $deplib" ;; 8739181834Sroberto esac 8740181834Sroberto ;; 8741290001Sglebius *) func_append new_libs " $deplib" ;; 8742181834Sroberto esac 8743181834Sroberto done 8744181834Sroberto compile_deplibs="$new_libs" 8745181834Sroberto 8746181834Sroberto 8747290001Sglebius func_append compile_command " $compile_deplibs" 8748290001Sglebius func_append finalize_command " $finalize_deplibs" 8749181834Sroberto 8750181834Sroberto if test -n "$rpath$xrpath"; then 8751181834Sroberto # If the user specified any rpath flags, then add them. 8752181834Sroberto for libdir in $rpath $xrpath; do 8753181834Sroberto # This is the magic to use -rpath. 8754181834Sroberto case "$finalize_rpath " in 8755181834Sroberto *" $libdir "*) ;; 8756290001Sglebius *) func_append finalize_rpath " $libdir" ;; 8757181834Sroberto esac 8758181834Sroberto done 8759181834Sroberto fi 8760181834Sroberto 8761181834Sroberto # Now hardcode the library paths 8762181834Sroberto rpath= 8763181834Sroberto hardcode_libdirs= 8764181834Sroberto for libdir in $compile_rpath $finalize_rpath; do 8765181834Sroberto if test -n "$hardcode_libdir_flag_spec"; then 8766181834Sroberto if test -n "$hardcode_libdir_separator"; then 8767181834Sroberto if test -z "$hardcode_libdirs"; then 8768181834Sroberto hardcode_libdirs="$libdir" 8769181834Sroberto else 8770181834Sroberto # Just accumulate the unique libdirs. 8771181834Sroberto case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8772181834Sroberto *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8773181834Sroberto ;; 8774181834Sroberto *) 8775290001Sglebius func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8776181834Sroberto ;; 8777181834Sroberto esac 8778181834Sroberto fi 8779181834Sroberto else 8780181834Sroberto eval flag=\"$hardcode_libdir_flag_spec\" 8781290001Sglebius func_append rpath " $flag" 8782181834Sroberto fi 8783181834Sroberto elif test -n "$runpath_var"; then 8784181834Sroberto case "$perm_rpath " in 8785181834Sroberto *" $libdir "*) ;; 8786290001Sglebius *) func_append perm_rpath " $libdir" ;; 8787181834Sroberto esac 8788181834Sroberto fi 8789181834Sroberto case $host in 8790290001Sglebius *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 8791290001Sglebius testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 8792181834Sroberto case :$dllsearchpath: in 8793181834Sroberto *":$libdir:"*) ;; 8794290001Sglebius ::) dllsearchpath=$libdir;; 8795290001Sglebius *) func_append dllsearchpath ":$libdir";; 8796181834Sroberto esac 8797181834Sroberto case :$dllsearchpath: in 8798181834Sroberto *":$testbindir:"*) ;; 8799290001Sglebius ::) dllsearchpath=$testbindir;; 8800290001Sglebius *) func_append dllsearchpath ":$testbindir";; 8801181834Sroberto esac 8802181834Sroberto ;; 8803181834Sroberto esac 8804181834Sroberto done 8805181834Sroberto # Substitute the hardcoded libdirs into the rpath. 8806181834Sroberto if test -n "$hardcode_libdir_separator" && 8807181834Sroberto test -n "$hardcode_libdirs"; then 8808181834Sroberto libdir="$hardcode_libdirs" 8809181834Sroberto eval rpath=\" $hardcode_libdir_flag_spec\" 8810181834Sroberto fi 8811181834Sroberto compile_rpath="$rpath" 8812181834Sroberto 8813181834Sroberto rpath= 8814181834Sroberto hardcode_libdirs= 8815181834Sroberto for libdir in $finalize_rpath; do 8816181834Sroberto if test -n "$hardcode_libdir_flag_spec"; then 8817181834Sroberto if test -n "$hardcode_libdir_separator"; then 8818181834Sroberto if test -z "$hardcode_libdirs"; then 8819181834Sroberto hardcode_libdirs="$libdir" 8820181834Sroberto else 8821181834Sroberto # Just accumulate the unique libdirs. 8822181834Sroberto case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8823181834Sroberto *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8824181834Sroberto ;; 8825181834Sroberto *) 8826290001Sglebius func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8827181834Sroberto ;; 8828181834Sroberto esac 8829181834Sroberto fi 8830181834Sroberto else 8831181834Sroberto eval flag=\"$hardcode_libdir_flag_spec\" 8832290001Sglebius func_append rpath " $flag" 8833181834Sroberto fi 8834181834Sroberto elif test -n "$runpath_var"; then 8835181834Sroberto case "$finalize_perm_rpath " in 8836181834Sroberto *" $libdir "*) ;; 8837290001Sglebius *) func_append finalize_perm_rpath " $libdir" ;; 8838181834Sroberto esac 8839181834Sroberto fi 8840181834Sroberto done 8841181834Sroberto # Substitute the hardcoded libdirs into the rpath. 8842181834Sroberto if test -n "$hardcode_libdir_separator" && 8843181834Sroberto test -n "$hardcode_libdirs"; then 8844181834Sroberto libdir="$hardcode_libdirs" 8845181834Sroberto eval rpath=\" $hardcode_libdir_flag_spec\" 8846181834Sroberto fi 8847181834Sroberto finalize_rpath="$rpath" 8848181834Sroberto 8849181834Sroberto if test -n "$libobjs" && test "$build_old_libs" = yes; then 8850181834Sroberto # Transform all the library objects into standard objects. 8851290001Sglebius compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8852290001Sglebius finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8853181834Sroberto fi 8854181834Sroberto 8855290001Sglebius func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8856181834Sroberto 8857290001Sglebius # template prelinking step 8858290001Sglebius if test -n "$prelink_cmds"; then 8859290001Sglebius func_execute_cmds "$prelink_cmds" 'exit $?' 8860181834Sroberto fi 8861181834Sroberto 8862290001Sglebius wrappers_required=yes 8863290001Sglebius case $host in 8864290001Sglebius *cegcc* | *mingw32ce*) 8865290001Sglebius # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 8866290001Sglebius wrappers_required=no 8867290001Sglebius ;; 8868290001Sglebius *cygwin* | *mingw* ) 8869290001Sglebius if test "$build_libtool_libs" != yes; then 8870290001Sglebius wrappers_required=no 8871290001Sglebius fi 8872290001Sglebius ;; 8873290001Sglebius *) 8874290001Sglebius if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 8875290001Sglebius wrappers_required=no 8876290001Sglebius fi 8877290001Sglebius ;; 8878290001Sglebius esac 8879290001Sglebius if test "$wrappers_required" = no; then 8880181834Sroberto # Replace the output file specification. 8881290001Sglebius compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8882181834Sroberto link_command="$compile_command$compile_rpath" 8883181834Sroberto 8884181834Sroberto # We have no uninstalled library dependencies, so finalize right now. 8885290001Sglebius exit_status=0 8886290001Sglebius func_show_eval "$link_command" 'exit_status=$?' 8887181834Sroberto 8888290001Sglebius if test -n "$postlink_cmds"; then 8889290001Sglebius func_to_tool_file "$output" 8890290001Sglebius postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8891290001Sglebius func_execute_cmds "$postlink_cmds" 'exit $?' 8892290001Sglebius fi 8893290001Sglebius 8894181834Sroberto # Delete the generated files. 8895290001Sglebius if test -f "$output_objdir/${outputname}S.${objext}"; then 8896290001Sglebius func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8897181834Sroberto fi 8898181834Sroberto 8899181834Sroberto exit $exit_status 8900181834Sroberto fi 8901181834Sroberto 8902181834Sroberto if test -n "$compile_shlibpath$finalize_shlibpath"; then 8903181834Sroberto compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 8904181834Sroberto fi 8905181834Sroberto if test -n "$finalize_shlibpath"; then 8906181834Sroberto finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 8907181834Sroberto fi 8908181834Sroberto 8909181834Sroberto compile_var= 8910181834Sroberto finalize_var= 8911181834Sroberto if test -n "$runpath_var"; then 8912181834Sroberto if test -n "$perm_rpath"; then 8913181834Sroberto # We should set the runpath_var. 8914181834Sroberto rpath= 8915181834Sroberto for dir in $perm_rpath; do 8916290001Sglebius func_append rpath "$dir:" 8917181834Sroberto done 8918181834Sroberto compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8919181834Sroberto fi 8920181834Sroberto if test -n "$finalize_perm_rpath"; then 8921181834Sroberto # We should set the runpath_var. 8922181834Sroberto rpath= 8923181834Sroberto for dir in $finalize_perm_rpath; do 8924290001Sglebius func_append rpath "$dir:" 8925181834Sroberto done 8926181834Sroberto finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8927181834Sroberto fi 8928181834Sroberto fi 8929181834Sroberto 8930181834Sroberto if test "$no_install" = yes; then 8931181834Sroberto # We don't need to create a wrapper script. 8932181834Sroberto link_command="$compile_var$compile_command$compile_rpath" 8933181834Sroberto # Replace the output file specification. 8934290001Sglebius link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8935181834Sroberto # Delete the old output file. 8936290001Sglebius $opt_dry_run || $RM $output 8937181834Sroberto # Link the executable and exit 8938290001Sglebius func_show_eval "$link_command" 'exit $?' 8939290001Sglebius 8940290001Sglebius if test -n "$postlink_cmds"; then 8941290001Sglebius func_to_tool_file "$output" 8942290001Sglebius postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8943290001Sglebius func_execute_cmds "$postlink_cmds" 'exit $?' 8944290001Sglebius fi 8945290001Sglebius 8946181834Sroberto exit $EXIT_SUCCESS 8947181834Sroberto fi 8948181834Sroberto 8949181834Sroberto if test "$hardcode_action" = relink; then 8950181834Sroberto # Fast installation is not supported 8951181834Sroberto link_command="$compile_var$compile_command$compile_rpath" 8952181834Sroberto relink_command="$finalize_var$finalize_command$finalize_rpath" 8953181834Sroberto 8954290001Sglebius func_warning "this platform does not like uninstalled shared libraries" 8955290001Sglebius func_warning "\`$output' will be relinked during installation" 8956181834Sroberto else 8957181834Sroberto if test "$fast_install" != no; then 8958181834Sroberto link_command="$finalize_var$compile_command$finalize_rpath" 8959181834Sroberto if test "$fast_install" = yes; then 8960290001Sglebius relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 8961181834Sroberto else 8962181834Sroberto # fast_install is set to needless 8963181834Sroberto relink_command= 8964181834Sroberto fi 8965181834Sroberto else 8966181834Sroberto link_command="$compile_var$compile_command$compile_rpath" 8967181834Sroberto relink_command="$finalize_var$finalize_command$finalize_rpath" 8968181834Sroberto fi 8969181834Sroberto fi 8970181834Sroberto 8971181834Sroberto # Replace the output file specification. 8972290001Sglebius link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8973181834Sroberto 8974181834Sroberto # Delete the old output files. 8975290001Sglebius $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8976181834Sroberto 8977290001Sglebius func_show_eval "$link_command" 'exit $?' 8978181834Sroberto 8979290001Sglebius if test -n "$postlink_cmds"; then 8980290001Sglebius func_to_tool_file "$output_objdir/$outputname" 8981290001Sglebius 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'` 8982290001Sglebius func_execute_cmds "$postlink_cmds" 'exit $?' 8983290001Sglebius fi 8984290001Sglebius 8985181834Sroberto # Now create the wrapper script. 8986290001Sglebius func_verbose "creating $output" 8987181834Sroberto 8988181834Sroberto # Quote the relink command for shipping. 8989181834Sroberto if test -n "$relink_command"; then 8990181834Sroberto # Preserve any variables that may affect compiler behavior 8991181834Sroberto for var in $variables_saved_for_relink; do 8992181834Sroberto if eval test -z \"\${$var+set}\"; then 8993290001Sglebius relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 8994181834Sroberto elif eval var_value=\$$var; test -z "$var_value"; then 8995181834Sroberto relink_command="$var=; export $var; $relink_command" 8996181834Sroberto else 8997290001Sglebius func_quote_for_eval "$var_value" 8998290001Sglebius relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8999181834Sroberto fi 9000181834Sroberto done 9001181834Sroberto relink_command="(cd `pwd`; $relink_command)" 9002290001Sglebius relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9003181834Sroberto fi 9004181834Sroberto 9005290001Sglebius # Only actually do things if not in dry run mode. 9006290001Sglebius $opt_dry_run || { 9007181834Sroberto # win32 will think the script is a binary if it has 9008181834Sroberto # a .exe suffix, so we strip it off here. 9009181834Sroberto case $output in 9010290001Sglebius *.exe) func_stripname '' '.exe' "$output" 9011290001Sglebius output=$func_stripname_result ;; 9012181834Sroberto esac 9013181834Sroberto # test for cygwin because mv fails w/o .exe extensions 9014181834Sroberto case $host in 9015181834Sroberto *cygwin*) 9016181834Sroberto exeext=.exe 9017290001Sglebius func_stripname '' '.exe' "$outputname" 9018290001Sglebius outputname=$func_stripname_result ;; 9019181834Sroberto *) exeext= ;; 9020181834Sroberto esac 9021181834Sroberto case $host in 9022181834Sroberto *cygwin* | *mingw* ) 9023290001Sglebius func_dirname_and_basename "$output" "" "." 9024290001Sglebius output_name=$func_basename_result 9025290001Sglebius output_path=$func_dirname_result 9026290001Sglebius cwrappersource="$output_path/$objdir/lt-$output_name.c" 9027290001Sglebius cwrapper="$output_path/$output_name.exe" 9028290001Sglebius $RM $cwrappersource $cwrapper 9029290001Sglebius trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 9030181834Sroberto 9031290001Sglebius func_emit_cwrapperexe_src > $cwrappersource 9032181834Sroberto 9033290001Sglebius # The wrapper executable is built using the $host compiler, 9034290001Sglebius # because it contains $host paths and files. If cross- 9035290001Sglebius # compiling, it, like the target executable, must be 9036290001Sglebius # executed on the $host or under an emulation environment. 9037290001Sglebius $opt_dry_run || { 9038290001Sglebius $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 9039290001Sglebius $STRIP $cwrapper 9040290001Sglebius } 9041181834Sroberto 9042290001Sglebius # Now, create the wrapper script for func_source use: 9043290001Sglebius func_ltwrapper_scriptname $cwrapper 9044290001Sglebius $RM $func_ltwrapper_scriptname_result 9045290001Sglebius trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 9046290001Sglebius $opt_dry_run || { 9047290001Sglebius # note: this script will not be executed, so do not chmod. 9048290001Sglebius if test "x$build" = "x$host" ; then 9049290001Sglebius $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 9050290001Sglebius else 9051290001Sglebius func_emit_wrapper no > $func_ltwrapper_scriptname_result 9052290001Sglebius fi 9053290001Sglebius } 9054181834Sroberto ;; 9055290001Sglebius * ) 9056290001Sglebius $RM $output 9057290001Sglebius trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 9058181834Sroberto 9059290001Sglebius func_emit_wrapper no > $output 9060290001Sglebius chmod +x $output 9061181834Sroberto ;; 9062181834Sroberto esac 9063290001Sglebius } 9064181834Sroberto exit $EXIT_SUCCESS 9065181834Sroberto ;; 9066181834Sroberto esac 9067181834Sroberto 9068181834Sroberto # See if we need to build an old-fashioned archive. 9069181834Sroberto for oldlib in $oldlibs; do 9070181834Sroberto 9071181834Sroberto if test "$build_libtool_libs" = convenience; then 9072290001Sglebius oldobjs="$libobjs_save $symfileobj" 9073181834Sroberto addlibs="$convenience" 9074181834Sroberto build_libtool_libs=no 9075181834Sroberto else 9076181834Sroberto if test "$build_libtool_libs" = module; then 9077181834Sroberto oldobjs="$libobjs_save" 9078181834Sroberto build_libtool_libs=no 9079181834Sroberto else 9080181834Sroberto oldobjs="$old_deplibs $non_pic_objects" 9081290001Sglebius if test "$preload" = yes && test -f "$symfileobj"; then 9082290001Sglebius func_append oldobjs " $symfileobj" 9083290001Sglebius fi 9084181834Sroberto fi 9085181834Sroberto addlibs="$old_convenience" 9086181834Sroberto fi 9087181834Sroberto 9088181834Sroberto if test -n "$addlibs"; then 9089181834Sroberto gentop="$output_objdir/${outputname}x" 9090290001Sglebius func_append generated " $gentop" 9091181834Sroberto 9092181834Sroberto func_extract_archives $gentop $addlibs 9093290001Sglebius func_append oldobjs " $func_extract_archives_result" 9094181834Sroberto fi 9095181834Sroberto 9096181834Sroberto # Do each command in the archive commands. 9097181834Sroberto if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 9098290001Sglebius cmds=$old_archive_from_new_cmds 9099181834Sroberto else 9100290001Sglebius 9101290001Sglebius # Add any objects from preloaded convenience libraries 9102290001Sglebius if test -n "$dlprefiles"; then 9103290001Sglebius gentop="$output_objdir/${outputname}x" 9104290001Sglebius func_append generated " $gentop" 9105290001Sglebius 9106290001Sglebius func_extract_archives $gentop $dlprefiles 9107290001Sglebius func_append oldobjs " $func_extract_archives_result" 9108290001Sglebius fi 9109290001Sglebius 9110181834Sroberto # POSIX demands no paths to be encoded in archives. We have 9111181834Sroberto # to avoid creating archives with duplicate basenames if we 9112181834Sroberto # might have to extract them afterwards, e.g., when creating a 9113181834Sroberto # static archive out of a convenience library, or when linking 9114181834Sroberto # the entirety of a libtool archive into another (currently 9115181834Sroberto # not supported by libtool). 9116181834Sroberto if (for obj in $oldobjs 9117181834Sroberto do 9118290001Sglebius func_basename "$obj" 9119290001Sglebius $ECHO "$func_basename_result" 9120181834Sroberto done | sort | sort -uc >/dev/null 2>&1); then 9121181834Sroberto : 9122181834Sroberto else 9123290001Sglebius echo "copying selected object files to avoid basename conflicts..." 9124290001Sglebius gentop="$output_objdir/${outputname}x" 9125290001Sglebius func_append generated " $gentop" 9126290001Sglebius func_mkdir_p "$gentop" 9127181834Sroberto save_oldobjs=$oldobjs 9128181834Sroberto oldobjs= 9129181834Sroberto counter=1 9130181834Sroberto for obj in $save_oldobjs 9131181834Sroberto do 9132290001Sglebius func_basename "$obj" 9133290001Sglebius objbase="$func_basename_result" 9134181834Sroberto case " $oldobjs " in 9135181834Sroberto " ") oldobjs=$obj ;; 9136181834Sroberto *[\ /]"$objbase "*) 9137181834Sroberto while :; do 9138181834Sroberto # Make sure we don't pick an alternate name that also 9139181834Sroberto # overlaps. 9140181834Sroberto newobj=lt$counter-$objbase 9141290001Sglebius func_arith $counter + 1 9142290001Sglebius counter=$func_arith_result 9143181834Sroberto case " $oldobjs " in 9144181834Sroberto *[\ /]"$newobj "*) ;; 9145181834Sroberto *) if test ! -f "$gentop/$newobj"; then break; fi ;; 9146181834Sroberto esac 9147181834Sroberto done 9148290001Sglebius func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 9149290001Sglebius func_append oldobjs " $gentop/$newobj" 9150181834Sroberto ;; 9151290001Sglebius *) func_append oldobjs " $obj" ;; 9152181834Sroberto esac 9153181834Sroberto done 9154181834Sroberto fi 9155181834Sroberto eval cmds=\"$old_archive_cmds\" 9156181834Sroberto 9157290001Sglebius func_len " $cmds" 9158290001Sglebius len=$func_len_result 9159290001Sglebius if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 9160181834Sroberto cmds=$old_archive_cmds 9161290001Sglebius elif test -n "$archiver_list_spec"; then 9162290001Sglebius func_verbose "using command file archive linking..." 9163290001Sglebius for obj in $oldobjs 9164290001Sglebius do 9165290001Sglebius func_to_tool_file "$obj" 9166290001Sglebius $ECHO "$func_to_tool_file_result" 9167290001Sglebius done > $output_objdir/$libname.libcmd 9168290001Sglebius func_to_tool_file "$output_objdir/$libname.libcmd" 9169290001Sglebius oldobjs=" $archiver_list_spec$func_to_tool_file_result" 9170290001Sglebius cmds=$old_archive_cmds 9171181834Sroberto else 9172181834Sroberto # the command line is too long to link in one step, link in parts 9173290001Sglebius func_verbose "using piecewise archive linking..." 9174181834Sroberto save_RANLIB=$RANLIB 9175181834Sroberto RANLIB=: 9176181834Sroberto objlist= 9177181834Sroberto concat_cmds= 9178181834Sroberto save_oldobjs=$oldobjs 9179290001Sglebius oldobjs= 9180181834Sroberto # Is there a better way of finding the last object in the list? 9181181834Sroberto for obj in $save_oldobjs 9182181834Sroberto do 9183181834Sroberto last_oldobj=$obj 9184181834Sroberto done 9185290001Sglebius eval test_cmds=\"$old_archive_cmds\" 9186290001Sglebius func_len " $test_cmds" 9187290001Sglebius len0=$func_len_result 9188290001Sglebius len=$len0 9189181834Sroberto for obj in $save_oldobjs 9190181834Sroberto do 9191290001Sglebius func_len " $obj" 9192290001Sglebius func_arith $len + $func_len_result 9193290001Sglebius len=$func_arith_result 9194290001Sglebius func_append objlist " $obj" 9195290001Sglebius if test "$len" -lt "$max_cmd_len"; then 9196181834Sroberto : 9197181834Sroberto else 9198181834Sroberto # the above command should be used before it gets too long 9199181834Sroberto oldobjs=$objlist 9200181834Sroberto if test "$obj" = "$last_oldobj" ; then 9201290001Sglebius RANLIB=$save_RANLIB 9202181834Sroberto fi 9203181834Sroberto test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 9204181834Sroberto eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 9205181834Sroberto objlist= 9206290001Sglebius len=$len0 9207181834Sroberto fi 9208181834Sroberto done 9209181834Sroberto RANLIB=$save_RANLIB 9210181834Sroberto oldobjs=$objlist 9211181834Sroberto if test "X$oldobjs" = "X" ; then 9212181834Sroberto eval cmds=\"\$concat_cmds\" 9213181834Sroberto else 9214181834Sroberto eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 9215181834Sroberto fi 9216181834Sroberto fi 9217181834Sroberto fi 9218290001Sglebius func_execute_cmds "$cmds" 'exit $?' 9219181834Sroberto done 9220181834Sroberto 9221290001Sglebius test -n "$generated" && \ 9222290001Sglebius func_show_eval "${RM}r$generated" 9223181834Sroberto 9224181834Sroberto # Now create the libtool archive. 9225181834Sroberto case $output in 9226181834Sroberto *.la) 9227181834Sroberto old_library= 9228181834Sroberto test "$build_old_libs" = yes && old_library="$libname.$libext" 9229290001Sglebius func_verbose "creating $output" 9230181834Sroberto 9231181834Sroberto # Preserve any variables that may affect compiler behavior 9232181834Sroberto for var in $variables_saved_for_relink; do 9233181834Sroberto if eval test -z \"\${$var+set}\"; then 9234290001Sglebius relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9235181834Sroberto elif eval var_value=\$$var; test -z "$var_value"; then 9236181834Sroberto relink_command="$var=; export $var; $relink_command" 9237181834Sroberto else 9238290001Sglebius func_quote_for_eval "$var_value" 9239290001Sglebius relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9240181834Sroberto fi 9241181834Sroberto done 9242181834Sroberto # Quote the link command for shipping. 9243181834Sroberto relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 9244290001Sglebius relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9245181834Sroberto if test "$hardcode_automatic" = yes ; then 9246181834Sroberto relink_command= 9247181834Sroberto fi 9248181834Sroberto 9249181834Sroberto # Only create the output if not a dry run. 9250290001Sglebius $opt_dry_run || { 9251181834Sroberto for installed in no yes; do 9252181834Sroberto if test "$installed" = yes; then 9253181834Sroberto if test -z "$install_libdir"; then 9254181834Sroberto break 9255181834Sroberto fi 9256181834Sroberto output="$output_objdir/$outputname"i 9257181834Sroberto # Replace all uninstalled libtool libraries with the installed ones 9258181834Sroberto newdependency_libs= 9259181834Sroberto for deplib in $dependency_libs; do 9260181834Sroberto case $deplib in 9261181834Sroberto *.la) 9262290001Sglebius func_basename "$deplib" 9263290001Sglebius name="$func_basename_result" 9264181834Sroberto eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 9265290001Sglebius test -z "$libdir" && \ 9266290001Sglebius func_fatal_error "\`$deplib' is not a valid libtool archive" 9267290001Sglebius func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 9268181834Sroberto ;; 9269290001Sglebius -L*) 9270290001Sglebius func_stripname -L '' "$deplib" 9271290001Sglebius func_replace_sysroot "$func_stripname_result" 9272290001Sglebius func_append newdependency_libs " -L$func_replace_sysroot_result" 9273290001Sglebius ;; 9274290001Sglebius -R*) 9275290001Sglebius func_stripname -R '' "$deplib" 9276290001Sglebius func_replace_sysroot "$func_stripname_result" 9277290001Sglebius func_append newdependency_libs " -R$func_replace_sysroot_result" 9278290001Sglebius ;; 9279290001Sglebius *) func_append newdependency_libs " $deplib" ;; 9280181834Sroberto esac 9281181834Sroberto done 9282181834Sroberto dependency_libs="$newdependency_libs" 9283181834Sroberto newdlfiles= 9284290001Sglebius 9285181834Sroberto for lib in $dlfiles; do 9286290001Sglebius case $lib in 9287290001Sglebius *.la) 9288290001Sglebius func_basename "$lib" 9289290001Sglebius name="$func_basename_result" 9290290001Sglebius eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9291290001Sglebius test -z "$libdir" && \ 9292290001Sglebius func_fatal_error "\`$lib' is not a valid libtool archive" 9293290001Sglebius func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 9294290001Sglebius ;; 9295290001Sglebius *) func_append newdlfiles " $lib" ;; 9296290001Sglebius esac 9297181834Sroberto done 9298181834Sroberto dlfiles="$newdlfiles" 9299181834Sroberto newdlprefiles= 9300181834Sroberto for lib in $dlprefiles; do 9301290001Sglebius case $lib in 9302290001Sglebius *.la) 9303290001Sglebius # Only pass preopened files to the pseudo-archive (for 9304290001Sglebius # eventual linking with the app. that links it) if we 9305290001Sglebius # didn't already link the preopened objects directly into 9306290001Sglebius # the library: 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 newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 9313290001Sglebius ;; 9314290001Sglebius esac 9315181834Sroberto done 9316181834Sroberto dlprefiles="$newdlprefiles" 9317181834Sroberto else 9318181834Sroberto newdlfiles= 9319181834Sroberto for lib in $dlfiles; do 9320181834Sroberto case $lib in 9321181834Sroberto [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9322181834Sroberto *) abs=`pwd`"/$lib" ;; 9323181834Sroberto esac 9324290001Sglebius func_append newdlfiles " $abs" 9325181834Sroberto done 9326181834Sroberto dlfiles="$newdlfiles" 9327181834Sroberto newdlprefiles= 9328181834Sroberto for lib in $dlprefiles; do 9329181834Sroberto case $lib in 9330181834Sroberto [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9331181834Sroberto *) abs=`pwd`"/$lib" ;; 9332181834Sroberto esac 9333290001Sglebius func_append newdlprefiles " $abs" 9334181834Sroberto done 9335181834Sroberto dlprefiles="$newdlprefiles" 9336181834Sroberto fi 9337290001Sglebius $RM $output 9338181834Sroberto # place dlname in correct position for cygwin 9339290001Sglebius # In fact, it would be nice if we could use this code for all target 9340290001Sglebius # systems that can't hard-code library paths into their executables 9341290001Sglebius # and that have no shared library path variable independent of PATH, 9342290001Sglebius # but it turns out we can't easily determine that from inspecting 9343290001Sglebius # libtool variables, so we have to hard-code the OSs to which it 9344290001Sglebius # applies here; at the moment, that means platforms that use the PE 9345290001Sglebius # object format with DLL files. See the long comment at the top of 9346290001Sglebius # tests/bindir.at for full details. 9347181834Sroberto tdlname=$dlname 9348181834Sroberto case $host,$output,$installed,$module,$dlname in 9349290001Sglebius *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 9350290001Sglebius # If a -bindir argument was supplied, place the dll there. 9351290001Sglebius if test "x$bindir" != x ; 9352290001Sglebius then 9353290001Sglebius func_relative_path "$install_libdir" "$bindir" 9354290001Sglebius tdlname=$func_relative_path_result$dlname 9355290001Sglebius else 9356290001Sglebius # Otherwise fall back on heuristic. 9357290001Sglebius tdlname=../bin/$dlname 9358290001Sglebius fi 9359290001Sglebius ;; 9360181834Sroberto esac 9361290001Sglebius $ECHO > $output "\ 9362181834Sroberto# $outputname - a libtool library file 9363290001Sglebius# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 9364181834Sroberto# 9365181834Sroberto# Please DO NOT delete this file! 9366181834Sroberto# It is necessary for linking the library. 9367181834Sroberto 9368181834Sroberto# The name that we can dlopen(3). 9369181834Srobertodlname='$tdlname' 9370181834Sroberto 9371181834Sroberto# Names of this library. 9372181834Srobertolibrary_names='$library_names' 9373181834Sroberto 9374181834Sroberto# The name of the static archive. 9375181834Srobertoold_library='$old_library' 9376181834Sroberto 9377290001Sglebius# Linker flags that can not go in dependency_libs. 9378290001Sglebiusinherited_linker_flags='$new_inherited_linker_flags' 9379290001Sglebius 9380181834Sroberto# Libraries that this one depends upon. 9381181834Srobertodependency_libs='$dependency_libs' 9382181834Sroberto 9383290001Sglebius# Names of additional weak libraries provided by this library 9384290001Sglebiusweak_library_names='$weak_libs' 9385290001Sglebius 9386181834Sroberto# Version information for $libname. 9387181834Srobertocurrent=$current 9388181834Srobertoage=$age 9389181834Srobertorevision=$revision 9390181834Sroberto 9391181834Sroberto# Is this an already installed library? 9392181834Srobertoinstalled=$installed 9393181834Sroberto 9394181834Sroberto# Should we warn about portability when linking against -modules? 9395181834Srobertoshouldnotlink=$module 9396181834Sroberto 9397181834Sroberto# Files to dlopen/dlpreopen 9398181834Srobertodlopen='$dlfiles' 9399181834Srobertodlpreopen='$dlprefiles' 9400181834Sroberto 9401181834Sroberto# Directory that this library needs to be installed in: 9402181834Srobertolibdir='$install_libdir'" 9403181834Sroberto if test "$installed" = no && test "$need_relink" = yes; then 9404290001Sglebius $ECHO >> $output "\ 9405181834Srobertorelink_command=\"$relink_command\"" 9406181834Sroberto fi 9407181834Sroberto done 9408290001Sglebius } 9409181834Sroberto 9410181834Sroberto # Do a symbolic link so that the libtool archive can be found in 9411181834Sroberto # LD_LIBRARY_PATH before the program is installed. 9412290001Sglebius func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 9413181834Sroberto ;; 9414181834Sroberto esac 9415181834Sroberto exit $EXIT_SUCCESS 9416290001Sglebius} 9417181834Sroberto 9418290001Sglebius{ test "$opt_mode" = link || test "$opt_mode" = relink; } && 9419290001Sglebius func_mode_link ${1+"$@"} 9420181834Sroberto 9421181834Sroberto 9422290001Sglebius# func_mode_uninstall arg... 9423290001Sglebiusfunc_mode_uninstall () 9424290001Sglebius{ 9425290001Sglebius $opt_debug 9426290001Sglebius RM="$nonopt" 9427181834Sroberto files= 9428181834Sroberto rmforce= 9429181834Sroberto exit_status=0 9430181834Sroberto 9431181834Sroberto # This variable tells wrapper scripts just to set variables rather 9432181834Sroberto # than running their programs. 9433181834Sroberto libtool_install_magic="$magic" 9434181834Sroberto 9435181834Sroberto for arg 9436181834Sroberto do 9437181834Sroberto case $arg in 9438290001Sglebius -f) func_append RM " $arg"; rmforce=yes ;; 9439290001Sglebius -*) func_append RM " $arg" ;; 9440290001Sglebius *) func_append files " $arg" ;; 9441181834Sroberto esac 9442181834Sroberto done 9443181834Sroberto 9444290001Sglebius test -z "$RM" && \ 9445290001Sglebius func_fatal_help "you must specify an RM program" 9446181834Sroberto 9447181834Sroberto rmdirs= 9448181834Sroberto 9449181834Sroberto for file in $files; do 9450290001Sglebius func_dirname "$file" "" "." 9451290001Sglebius dir="$func_dirname_result" 9452290001Sglebius if test "X$dir" = X.; then 9453290001Sglebius odir="$objdir" 9454181834Sroberto else 9455290001Sglebius odir="$dir/$objdir" 9456181834Sroberto fi 9457290001Sglebius func_basename "$file" 9458290001Sglebius name="$func_basename_result" 9459290001Sglebius test "$opt_mode" = uninstall && odir="$dir" 9460181834Sroberto 9461290001Sglebius # Remember odir for removal later, being careful to avoid duplicates 9462290001Sglebius if test "$opt_mode" = clean; then 9463181834Sroberto case " $rmdirs " in 9464290001Sglebius *" $odir "*) ;; 9465290001Sglebius *) func_append rmdirs " $odir" ;; 9466181834Sroberto esac 9467181834Sroberto fi 9468181834Sroberto 9469181834Sroberto # Don't error if the file doesn't exist and rm -f was used. 9470290001Sglebius if { test -L "$file"; } >/dev/null 2>&1 || 9471290001Sglebius { test -h "$file"; } >/dev/null 2>&1 || 9472290001Sglebius test -f "$file"; then 9473181834Sroberto : 9474181834Sroberto elif test -d "$file"; then 9475181834Sroberto exit_status=1 9476181834Sroberto continue 9477181834Sroberto elif test "$rmforce" = yes; then 9478181834Sroberto continue 9479181834Sroberto fi 9480181834Sroberto 9481181834Sroberto rmfiles="$file" 9482181834Sroberto 9483181834Sroberto case $name in 9484181834Sroberto *.la) 9485181834Sroberto # Possibly a libtool archive, so verify it. 9486290001Sglebius if func_lalib_p "$file"; then 9487290001Sglebius func_source $dir/$name 9488181834Sroberto 9489181834Sroberto # Delete the libtool libraries and symlinks. 9490181834Sroberto for n in $library_names; do 9491290001Sglebius func_append rmfiles " $odir/$n" 9492181834Sroberto done 9493290001Sglebius test -n "$old_library" && func_append rmfiles " $odir/$old_library" 9494181834Sroberto 9495290001Sglebius case "$opt_mode" in 9496181834Sroberto clean) 9497290001Sglebius case " $library_names " in 9498181834Sroberto *" $dlname "*) ;; 9499290001Sglebius *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 9500181834Sroberto esac 9501290001Sglebius test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 9502181834Sroberto ;; 9503181834Sroberto uninstall) 9504181834Sroberto if test -n "$library_names"; then 9505181834Sroberto # Do each command in the postuninstall commands. 9506290001Sglebius func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9507181834Sroberto fi 9508181834Sroberto 9509181834Sroberto if test -n "$old_library"; then 9510181834Sroberto # Do each command in the old_postuninstall commands. 9511290001Sglebius func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9512181834Sroberto fi 9513181834Sroberto # FIXME: should reinstall the best remaining shared library. 9514181834Sroberto ;; 9515181834Sroberto esac 9516181834Sroberto fi 9517181834Sroberto ;; 9518181834Sroberto 9519181834Sroberto *.lo) 9520181834Sroberto # Possibly a libtool object, so verify it. 9521290001Sglebius if func_lalib_p "$file"; then 9522181834Sroberto 9523181834Sroberto # Read the .lo file 9524290001Sglebius func_source $dir/$name 9525181834Sroberto 9526181834Sroberto # Add PIC object to the list of files to remove. 9527290001Sglebius if test -n "$pic_object" && 9528290001Sglebius test "$pic_object" != none; then 9529290001Sglebius func_append rmfiles " $dir/$pic_object" 9530181834Sroberto fi 9531181834Sroberto 9532181834Sroberto # Add non-PIC object to the list of files to remove. 9533290001Sglebius if test -n "$non_pic_object" && 9534290001Sglebius test "$non_pic_object" != none; then 9535290001Sglebius func_append rmfiles " $dir/$non_pic_object" 9536181834Sroberto fi 9537181834Sroberto fi 9538181834Sroberto ;; 9539181834Sroberto 9540181834Sroberto *) 9541290001Sglebius if test "$opt_mode" = clean ; then 9542181834Sroberto noexename=$name 9543181834Sroberto case $file in 9544181834Sroberto *.exe) 9545290001Sglebius func_stripname '' '.exe' "$file" 9546290001Sglebius file=$func_stripname_result 9547290001Sglebius func_stripname '' '.exe' "$name" 9548290001Sglebius noexename=$func_stripname_result 9549181834Sroberto # $file with .exe has already been added to rmfiles, 9550181834Sroberto # add $file without .exe 9551290001Sglebius func_append rmfiles " $file" 9552181834Sroberto ;; 9553181834Sroberto esac 9554181834Sroberto # Do a test to see if this is a libtool program. 9555290001Sglebius if func_ltwrapper_p "$file"; then 9556290001Sglebius if func_ltwrapper_executable_p "$file"; then 9557290001Sglebius func_ltwrapper_scriptname "$file" 9558290001Sglebius relink_command= 9559290001Sglebius func_source $func_ltwrapper_scriptname_result 9560290001Sglebius func_append rmfiles " $func_ltwrapper_scriptname_result" 9561290001Sglebius else 9562290001Sglebius relink_command= 9563290001Sglebius func_source $dir/$noexename 9564290001Sglebius fi 9565181834Sroberto 9566181834Sroberto # note $name still contains .exe if it was in $file originally 9567181834Sroberto # as does the version of $file that was added into $rmfiles 9568290001Sglebius func_append rmfiles " $odir/$name $odir/${name}S.${objext}" 9569181834Sroberto if test "$fast_install" = yes && test -n "$relink_command"; then 9570290001Sglebius func_append rmfiles " $odir/lt-$name" 9571181834Sroberto fi 9572181834Sroberto if test "X$noexename" != "X$name" ; then 9573290001Sglebius func_append rmfiles " $odir/lt-${noexename}.c" 9574181834Sroberto fi 9575181834Sroberto fi 9576181834Sroberto fi 9577181834Sroberto ;; 9578181834Sroberto esac 9579290001Sglebius func_show_eval "$RM $rmfiles" 'exit_status=1' 9580181834Sroberto done 9581181834Sroberto 9582181834Sroberto # Try to remove the ${objdir}s in the directories where we deleted files 9583181834Sroberto for dir in $rmdirs; do 9584181834Sroberto if test -d "$dir"; then 9585290001Sglebius func_show_eval "rmdir $dir >/dev/null 2>&1" 9586181834Sroberto fi 9587181834Sroberto done 9588181834Sroberto 9589181834Sroberto exit $exit_status 9590290001Sglebius} 9591181834Sroberto 9592290001Sglebius{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && 9593290001Sglebius func_mode_uninstall ${1+"$@"} 9594181834Sroberto 9595290001Sglebiustest -z "$opt_mode" && { 9596290001Sglebius help="$generic_help" 9597290001Sglebius func_fatal_help "you must specify a MODE" 9598290001Sglebius} 9599181834Sroberto 9600290001Sglebiustest -z "$exec_cmd" && \ 9601290001Sglebius func_fatal_help "invalid operation mode \`$opt_mode'" 9602290001Sglebius 9603181834Srobertoif test -n "$exec_cmd"; then 9604290001Sglebius eval exec "$exec_cmd" 9605181834Sroberto exit $EXIT_FAILURE 9606181834Srobertofi 9607181834Sroberto 9608290001Sglebiusexit $exit_status 9609181834Sroberto 9610181834Sroberto 9611181834Sroberto# The TAGs below are defined such that we never get into a situation 9612181834Sroberto# in which we disable both kinds of libraries. Given conflicting 9613181834Sroberto# choices, we go for a static library, that is the most portable, 9614181834Sroberto# since we can't tell whether shared libraries were disabled because 9615181834Sroberto# the user asked for that or because the platform doesn't support 9616181834Sroberto# them. This is particularly important on AIX, because we don't 9617181834Sroberto# support having both static and shared libraries enabled at the same 9618181834Sroberto# time on that platform, so we default to a shared-only configuration. 9619181834Sroberto# If a disable-shared tag is given, we'll fallback to a static-only 9620181834Sroberto# configuration. But we'll never go from static-only to shared-only. 9621181834Sroberto 9622181834Sroberto# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 9623290001Sglebiusbuild_libtool_libs=no 9624290001Sglebiusbuild_old_libs=yes 9625181834Sroberto# ### END LIBTOOL TAG CONFIG: disable-shared 9626181834Sroberto 9627181834Sroberto# ### BEGIN LIBTOOL TAG CONFIG: disable-static 9628290001Sglebiusbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 9629181834Sroberto# ### END LIBTOOL TAG CONFIG: disable-static 9630181834Sroberto 9631181834Sroberto# Local Variables: 9632181834Sroberto# mode:shell-script 9633181834Sroberto# sh-indentation:2 9634181834Sroberto# End: 9635290001Sglebius# vi:sw=2 9636290001Sglebius 9637