11d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# libtool (GNU libtool) 2.4.2 31d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 41d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 51d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 61d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. 71d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This is free software; see the source for copying conditions. There is NO 81d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 91d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# GNU Libtool is free software; you can redistribute it and/or modify 111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# it under the terms of the GNU General Public License as published by 121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# the Free Software Foundation; either version 2 of the License, or 131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# (at your option) any later version. 141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# As a special exception to the GNU General Public License, 161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# if you distribute this file as part of a program or library that 171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# is built using GNU Libtool, you may include this file under the 181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# same distribution terms that you use for the rest of that program. 191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# GNU Libtool is distributed in the hope that it will be useful, but 211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# WITHOUT ANY WARRANTY; without even the implied warranty of 221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# General Public License for more details. 241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# You should have received a copy of the GNU General Public License 261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# along with GNU Libtool; see the file COPYING. If not, a copy 271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# can be downloaded from http://www.gnu.org/licenses/gpl.html, 281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# or obtained by writing to the Free Software Foundation, Inc., 291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Usage: $progname [OPTION]... [MODE-ARG]... 321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Provide generalized library-building support services. 341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --config show all configuration variables 361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --debug enable verbose shell tracing 371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# -n, --dry-run display commands without modifying any files 381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --features display basic configuration information and exit 391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --mode=MODE use operation mode MODE 401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --preserve-dup-deps don't remove duplicate dependency libraries 411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --quiet, --silent don't print informational messages 421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --no-quiet, --no-silent 431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# print informational messages (default) 441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --no-warn don't display warning messages 451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --tag=TAG use configuration variables from tag TAG 461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# -v, --verbose print more informational messages than default 471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --no-verbose don't print the extra informational messages 481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --version print version information 491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# -h, --help, --help-all print short, long, or detailed help message 501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# MODE must be one of the following: 521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# clean remove files from the build directory 541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# compile compile a source file into a libtool object 551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# execute automatically set library path, then run a program 561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# finish complete the installation of libtool libraries 571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# install install libraries or executables 581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# link create a library or an executable 591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# uninstall remove libraries from an installed directory 601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# MODE-ARGS vary depending on the MODE. When passed as first option, 621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# When reporting a bug, please describe a test case to reproduce it and 661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# include the following information: 671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# host-triplet: $host 691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# shell: $SHELL 701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# compiler: $LTCC 711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# compiler flags: $LTCFLAGS 721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# linker: $LD (gnu? $with_gnu_ld) 731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $progname: (GNU libtool) 2.4.2 741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# automake: $automake_version 751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# autoconf: $autoconf_version 761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Report bugs to <bug-libtool@gnu.org>. 781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# GNU libtool home page: <http://www.gnu.org/software/libtool/>. 791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# General help using GNU software: <http://www.gnu.org/gethelp/>. 801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 811d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichPROGRAM=libtool 821d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichPACKAGE=libtool 831d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichVERSION=2.4.2 841d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichTIMESTAMP="" 851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichpackage_revision=1.3337 861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Be Bourne compatible 881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich emulate sh 901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich NULLCMD=: 911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # is contrary to our usage. Disable this feature. 931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich alias -g '${1+"$@"}'='"$@"' 941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich setopt NO_GLOB_SUBST 951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichelse 961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfi 981d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichBIN_SH=xpg4; export BIN_SH # for Tru64 991d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichDUALCASE=1; export DUALCASE # for MKS sh 1001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# A function that is used when there is no print builtin or printf. 1021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_fallback_echo () 1031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 1041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval 'cat <<_LTECHO_EOF 1051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$1 1061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich_LTECHO_EOF' 1071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 1081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# NLS nuisances: We save the old values to restore during execute mode. 1101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_user_locale= 1111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_safe_locale= 1121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdo 1141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "if test \"\${$lt_var+set}\" = set; then 1151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_$lt_var=\$$lt_var 1161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $lt_var=C 1171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export $lt_var 1181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 1191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 1201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi" 1211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdone 1221d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichLC_ALL=C 1231d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichLANGUAGE=C 1241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichexport LANGUAGE LC_ALL 1251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$lt_unset CDPATH 1271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 1301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# is ksh but when the shell is invoked as "sh" and the current value of 1311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# the _XPG environment variable is not equal to 1 (one), the special 1321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# positional parameter $0, within a function call, is the name of the 1331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# function. 1341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichprogpath="$0" 1351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich: ${CP="cp -f"} 1391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 1401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich: ${MAKE="make"} 1411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich: ${MKDIR="mkdir"} 1421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich: ${MV="mv -f"} 1431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich: ${RM="rm -f"} 1441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 1451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich: ${Xsed="$SED -e 1s/^X//"} 1461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Global variables: 1481d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEXIT_SUCCESS=0 1491d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEXIT_FAILURE=1 1501d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 1511d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 1521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichexit_status=$EXIT_SUCCESS 1541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Make sure IFS has a sensible default 1561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_nl=' 1571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich' 1581d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichIFS=" $lt_nl" 1591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdirname="s,/[^/]*$,," 1611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbasename="s,^.*/,," 1621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_dirname file append nondir_replacement 1641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Compute the dirname of FILE. If nonempty, add APPEND to the result, 1651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# otherwise set result to NONDIR_REPLACEMENT. 1661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_dirname () 1671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 1681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` 1691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$func_dirname_result" = "X${1}"; then 1701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_result="${3}" 1711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 1721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_result="$func_dirname_result${2}" 1731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 1741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_dirname may be replaced by extended shell implementation 1751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_basename file 1781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_basename () 1791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 1801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename_result=`$ECHO "${1}" | $SED "$basename"` 1811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_basename may be replaced by extended shell implementation 1821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_dirname_and_basename file append nondir_replacement 1851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# perform func_basename and func_dirname in a single function 1861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# call: 1871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# dirname: Compute the dirname of FILE. If nonempty, 1881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# add APPEND to the result, otherwise set result 1891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# to NONDIR_REPLACEMENT. 1901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# value returned in "$func_dirname_result" 1911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# basename: Compute filename of FILE. 1921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# value retuned in "$func_basename_result" 1931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Implementation must be kept synchronized with func_dirname 1941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# and func_basename. For efficiency, we do not delegate to 1951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# those functions but instead duplicate the functionality here. 1961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_dirname_and_basename () 1971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 1981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Extract subdirectory from the argument. 1991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 2001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$func_dirname_result" = "X${1}"; then 2011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_result="${3}" 2021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 2031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_result="$func_dirname_result${2}" 2041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 2051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 2061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_dirname_and_basename may be replaced by extended shell implementation 2071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 2081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 2091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_stripname prefix suffix name 2101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# strip PREFIX and SUFFIX off of NAME. 2111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# PREFIX and SUFFIX must not contain globbing or regex special 2121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# characters, hashes, percent signs, but SUFFIX may contain a leading 2131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# dot (in which case that matches only a dot). 2141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_strip_suffix prefix name 2151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_stripname () 2161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 2171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case ${2} in 2181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; 2191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; 2201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 2211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_stripname may be replaced by extended shell implementation 2221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 2231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 2241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# These SED scripts presuppose an absolute path with a trailing slash. 2251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichpathcar='s,^/\([^/]*\).*$,\1,' 2261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichpathcdr='s,^/[^/]*,,' 2271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichremovedotparts=':dotsl 2281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s@/\./@/@g 2291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich t dotsl 2301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s,/\.$,/,' 2311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcollapseslashes='s@/\{1,\}@/@g' 2321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfinalslash='s,/*$,/,' 2331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 2341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_normal_abspath PATH 2351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Remove doubled-up and trailing slashes, "." path components, 2361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# and cancel out any ".." path components in PATH after making 2371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# it an absolute path. 2381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# value returned in "$func_normal_abspath_result" 2391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_normal_abspath () 2401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 2411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Start from root dir and reassemble the path. 2421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_result= 2431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_tpath=$1 2441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_altnamespace= 2451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $func_normal_abspath_tpath in 2461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "") 2471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Empty path, that just means $cwd. 2481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '/' "`pwd`" 2491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_result=$func_stripname_result 2501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return 2511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 2521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The next three entries are used to spot a run of precisely 2531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # two leading slashes without using negated character classes; 2541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # we take advantage of case's first-match behaviour. 2551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ///*) 2561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Unusual form of absolute path, do nothing. 2571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 2581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich //*) 2591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Not necessarily an ordinary path; POSIX reserves leading '//' 2601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # and for example Cygwin uses it to access remote file shares 2611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # over CIFS/SMB, so we conserve a leading double slash if found. 2621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_altnamespace=/ 2631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 2641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /*) 2651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Absolute path, do nothing. 2661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 2671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 2681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Relative path, prepend $cwd. 2691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 2701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 2711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 2721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Cancel out all the simple stuff to save iterations. We also want 2731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the path to end with a slash for ease of parsing, so make sure 2741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # there is one (and only one) here. 2751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 2771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while :; do 2781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Processed it all yet? 2791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$func_normal_abspath_tpath" = / ; then 2801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If we ascended to the root using ".." the result may be empty now. 2811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$func_normal_abspath_result" ; then 2821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_result=/ 2831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 2841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 2851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 2861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -e "$pathcar"` 2881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 2891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -e "$pathcdr"` 2901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Figure out what to do with it 2911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $func_normal_abspath_tcomponent in 2921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "") 2931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Trailing empty path component, ignore it. 2941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 2951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ..) 2961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Parent dir; strip last assembled component from result. 2971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$func_normal_abspath_result" 2981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_result=$func_dirname_result 2991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 3001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 3011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Actual path component, append it. 3021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 3031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 3041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 3051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 3061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Restore leading double-slash if one was found on entry. 3071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 3081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 3091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 3101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_relative_path SRCDIR DSTDIR 3111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# generates a relative path from SRCDIR to DSTDIR, with a trailing 3121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# slash if non-empty, suitable for immediately appending a filename 3131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# without needing to append a separator. 3141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# value returned in "$func_relative_path_result" 3151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_relative_path () 3161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 3171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_result= 3181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath "$1" 3191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_tlibdir=$func_normal_abspath_result 3201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_normal_abspath "$2" 3211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_tbindir=$func_normal_abspath_result 3221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 3231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Ascend the tree starting from libdir 3241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while :; do 3251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # check if we have found a prefix of bindir 3261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $func_relative_path_tbindir in 3271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $func_relative_path_tlibdir) 3281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # found an exact match 3291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_tcancelled= 3301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 3311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 3321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $func_relative_path_tlibdir*) 3331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # found a matching prefix 3341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 3351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_tcancelled=$func_stripname_result 3361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$func_relative_path_result"; then 3371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_result=. 3381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 3391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 3401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 3411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 3421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname $func_relative_path_tlibdir 3431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_tlibdir=${func_dirname_result} 3441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "x$func_relative_path_tlibdir" = x ; then 3451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Have to descend all the way to the root! 3461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_result=../$func_relative_path_result 3471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_tcancelled=$func_relative_path_tbindir 3481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 3491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 3501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_result=../$func_relative_path_result 3511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 3521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 3531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 3541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 3551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now calculate path; take care to avoid doubling-up slashes. 3561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '/' "$func_relative_path_result" 3571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_result=$func_stripname_result 3581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '/' '/' "$func_relative_path_tcancelled" 3591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "x$func_stripname_result" != x ; then 3601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 3611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 3621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 3631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Normalisation. If bindir is libdir, return empty string, 3641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # else relative path ending with a slash; either way, target 3651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # file name can be directly appended. 3661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test ! -z "$func_relative_path_result"; then 3671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname './' '' "$func_relative_path_result/" 3681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path_result=$func_stripname_result 3691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 3701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 3711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 3721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# The name of this program: 3731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_dirname_and_basename "$progpath" 3741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichprogname=$func_basename_result 3751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 3761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Make sure we have an absolute path for reexecution: 3771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcase $progpath in 3781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]*|[A-Za-z]:\\*) ;; 3791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[\\/]*) 3801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich progdir=$func_dirname_result 3811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich progdir=`cd "$progdir" && pwd` 3821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich progpath="$progdir/$progname" 3831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 3841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 3851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_IFS="$IFS" 3861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS=${PATH_SEPARATOR-:} 3871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for progdir in $PATH; do 3881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_IFS" 3891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -x "$progdir/$progname" && break 3901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 3911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_IFS" 3921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$progdir" || progdir=`pwd` 3931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich progpath="$progdir/$progname" 3941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 3951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichesac 3961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 3971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Sed substitution that helps us do robust quoting. It backslashifies 3981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# metacharacters that are still active within double-quoted strings. 3991d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichXsed="${SED}"' -e 1s/^X//' 4001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 4011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Same as above, but do not quote variable references. 4031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 4041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Sed substitution that turns a string into a regex matching for the 4061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# string literally. 4071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichsed_make_literal_regex='s,[].[^$\\*\/],\\&,g' 4081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Sed substitution that converts a w32 file name or path 4101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# which contains forward slashes, into one that contains 4111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# (escaped) backslashes. A very naive implementation. 4121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 4131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Re-`\' parameter expansions in output of double_quote_subst that were 4151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 4161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# in input to double_quote_subst, that '$' was protected from expansion. 4171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Since each input `\' is now two `\'s, look for any number of runs of 4181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 4191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbs='\\' 4201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbs2='\\\\' 4211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbs4='\\\\\\\\' 4221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdollar='\$' 4231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichsed_double_backslash="\ 4241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/$bs4/&\\ 4251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/g 4261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^$bs2$dollar/$bs&/ 4271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 4281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/\n//g" 4291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Standard options: 4311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_dry_run=false 4321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_help=false 4331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_quiet=false 4341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_verbose=false 4351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_warning=: 4361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_echo arg... 4381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo program name prefixed message, along with the current mode 4391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# name if it has been set yet. 4401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_echo () 4411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 4421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$progname: ${opt_mode+$opt_mode: }$*" 4431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 4441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_verbose arg... 4461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo program name prefixed message in verbose mode only. 4471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_verbose () 4481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 4491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_verbose && func_echo ${1+"$@"} 4501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # A bug in bash halts the script if the last line of a function 4521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # fails when set -e is in force, so we need another command to 4531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # work around that: 4541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich : 4551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 4561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_echo_all arg... 4581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Invoke $ECHO with all args, space-separated. 4591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_echo_all () 4601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 4611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$*" 4621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 4631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_error arg... 4651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo program name prefixed message to standard error. 4661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_error () 4671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 4681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 4691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 4701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_warning arg... 4721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo program name prefixed warning message to standard error. 4731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_warning () 4741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 4751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 4761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # bash bug again: 4781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich : 4791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 4801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_fatal_error arg... 4821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo program name prefixed message to standard error, and exit. 4831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_fatal_error () 4841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 4851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error ${1+"$@"} 4861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_FAILURE 4871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 4881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_fatal_help arg... 4901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo program name prefixed message to standard error, followed by 4911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# a help hint, and exit. 4921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_fatal_help () 4931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 4941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error ${1+"$@"} 4951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "$help" 4961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 4971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichhelp="Try \`$progname --help' for more information." ## default 4981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 4991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_grep expression filename 5011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Check whether EXPRESSION matches any line of FILENAME, without output. 5021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_grep () 5031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 5041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $GREP "$1" "$2" >/dev/null 2>&1 5051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 5061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_mkdir_p directory-path 5091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Make sure the entire path to DIRECTORY-PATH is available. 5101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_mkdir_p () 5111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 5121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_directory_path="$1" 5131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_dir_list= 5141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 5161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Protect directory names starting with `-' 5181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $my_directory_path in 5191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -*) my_directory_path="./$my_directory_path" ;; 5201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 5211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # While some portion of DIR does not yet exist... 5231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while test ! -d "$my_directory_path"; do 5241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # ...make a list in topmost first order. Use a colon delimited 5251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # list incase some portion of path contains whitespace. 5261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_dir_list="$my_directory_path:$my_dir_list" 5271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the last portion added has no slash in it, the list is done 5291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $my_directory_path in */*) ;; *) break ;; esac 5301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # ...otherwise throw away the child directory and loop 5321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 5331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 5341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 5351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_mkdir_p_IFS="$IFS"; IFS=':' 5371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for my_dir in $my_dir_list; do 5381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_mkdir_p_IFS" 5391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # mkdir can fail with a `File exist' error if two processes 5401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # try to create one of the directories concurrently. Don't 5411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # stop in that case! 5421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $MKDIR "$my_dir" 2>/dev/null || : 5431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 5441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_mkdir_p_IFS" 5451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Bail out if we (or some other process) failed to create a directory. 5471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -d "$my_directory_path" || \ 5481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "Failed to create \`$1'" 5491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 5501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 5511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_mktempdir [string] 5541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Make a temporary directory that won't clash with other running 5551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# libtool processes, and avoids race conditions if possible. If 5561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# given, STRING is the basename for that directory. 5571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_mktempdir () 5581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 5591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_template="${TMPDIR-/tmp}/${1-$progname}" 5601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$opt_dry_run" = ":"; then 5621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Return a directory name, but don't create it in dry-run mode 5631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_tmpdir="${my_template}-$$" 5641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 5651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If mktemp works, use that first and foremost 5671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 5681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test ! -d "$my_tmpdir"; then 5701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Failing that, at least try and use $RANDOM to avoid a race 5711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_tmpdir="${my_template}-${RANDOM-0}$$" 5721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_mktempdir_umask=`umask` 5741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich umask 0077 5751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $MKDIR "$my_tmpdir" 5761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich umask $save_mktempdir_umask 5771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 5781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If we're not in dry-run mode, bomb out on failure 5801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -d "$my_tmpdir" || \ 5811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 5821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 5831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$my_tmpdir" 5851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 5861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 5881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_quote_for_eval arg 5891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Aesthetically quote ARG to be evaled later. 5901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 5911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# is double-quoted, suitable for a subsequent eval, whereas 5921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 5931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# which are still active within double quotes backslashified. 5941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_quote_for_eval () 5951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 5961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $1 in 5971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[\\\`\"\$]*) 5981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 5991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 6001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval_unquoted_result="$1" ;; 6011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 6021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $func_quote_for_eval_unquoted_result in 6041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Double-quote args containing shell metacharacters to delay 6051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # word splitting, command substitution and and variable 6061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # expansion for a subsequent eval. 6071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Many Bourne shells cannot handle close brackets correctly 6081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # in scan sets, so we specify it separately. 6091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 6101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 6111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 6121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 6131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 6141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 6151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 6161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_quote_for_expand arg 6191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Aesthetically quote ARG to be evaled later; same as above, 6201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# but do not quote variable references. 6211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_quote_for_expand () 6221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 6231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $1 in 6241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[\\\`\"]*) 6251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_arg=`$ECHO "$1" | $SED \ 6261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 6271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 6281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_arg="$1" ;; 6291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 6301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $my_arg in 6321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Double-quote args containing shell metacharacters to delay 6331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # word splitting and command substitution for a subsequent eval. 6341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Many Bourne shells cannot handle close brackets correctly 6351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # in scan sets, so we specify it separately. 6361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 6371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_arg="\"$my_arg\"" 6381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 6391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 6401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_expand_result="$my_arg" 6421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 6431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_show_eval cmd [fail_exp] 6461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 6471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 6481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# is given, then evaluate it. 6491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_show_eval () 6501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 6511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_cmd="$1" 6521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_fail_exp="${2-:}" 6531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ${opt_silent-false} || { 6551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_expand "$my_cmd" 6561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "func_echo $func_quote_for_expand_result" 6571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 6581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ${opt_dry_run-false}; then :; else 6601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$my_cmd" 6611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_status=$? 6621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$my_status" -eq 0; then :; else 6631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "(exit $my_status); $my_fail_exp" 6641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 6651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 6661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 6671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_show_eval_locale cmd [fail_exp] 6701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 6711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 6721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# is given, then evaluate it. Use the saved locale for evaluation. 6731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_show_eval_locale () 6741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 6751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_cmd="$1" 6761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_fail_exp="${2-:}" 6771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ${opt_silent-false} || { 6791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_expand "$my_cmd" 6801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "func_echo $func_quote_for_expand_result" 6811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 6821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ${opt_dry_run-false}; then :; else 6841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$lt_user_locale 6851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $my_cmd" 6861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_status=$? 6871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$lt_safe_locale" 6881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$my_status" -eq 0; then :; else 6891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "(exit $my_status); $my_fail_exp" 6901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 6911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 6921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 6931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 6941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_tr_sh 6951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Turn $1 into a string suitable for a shell variable name. 6961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Result is stored in $func_tr_sh_result. All characters 6971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 6981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# if $1 begins with a digit, a '_' is prepended as well. 6991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_tr_sh () 7001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 7011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $1 in 7021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [0-9]* | *[!a-zA-Z0-9_]*) 7031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` 7041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 7051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich * ) 7061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_tr_sh_result=$1 7071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 7081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 7091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 7101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_version 7131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo version message to standard output and exit. 7141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_version () 7151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 7161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 7171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -n '/(C)/!b go 7191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich :more 7201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /\./!{ 7211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich N 7221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/\n# / / 7231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich b more 7241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 7251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich :go 7261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /^# '$PROGRAM' (GNU /,/# warranty; / { 7271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^# // 7281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^# *$// 7291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 7301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p 7311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich }' < "$progpath" 7321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $? 7331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 7341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_usage 7361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo short help message to standard output and exit. 7371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_usage () 7381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 7391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 7401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -n '/^# Usage:/,/^# *.*--help/ { 7421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^# // 7431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^# *$// 7441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/\$progname/'$progname'/ 7451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p 7461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich }' < "$progpath" 7471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 7481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "run \`$progname --help | more' for full usage" 7491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $? 7501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 7511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_help [NOEXIT] 7531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo long help message to standard output and exit, 7541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# unless 'noexit' is passed as argument. 7551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_help () 7561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 7571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 7581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -n '/^# Usage:/,/# Report bugs to/ { 7601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich :print 7611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^# // 7621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^# *$// 7631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s*\$progname*'$progname'* 7641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s*\$host*'"$host"'* 7651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s*\$SHELL*'"$SHELL"'* 7661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s*\$LTCC*'"$LTCC"'* 7671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s*\$LTCFLAGS*'"$LTCFLAGS"'* 7681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s*\$LD*'"$LD"'* 7691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/\$with_gnu_ld/'"$with_gnu_ld"'/ 7701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ 7711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ 7721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p 7731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich d 7741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 7751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /^# .* home page:/b print 7761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /^# General help using/b print 7771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ' < "$progpath" 7781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ret=$? 7791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$1"; then 7801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $ret 7811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 7821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 7831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_missing_arg argname 7851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo program name prefixed message to standard error and set global 7861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# exit_cmd. 7871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_missing_arg () 7881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 7891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 7901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "missing argument for $1." 7921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit_cmd=exit 7931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 7941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 7961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_split_short_opt shortopt 7971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Set func_split_short_opt_name and func_split_short_opt_arg shell 7981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# variables after splitting SHORTOPT after the 2nd character. 7991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_split_short_opt () 8001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 8011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_sed_short_opt='1s/^\(..\).*$/\1/;q' 8021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_sed_short_rest='1s/^..\(.*\)$/\1/;q' 8031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` 8051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` 8061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_split_short_opt may be replaced by extended shell implementation 8071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_split_long_opt longopt 8101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Set func_split_long_opt_name and func_split_long_opt_arg shell 8111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# variables after splitting LONGOPT at the `=' sign. 8121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_split_long_opt () 8131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 8141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' 8151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_sed_long_arg='1s/^--[^=]*=//' 8161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` 8181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` 8191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_split_long_opt may be replaced by extended shell implementation 8201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichexit_cmd=: 8221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichmagic="%%%MAGIC variable%%%" 8281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichmagic_exe="%%%MAGIC EXE variable%%%" 8291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Global variables. 8311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichnonopt= 8321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichpreserve_args= 8331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlo2o="s/\\.lo\$/.${objext}/" 8341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevicho2lo="s/\\.${objext}\$/.lo/" 8351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichextracted_archives= 8361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichextracted_serial=0 8371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# If this variable is set in any of the actions, the command in it 8391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# will be execed at the end. This prevents here-documents from being 8401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# left over by shells. 8411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichexec_cmd= 8421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_append var value 8441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Append VALUE to the end of shell variable VAR. 8451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_append () 8461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 8471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "${1}=\$${1}\${2}" 8481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_append may be replaced by extended shell implementation 8491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_append_quoted var value 8511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Quote VALUE and append to the end of shell variable VAR, separated 8521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# by a space. 8531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_append_quoted () 8541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 8551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "${2}" 8561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "${1}=\$${1}\\ \$func_quote_for_eval_result" 8571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_append_quoted may be replaced by extended shell implementation 8581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_arith arithmetic-term... 8611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_arith () 8621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 8631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith_result=`expr "${@}"` 8641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_arith may be replaced by extended shell implementation 8651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_len string 8681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# STRING may not start with a hyphen. 8691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_len () 8701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 8711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` 8721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_len may be replaced by extended shell implementation 8731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_lo2o object 8761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_lo2o () 8771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 8781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` 8791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_lo2o may be replaced by extended shell implementation 8801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_xform libobj-or-source 8831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_xform () 8841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 8851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` 8861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} # func_xform may be replaced by extended shell implementation 8871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_fatal_configuration arg... 8901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echo program name prefixed message to standard error, followed by 8911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# a configuration failure hint, and exit. 8921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_fatal_configuration () 8931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 8941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error ${1+"$@"} 8951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "See the $PACKAGE documentation for more information." 8961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "Fatal configuration error." 8971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 8981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 8991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_config 9011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Display the configuration for all the tags in this script. 9021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_config () 9031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 9041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich re_begincf='^# ### BEGIN LIBTOOL' 9051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich re_endcf='^# ### END LIBTOOL' 9061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Default configuration. 9081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 9091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now print the configurations for the tags. 9111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for tagname in $taglist; do 9121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 9131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 9141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $? 9161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 9171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_features 9191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Display the features supported by this script. 9201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_features () 9211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 9221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "host: $host" 9231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = yes; then 9241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "enable shared libraries" 9251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 9261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "disable shared libraries" 9271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 9281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_old_libs" = yes; then 9291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "enable static libraries" 9301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 9311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "disable static libraries" 9321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 9331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $? 9351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 9361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_enable_tag tagname 9381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Verify that TAGNAME is valid, and either flag an error and exit, or 9391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 9401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# variable here. 9411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_enable_tag () 9421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 9431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Global variable: 9441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tagname="$1" 9451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 9471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 9481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sed_extractcf="/$re_begincf/,/$re_endcf/p" 9491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Validate tagname. 9511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $tagname in 9521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[!-_A-Za-z0-9,/]*) 9531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "invalid tag name: $tagname" 9541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 9551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 9561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Don't test for the "default" C tag, as we know it's 9581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # there but not specially marked. 9591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $tagname in 9601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich CC) ;; 9611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 9621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 9631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich taglist="$taglist $tagname" 9641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Evaluate the configuration. Be careful to quote the path 9661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # and the sed script, to avoid splitting on whitespace, but 9671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # also don't use non-portable quotes within backquotes within 9681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # quotes we have to do it in 2 steps: 9691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 9701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$extractedcf" 9711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 9721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "ignoring unknown tag $tagname" 9731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 9741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 9751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 9761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 9771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_check_version_match 9791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Ensure that we are using m4 macros, and libtool script from the same 9801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# release of libtool. 9811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_check_version_match () 9821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 9831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$package_revision" != "$macro_revision"; then 9841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$VERSION" != "$macro_version"; then 9851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$macro_version"; then 9861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat >&2 <<_LT_EOF 9871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: definition of this LT_INIT comes from an older release. 9891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 9901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: and run autoconf again. 9911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich_LT_EOF 9921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 9931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat >&2 <<_LT_EOF 9941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 9951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 9961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 9971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: and run autoconf again. 9981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich_LT_EOF 9991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 10001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 10011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat >&2 <<_LT_EOF 10021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 10031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: but the definition of this LT_INIT comes from revision $macro_revision. 10041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: You should recreate aclocal.m4 with macros from revision $package_revision 10051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$progname: of $PACKAGE $VERSION and run autoconf again. 10061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich_LT_EOF 10071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 10081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 10091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_MISMATCH 10101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 10111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 10121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 10131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 10141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Shorthand for --mode=foo, only valid as the first argument 10151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcase $1 in 10161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichclean|clea|cle|cl) 10171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift; set dummy --mode clean ${1+"$@"}; shift 10181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcompile|compil|compi|comp|com|co|c) 10201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift; set dummy --mode compile ${1+"$@"}; shift 10211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichexecute|execut|execu|exec|exe|ex|e) 10231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift; set dummy --mode execute ${1+"$@"}; shift 10241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfinish|finis|fini|fin|fi|f) 10261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift; set dummy --mode finish ${1+"$@"}; shift 10271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichinstall|instal|insta|inst|ins|in|i) 10291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift; set dummy --mode install ${1+"$@"}; shift 10301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlink|lin|li|l) 10321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift; set dummy --mode link ${1+"$@"}; shift 10331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichuninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 10351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift; set dummy --mode uninstall ${1+"$@"}; shift 10361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichesac 10381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 10391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 10401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 10411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Option defaults: 10421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_debug=: 10431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_dry_run=false 10441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_config=false 10451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_preserve_dup_deps=false 10461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_features=false 10471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_finish=false 10481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_help=false 10491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_help_all=false 10501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_silent=: 10511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_warning=: 10521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_verbose=: 10531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_silent=false 10541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_verbose=false 10551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 10561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 10571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Parse options once, thoroughly. This comes as soon as possible in the 10581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# script to make things like `--version' happen as quickly as we can. 10591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 10601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # this just eases exit handling 10611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while test $# -gt 0; do 10621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt="$1" 10631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 10641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $opt in 10651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --debug|-x) opt_debug='set -x' 10661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_echo "enabling shell trace mode" 10671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 10681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --dry-run|--dryrun|-n) 10701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_dry_run=: 10711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --config) 10731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_config=: 10741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_config 10751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --dlopen|-dlopen) 10771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich optarg="$1" 10781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_dlopen="${opt_dlopen+$opt_dlopen 10791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich}$optarg" 10801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 10811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --preserve-dup-deps) 10831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_preserve_dup_deps=: 10841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --features) 10861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_features=: 10871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_features 10881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --finish) 10901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_finish=: 10911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichset dummy --mode finish ${1+"$@"}; shift 10921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --help) 10941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_help=: 10951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 10961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --help-all) 10971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_help_all=: 10981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_help=': help-all' 10991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --mode) 11011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test $# = 0 && func_missing_arg $opt && break 11021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich optarg="$1" 11031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_mode="$optarg" 11041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcase $optarg in 11051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Valid mode arguments: 11061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich clean|compile|execute|finish|install|link|relink|uninstall) ;; 11071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Catch anything else as an error 11091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_error "invalid argument for $opt" 11101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit_cmd=exit 11111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 11121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichesac 11141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 11151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --no-silent|--no-quiet) 11171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_silent=false 11181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_append preserve_args " $opt" 11191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --no-warning|--no-warn) 11211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_warning=false 11221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_append preserve_args " $opt" 11231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --no-verbose) 11251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_verbose=false 11261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_append preserve_args " $opt" 11271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --silent|--quiet) 11291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_silent=: 11301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_append preserve_args " $opt" 11311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_verbose=false 11321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --verbose|-v) 11341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_verbose=: 11351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_append preserve_args " $opt" 11361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichopt_silent=false 11371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --tag) 11391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test $# = 0 && func_missing_arg $opt && break 11401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich optarg="$1" 11411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_tag="$optarg" 11421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_append preserve_args " $opt $optarg" 11431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_enable_tag "$optarg" 11441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 11451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -\?|-h) func_usage ;; 11481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --help) func_help ;; 11491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --version) func_version ;; 11501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Separate optargs to long options: 11521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --*=*) 11531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_split_long_opt "$opt" 11541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} 11551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 11561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Separate non-argument short options: 11591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -\?*|-h*|-n*|-v*) 11601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_split_short_opt "$opt" 11611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} 11621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 11631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --) break ;; 11661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -*) func_fatal_help "unrecognized option \`$opt'" ;; 11671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) set dummy "$opt" ${1+"$@"}; shift; break ;; 11681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 11691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 11701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Validate options: 11721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # save first non-option argument 11741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$#" -gt 0; then 11751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonopt="$opt" 11761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 11771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 11781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # preserve --debug 11801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$opt_debug" = : || func_append preserve_args " --debug" 11811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 11831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw* | *pw32* | *cegcc*) 11841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # don't eliminate duplications in $postdeps and $predeps 11851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_duplicate_compiler_generated_deps=: 11861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 11881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 11891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 11901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 11911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_help || { 11931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Sanity checks first: 11941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_check_version_match 11951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 11961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 11971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_configuration "not configured to build any kind of library" 11981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 11991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Darwin sucks 12011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval std_shrext=\"$shrext_cmds\" 12021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only execute mode is allowed to have -dlopen flags. 12041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$opt_dlopen" && test "$opt_mode" != execute; then 12051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "unrecognized option \`-dlopen'" 12061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$help" 1>&2 12071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_FAILURE 12081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 12091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Change the help message to a mode-specific one. 12111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich generic_help="$help" 12121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich help="Try \`$progname --help --mode=$opt_mode' for more information." 12131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 12141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Bail if the options were screwed 12171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $exit_cmd $EXIT_FAILURE 12181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 12191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich## ----------- ## 12241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich## Main. ## 12251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich## ----------- ## 12261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_lalib_p file 12281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# True iff FILE is a libtool `.la' library or `.lo' object file. 12291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This function is only a basic sanity check; it will hardly flush out 12301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# determined imposters. 12311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_lalib_p () 12321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 12331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -f "$1" && 12341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -e 4q "$1" 2>/dev/null \ 12351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 12361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 12371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_lalib_unsafe_p file 12391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# True iff FILE is a libtool `.la' library or `.lo' object file. 12401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This function implements the same check as func_lalib_p without 12411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# resorting to external programs. To this end, it redirects stdin and 12421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# closes it afterwards, without saving the original file descriptor. 12431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# As a safety measure, use it only where a negative result would be 12441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# fatal anyway. Works if `file' does not exist. 12451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_lalib_unsafe_p () 12461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 12471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lalib_p=no 12481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 12491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lalib_p_l in 1 2 3 4 12501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 12511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich read lalib_p_line 12521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$lalib_p_line" in 12531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 12541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 12551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 12561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exec 0<&5 5<&- 12571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 12581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$lalib_p" = yes 12591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 12601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_ltwrapper_script_p file 12621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# True iff FILE is a libtool wrapper script 12631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This function is only a basic sanity check; it will hardly flush out 12641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# determined imposters. 12651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_ltwrapper_script_p () 12661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 12671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lalib_p "$1" 12681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 12691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_ltwrapper_executable_p file 12711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# True iff FILE is a libtool wrapper executable 12721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This function is only a basic sanity check; it will hardly flush out 12731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# determined imposters. 12741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_ltwrapper_executable_p () 12751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 12761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_ltwrapper_exec_suffix= 12771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $1 in 12781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.exe) ;; 12791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_ltwrapper_exec_suffix=.exe ;; 12801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 12811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 12821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 12831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_ltwrapper_scriptname file 12851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Assumes file is an ltwrapper_executable 12861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# uses $file to determine the appropriate filename for a 12871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# temporary ltwrapper_script. 12881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_ltwrapper_scriptname () 12891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 12901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_and_basename "$1" "" "." 12911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '.exe' "$func_basename_result" 12921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 12931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 12941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 12951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_ltwrapper_p file 12961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# True iff FILE is a libtool wrapper script or wrapper executable 12971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This function is only a basic sanity check; it will hardly flush out 12981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# determined imposters. 12991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_ltwrapper_p () 13001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 13011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 13021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 13031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 13041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 13051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_execute_cmds commands fail_cmd 13061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Execute tilde-delimited COMMANDS. 13071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# If FAIL_CMD is given, eval that upon failure. 13081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# FAIL_CMD may read-access the current command in variable CMD! 13091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_execute_cmds () 13101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 13111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 13121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_ifs=$IFS; IFS='~' 13131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for cmd in $1; do 13141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS=$save_ifs 13151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval cmd=\"$cmd\" 13161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$cmd" "${2-:}" 13171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 13181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS=$save_ifs 13191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 13201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 13211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 13221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_source file 13231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Source FILE, adding directory component if necessary. 13241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Note that it is not necessary on cygwin/mingw to append a dot to 13251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 13261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# behavior happens only for exec(3), not for open(2)! Also, sourcing 13271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# `FILE.' does not work on cygwin managed mounts. 13281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_source () 13291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 13301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 13311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $1 in 13321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich */* | *\\*) . "$1" ;; 13331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) . "./$1" ;; 13341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 13351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 13361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 13371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 13381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_resolve_sysroot PATH 13391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Replace a leading = in PATH with a sysroot. Store the result into 13401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_resolve_sysroot_result 13411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_resolve_sysroot () 13421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 13431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot_result=$1 13441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $func_resolve_sysroot_result in 13451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich =*) 13461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '=' '' "$func_resolve_sysroot_result" 13471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 13481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 13491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 13501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 13511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 13521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_replace_sysroot PATH 13531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# If PATH begins with the sysroot, replace it with = and 13541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# store the result into func_replace_sysroot_result. 13551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_replace_sysroot () 13561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 13571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$lt_sysroot:$1" in 13581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ?*:"$lt_sysroot"*) 13591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname "$lt_sysroot" '' "$1" 13601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_replace_sysroot_result="=$func_stripname_result" 13611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 13621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 13631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Including no sysroot. 13641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_replace_sysroot_result=$1 13651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 13661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 13671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 13681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 13691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_infer_tag arg 13701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Infer tagged configuration to use if any are available and 13711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# if one wasn't chosen via the "--tag" command line option. 13721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Only attempt this if the compiler in the base compile 13731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# command doesn't match the default compiler. 13741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# arg is usually of the form 'gcc ...' 13751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_infer_tag () 13761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 13771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 13781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$available_tags" && test -z "$tagname"; then 13791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich CC_quoted= 13801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for arg in $CC; do 13811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append_quoted CC_quoted "$arg" 13821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 13831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich CC_expanded=`func_echo_all $CC` 13841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich CC_quoted_expanded=`func_echo_all $CC_quoted` 13851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $@ in 13861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Blanks in the command may have been stripped by the calling shell, 13871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # but not from the CC environment variable when configure was run. 13881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 13891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 13901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Blanks at the start of $base_compile will cause this to fail 13911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # if we don't check for them as well. 13921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 13931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for z in $available_tags; do 13941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 13951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Evaluate the configuration. 13961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 13971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich CC_quoted= 13981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for arg in $CC; do 13991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Double-quote args containing other shell metacharacters. 14001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append_quoted CC_quoted "$arg" 14011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 14021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich CC_expanded=`func_echo_all $CC` 14031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich CC_quoted_expanded=`func_echo_all $CC_quoted` 14041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$@ " in 14051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 14061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 14071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The compiler in the base compile command matches 14081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the one in the tagged configuration. 14091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Assume this is the tagged configuration we want. 14101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tagname=$z 14111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 14121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 14131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 14141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 14151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 14161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If $tagname still isn't set, then no tagged configuration 14171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # was found and let the user know that the "--tag" command 14181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # line option must be used. 14191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$tagname"; then 14201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_echo "unable to infer tagged configuration" 14211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "specify a tag with \`--tag'" 14221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# else 14231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_verbose "using $tagname tagged configuration" 14241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 14251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 14261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 14271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 14281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 14291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_write_libtool_object output_name pic_name nonpic_name 14331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Create a libtool object file (analogous to a ".la" file), 14341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# but don't create it if we're doing a dry run. 14351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_write_libtool_object () 14361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 14371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich write_libobj=${1} 14381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = yes; then 14391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich write_lobj=\'${2}\' 14401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 14411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich write_lobj=none 14421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 14431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_old_libs" = yes; then 14451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich write_oldobj=\'${3}\' 14461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 14471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich write_oldobj=none 14481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 14491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 14511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat >${write_libobj}T <<EOF 14521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $write_libobj - a libtool object file 14531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 14541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 14551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Please DO NOT delete this file! 14561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# It is necessary for linking the library. 14571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Name of the PIC object. 14591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichpic_object=$write_lobj 14601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Name of the non-PIC object 14621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichnon_pic_object=$write_oldobj 14631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14641d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 14651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $MV "${write_libobj}T" "${write_libobj}" 14661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 14671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 14681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich################################################## 14711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 14721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich################################################## 14731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 14741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_core_file_wine_to_w32 ARG 14751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Helper function used by file name conversion functions when $build is *nix, 14761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# and $host is mingw, cygwin, or some other w32 environment. Relies on a 14771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# correctly configured wine environment available, with the winepath program 14781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# in $build's $PATH. 14791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 14801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ARG is the $build file name to be converted to w32 format. 14811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Result is available in $func_convert_core_file_wine_to_w32_result, and will 14821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# be empty on error (or when ARG is empty) 14831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_core_file_wine_to_w32 () 14841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 14851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 14861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_file_wine_to_w32_result="$1" 14871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 14881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Unfortunately, winepath does not exit with a non-zero error code, so we 14891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # are forced to check the contents of stdout. On the other hand, if the 14901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # command is not found, the shell will set an exit code of 127 and print 14911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # *an error message* to stdout. So we must check for both error code of 14921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # zero AND non-empty stdout, which explains the odd construction: 14931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 14941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then 14951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 14961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -e "$lt_sed_naive_backslashify"` 14971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 14981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_file_wine_to_w32_result= 14991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 15001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 15011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 15021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end: func_convert_core_file_wine_to_w32 15031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 15041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 15051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_core_path_wine_to_w32 ARG 15061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Helper function used by path conversion functions when $build is *nix, and 15071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 15081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# configured wine environment available, with the winepath program in $build's 15091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $PATH. Assumes ARG has no leading or trailing path separator characters. 15101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 15111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ARG is path to be converted from $build format to win32. 15121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Result is available in $func_convert_core_path_wine_to_w32_result. 15131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Unconvertible file (directory) names in ARG are skipped; if no directory names 15141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# are convertible, then the result may be empty. 15151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_core_path_wine_to_w32 () 15161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 15171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 15181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # unfortunately, winepath doesn't convert paths, only file names 15191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_path_wine_to_w32_result="" 15201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 15211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldIFS=$IFS 15221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS=: 15231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for func_convert_core_path_wine_to_w32_f in $1; do 15241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS=$oldIFS 15251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 15261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$func_convert_core_file_wine_to_w32_result" ; then 15271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$func_convert_core_path_wine_to_w32_result"; then 15281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" 15291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 15301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 15311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 15321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 15331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 15341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS=$oldIFS 15351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 15361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 15371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end: func_convert_core_path_wine_to_w32 15381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 15391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 15401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_cygpath ARGS... 15411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 15421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 15431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 15441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# (2), returns the Cygwin file name or path in func_cygpath_result (input 15451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# file name or path is assumed to be in w32 format, as previously converted 15461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# from $build's *nix or MSYS format). In case (3), returns the w32 file name 15471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# or path in func_cygpath_result (input file name or path is assumed to be in 15481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Cygwin format). Returns an empty string on error. 15491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 15501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ARGS are passed to cygpath, with the last one being the file name or path to 15511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# be converted. 15521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 15531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 15541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# environment variable; do not put it in $PATH. 15551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_cygpath () 15561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 15571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 15581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 15591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 15601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$?" -ne 0; then 15611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # on failure, ensure result is empty 15621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_cygpath_result= 15631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 15641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 15651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_cygpath_result= 15661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" 15671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 15681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 15691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#end: func_cygpath 15701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 15711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 15721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_core_msys_to_w32 ARG 15731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert file name or path ARG from MSYS format to w32 format. Return 15741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# result in func_convert_core_msys_to_w32_result. 15751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_core_msys_to_w32 () 15761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 15771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 15781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # awkward: cmd appends spaces to result 15791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 15801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 15811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 15821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#end: func_convert_core_msys_to_w32 15831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 15841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 15851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_file_check ARG1 ARG2 15861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Verify that ARG1 (a file name in $build format) was converted to $host 15871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# format in ARG2. Otherwise, emit an error message, but continue (resetting 15881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_host_file_result to ARG1). 15891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_file_check () 15901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 15911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 15921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$2" && test -n "$1" ; then 15931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "Could not determine host file name corresponding to" 15941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error " \`$1'" 15951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "Continuing, but uninstalled executables may not work." 15961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Fallback: 15971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$1" 15981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 15991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 16001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_file_check 16011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 16041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Verify that FROM_PATH (a path in $build format) was converted to $host 16051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 16061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_host_file_result to a simplistic fallback value (see below). 16071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_path_check () 16081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 16091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 16101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$4" && test -n "$3"; then 16111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "Could not determine the host path corresponding to" 16121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error " \`$3'" 16131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "Continuing, but uninstalled executables may not work." 16141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Fallback. This is a deliberately simplistic "conversion" and 16151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # should not be "improved". See libtool.info. 16161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "x$1" != "x$2"; then 16171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_replace_pathsep_chars="s|$1|$2|g" 16181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result=`echo "$3" | 16191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -e "$lt_replace_pathsep_chars"` 16201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 16211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$3" 16221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 16231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 16241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 16251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_path_check 16261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 16291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 16301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# and appending REPL if ORIG matches BACKPAT. 16311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_path_front_back_pathsep () 16321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 16331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 16341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $4 in 16351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $1 ) func_to_host_path_result="$3$func_to_host_path_result" 16361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 16371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 16381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $4 in 16391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $2 ) func_append func_to_host_path_result "$3" 16401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 16411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 16421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 16431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_path_front_back_pathsep 16441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich################################################## 16471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $build to $host FILE NAME CONVERSION FUNCTIONS # 16481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich################################################## 16491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# invoked via `$to_host_file_cmd ARG' 16501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 16511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# In each case, ARG is the path to be converted from $build to $host format. 16521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Result will be available in $func_to_host_file_result. 16531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_host_file ARG 16561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Converts the file name ARG from $build format to $host format. Return result 16571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# in func_to_host_file_result. 16581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_to_host_file () 16591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 16601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 16611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $to_host_file_cmd "$1" 16621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 16631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_to_host_file 16641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_tool_file ARG LAZY 16671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# converts the file name ARG from $build format to toolchain format. Return 16681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# result in func_to_tool_file_result. If the conversion in use is listed 16691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# in (the comma separated) LAZY, no conversion takes place. 16701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_to_tool_file () 16711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 16721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 16731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case ,$2, in 16741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *,"$to_tool_file_cmd",*) 16751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file_result=$1 16761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 16771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 16781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $to_tool_file_cmd "$1" 16791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file_result=$func_to_host_file_result 16801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 16811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 16821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 16831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_to_tool_file 16841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_file_noop ARG 16871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Copy ARG to func_to_host_file_result. 16881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_file_noop () 16891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 16901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$1" 16911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 16921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_file_noop 16931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 16951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_file_msys_to_w32 ARG 16961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 16971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# conversion to w32 is not available inside the cwrapper. Returns result in 16981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_host_file_result. 16991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_file_msys_to_w32 () 17001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 17011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 17021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$1" 17031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 17041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_msys_to_w32 "$1" 17051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$func_convert_core_msys_to_w32_result" 17061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 17071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_file_check "$1" "$func_to_host_file_result" 17081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 17091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_file_msys_to_w32 17101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_file_cygwin_to_w32 ARG 17131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert file name ARG from Cygwin to w32 format. Returns result in 17141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_host_file_result. 17151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_file_cygwin_to_w32 () 17161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 17171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 17181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$1" 17191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 17201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 17211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # LT_CYGPATH in this case. 17221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result=`cygpath -m "$1"` 17231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 17241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_file_check "$1" "$func_to_host_file_result" 17251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 17261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_file_cygwin_to_w32 17271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_file_nix_to_w32 ARG 17301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert file name ARG from *nix to w32 format. Requires a wine environment 17311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# and a working winepath. Returns result in func_to_host_file_result. 17321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_file_nix_to_w32 () 17331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 17341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 17351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$1" 17361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 17371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_file_wine_to_w32 "$1" 17381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" 17391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 17401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_file_check "$1" "$func_to_host_file_result" 17411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 17421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_file_nix_to_w32 17431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_file_msys_to_cygwin ARG 17461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 17471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Returns result in func_to_host_file_result. 17481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_file_msys_to_cygwin () 17491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 17501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 17511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$1" 17521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 17531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_msys_to_w32 "$1" 17541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_cygpath -u "$func_convert_core_msys_to_w32_result" 17551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$func_cygpath_result" 17561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 17571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_file_check "$1" "$func_to_host_file_result" 17581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 17591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_file_msys_to_cygwin 17601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_file_nix_to_cygwin ARG 17631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 17641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 17651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# in func_to_host_file_result. 17661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_file_nix_to_cygwin () 17671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 17681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 17691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$1" 17701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 17711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 17721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_file_wine_to_w32 "$1" 17731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 17741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_file_result="$func_cygpath_result" 17751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 17761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_file_check "$1" "$func_to_host_file_result" 17771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 17781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_file_nix_to_cygwin 17791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 17811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich############################################# 17821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $build to $host PATH CONVERSION FUNCTIONS # 17831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich############################################# 17841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# invoked via `$to_host_path_cmd ARG' 17851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 17861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# In each case, ARG is the path to be converted from $build to $host format. 17871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# The result will be available in $func_to_host_path_result. 17881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 17891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Path separators are also converted from $build format to $host format. If 17901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ARG begins or ends with a path separator character, it is preserved (but 17911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# converted to $host format) on output. 17921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 17931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# All path conversion functions are named using the following convention: 17941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# file name conversion function : func_convert_file_X_to_Y () 17951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# path conversion function : func_convert_path_X_to_Y () 17961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# where, for any given $build/$host combination the 'X_to_Y' value is the 17971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# same. If conversion functions are added for new $build/$host combinations, 17981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# the two new functions must follow this pattern, or func_init_to_host_path_cmd 17991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# will break. 18001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_init_to_host_path_cmd 18031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Ensures that function "pointer" variable $to_host_path_cmd is set to the 18041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# appropriate value, based on the value of $to_host_file_cmd. 18051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichto_host_path_cmd= 18061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_init_to_host_path_cmd () 18071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 18081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 18091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$to_host_path_cmd"; then 18101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 18111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich to_host_path_cmd="func_convert_path_${func_stripname_result}" 18121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 18131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 18141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_host_path ARG 18171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Converts the path ARG from $build format to $host format. Return result 18181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# in func_to_host_path_result. 18191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_to_host_path () 18201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 18211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 18221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_init_to_host_path_cmd 18231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $to_host_path_cmd "$1" 18241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 18251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_to_host_path 18261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_path_noop ARG 18291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Copy ARG to func_to_host_path_result. 18301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_path_noop () 18311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 18321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$1" 18331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 18341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_path_noop 18351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_path_msys_to_w32 ARG 18381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 18391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# conversion to w32 is not available inside the cwrapper. Returns result in 18401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_host_path_result. 18411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_path_msys_to_w32 () 18421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 18431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 18441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$1" 18451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 18461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove leading and trailing path separator characters from ARG. MSYS 18471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 18481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # and winepath ignores them completely. 18491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname : : "$1" 18501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_tmp1=$func_stripname_result 18511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 18521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$func_convert_core_msys_to_w32_result" 18531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_check : ";" \ 18541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "$func_to_host_path_tmp1" "$func_to_host_path_result" 18551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 18571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 18581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_path_msys_to_w32 18591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_path_cygwin_to_w32 ARG 18621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert path ARG from Cygwin to w32 format. Returns result in 18631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_host_file_result. 18641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_path_cygwin_to_w32 () 18651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 18661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 18671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$1" 18681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 18691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # See func_convert_path_msys_to_w32: 18701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname : : "$1" 18711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_tmp1=$func_stripname_result 18721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 18731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_check : ";" \ 18741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "$func_to_host_path_tmp1" "$func_to_host_path_result" 18751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 18771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 18781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_path_cygwin_to_w32 18791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 18811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_path_nix_to_w32 ARG 18821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert path ARG from *nix to w32 format. Requires a wine environment and 18831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# a working winepath. Returns result in func_to_host_file_result. 18841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_path_nix_to_w32 () 18851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 18861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 18871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$1" 18881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 18891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # See func_convert_path_msys_to_w32: 18901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname : : "$1" 18911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_tmp1=$func_stripname_result 18921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 18931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" 18941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_check : ";" \ 18951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "$func_to_host_path_tmp1" "$func_to_host_path_result" 18961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 18971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 18981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 18991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_path_nix_to_w32 19001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_path_msys_to_cygwin ARG 19031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 19041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Returns result in func_to_host_file_result. 19051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_path_msys_to_cygwin () 19061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 19071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 19081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$1" 19091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 19101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # See func_convert_path_msys_to_w32: 19111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname : : "$1" 19121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_tmp1=$func_stripname_result 19131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 19141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 19151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$func_cygpath_result" 19161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_check : : \ 19171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "$func_to_host_path_tmp1" "$func_to_host_path_result" 19181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_front_back_pathsep ":*" "*:" : "$1" 19191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 19201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 19211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_path_msys_to_cygwin 19221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_convert_path_nix_to_cygwin ARG 19251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 19261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 19271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_to_host_file_result. 19281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_convert_path_nix_to_cygwin () 19291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 19301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 19311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$1" 19321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 19331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove leading and trailing path separator characters from 19341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # ARG. msys behavior is inconsistent here, cygpath turns them 19351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # into '.;' and ';.', and winepath ignores them completely. 19361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname : : "$1" 19371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_tmp1=$func_stripname_result 19381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 19391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 19401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path_result="$func_cygpath_result" 19411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_check : : \ 19421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "$func_to_host_path_tmp1" "$func_to_host_path_result" 19431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_convert_path_front_back_pathsep ":*" "*:" : "$1" 19441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 19451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 19461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end func_convert_path_nix_to_cygwin 19471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_mode_compile arg... 19501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_mode_compile () 19511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 19521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 19531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Get the compilation command and the source file. 19541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich base_compile= 19551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich srcfile="$nonopt" # always keep a non-empty value in "srcfile" 19561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich suppress_opt=yes 19571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich suppress_output= 19581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg_mode=normal 19591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobj= 19601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich later= 19611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pie_flag= 19621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for arg 19641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 19651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg_mode in 19661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg ) 19671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # do not "continue". Instead, add this to base_compile 19681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lastarg="$arg" 19691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg_mode=normal 19701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 19711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich target ) 19731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobj="$arg" 19741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg_mode=normal 19751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 19761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 19771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich normal ) 19791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Accept any command-line options. 19801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 19811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -o) 19821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$libobj" && \ 19831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "you cannot specify \`-o' more than once" 19841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg_mode=target 19851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 19861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 19871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -pie | -fpie | -fPIE) 19891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append pie_flag " $arg" 19901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 19911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 19921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -shared | -static | -prefer-pic | -prefer-non-pic) 19941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append later " $arg" 19951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 19961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 19971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 19981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -no-suppress) 19991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich suppress_opt=no 20001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 20011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Xcompiler) 20041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg_mode=arg # the next one goes into the "base_compile" arg list 20051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue # The current "srcfile" will either be retained or 20061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; # replaced later. I would guess that would be a bug. 20071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Wc,*) 20091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '-Wc,' '' "$arg" 20101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich args=$func_stripname_result 20111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lastarg= 20121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_ifs="$IFS"; IFS=',' 20131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for arg in $args; do 20141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 20151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append_quoted lastarg "$arg" 20161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 20171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 20181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname ' ' '' "$lastarg" 20191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lastarg=$func_stripname_result 20201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add the arguments to base_compile. 20221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append base_compile " $lastarg" 20231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 20241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 20271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Accept the current argument as the source file. 20281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The previous "srcfile" becomes the current argument. 20291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # 20301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lastarg="$srcfile" 20311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich srcfile="$arg" 20321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac # case $arg 20341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac # case $arg_mode 20361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Aesthetically quote the previous argument. 20381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append_quoted base_compile "$lastarg" 20391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # for arg 20401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg_mode in 20421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg) 20431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "you must specify an argument for -Xcompile" 20441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich target) 20461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "you must specify a target with \`-o'" 20471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 20491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Get the name of the library object. 20501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$libobj" && { 20511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$srcfile" 20521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobj="$func_basename_result" 20531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 20541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 20561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Recognize several different file suffixes. 20581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the user specifies -o file.o, it is replaced with file.lo 20591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $libobj in 20601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.[cCFSifmso] | \ 20611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.ada | *.adb | *.ads | *.asm | \ 20621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 20631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) 20641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_xform "$libobj" 20651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobj=$func_xform_result 20661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 20681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $libobj in 20701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 20711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 20721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot determine name of library object from \`$libobj'" 20731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 20751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_infer_tag $base_compile 20771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for arg in $later; do 20791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 20801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -shared) 20811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$build_libtool_libs" != yes && \ 20821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_configuration "can not build a shared library" 20831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_old_libs=no 20841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 20851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -static) 20881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=no 20891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_old_libs=yes 20901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 20911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -prefer-pic) 20941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_mode=yes 20951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 20961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 20971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 20981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -prefer-non-pic) 20991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_mode=no 21001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 21011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 21021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 21031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 21041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$libobj" 21061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$libobj" != "X$func_quote_for_eval_result" \ 21071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 21081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich && func_warning "libobj name \`$libobj' may not contain shell special characters." 21091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_and_basename "$obj" "/" "" 21101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich objname="$func_basename_result" 21111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xdir="$func_dirname_result" 21121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lobj=${xdir}$objdir/$objname 21131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$base_compile" && \ 21151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "you must specify a compilation command" 21161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Delete any leftover library objects. 21181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_old_libs" = yes; then 21191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich removelist="$obj $lobj $libobj ${libobj}T" 21201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 21211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich removelist="$lobj $libobj ${libobj}T" 21221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 21231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # On Cygwin there's no "real" PIC flag so we must build both object types 21251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host_os in 21261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cygwin* | mingw* | pw32* | os2* | cegcc*) 21271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_mode=default 21281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 21291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 21301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 21311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # non-PIC code in shared libraries is not supported 21321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_mode=default 21331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 21341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Calculate the filename of the output object if compiler does 21361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # not support -o with -c 21371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$compiler_c_o" = no; then 21381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 21391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lockfile="$output_obj.lock" 21401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 21411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output_obj= 21421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich need_locks=no 21431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lockfile= 21441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 21451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Lock this critical section if it is needed 21471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We use this script file to make the link, it avoids creating a new file 21481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$need_locks" = yes; then 21491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 21501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_echo "Waiting for $lockfile to be removed" 21511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sleep 2 21521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 21531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$need_locks" = warn; then 21541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$lockfile"; then 21551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 21561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich*** ERROR, $lockfile exists and contains: 21571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich`cat $lockfile 2>/dev/null` 21581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21591d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThis indicates that another process is trying to use the same 21601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtemporary object file, and libtool could not work around it because 21611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichyour compiler does not support \`-c' and \`-o' together. If you 21621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichrepeat this compilation, it may succeed, by chance, but you had better 21631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichavoid parallel builds (make -j) in this platform, or get a better 21641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcompiler." 21651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM $removelist 21671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_FAILURE 21681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 21691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append removelist " $output_obj" 21701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$srcfile" > "$lockfile" 21711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 21721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM $removelist 21741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append removelist " $lockfile" 21751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 21761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 21781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich srcfile=$func_to_tool_file_result 21791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$srcfile" 21801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich qsrcfile=$func_quote_for_eval_result 21811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only build a PIC object if we are building libtool libraries. 21831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = yes; then 21841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Without this assignment, base_compile gets emptied. 21851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fbsd_hideous_sh_bug=$base_compile 21861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pic_mode" != no; then 21881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich command="$base_compile $qsrcfile $pic_flag" 21891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 21901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Don't build PIC code 21911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich command="$base_compile $qsrcfile" 21921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 21931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mkdir_p "$xdir$objdir" 21951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 21961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$output_obj"; then 21971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Place PIC objects in $objdir 21981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append command " -o $lobj" 21991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval_locale "$command" \ 22021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 22031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$need_locks" = warn && 22051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 22061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 22071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich*** ERROR, $lockfile contains: 22081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich`cat $lockfile 2>/dev/null` 22091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbut it should contain: 22111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$srcfile 22121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22131d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThis indicates that another process is trying to use the same 22141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtemporary object file, and libtool could not work around it because 22151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichyour compiler does not support \`-c' and \`-o' together. If you 22161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichrepeat this compilation, it may succeed, by chance, but you had better 22171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichavoid parallel builds (make -j) in this platform, or get a better 22181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcompiler." 22191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM $removelist 22211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_FAILURE 22221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Just move the object if needed, then go on to compile the next one 22251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 22261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '$MV "$output_obj" "$lobj"' \ 22271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 22281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Allow error messages only from the first compilation. 22311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$suppress_opt" = yes; then 22321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich suppress_output=' >/dev/null 2>&1' 22331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only build a position-dependent object if we build old libraries. 22371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_old_libs" = yes; then 22381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pic_mode" != yes; then 22391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Don't build PIC code 22401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich command="$base_compile $qsrcfile$pie_flag" 22411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 22421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich command="$base_compile $qsrcfile $pic_flag" 22431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$compiler_c_o" = yes; then 22451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append command " -o $obj" 22461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Suppress compiler output if we already did a PIC compilation. 22491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append command "$suppress_output" 22501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval_locale "$command" \ 22511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 22521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$need_locks" = warn && 22541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 22551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 22561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich*** ERROR, $lockfile contains: 22571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich`cat $lockfile 2>/dev/null` 22581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbut it should contain: 22601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$srcfile 22611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22621d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThis indicates that another process is trying to use the same 22631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtemporary object file, and libtool could not work around it because 22641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichyour compiler does not support \`-c' and \`-o' together. If you 22651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichrepeat this compilation, it may succeed, by chance, but you had better 22661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichavoid parallel builds (make -j) in this platform, or get a better 22671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcompiler." 22681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM $removelist 22701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_FAILURE 22711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Just move the object if needed 22741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 22751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '$MV "$output_obj" "$obj"' \ 22761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 22771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 22811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 22821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Unlock the critical section if it was locked 22841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$need_locks" != no; then 22851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich removelist=$lockfile 22861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM "$lockfile" 22871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 22881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 22891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 22911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 22921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich$opt_help || { 22941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$opt_mode" = compile && func_mode_compile ${1+"$@"} 22951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 22961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 22971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_mode_help () 22981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 22991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need to display help for each of the modes. 23001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $opt_mode in 23011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "") 23021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Generic help is extracted from the usage comments 23031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # at the start of this file. 23041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_help 23051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 23061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich clean) 23081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO \ 23091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 23101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23111d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichRemove files from the build directory. 23121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23131d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichRM is the name of the program to use to delete files associated with each FILE 23141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 23151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichto RM. 23161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23171d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichIf FILE is a libtool library, object or program, all the files associated 23181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichwith it are deleted. Otherwise, only FILE itself is deleted using RM." 23191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 23201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile) 23221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO \ 23231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 23241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23251d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichCompile a source file into a libtool library object. 23261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23271d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThis mode accepts the following additional options: 23281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -o OUTPUT-FILE set the output file name to OUTPUT-FILE 23301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -no-suppress do not suppress compiler output for multiple passes 23311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -prefer-pic try to build PIC objects only 23321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -prefer-non-pic try to build non-PIC objects only 23331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -shared do not build a \`.o' file suitable for static linking 23341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -static only build a \`.o' file suitable for static linking 23351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Wc,FLAG pass FLAG directly to the compiler 23361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23371d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 23381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfrom the given SOURCEFILE. 23391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23401d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThe output file name is determined by removing the directory component from 23411d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichSOURCEFILE, then substituting the C source code suffix \`.c' with the 23421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlibrary object suffix, \`.lo'." 23431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 23441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich execute) 23461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO \ 23471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 23481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23491d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichAutomatically set library path, then run a program. 23501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23511d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThis mode accepts the following additional options: 23521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -dlopen FILE add the directory containing FILE to the library path 23541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23551d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThis mode sets the library path environment variable according to \`-dlopen' 23561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichflags. 23571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23581d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichIf any of the ARGS are libtool executable wrappers, then they are translated 23591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichinto their corresponding uninstalled binary, and any of their required library 23601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdirectories are added to the library path. 23611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23621d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThen, COMMAND is executed, with ARGS as arguments." 23631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 23641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finish) 23661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO \ 23671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 23681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23691d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichComplete the installation of libtool libraries. 23701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23711d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEach LIBDIR is a directory that contains libtool libraries. 23721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23731d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThe commands that this mode executes may require superuser privileges. Use 23741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichthe \`--dry-run' option if you just want to see what would be executed." 23751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 23761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich install) 23781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO \ 23791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 23801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23811d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichInstall executables or libraries. 23821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23831d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichINSTALL-COMMAND is the installation command. The first component should be 23841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevicheither the \`install' or \`cp' program. 23851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23861d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThe following components of INSTALL-COMMAND are treated specially: 23871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 23891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23901d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThe rest of the components are interpreted as arguments to that command (only 23911d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichBSD-compatible install options are recognized)." 23921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 23931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link) 23951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO \ 23961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 23971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 23981d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichLink object files or libraries together to form another library, or to 23991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcreate an executable program. 24001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24011d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichLINK-COMMAND is a command using the C compiler that you would use to create 24021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevicha program from several object files. 24031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24041d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichThe following components of LINK-COMMAND are treated specially: 24051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -all-static do not do any dynamic linking at all 24071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -avoid-version do not add a version suffix if possible 24081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -bindir BINDIR specify path to binaries directory (for systems where 24091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libraries must be found in the PATH setting at runtime) 24101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 24111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 24121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 24131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -export-symbols SYMFILE 24141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich try to export only the symbols listed in SYMFILE 24151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -export-symbols-regex REGEX 24161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich try to export only the symbols matching REGEX 24171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -LLIBDIR search LIBDIR for required installed libraries 24181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -lNAME OUTPUT-FILE requires the installed library libNAME 24191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -module build a library that can dlopened 24201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -no-fast-install disable the fast-install mode 24211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -no-install link a not-installable executable 24221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -no-undefined declare that a library does not refer to external symbols 24231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 24241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -objectlist FILE Use a list of object files found in FILE to specify objects 24251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -precious-files-regex REGEX 24261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich don't remove output files matching REGEX 24271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -release RELEASE specify package release information 24281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -rpath LIBDIR the created library will eventually be installed in LIBDIR 24291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 24301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -shared only do dynamic linking of libtool libraries 24311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -shrext SUFFIX override the standard shared library file extension 24321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -static do not do any dynamic linking of uninstalled libtool libraries 24331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -static-libtool-libs 24341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do not do any dynamic linking of libtool libraries 24351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -version-info CURRENT[:REVISION[:AGE]] 24361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich specify library version info [each variable defaults to 0] 24371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -weak LIBNAME declare that the target provides the LIBNAME interface 24381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Wc,FLAG 24391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 24401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Wl,FLAG 24411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Xlinker FLAG pass linker-specific FLAG directly to the linker 24421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 24431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24441d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichAll other options (arguments beginning with \`-') are ignored. 24451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24461d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEvery other argument is treated as a filename. Files ending in \`.la' are 24471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtreated as uninstalled libtool libraries, other files are standard or library 24481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichobject files. 24491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24501d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 24511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichonly library objects (\`.lo' files) may be specified, and \`-rpath' is 24521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichrequired, except when creating a convenience library. 24531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24541d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 24551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichusing \`ar' and \`ranlib', or on Windows using \`lib'. 24561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24571d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 24581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichis created, otherwise an executable program is created." 24591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 24601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich uninstall) 24621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO \ 24631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 24641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24651d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichRemove libraries from an installation directory. 24661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24671d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichRM is the name of the program to use to delete files associated with each FILE 24681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 24691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichto RM. 24701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24711d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichIf FILE is a libtool library, all the files associated with it are deleted. 24721d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichOtherwise, only FILE itself is deleted using RM." 24731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 24741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 24761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "invalid operation mode \`$opt_mode'" 24771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 24781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 24791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 24811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "Try \`$progname --help' for more information about other modes." 24821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 24831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 24841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Now that we've collected a possible --mode arg, show help if necessary 24851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichif $opt_help; then 24861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$opt_help" = :; then 24871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mode_help 24881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 24891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 24901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_help noexit 24911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for opt_mode in compile link execute install finish uninstall clean; do 24921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mode_help 24931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 24941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } | sed -n '1p; 2,$s/^Usage:/ or: /p' 24951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 24961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_help noexit 24971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for opt_mode in compile link execute install finish uninstall clean; do 24981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 24991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mode_help 25001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 25011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } | 25021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sed '1d 25031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /^When reporting/,/^Report/{ 25041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich H 25051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich d 25061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 25071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $x 25081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /information about other modes/d 25091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /more detailed .*MODE/d 25101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 25111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 25121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $? 25131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfi 25141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_mode_execute arg... 25171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_mode_execute () 25181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 25191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 25201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The first argument is the command name. 25211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmd="$nonopt" 25221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$cmd" && \ 25231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "you must specify a COMMAND" 25241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Handle -dlopen flags immediately. 25261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for file in $opt_dlopen; do 25271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -f "$file" \ 25281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich || func_fatal_help "\`$file' is not a file" 25291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir= 25311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $file in 25321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 25331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$file" 25341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=$func_resolve_sysroot_result 25351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check to see that this really is a libtool archive. 25371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lalib_unsafe_p "$file" \ 25381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich || func_fatal_help "\`$lib' is not a valid libtool archive" 25391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Read the libtool library. 25411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlname= 25421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich library_names= 25431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$file" 25441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Skip this library if it cannot be dlopened. 25461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$dlname"; then 25471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Warn if it was a shared library. 25481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$library_names" && \ 25491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`$file' was not linked with \`-export-dynamic'" 25501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 25511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 25521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$file" "" "." 25541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir="$func_dirname_result" 25551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$dir/$objdir/$dlname"; then 25571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dir "/$objdir" 25581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 25591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test ! -f "$dir/$dlname"; then 25601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 25611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 25621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 25631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 25641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo) 25661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Just add the directory containing the .lo file. 25671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$file" "" "." 25681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir="$func_dirname_result" 25691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 25701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 25721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 25731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 25741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 25751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 25761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Get the absolute pathname. 25781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich absdir=`cd "$dir" && pwd` 25791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$absdir" && dir="$absdir" 25801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now add the directory to shlibpath_var. 25821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if eval "test -z \"\$$shlibpath_var\""; then 25831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$shlibpath_var=\"\$dir\"" 25841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 25851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 25861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 25871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 25881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This variable tells wrapper scripts just to set shlibpath_var 25901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # rather than running their programs. 25911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libtool_execute_magic="$magic" 25921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 25931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check if any of the arguments is a wrapper script. 25941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich args= 25951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for file 25961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 25971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $file in 25981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -* | *.la | *.lo ) ;; 25991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 26001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do a test to see if this is really a libtool program. 26011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_ltwrapper_script_p "$file"; then 26021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$file" 26031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Transform arg to wrapped name. 26041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file="$progdir/$program" 26051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif func_ltwrapper_executable_p "$file"; then 26061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_ltwrapper_scriptname "$file" 26071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$func_ltwrapper_scriptname_result" 26081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Transform arg to wrapped name. 26091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file="$progdir/$program" 26101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 26111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 26121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 26131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Quote arguments (to preserve shell metacharacters). 26141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append_quoted args "$file" 26151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 26161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$opt_dry_run" = Xfalse; then 26181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$shlibpath_var"; then 26191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Export the shlibpath_var. 26201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "export $shlibpath_var" 26211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 26221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Restore saved environment variables 26241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 26251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 26261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "if test \"\${save_$lt_var+set}\" = set; then 26271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $lt_var=\$save_$lt_var; export $lt_var 26281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 26291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $lt_unset $lt_var 26301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi" 26311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 26321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now prepare to actually exec the command. 26341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exec_cmd="\$cmd$args" 26351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 26361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Display what would be done. 26371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$shlibpath_var"; then 26381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 26391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "export $shlibpath_var" 26401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 26411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$cmd$args" 26421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 26431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 26441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 26451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtest "$opt_mode" = execute && func_mode_execute ${1+"$@"} 26471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_mode_finish arg... 26501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_mode_finish () 26511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 26521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 26531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libs= 26541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libdirs= 26551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich admincmds= 26561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for opt in "$nonopt" ${1+"$@"} 26581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 26591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -d "$opt"; then 26601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libdirs " $opt" 26611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -f "$opt"; then 26631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_lalib_unsafe_p "$opt"; then 26641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libs " $opt" 26651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 26661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`$opt' is not a valid libtool archive" 26671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 26681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 26701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "invalid argument \`$opt'" 26711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 26721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 26731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$libs"; then 26751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$lt_sysroot"; then 26761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 26771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 26781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 26791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sysroot_cmd= 26801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 26811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove sysroot references 26831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $opt_dry_run; then 26841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $libs; do 26851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "removing references to $lt_sysroot and \`=' prefixes from $lib" 26861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 26871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 26881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmpdir=`func_mktempdir` 26891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $libs; do 26901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 26911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich > $tmpdir/tmp-la 26921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich mv -f $tmpdir/tmp-la $lib 26931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 26941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ${RM}r "$tmpdir" 26951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 26961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 26971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 26981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 26991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for libdir in $libdirs; do 27001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$finish_cmds"; then 27011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do each command in the finish commands. 27021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 27031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich'"$cmd"'"' 27041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$finish_eval"; then 27061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do the single finish_eval. 27071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval cmds=\"$finish_eval\" 27081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || eval "$cmds" || func_append admincmds " 27091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $cmds" 27101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 27121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 27141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Exit here if they wanted silent mode. 27151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_silent && exit $EXIT_SUCCESS 27161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 27171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 27181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "----------------------------------------------------------------------" 27191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "Libraries have been installed in:" 27201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for libdir in $libdirs; do 27211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO " $libdir" 27221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 27231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 27241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "If you ever happen to want to link against installed libraries" 27251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "in a given directory, LIBDIR, you must either use libtool, and" 27261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 27271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "flag during linking and do at least one of the following:" 27281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$shlibpath_var"; then 27291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 27301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo " during execution" 27311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$runpath_var"; then 27331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo " - add LIBDIR to the \`$runpath_var' environment variable" 27341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo " during linking" 27351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_flag_spec"; then 27371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libdir=LIBDIR 27381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval flag=\"$hardcode_libdir_flag_spec\" 27391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 27401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO " - use the \`$flag' linker flag" 27411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$admincmds"; then 27431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO " - have your system administrator run these commands:$admincmds" 27441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f /etc/ld.so.conf; then 27461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 27471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 27491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 27501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "See any operating system documentation about shared libraries for" 27511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 27521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich solaris2.[6789]|solaris2.1[0-9]) 27531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 27541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "pages." 27551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 27561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 27571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "more information, such as the ld(1) and ld.so(8) manual pages." 27581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 27591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 27601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "----------------------------------------------------------------------" 27611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 27631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 27641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 27651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtest "$opt_mode" = finish && func_mode_finish ${1+"$@"} 27661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 27671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 27681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_mode_install arg... 27691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_mode_install () 27701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 27711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 27721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # There may be an optional sh(1) argument at the beginning of 27731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # install_prog (especially on Windows NT). 27741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 27751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Allow the use of GNU shtool's install command. 27761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $nonopt in *shtool*) :;; *) false;; esac; then 27771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Aesthetically quote it. 27781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$nonopt" 27791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich install_prog="$func_quote_for_eval_result " 27801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg=$1 27811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 27821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 27831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich install_prog= 27841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg=$nonopt 27851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 27861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 27871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The real first argument should be the name of the installation program. 27881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Aesthetically quote it. 27891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$arg" 27901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append install_prog "$func_quote_for_eval_result" 27911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich install_shared_prog=$install_prog 27921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $install_prog " in 27931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[\\\ /]cp\ *) install_cp=: ;; 27941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) install_cp=false ;; 27951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 27961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 27971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need to accept at least all the BSD install flags. 27981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dest= 27991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich files= 28001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich opts= 28011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 28021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich install_type= 28031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich isdir=no 28041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich stripme= 28051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich no_mode=: 28061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for arg 28071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 28081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg2= 28091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dest"; then 28101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append files " $dest" 28111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dest=$arg 28121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 28131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 28151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 28161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -d) isdir=yes ;; 28171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -f) 28181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $install_cp; then :; else 28191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=$arg 28201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 28221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -g | -m | -o) 28231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=$arg 28241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 28251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -s) 28261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich stripme=" -s" 28271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 28281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 28291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -*) 28301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 28311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 28321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the previous option needed an argument, then skip it. 28331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$prev"; then 28341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "x$prev" = x-m && test -n "$install_override_mode"; then 28351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg2=$install_override_mode 28361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich no_mode=false 28371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 28391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 28401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dest=$arg 28411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 28421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 28441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 28451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 28461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Aesthetically quote the argument. 28471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$arg" 28481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append install_prog " $func_quote_for_eval_result" 28491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$arg2"; then 28501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$arg2" 28511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append install_shared_prog " $func_quote_for_eval_result" 28531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 28541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 28551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$install_prog" && \ 28561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "you must specify an install program" 28571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 28581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$prev" && \ 28591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "the \`$prev' option requires an argument" 28601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 28611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$install_override_mode" && $no_mode; then 28621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $install_cp; then :; else 28631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$install_override_mode" 28641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append install_shared_prog " -m $func_quote_for_eval_result" 28651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 28681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$files"; then 28691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$dest"; then 28701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "no file or destination specified" 28711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 28721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "you must specify a destination" 28731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 28761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Strip any trailing slash from the destination. 28771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '/' "$dest" 28781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dest=$func_stripname_result 28791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 28801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check to see that the destination is a directory. 28811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -d "$dest" && isdir=yes 28821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$isdir" = yes; then 28831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destdir="$dest" 28841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destname= 28851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 28861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_and_basename "$dest" "" "." 28871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destdir="$func_dirname_result" 28881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destname="$func_basename_result" 28891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 28901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Not a directory, so check to see that there is only one file specified. 28911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $files; shift 28921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$#" -gt 1 && \ 28931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "\`$dest' is not a directory" 28941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 28951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $destdir in 28961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) ;; 28971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 28981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for file in $files; do 28991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $file in 29001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo) ;; 29011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 29021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "\`$destdir' must be an absolute directory name" 29031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 29041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 29051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 29061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 29071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 29081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This variable tells wrapper scripts just to set variables rather 29101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # than running their programs. 29111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libtool_install_magic="$magic" 29121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich staticlibs= 29141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich future_libdirs= 29151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich current_libdirs= 29161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for file in $files; do 29171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do each installation. 29191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $file in 29201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.$libext) 29211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do the static libraries later. 29221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append staticlibs " $file" 29231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 29241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 29261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$file" 29271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=$func_resolve_sysroot_result 29281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check to see that this really is a libtool archive. 29301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lalib_unsafe_p "$file" \ 29311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich || func_fatal_help "\`$file' is not a valid libtool archive" 29321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich library_names= 29341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich old_library= 29351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command= 29361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$file" 29371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add the libdir to current_libdirs if it is the destination. 29391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$destdir" = "X$libdir"; then 29401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$current_libdirs " in 29411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 29421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append current_libdirs " $libdir" ;; 29431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 29441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 29451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Note the libdir as a future libdir. 29461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$future_libdirs " in 29471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 29481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append future_libdirs " $libdir" ;; 29491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 29501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 29511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$file" "/" "" 29531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir="$func_dirname_result" 29541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dir "$objdir" 29551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$relink_command"; then 29571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Determine the prefix the user has applied to our future dir. 29581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 29591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Don't allow the user to place us outside of our expected 29611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # location b/c this prevents finding dependent libraries that 29621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # are installed to the same prefix. 29631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # At present, this check doesn't affect windows .dll's that 29641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # are installed into $libdir/../bin (currently, that works fine) 29651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # but it's something to keep an eye on. 29661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$inst_prefix_dir" = "$destdir" && \ 29671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 29681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$inst_prefix_dir"; then 29701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Stick the inst_prefix_dir data into the link command. 29711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 29721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 29731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 29741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 29751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "relinking \`$file'" 29771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$relink_command" \ 29781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 29791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 29801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # See the names of the shared library. 29821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $library_names; shift 29831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$1"; then 29841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich realname="$1" 29851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 29861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich srcname="$realname" 29881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$relink_command" && srcname="$realname"T 29891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 29901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Install the shared library and build the symlinks. 29911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 29921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 'exit $?' 29931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tstripme="$stripme" 29941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host_os in 29951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cygwin* | mingw* | pw32* | cegcc*) 29961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $realname in 29971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.dll.a) 29981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tstripme="" 29991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 30001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 30011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 30021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 30031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$tstripme" && test -n "$striplib"; then 30041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$striplib $destdir/$realname" 'exit $?' 30051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 30061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$#" -gt 0; then 30081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Delete the old symlinks, and create new ones. 30091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Try `ln -sf' first, because the `ln' binary might depend on 30101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the symlink we replace! Solaris /bin/ln does not understand -f, 30111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # so we also need to try rm && ln -s. 30121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for linkname 30131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 30141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$linkname" != "$realname" \ 30151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 30161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 30171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 30181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do each command in the postinstall commands. 30201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib="$destdir/$realname" 30211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$postinstall_cmds" 'exit $?' 30221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 30231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Install the pseudo-library for information purposes. 30251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$file" 30261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name="$func_basename_result" 30271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich instname="$dir/$name"i 30281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 30291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Maybe install the static library, too. 30311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$old_library" && func_append staticlibs " $dir/$old_library" 30321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 30331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo) 30351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Install (i.e. copy) a libtool object. 30361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Figure out destination file name, if it wasn't already specified. 30381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$destname"; then 30391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destfile="$destdir/$destname" 30401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 30411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$file" 30421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destfile="$func_basename_result" 30431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destfile="$destdir/$destfile" 30441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 30451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Deduce the name of the destination old-style object file. 30471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $destfile in 30481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo) 30491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lo2o "$destfile" 30501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich staticdest=$func_lo2o_result 30511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 30521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.$objext) 30531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich staticdest="$destfile" 30541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destfile= 30551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 30561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 30571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "cannot copy a libtool object to \`$destfile'" 30581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 30591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 30601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Install the libtool object if requested. 30621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$destfile" && \ 30631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$install_prog $file $destfile" 'exit $?' 30641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Install the old object if enabled. 30661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_old_libs" = yes; then 30671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Deduce the name of the old-style object file. 30681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lo2o "$file" 30691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich staticobj=$func_lo2o_result 30701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 30711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 30721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 30731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 30741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 30761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Figure out destination file name, if it wasn't already specified. 30771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$destname"; then 30781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destfile="$destdir/$destname" 30791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 30801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$file" 30811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destfile="$func_basename_result" 30821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destfile="$destdir/$destfile" 30831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 30841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the file is missing, and there is a .exe on the end, strip it 30861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # because it is most likely a libtool script we actually want to 30871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # install 30881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich stripped_ext="" 30891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $file in 30901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.exe) 30911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test ! -f "$file"; then 30921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '.exe' "$file" 30931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=$func_stripname_result 30941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich stripped_ext=".exe" 30951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 30961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 30971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 30981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 30991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do a test to see if this is really a libtool program. 31001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 31011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw*) 31021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_ltwrapper_executable_p "$file"; then 31031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_ltwrapper_scriptname "$file" 31041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich wrapper=$func_ltwrapper_scriptname_result 31051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 31061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '.exe' "$file" 31071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich wrapper=$func_stripname_result 31081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 31091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 31101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 31111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich wrapper=$file 31121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 31131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 31141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_ltwrapper_script_p "$wrapper"; then 31151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich notinst_deplibs= 31161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command= 31171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 31181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$wrapper" 31191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 31201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check the variables that should have been set. 31211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$generated_by_libtool_version" && \ 31221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "invalid libtool wrapper script \`$wrapper'" 31231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 31241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize=yes 31251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $notinst_deplibs; do 31261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check to see that each library is installed. 31271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libdir= 31281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$lib"; then 31291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$lib" 31301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 31311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 31321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$libdir" && test ! -f "$libfile"; then 31331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`$lib' has not been installed in \`$libdir'" 31341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize=no 31351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 31361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 31371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 31381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command= 31391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$wrapper" 31401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 31411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich outputname= 31421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$fast_install" = no && test -n "$relink_command"; then 31431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 31441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$finalize" = yes; then 31451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmpdir=`func_mktempdir` 31461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$file$stripped_ext" 31471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file="$func_basename_result" 31481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich outputname="$tmpdir/$file" 31491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Replace the output file specification. 31501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 31511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 31521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_silent || { 31531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_expand "$relink_command" 31541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "func_echo $func_quote_for_expand_result" 31551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 31561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if eval "$relink_command"; then : 31571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 31581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "error: relink \`$file' with the above command before installing it" 31591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || ${RM}r "$tmpdir" 31601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 31611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 31621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file="$outputname" 31631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 31641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "cannot relink \`$file'" 31651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 31661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 31671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 31681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Install the binary that we compiled earlier. 31691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 31701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 31711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 31721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 31731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # remove .exe since cygwin /usr/bin/install will append another 31741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # one anyway 31751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $install_prog,$host in 31761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich */usr/bin/install*,*cygwin*) 31771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $file:$destfile in 31781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.exe:*.exe) 31791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # this is ok 31801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 31811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.exe:*) 31821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destfile=$destfile.exe 31831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 31841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *:*.exe) 31851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '.exe' "$destfile" 31861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destfile=$func_stripname_result 31871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 31881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 31891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 31901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 31911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 31921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || if test -n "$outputname"; then 31931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ${RM}r "$tmpdir" 31941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 31951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 31961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 31971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 31981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 31991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for file in $staticlibs; do 32001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$file" 32011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name="$func_basename_result" 32021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Set up the ranlib parameters. 32041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldlib="$destdir/$name" 32051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 32061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tool_oldlib=$func_to_tool_file_result 32071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 32091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$stripme" && test -n "$old_striplib"; then 32111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$old_striplib $tool_oldlib" 'exit $?' 32121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 32131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do each command in the postinstall commands. 32151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$old_postinstall_cmds" 'exit $?' 32161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 32171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$future_libdirs" && \ 32191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "remember to run \`$progname --finish$future_libdirs'" 32201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$current_libdirs"; then 32221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Maybe just do a dry run. 32231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run && current_libdirs=" -n$current_libdirs" 32241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 32251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 32261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 32271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 32281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 32291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtest "$opt_mode" = install && func_mode_install ${1+"$@"} 32311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_generate_dlsyms outputname originator pic_p 32341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Extract symbols from dlprefiles and create ${outputname}S.o with 32351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# a dlpreopen symbol table. 32361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_generate_dlsyms () 32371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 32381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 32391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_outputname="$1" 32401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_originator="$2" 32411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_pic_p="${3-no}" 32421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 32431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_dlsyms= 32441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 32461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$NM" && test -n "$global_symbol_pipe"; then 32471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_dlsyms="${my_outputname}S.c" 32481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 32491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "not configured to extract global symbols from dlpreopened files" 32501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 32511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 32521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$my_dlsyms"; then 32541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $my_dlsyms in 32551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "") ;; 32561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.c) 32571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Discover the nlist of each of the dlfiles. 32581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nlist="$output_objdir/${my_outputname}.nm" 32591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 32611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Parse the name list into a source file. 32631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "creating $output_objdir/$my_dlsyms" 32641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 32661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 32671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 32681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifdef __cplusplus 32701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichextern \"C\" { 32711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 32721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 32741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 32751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 32761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 32781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 32791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* DATA imports from DLLs on WIN32 con't be const, because runtime 32801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relocations are performed -- see ld's documentation on pseudo-relocs. */ 32811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define LT_DLSYM_CONST 32821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#elif defined(__osf__) 32831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* This system does not cope well with relocations in const data. */ 32841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define LT_DLSYM_CONST 32851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#else 32861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define LT_DLSYM_CONST const 32871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 32881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* External symbol declarations for the compiler. */\ 32901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 32911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$dlself" = yes; then 32931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "generating symbol list for \`$output'" 32941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 32961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 32971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add our own program objects to the symbol list. 32981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 32991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for progfile in $progfiles; do 33001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$progfile" func_convert_file_msys_to_w32 33011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" 33021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 33031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 33041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 33051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$exclude_expsyms"; then 33061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 33071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 33081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$MV "$nlist"T "$nlist"' 33091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 33101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 33111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 33121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols_regex"; then 33131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 33141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 33151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$MV "$nlist"T "$nlist"' 33161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 33171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 33181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 33191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Prepare the list of exported symbols 33201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$export_symbols"; then 33211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols="$output_objdir/$outputname.exp" 33221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 33231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM $export_symbols 33241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 33251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 33261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw* | *cegcc* ) 33271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 33281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 33291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 33301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 33311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 33321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 33331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 33341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 33351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 33361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$MV "$nlist"T "$nlist"' 33371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 33381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw* | *cegcc* ) 33391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 33401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 33411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 33421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 33431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 33441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 33451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 33461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 33471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for dlprefile in $dlprefiles; do 33481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "extracting global C symbols from \`$dlprefile'" 33491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$dlprefile" 33501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name="$func_basename_result" 33511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 33521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw* | *cegcc* ) 33531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # if an import library, we need to obtain dlname 33541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_win32_import_lib_p "$dlprefile"; then 33551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_tr_sh "$dlprefile" 33561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "curr_lafile=\$libfile_$func_tr_sh_result" 33571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlprefile_dlbasename="" 33581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 33591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Use subshell, to avoid clobbering current variable values 33601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 33611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dlprefile_dlname" ; then 33621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$dlprefile_dlname" 33631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlprefile_dlbasename="$func_basename_result" 33641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 33651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # no lafile. user explicitly requested -dlpreopen <import library>. 33661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $sharedlib_from_linklib_cmd "$dlprefile" 33671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlprefile_dlbasename=$sharedlib_from_linklib_result 33681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 33691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 33701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 33711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dlprefile_dlbasename" ; then 33721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 33731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 33741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "Could not compute DLL name from $name" 33751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$ECHO ": $name " >> "$nlist"' 33761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 33771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 33791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 33801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 33811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else # not an import lib 33821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 33831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$ECHO ": $name " >> "$nlist"' 33841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 33861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 33871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 33881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 33891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 33901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 33911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval '$ECHO ": $name " >> "$nlist"' 33921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 33931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 33941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 33951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 33961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 33971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 33981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 33991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 34001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make sure we have at least an empty file. 34011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -f "$nlist" || : > "$nlist" 34021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$exclude_expsyms"; then 34041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 34051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $MV "$nlist"T "$nlist" 34061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 34071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Try sorting and uniquifying the output. 34091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $GREP -v "^: " < "$nlist" | 34101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if sort -k 3 </dev/null >/dev/null 2>&1; then 34111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sort -k 3 34121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 34131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sort +2 34141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi | 34151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich uniq > "$nlist"S; then 34161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich : 34171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 34181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $GREP -v "^: " < "$nlist" > "$nlist"S 34191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 34201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$nlist"S; then 34221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 34231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 34241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 34251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 34261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo >> "$output_objdir/$my_dlsyms" "\ 34281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* The mapping between symbol names and symbols. */ 34301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtypedef struct { 34311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich const char *name; 34321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich void *address; 34331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} lt_dlsymlist; 34341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichextern LT_DLSYM_CONST lt_dlsymlist 34351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_${my_prefix}_LTX_preloaded_symbols[]; 34361d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichLT_DLSYM_CONST lt_dlsymlist 34371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_${my_prefix}_LTX_preloaded_symbols[] = 34381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{\ 34391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { \"$my_originator\", (void *) 0 }," 34401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $need_lib_prefix in 34421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich no) 34431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 34441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 34451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 34461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 34471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 34481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 34491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo >> "$output_objdir/$my_dlsyms" "\ 34501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich {0, (void *) 0} 34511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich}; 34521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* This works around a problem in FreeBSD linker */ 34541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifdef FREEBSD_WORKAROUND 34551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic const void *lt_preloaded_setup() { 34561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return lt_${my_prefix}_LTX_preloaded_symbols; 34571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 34581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 34591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifdef __cplusplus 34611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 34621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif\ 34631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 34641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } # !$opt_dry_run 34651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_flag_for_symtable= 34671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$compile_command " in 34681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" -static "*) ;; 34691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 34701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 34711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # compiling the symbol table file with pic_flag works around 34721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # a FreeBSD bug that causes programs to crash when -lm is 34731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # linked before any other PIC object. But we must not use 34741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # pic_flag when linking with -static. The problem exists in 34751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 34761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 34771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 34781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-hpux*) 34791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_flag_for_symtable=" $pic_flag" ;; 34801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 34811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$my_pic_p" != Xno; then 34821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_flag_for_symtable=" $pic_flag" 34831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 34841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 34851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 34861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 34871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 34881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich symtab_cflags= 34891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for arg in $LTCFLAGS; do 34901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 34911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -pie | -fpie | -fPIE) ;; 34921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append symtab_cflags " $arg" ;; 34931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 34941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 34951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now compile the dynamic symbol file. 34971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 34981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 34991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Clean up the generated files. 35001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 35011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 35021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Transform the symbol file into the correct name. 35031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich symfileobj="$output_objdir/${my_outputname}S.$objext" 35041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 35051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw* | *cegcc* ) 35061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$output_objdir/$my_outputname.def"; then 35071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 35081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 35091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 35101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 35131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 35141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 35151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 35171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 35181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 35191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 35201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 35211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "unknown suffix for \`$my_dlsyms'" 35221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 35231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 35241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 35251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We keep going just in case the user didn't refer to 35261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 35271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # really was required. 35281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 35291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Nullify the symbol file. 35301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 35311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 35321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 35331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 35341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 35351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_win32_libid arg 35361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# return the library type of file 'arg' 35371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 35381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Need a lot of goo to handle *both* DLLs and import libs 35391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Has to be a shell function in order to 'eat' the argument 35401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# that is supplied when $file_magic_command is called. 35411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Despite the name, also deal with 64 bit binaries. 35421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_win32_libid () 35431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 35441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 35451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich win32_libid_type="unknown" 35461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich win32_fileres=`file -L $1 2>/dev/null` 35471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $win32_fileres in 35481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *ar\ archive\ import\ library*) # definitely import 35491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich win32_libid_type="x86 archive import" 35501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 35511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *ar\ archive*) # could be an import, or static 35521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 35531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 35541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 35551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$1" func_convert_file_msys_to_w32 35561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 35571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -n -e ' 35581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 1,100{ 35591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich / I /{ 35601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s,.*,import, 35611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p 35621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich q 35631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 35641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich }'` 35651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $win32_nmres in 35661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich import*) win32_libid_type="x86 archive import";; 35671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) win32_libid_type="x86 archive static";; 35681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 35691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 35701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 35711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *DLL*) 35721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich win32_libid_type="x86 DLL" 35731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 35741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *executable*) # but shell scripts are "executable" too... 35751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $win32_fileres in 35761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *MS\ Windows\ PE\ Intel*) 35771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich win32_libid_type="x86 DLL" 35781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 35791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 35801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 35811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 35821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$win32_libid_type" 35831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 35841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 35851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_cygming_dll_for_implib ARG 35861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 35871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Platform-specific function to extract the 35881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# name of the DLL associated with the specified 35891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# import library ARG. 35901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Invoked by eval'ing the libtool variable 35911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $sharedlib_from_linklib_cmd 35921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Result is available in the variable 35931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $sharedlib_from_linklib_result 35941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_cygming_dll_for_implib () 35951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 35961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 35971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 35981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 35991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 36001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 36011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 36021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# The is the core of a fallback implementation of a 36031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# platform-specific function to extract the name of the 36041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# DLL associated with the specified import library LIBNAME. 36051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 36061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# SECTION_NAME is either .idata$6 or .idata$7, depending 36071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# on the platform and compiler that created the implib. 36081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 36091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Echos the name of the DLL associated with the 36101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# specified import library. 36111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_cygming_dll_for_implib_fallback_core () 36121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 36131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 36141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 36151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 36161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED '/^Contents of section '"$match_literal"':/{ 36171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Place marker at beginning of archive member dllname section 36181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/.*/====MARK====/ 36191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p 36201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich d 36211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 36221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # These lines can sometimes be longer than 43 characters, but 36231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # are always uninteresting 36241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /:[ ]*file format pe[i]\{,1\}-/d 36251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /^In archive [^:]*:/d 36261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Ensure marker is printed 36271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /^====MARK====/p 36281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove all lines with less than 43 characters 36291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /^.\{43\}/!d 36301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # From remaining lines, remove first 43 characters 36311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^.\{43\}//' | 36321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -n ' 36331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Join marker and all lines until next marker into a single line 36341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /^====MARK====/ b para 36351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich H 36361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ b para 36371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich b 36381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich :para 36391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich x 36401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/\n//g 36411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove the marker 36421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/^====MARK====// 36431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove trailing dots and whitespace 36441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich s/[\. \t]*$// 36451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Print 36461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /./p' | 36471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # we now have a list, one entry per line, of the stringified 36481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # contents of the appropriate section of all members of the 36491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # archive which possess that section. Heuristic: eliminate 36501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # all those which have a first or second character that is 36511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # a '.' (that is, objdump's representation of an unprintable 36521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # character.) This should work for all archives with less than 36531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # 0x302f exports -- but will fail for DLLs whose name actually 36541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # begins with a literal '.' or a single character followed by 36551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # a '.'. 36561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # 36571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Of those that remain, print the first one. 36581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -e '/^\./d;/^.\./d;q' 36591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 36601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 36611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_cygming_gnu_implib_p ARG 36621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This predicate returns with zero status (TRUE) if 36631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ARG is a GNU/binutils-style import library. Returns 36641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# with nonzero status (FALSE) otherwise. 36651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_cygming_gnu_implib_p () 36661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 36671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 36681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$1" func_convert_file_msys_to_w32 36691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 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)$'` 36701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$func_cygming_gnu_implib_tmp" 36711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 36721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 36731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_cygming_ms_implib_p ARG 36741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This predicate returns with zero status (TRUE) if 36751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ARG is an MS-style import library. Returns 36761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# with nonzero status (FALSE) otherwise. 36771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_cygming_ms_implib_p () 36781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 36791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 36801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$1" func_convert_file_msys_to_w32 36811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 36821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$func_cygming_ms_implib_tmp" 36831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 36841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 36851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_cygming_dll_for_implib_fallback ARG 36861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Platform-specific function to extract the 36871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# name of the DLL associated with the specified 36881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# import library ARG. 36891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 36901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This fallback implementation is for use when $DLLTOOL 36911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# does not support the --identify-strict option. 36921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Invoked by eval'ing the libtool variable 36931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $sharedlib_from_linklib_cmd 36941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Result is available in the variable 36951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $sharedlib_from_linklib_result 36961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_cygming_dll_for_implib_fallback () 36971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 36981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 36991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_cygming_gnu_implib_p "$1" ; then 37001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # binutils import library 37011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 37021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif func_cygming_ms_implib_p "$1" ; then 37031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # ms-generated import library 37041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 37051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 37061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # unknown 37071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sharedlib_from_linklib_result="" 37081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 37091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 37101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 37111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 37121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_extract_an_archive dir oldlib 37131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_extract_an_archive () 37141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 37151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 37161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich f_ex_an_ar_dir="$1"; shift 37171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich f_ex_an_ar_oldlib="$1" 37181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$lock_old_archive_extraction" = yes; then 37191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lockfile=$f_ex_an_ar_oldlib.lock 37201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 37211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_echo "Waiting for $lockfile to be removed" 37221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sleep 2 37231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 37241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 37251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 37261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 'stat=$?; rm -f "$lockfile"; exit $stat' 37271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$lock_old_archive_extraction" = yes; then 37281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || rm -f "$lockfile" 37291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 37301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 37311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich : 37321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 37331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 37341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 37351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 37361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 37371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 37381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_extract_archives gentop oldlib ... 37391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_extract_archives () 37401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 37411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 37421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_gentop="$1"; shift 37431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_oldlibs=${1+"$@"} 37441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_oldobjs="" 37451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_xlib="" 37461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_xabs="" 37471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_xdir="" 37481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 37491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for my_xlib in $my_oldlibs; do 37501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Extract the objects. 37511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $my_xlib in 37521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 37531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) my_xabs=`pwd`"/$my_xlib" ;; 37541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 37551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$my_xlib" 37561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_xlib="$func_basename_result" 37571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_xlib_u=$my_xlib 37581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while :; do 37591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $extracted_archives " in 37601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $my_xlib_u "*) 37611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $extracted_serial + 1 37621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich extracted_serial=$func_arith_result 37631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_xlib_u=lt$extracted_serial-$my_xlib ;; 37641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) break ;; 37651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 37661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 37671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich extracted_archives="$extracted_archives $my_xlib_u" 37681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_xdir="$my_gentop/$my_xlib_u" 37691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 37701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mkdir_p "$my_xdir" 37711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 37721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 37731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-darwin*) 37741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "Extracting $my_xabs" 37751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do not bother doing anything if just a dry run 37761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 37771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_orig_dir=`pwd` 37781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cd $my_xdir || exit $? 37791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_archive=$my_xabs 37801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_curdir=`pwd` 37811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_base_archive=`basename "$darwin_archive"` 37821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 37831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$darwin_arches"; then 37841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 37851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_arch= 37861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 37871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for darwin_arch in $darwin_arches ; do 37881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 37891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 37901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 37911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_extract_an_archive "`pwd`" "${darwin_base_archive}" 37921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cd "$darwin_curdir" 37931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 37941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # $darwin_arches 37951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ## Okay now we've a bunch of thin objects, gotta fatten them up :) 37961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 37971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_file= 37981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_files= 37991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for darwin_file in $darwin_filelist; do 38001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 38011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $LIPO -create -output "$darwin_file" $darwin_files 38021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # $darwin_filelist 38031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM -rf unfat-$$ 38041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cd "$darwin_orig_dir" 38051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 38061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cd $darwin_orig_dir 38071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_extract_an_archive "$my_xdir" "$my_xabs" 38081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # $darwin_arches 38091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } # !$opt_dry_run 38101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 38111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 38121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_extract_an_archive "$my_xdir" "$my_xabs" 38131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 38141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 38151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 38161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 38171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_extract_archives_result="$my_oldobjs" 38191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 38201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_emit_wrapper [arg=no] 38231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 38241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Emit a libtool wrapper script on stdout. 38251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Don't directly open a file because we may want to 38261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# incorporate the script contents within a cygwin/mingw 38271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# wrapper executable. Must ONLY be called from within 38281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_mode_link because it depends on a number of variables 38291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# set therein. 38301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 38311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 38321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# variable will take. If 'yes', then the emitted script 38331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# will assume that the directory in which it is stored is 38341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# the $objdir directory. This is a cygwin/mingw-specific 38351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# behavior. 38361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_emit_wrapper () 38371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 38381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_emit_wrapper_arg1=${1-no} 38391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 38411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#! $SHELL 38421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $output - temporary wrapper script for $objdir/$outputname 38441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 38451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 38461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# The $output program cannot be directly executed until all the libtool 38471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# libraries that it depends on are installed. 38481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 38491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This wrapper script should never be moved out of the build directory. 38501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# If it is, it will not operate correctly. 38511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Sed substitution that helps us do robust quoting. It backslashifies 38531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# metacharacters that are still active within double-quoted strings. 38541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichsed_quote_subst='$sed_quote_subst' 38551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Be Bourne compatible 38571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 38581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich emulate sh 38591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich NULLCMD=: 38601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 38611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # is contrary to our usage. Disable this feature. 38621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich alias -g '\${1+\"\$@\"}'='\"\$@\"' 38631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich setopt NO_GLOB_SUBST 38641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichelse 38651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 38661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfi 38671d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichBIN_SH=xpg4; export BIN_SH # for Tru64 38681d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichDUALCASE=1; export DUALCASE # for MKS sh 38691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# The HP-UX ksh and POSIX shell print the target directory to stdout 38711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# if CDPATH is set. 38721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 38731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichrelink_command=\"$relink_command\" 38751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# This environment variable determines our operation mode. 38771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichif test \"\$libtool_install_magic\" = \"$magic\"; then 38781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # install mode needs the following variables: 38791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich generated_by_libtool_version='$macro_version' 38801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich notinst_deplibs='$notinst_deplibs' 38811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichelse 38821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # When we are sourced in execute mode, \$file and \$ECHO are already set. 38831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test \"\$libtool_execute_magic\" != \"$magic\"; then 38841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=\"\$0\"" 38851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 38871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 38881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# A function that is used when there is no print builtin or printf. 38901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_fallback_echo () 38911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 38921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval 'cat <<_LTECHO_EOF 38931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich\$1 38941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich_LTECHO_EOF' 38951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 38961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ECHO=\"$qECHO\" 38971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 38981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 38991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Very basic option parsing. These options are (a) specific to 39001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# the libtool wrapper, (b) are identical between the wrapper 39011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# /script/ and the wrapper /executable/ which is used only on 39021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# windows platforms, and (c) all begin with the string "--lt-" 39031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# (application programs are unlikely to have options which match 39041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# this pattern). 39051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 39061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# There are only two supported options: --lt-debug and 39071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# --lt-dump-script. There is, deliberately, no --lt-help. 39081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 39091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# The first argument to this parsing function should be the 39101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# script's $0 value, followed by "$@". 39111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_option_debug= 39121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_parse_lt_options () 39131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 39141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_script_arg0=\$0 39151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 39161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lt_opt 39171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 39181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case \"\$lt_opt\" in 39191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --lt-debug) lt_option_debug=1 ;; 39201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --lt-dump-script) 39211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 39221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 39231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 39241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat \"\$lt_dump_D/\$lt_dump_F\" 39251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit 0 39261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 39271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --lt-*) 39281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 39291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit 1 39301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 39311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 39321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 39331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 39341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Print the debug banner immediately: 39351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n \"\$lt_option_debug\"; then 39361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 39371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 39381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 39391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 39401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Used when --lt-debug. Prints its arguments to stdout 39411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# (redirection is the responsibility of the caller) 39421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_lt_dump_args () 39431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 39441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_dump_args_N=1; 39451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lt_arg 39461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 39471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 39481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 39491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 39501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 39511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 39521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Core function for launching the target application 39531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_exec_program_core () 39541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 39551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 39561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 39571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Backslashes separate directories on plain windows 39581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-mingw | *-*-os2* | *-cegcc*) 39591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 39601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n \"\$lt_option_debug\"; then 39611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 39621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lt_dump_args \${1+\"\$@\"} 1>&2 39631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 39641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 39651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 39661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 39671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 39681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 39691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 39701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n \"\$lt_option_debug\"; then 39711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 39721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lt_dump_args \${1+\"\$@\"} 1>&2 39731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 39741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exec \"\$progdir/\$program\" \${1+\"\$@\"} 39751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 39761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 39771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 39781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 39791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 39801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit 1 39811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 39821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 39831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# A function to encapsulate launching the target application 39841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Strips options in the --lt-* namespace from \$@ and 39851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# launches target application with the remaining arguments. 39861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_exec_program () 39871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 39881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case \" \$* \" in 39891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *\\ --lt-*) 39901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lt_wr_arg 39911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 39921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case \$lt_wr_arg in 39931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich --lt-*) ;; 39941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 39951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 39961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 39971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done ;; 39981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 39991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_exec_program_core \${1+\"\$@\"} 40001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 40011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Parse options 40031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_parse_lt_options \"\$0\" \${1+\"\$@\"} 40041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Find the directory that this script lives in. 40061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 40071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test \"x\$thisdir\" = \"x\$file\" && thisdir=. 40081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Follow symbolic links until we get to the real thisdir. 40101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 40111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while test -n \"\$file\"; do 40121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 40131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If there was a directory component, then change thisdir. 40151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test \"x\$destdir\" != \"x\$file\"; then 40161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case \"\$destdir\" in 40171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 40181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) thisdir=\"\$thisdir/\$destdir\" ;; 40191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 40201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 40211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 40231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 40241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 40251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Usually 'no', except on cygwin/mingw when embedded into 40271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the cwrapper. 40281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 40291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 40301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # special case for '.' 40311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test \"\$thisdir\" = \".\"; then 40321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich thisdir=\`pwd\` 40331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 40341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # remove .libs from thisdir 40351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case \"\$thisdir\" in 40361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 40371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $objdir ) thisdir=. ;; 40381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 40391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 40401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Try to get the absolute directory name. 40421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich absdir=\`cd \"\$thisdir\" && pwd\` 40431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n \"\$absdir\" && thisdir=\"\$absdir\" 40441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 40451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$fast_install" = yes; then 40471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 40481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich program=lt-'$outputname'$exeext 40491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich progdir=\"\$thisdir/$objdir\" 40501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test ! -f \"\$progdir/\$program\" || 40521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 40531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test \"X\$file\" != \"X\$progdir/\$program\"; }; then 40541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=\"\$\$-\$program\" 40561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test ! -d \"\$progdir\"; then 40581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $MKDIR \"\$progdir\" 40591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 40601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM \"\$progdir/\$file\" 40611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi" 40621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 40641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # relink executable if necessary 40661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n \"\$relink_command\"; then 40671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if relink_command_output=\`eval \$relink_command 2>&1\`; then : 40681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 40691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO \"\$relink_command_output\" >&2 40701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM \"\$progdir/\$file\" 40711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit 1 40721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 40731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 40741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 40761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { $RM \"\$progdir/\$program\"; 40771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 40781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM \"\$progdir/\$file\" 40791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi" 40801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 40811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 40821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich program='$outputname' 40831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich progdir=\"\$thisdir/$objdir\" 40841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 40851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 40861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 40881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f \"\$progdir/\$program\"; then" 40901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 40911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # fixup the dll searchpath if we need to. 40921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # 40931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Fix the DLL searchpath if we need to. Do this before prepending 40941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # to shlibpath, because on Windows, both are PATH and uninstalled 40951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # libraries must come first. 40961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dllsearchpath"; then 40971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 40981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add the dll search path components to the executable PATH 40991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich PATH=$dllsearchpath:\$PATH 41001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 41011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 41021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Export our shlibpath_var if we have one. 41041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 41051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 41061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add our own library path to $shlibpath_var 41071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 41081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Some systems cannot cope with colon-terminated $shlibpath_var 41101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The second colon is a workaround for a bug in BeOS R4 sed 41111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 41121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export $shlibpath_var 41141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 41151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 41161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "\ 41181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test \"\$libtool_execute_magic\" != \"$magic\"; then 41191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Run the actual program with our arguments. 41201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_exec_program \${1+\"\$@\"} 41211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 41221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 41231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The program doesn't exist. 41241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 41251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 41261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 41271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit 1 41281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 41291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfi\ 41301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich" 41311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 41321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_emit_cwrapperexe_src 41351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# emit the source code for a wrapper executable on stdout 41361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Must ONLY be called from within func_mode_link because 41371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# it depends on a number of variable set therein. 41381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_emit_cwrapperexe_src () 41391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 41401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<EOF 41411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 41431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 41441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich The $output program cannot be directly executed until all the libtool 41461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libraries that it depends on are installed. 41471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich This wrapper executable should never be moved out of the build directory. 41491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich If it is, it will not operate correctly. 41501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich*/ 41511d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 41521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 41531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifdef _MSC_VER 41541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define _CRT_SECURE_NO_DEPRECATE 1 41551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 41561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <stdio.h> 41571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <stdlib.h> 41581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifdef _MSC_VER 41591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# include <direct.h> 41601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# include <process.h> 41611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# include <io.h> 41621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#else 41631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# include <unistd.h> 41641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# include <stdint.h> 41651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ifdef __CYGWIN__ 41661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# include <io.h> 41671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# endif 41681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 41691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <malloc.h> 41701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <stdarg.h> 41711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <assert.h> 41721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <string.h> 41731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <ctype.h> 41741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <errno.h> 41751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <fcntl.h> 41761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#include <sys/stat.h> 41771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* declarations of non-ANSI functions */ 41791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined(__MINGW32__) 41801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ifdef __STRICT_ANSI__ 41811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichint _putenv (const char *); 41821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# endif 41831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#elif defined(__CYGWIN__) 41841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ifdef __STRICT_ANSI__ 41851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar *realpath (const char *, char *); 41861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichint putenv (char *); 41871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichint setenv (const char *, const char *, int); 41881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# endif 41891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* #elif defined (other platforms) ... */ 41901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 41911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 41921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* portability defines, excluding path handling macros */ 41931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined(_MSC_VER) 41941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define setmode _setmode 41951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define stat _stat 41961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define chmod _chmod 41971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define getcwd _getcwd 41981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define putenv _putenv 41991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define S_IXUSR _S_IEXEC 42001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ifndef _INTPTR_T_DEFINED 42011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define _INTPTR_T_DEFINED 42021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define intptr_t int 42031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# endif 42041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#elif defined(__MINGW32__) 42051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define setmode _setmode 42061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define stat _stat 42071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define chmod _chmod 42081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define getcwd _getcwd 42091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define putenv _putenv 42101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#elif defined(__CYGWIN__) 42111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define HAVE_SETENV 42121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define FOPEN_WB "wb" 42131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* #elif defined (other platforms) ... */ 42141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 42151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined(PATH_MAX) 42171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define LT_PATHMAX PATH_MAX 42181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#elif defined(MAXPATHLEN) 42191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define LT_PATHMAX MAXPATHLEN 42201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#else 42211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define LT_PATHMAX 1024 42221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 42231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifndef S_IXOTH 42251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define S_IXOTH 0 42261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 42271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifndef S_IXGRP 42281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define S_IXGRP 0 42291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 42301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* path handling portability macros */ 42321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifndef DIR_SEPARATOR 42331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define DIR_SEPARATOR '/' 42341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define PATH_SEPARATOR ':' 42351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 42361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 42381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich defined (__OS2__) 42391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define HAVE_DOS_BASED_FILE_SYSTEM 42401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define FOPEN_WB "wb" 42411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ifndef DIR_SEPARATOR_2 42421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define DIR_SEPARATOR_2 '\\' 42431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# endif 42441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ifndef PATH_SEPARATOR_2 42451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define PATH_SEPARATOR_2 ';' 42461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# endif 42471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 42481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifndef DIR_SEPARATOR_2 42501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 42511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#else /* DIR_SEPARATOR_2 */ 42521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define IS_DIR_SEPARATOR(ch) \ 42531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 42541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif /* DIR_SEPARATOR_2 */ 42551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifndef PATH_SEPARATOR_2 42571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 42581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#else /* PATH_SEPARATOR_2 */ 42591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 42601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif /* PATH_SEPARATOR_2 */ 42611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifndef FOPEN_WB 42631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define FOPEN_WB "w" 42641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 42651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifndef _O_BINARY 42661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# define _O_BINARY 0 42671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 42681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 42701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#define XFREE(stale) do { \ 42711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (stale) { free ((void *) stale); stale = 0; } \ 42721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} while (0) 42731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined(LT_DEBUGWRAPPER) 42751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic int lt_debug = 1; 42761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#else 42771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic int lt_debug = 0; 42781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 42791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 42811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 42821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid *xmalloc (size_t num); 42831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar *xstrdup (const char *string); 42841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char *base_name (const char *name); 42851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar *find_executable (const char *wrapper); 42861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar *chase_symlinks (const char *pathspec); 42871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichint make_executable (const char *path); 42881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichint check_executable (const char *path); 42891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar *strendzap (char *str, const char *pat); 42901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 42911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid lt_fatal (const char *file, int line, const char *message, ...); 42921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic const char *nonnull (const char *s); 42931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic const char *nonempty (const char *s); 42941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid lt_setenv (const char *name, const char *value); 42951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 42961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid lt_update_exe_path (const char *name, const char *value); 42971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid lt_update_lib_path (const char *name, const char *value); 42981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar **prepare_spawn (char **argv); 42991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid lt_dump_script (FILE *f); 43001d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 43011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<EOF 43031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvolatile const char * MAGIC_EXE = "$magic_exe"; 43041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 43051d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 43061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 43081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path "$temp_rpath" 43091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<EOF 43101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * LIB_PATH_VALUE = "$func_to_host_path_result"; 43111d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 43121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 43131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 43141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * LIB_PATH_VALUE = ""; 43151d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 43161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 43171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dllsearchpath"; then 43191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_host_path "$dllsearchpath:" 43201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<EOF 43211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * EXE_PATH_VARNAME = "PATH"; 43221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * EXE_PATH_VALUE = "$func_to_host_path_result"; 43231d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 43241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 43251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 43261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * EXE_PATH_VARNAME = ""; 43271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * EXE_PATH_VALUE = ""; 43281d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 43291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 43301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$fast_install" = yes; then 43321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<EOF 43331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 43341d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 43351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 43361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<EOF 43371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 43381d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 43391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 43401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 43431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#define LTWRAPPER_OPTION_PREFIX "--lt-" 43451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 43471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 43481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 43491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichint 43511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichmain (int argc, char *argv[]) 43521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 43531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char **newargz; 43541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int newargc; 43551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *tmp_pathspec; 43561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *actual_cwrapper_path; 43571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *actual_cwrapper_name; 43581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *target_name; 43591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *lt_argv_zero; 43601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich intptr_t rval = 127; 43611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int i; 43631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich program_name = (char *) xstrdup (base_name (argv[0])); 43651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newargz = XMALLOC (char *, argc + 1); 43661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* very simple arg parsing; don't want to rely on getopt 43681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich * also, copy all non cwrapper options to newargz, except 43691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich * argz[0], which is handled differently 43701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich */ 43711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newargc=0; 43721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (i = 1; i < argc; i++) 43731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 43741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (strcmp (argv[i], dumpscript_opt) == 0) 43751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 43761d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 43771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$host" in 43781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *mingw* | *cygwin* ) 43791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # make stdout use "unix" line endings 43801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo " setmode(1,_O_BINARY);" 43811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 43821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 43831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 43841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 43851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_dump_script (stdout); 43861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return 0; 43871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 43881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (strcmp (argv[i], debug_opt) == 0) 43891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 43901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debug = 1; 43911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue; 43921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 43931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 43941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 43951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 43961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich namespace, but it is not one of the ones we know about and 43971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich have already dealt with, above (inluding dump-script), then 43981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich report an error. Otherwise, targets might begin to believe 43991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 44001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich namespace. The first time any user complains about this, we'll 44011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich need to make LTWRAPPER_OPTION_PREFIX a configure-time option 44021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich or a configure.ac-settable value. 44031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich */ 44041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_fatal (__FILE__, __LINE__, 44051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "unrecognized %s option: '%s'", 44061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ltwrapper_option_prefix, argv[i]); 44071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 44081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* otherwise ... */ 44091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newargz[++newargc] = xstrdup (argv[i]); 44101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 44111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newargz[++newargc] = NULL; 44121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44131d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 44141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<EOF 44151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* The GNU banner must be the first non-error debug message */ 44161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 44171d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 44181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 44191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 44201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 44211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec = find_executable (argv[0]); 44231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (tmp_pathspec == NULL) 44241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 44251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, 44261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "(main) found exe (before symlink chase) at: %s\n", 44271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec); 44281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich actual_cwrapper_path = chase_symlinks (tmp_pathspec); 44301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, 44311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "(main) found exe (after symlink chase) at: %s\n", 44321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich actual_cwrapper_path); 44331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (tmp_pathspec); 44341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 44361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strendzap (actual_cwrapper_path, actual_cwrapper_name); 44371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* wrapper name transforms */ 44391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strendzap (actual_cwrapper_name, ".exe"); 44401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 44411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (actual_cwrapper_name); 44421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich actual_cwrapper_name = tmp_pathspec; 44431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec = 0; 44441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* target_name transforms -- use actual target program name; might have lt- prefix */ 44461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 44471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strendzap (target_name, ".exe"); 44481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 44491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (target_name); 44501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich target_name = tmp_pathspec; 44511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec = 0; 44521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, 44541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "(main) libtool target name: %s\n", 44551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich target_name); 44561d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 44571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<EOF 44591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newargz[0] = 44601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XMALLOC (char, (strlen (actual_cwrapper_path) + 44611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 44621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcpy (newargz[0], actual_cwrapper_path); 44631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcat (newargz[0], "$objdir"); 44641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcat (newargz[0], "/"); 44651d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 44661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 44681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* stop here, and copy so we don't have to do this twice */ 44691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec = xstrdup (newargz[0]); 44701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 44721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcat (newargz[0], actual_cwrapper_name); 44731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* DO want the lt- prefix here if it exists, so use target_name */ 44751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 44761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (tmp_pathspec); 44771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec = NULL; 44781d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 44791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host_os in 44811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich mingw*) 44821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 44831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 44841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char* p; 44851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while ((p = strchr (newargz[0], '\\')) != NULL) 44861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 44871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *p = '/'; 44881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 44891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while ((p = strchr (lt_argv_zero, '\\')) != NULL) 44901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 44911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *p = '/'; 44921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 44931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 44941d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 44951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 44961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 44971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 44981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 44991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (target_name); 45001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (actual_cwrapper_path); 45011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (actual_cwrapper_name); 45021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 45041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 45051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 45061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 45071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich because on Windows, both *_VARNAMEs are PATH but uninstalled 45081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libraries must come first. */ 45091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 45101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 45111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 45131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonnull (lt_argv_zero)); 45141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (i = 0; i < newargc; i++) 45151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 45161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 45171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich i, nonnull (newargz[i])); 45181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 45191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45201d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 45211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host_os in 45231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich mingw*) 45241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 45251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* execv doesn't actually work on mingw as expected on unix */ 45261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newargz = prepare_spawn (newargz); 45271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 45281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (rval == -1) 45291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 45301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* failed to start process */ 45311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, 45321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "(main) failed to launch target \"%s\": %s\n", 45331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_argv_zero, nonnull (strerror (errno))); 45341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return 127; 45351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 45361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return rval; 45371d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 45381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 45391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 45401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 45411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich execv (lt_argv_zero, newargz); 45421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return rval; /* =127, but avoids unused variable warning */ 45431d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 45441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 45451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 45461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 45481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 45491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid * 45511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichxmalloc (size_t num) 45521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 45531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich void *p = (void *) malloc (num); 45541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (!p) 45551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_fatal (__FILE__, __LINE__, "memory exhausted"); 45561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return p; 45581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 45591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar * 45611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichxstrdup (const char *string) 45621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 45631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 45641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich string) : NULL; 45651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 45661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichconst char * 45681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbase_name (const char *name) 45691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 45701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich const char *base; 45711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 45731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* Skip over the disk name in MSDOS pathnames. */ 45741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (isalpha ((unsigned char) name[0]) && name[1] == ':') 45751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name += 2; 45761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 45771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (base = name; *name; name++) 45791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (IS_DIR_SEPARATOR (*name)) 45801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich base = name + 1; 45811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return base; 45821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 45831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichint 45851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcheck_executable (const char *path) 45861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 45871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich struct stat st; 45881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 45901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonempty (path)); 45911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ((!path) || (!*path)) 45921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return 0; 45931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 45941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ((stat (path, &st) >= 0) 45951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 45961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return 1; 45971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 45981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return 0; 45991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 46001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 46011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichint 46021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichmake_executable (const char *path) 46031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 46041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int rval = 0; 46051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich struct stat st; 46061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 46071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 46081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonempty (path)); 46091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ((!path) || (!*path)) 46101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return 0; 46111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 46121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (stat (path, &st) >= 0) 46131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 46151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 46161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return rval; 46171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 46181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 46191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* Searches for the full path of the wrapper. Returns 46201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newly allocated full path name if found, NULL otherwise 46211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich Does not chase symlinks, even on platforms that support them. 46221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich*/ 46231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar * 46241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfind_executable (const char *wrapper) 46251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 46261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int has_slash = 0; 46271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich const char *p; 46281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich const char *p_next; 46291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* static buffer for getcwd */ 46301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char tmp[LT_PATHMAX + 1]; 46311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int tmp_len; 46321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *concat_name; 46331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 46341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 46351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonempty (wrapper)); 46361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 46371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ((wrapper == NULL) || (*wrapper == '\0')) 46381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return NULL; 46391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 46401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* Absolute path? */ 46411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 46421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 46431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_name = xstrdup (wrapper); 46451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (check_executable (concat_name)) 46461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return concat_name; 46471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (concat_name); 46481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 46491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 46501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 46521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (IS_DIR_SEPARATOR (wrapper[0])) 46531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_name = xstrdup (wrapper); 46551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (check_executable (concat_name)) 46561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return concat_name; 46571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (concat_name); 46581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 46591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 46601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 46611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 46621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 46631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (p = wrapper; *p; p++) 46641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (*p == '/') 46651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich has_slash = 1; 46671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break; 46681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 46691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (!has_slash) 46701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* no slashes; search PATH */ 46721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich const char *path = getenv ("PATH"); 46731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (path != NULL) 46741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (p = path; *p; p = p_next) 46761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich const char *q; 46781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich size_t p_len; 46791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (q = p; *q; q++) 46801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (IS_PATH_SEPARATOR (*q)) 46811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break; 46821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p_len = q - p; 46831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p_next = (*q == '\0' ? q : q + 1); 46841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (p_len == 0) 46851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* empty path: current directory */ 46871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (getcwd (tmp, LT_PATHMAX) == NULL) 46881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 46891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonnull (strerror (errno))); 46901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_len = strlen (tmp); 46911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_name = 46921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 46931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich memcpy (concat_name, tmp, tmp_len); 46941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_name[tmp_len] = '/'; 46951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcpy (concat_name + tmp_len + 1, wrapper); 46961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 46971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 46981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 46991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_name = 47001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 47011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich memcpy (concat_name, p, p_len); 47021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_name[p_len] = '/'; 47031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcpy (concat_name + p_len + 1, wrapper); 47041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (check_executable (concat_name)) 47061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return concat_name; 47071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (concat_name); 47081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* not found in PATH; assume curdir */ 47111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* Relative path | not found in path: prepend cwd */ 47131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (getcwd (tmp, LT_PATHMAX) == NULL) 47141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 47151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonnull (strerror (errno))); 47161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_len = strlen (tmp); 47171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 47181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich memcpy (concat_name, tmp, tmp_len); 47191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_name[tmp_len] = '/'; 47201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcpy (concat_name + tmp_len + 1, wrapper); 47211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 47221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (check_executable (concat_name)) 47231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return concat_name; 47241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (concat_name); 47251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return NULL; 47261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 47271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 47281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar * 47291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchase_symlinks (const char *pathspec) 47301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 47311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifndef S_ISLNK 47321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return xstrdup (pathspec); 47331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#else 47341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char buf[LT_PATHMAX]; 47351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich struct stat s; 47361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *tmp_pathspec = xstrdup (pathspec); 47371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *p; 47381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int has_symlinks = 0; 47391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while (strlen (tmp_pathspec) && !has_symlinks) 47401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 47411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, 47421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "checking path component for symlinks: %s\n", 47431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec); 47441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (lstat (tmp_pathspec, &s) == 0) 47451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 47461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (S_ISLNK (s.st_mode) != 0) 47471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 47481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich has_symlinks = 1; 47491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break; 47501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 47521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* search backwards for last DIR_SEPARATOR */ 47531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p = tmp_pathspec + strlen (tmp_pathspec) - 1; 47541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 47551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p--; 47561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 47571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 47581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* no more DIR_SEPARATORS left */ 47591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break; 47601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *p = '\0'; 47621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 47641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 47651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_fatal (__FILE__, __LINE__, 47661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "error accessing file \"%s\": %s", 47671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec, nonnull (strerror (errno))); 47681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (tmp_pathspec); 47711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 47721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (!has_symlinks) 47731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 47741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return xstrdup (pathspec); 47751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 47771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_pathspec = realpath (pathspec, buf); 47781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (tmp_pathspec == 0) 47791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 47801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_fatal (__FILE__, __LINE__, 47811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "could not follow symlinks for %s", pathspec); 47821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 47831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return xstrdup (tmp_pathspec); 47841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 47851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 47861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 47871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar * 47881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstrendzap (char *str, const char *pat) 47891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 47901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich size_t len, patlen; 47911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 47921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich assert (str != NULL); 47931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich assert (pat != NULL); 47941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 47951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len = strlen (str); 47961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich patlen = strlen (pat); 47971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 47981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (patlen <= len) 47991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 48001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich str += len - patlen; 48011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (strcmp (str, pat) == 0) 48021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *str = '\0'; 48031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 48041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return str; 48051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 48061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 48071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid 48081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_debugprintf (const char *file, int line, const char *fmt, ...) 48091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 48101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich va_list args; 48111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (lt_debug) 48121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 48131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 48141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich va_start (args, fmt); 48151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich (void) vfprintf (stderr, fmt, args); 48161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich va_end (args); 48171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 48181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 48191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 48201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic void 48211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_error_core (int exit_status, const char *file, 48221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int line, const char *mode, 48231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich const char *message, va_list ap) 48241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 48251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 48261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich vfprintf (stderr, message, ap); 48271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fprintf (stderr, ".\n"); 48281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 48291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (exit_status >= 0) 48301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit (exit_status); 48311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 48321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 48331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid 48341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_fatal (const char *file, int line, const char *message, ...) 48351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 48361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich va_list ap; 48371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich va_start (ap, message); 48381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 48391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich va_end (ap); 48401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 48411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 48421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic const char * 48431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichnonnull (const char *s) 48441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 48451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return s ? s : "(null)"; 48461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 48471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 48481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichstatic const char * 48491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichnonempty (const char *s) 48501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 48511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return (s && !*s) ? "(empty)" : nonnull (s); 48521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 48531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 48541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid 48551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_setenv (const char *name, const char *value) 48561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 48571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, 48581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "(lt_setenv) setting '%s' to '%s'\n", 48591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonnull (name), nonnull (value)); 48601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 48611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#ifdef HAVE_SETENV 48621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* always make a copy, for consistency with !HAVE_SETENV */ 48631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *str = xstrdup (value); 48641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich setenv (name, str, 1); 48651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#else 48661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int len = strlen (name) + 1 + strlen (value) + 1; 48671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *str = XMALLOC (char, len); 48681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sprintf (str, "%s=%s", name, value); 48691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (putenv (str) != EXIT_SUCCESS) 48701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 48711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (str); 48721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 48731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#endif 48741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 48751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 48761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 48771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar * 48781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_extend_str (const char *orig_value, const char *add, int to_end) 48791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 48801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *new_value; 48811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (orig_value && *orig_value) 48821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 48831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int orig_value_len = strlen (orig_value); 48841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int add_len = strlen (add); 48851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_value = XMALLOC (char, add_len + orig_value_len + 1); 48861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (to_end) 48871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 48881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcpy (new_value, orig_value); 48891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcpy (new_value + orig_value_len, add); 48901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 48911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 48921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 48931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcpy (new_value, add); 48941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich strcpy (new_value + add_len, orig_value); 48951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 48961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 48971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 48981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 48991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_value = xstrdup (add); 49001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 49011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return new_value; 49021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 49031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid 49051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_update_exe_path (const char *name, const char *value) 49061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 49071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, 49081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 49091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonnull (name), nonnull (value)); 49101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (name && *name && value && *value) 49121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 49131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *new_value = lt_extend_str (getenv (name), value, 0); 49141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* some systems can't cope with a ':'-terminated path #' */ 49151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int len = strlen (new_value); 49161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 49171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 49181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_value[len-1] = '\0'; 49191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 49201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_setenv (name, new_value); 49211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (new_value); 49221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 49231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 49241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid 49261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlt_update_lib_path (const char *name, const char *value) 49271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 49281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_debugprintf (__FILE__, __LINE__, 49291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 49301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonnull (name), nonnull (value)); 49311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (name && *name && value && *value) 49331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 49341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *new_value = lt_extend_str (getenv (name), value, 0); 49351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_setenv (name, new_value); 49361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich XFREE (new_value); 49371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 49381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 49391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49401d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 49411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host_os in 49421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich mingw*) 49431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 49441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich/* Prepares an argument vector before calling spawn(). 49461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich Note that spawn() does not by itself call the command interpreter 49471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 49481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 49491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich GetVersionEx(&v); 49501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich v.dwPlatformId == VER_PLATFORM_WIN32_NT; 49511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich }) ? "cmd.exe" : "command.com"). 49521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich Instead it simply concatenates the arguments, separated by ' ', and calls 49531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich CreateProcess(). We must quote the arguments since Win32 CreateProcess() 49541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 49551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich special way: 49561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich - Space and tab are interpreted as delimiters. They are not treated as 49571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich delimiters if they are surrounded by double quotes: "...". 49581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich - Unescaped double quotes are removed from the input. Their only effect is 49591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich that within double quotes, space and tab are treated like normal 49601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich characters. 49611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich - Backslashes not followed by double quotes are not special. 49621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich - But 2*n+1 backslashes followed by a double quote become 49631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich n backslashes followed by a double quote (n >= 0): 49641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \" -> " 49651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \\\" -> \" 49661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich \\\\\" -> \\" 49671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich */ 49681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#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" 49691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich#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" 49701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichchar ** 49711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichprepare_spawn (char **argv) 49721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 49731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich size_t argc; 49741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char **new_argv; 49751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich size_t i; 49761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* Count number of arguments. */ 49781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (argc = 0; argv[argc] != NULL; argc++) 49791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ; 49801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* Allocate new argument vector. */ 49821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_argv = XMALLOC (char *, argc + 1); 49831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich /* Put quoted arguments into the new argument vector. */ 49851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (i = 0; i < argc; i++) 49861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 49871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich const char *string = argv[i]; 49881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 49891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (string[0] == '\0') 49901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_argv[i] = xstrdup ("\"\""); 49911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 49921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 49931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 49941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich size_t length; 49951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich unsigned int backslashes; 49961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich const char *s; 49971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *quoted_string; 49981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char *p; 49991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 50001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich length = 0; 50011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich backslashes = 0; 50021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (quote_around) 50031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich length++; 50041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (s = string; *s != '\0'; s++) 50051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 50061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char c = *s; 50071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (c == '"') 50081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich length += backslashes + 1; 50091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich length++; 50101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (c == '\\') 50111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich backslashes++; 50121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 50131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich backslashes = 0; 50141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 50151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (quote_around) 50161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich length += backslashes + 1; 50171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 50181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich quoted_string = XMALLOC (char, length + 1); 50191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 50201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich p = quoted_string; 50211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich backslashes = 0; 50221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (quote_around) 50231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *p++ = '"'; 50241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (s = string; *s != '\0'; s++) 50251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 50261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich char c = *s; 50271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (c == '"') 50281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 50291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich unsigned int j; 50301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (j = backslashes + 1; j > 0; j--) 50311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *p++ = '\\'; 50321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 50331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *p++ = c; 50341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (c == '\\') 50351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich backslashes++; 50361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 50371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich backslashes = 0; 50381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 50391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (quote_around) 50401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { 50411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich unsigned int j; 50421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for (j = backslashes; j > 0; j--) 50431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *p++ = '\\'; 50441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *p++ = '"'; 50451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 50461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *p = '\0'; 50471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 50481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_argv[i] = quoted_string; 50491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 50501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 50511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_argv[i] = (char *) string; 50521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 50531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_argv[argc] = NULL; 50541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 50551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich return new_argv; 50561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 50571d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 50581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 50591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 50601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 50611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 50621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichvoid lt_dump_script (FILE* f) 50631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 50641d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 50651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_emit_wrapper yes | 50661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -n -e ' 50671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichs/^\(.\{79\}\)\(..*\)/\1\ 50681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich\2/ 50691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichh 50701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichs/\([\\"]\)/\\\1/g 50711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichs/$/\\n/ 50721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichs/\([^\n]*\).*/ fputs ("\1", f);/p 50731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichg 50741d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichD' 50751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat <<"EOF" 50761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 50771d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 50781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 50791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# end: func_emit_cwrapperexe_src 50801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 50811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_win32_import_lib_p ARG 50821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# True if ARG is an import lib, as indicated by $file_magic_cmd 50831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_win32_import_lib_p () 50841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 50851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 50861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 50871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *import*) : ;; 50881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) false ;; 50891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 50901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 50911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 50921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_mode_link arg... 50931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_mode_link () 50941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 50951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 50961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 50971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 50981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # It is impossible to link a dll without this setting, and 50991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # we shouldn't force the makefile maintainer to figure out 51001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # which system we are compiling for in order to pass an extra 51011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # flag for every libtool invocation. 51021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # allow_undefined=no 51031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 51041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # FIXME: Unfortunately, there are problems with the above when trying 51051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # to make a dll which has undefined symbols, in which case not 51061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # even a static library is built. For now, we need to specify 51071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -no-undefined on the libtool link line when we can be certain 51081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # that all symbols are satisfied, otherwise we get a static library. 51091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich allow_undefined=yes 51101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 51111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 51121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich allow_undefined=yes 51131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 51141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 51151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libtool_args=$nonopt 51161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich base_compile="$nonopt $@" 51171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_command=$nonopt 51181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_command=$nonopt 51191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 51201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_rpath= 51211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_rpath= 51221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_shlibpath= 51231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_shlibpath= 51241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich convenience= 51251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich old_convenience= 51261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs= 51271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich old_deplibs= 51281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compiler_flags= 51291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich linker_flags= 51301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dllsearchpath= 51311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib_search_path=`pwd` 51321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich inst_prefix_dir= 51331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_inherited_linker_flags= 51341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 51351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich avoid_version=no 51361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich bindir= 51371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlfiles= 51381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlprefiles= 51391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlself=no 51401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_dynamic=no 51411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols= 51421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols_regex= 51431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich generated= 51441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobjs= 51451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ltlibs= 51461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich module=no 51471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich no_install=no 51481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich objs= 51491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich non_pic_objects= 51501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich precious_files_regex= 51511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prefer_static_libs=no 51521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich preload=no 51531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 51541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prevarg= 51551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich release= 51561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rpath= 51571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xrpath= 51581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich perm_rpath= 51591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich temp_rpath= 51601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich thread_safe=no 51611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich vinfo= 51621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich vinfo_number=no 51631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich weak_libs= 51641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich single_module="${wl}-single_module" 51651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_infer_tag $base_compile 51661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 51671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need to know -static, to get the right output filenames. 51681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for arg 51691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 51701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 51711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -shared) 51721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$build_libtool_libs" != yes && \ 51731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_configuration "can not build a shared library" 51741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_old_libs=no 51751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 51761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 51771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -all-static | -static | -static-libtool-libs) 51781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 51791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -all-static) 51801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 51811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "complete static linking is impossible in this configuration" 51821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 51831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$link_static_flag"; then 51841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlopen_self=$dlopen_self_static 51851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 51861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prefer_static_libs=yes 51871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 51881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -static) 51891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$pic_flag" && test -n "$link_static_flag"; then 51901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlopen_self=$dlopen_self_static 51911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 51921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prefer_static_libs=built 51931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 51941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -static-libtool-libs) 51951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$pic_flag" && test -n "$link_static_flag"; then 51961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlopen_self=$dlopen_self_static 51971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 51981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prefer_static_libs=yes 51991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 52011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=no 52021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_old_libs=yes 52031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 52041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 52061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 52071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 52081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # See if our shared archives depend on static archives. 52091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$old_archive_from_new_cmds" && build_old_libs=yes 52101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 52111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Go through the arguments, transforming them on the way. 52121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while test "$#" -gt 0; do 52131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg="$1" 52141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 52151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$arg" 52161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich qarg=$func_quote_for_eval_unquoted_result 52171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libtool_args " $func_quote_for_eval_result" 52181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 52191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the previous option needs an argument, assign it. 52201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$prev"; then 52211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $prev in 52221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output) 52231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " @OUTPUT@" 52241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " @OUTPUT@" 52251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 52271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 52281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $prev in 52291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich bindir) 52301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich bindir="$arg" 52311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 52321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 52331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlfiles|dlprefiles) 52351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$preload" = no; then 52361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add the symbol object into the linking commands. 52371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " @SYMFILE@" 52381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " @SYMFILE@" 52391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich preload=yes 52401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 52411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 52421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la | *.lo) ;; # We handle these cases below. 52431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich force) 52441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$dlself" = no; then 52451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlself=needless 52461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_dynamic=yes 52471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 52481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 52491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 52501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich self) 52521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$prev" = dlprefiles; then 52531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlself=yes 52541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 52551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlself=yes 52561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 52571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlself=needless 52581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_dynamic=yes 52591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 52601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 52611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 52621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 52641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$prev" = dlfiles; then 52651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlfiles " $arg" 52661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 52671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlprefiles " $arg" 52681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 52691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 52701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 52711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 52731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich expsyms) 52751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols="$arg" 52761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -f "$arg" \ 52771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich || func_fatal_error "symbol file \`$arg' does not exist" 52781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 52791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 52801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich expsyms_regex) 52821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols_regex="$arg" 52831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 52841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 52851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich framework) 52871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 52881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-darwin*) 52891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$deplibs " in 52901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $qarg.ltframework "*) ;; 52911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append deplibs " $qarg.ltframework" # this is fixed later 52921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 52941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 52961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 52971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 52981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 52991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich inst_prefix) 53001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich inst_prefix_dir="$arg" 53011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 53021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 53031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 53041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich objectlist) 53051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$arg"; then 53061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_arg=$arg 53071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich moreargs= 53081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for fil in `cat "$save_arg"` 53091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 53101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_append moreargs " $fil" 53111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg=$fil 53121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # A libtool-controlled object. 53131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check to see that this really is a libtool object. 53151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_lalib_unsafe_p "$arg"; then 53161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_object= 53171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich non_pic_object= 53181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Read the .lo file 53201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$arg" 53211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$pic_object" || 53231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$non_pic_object" || 53241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$pic_object" = none && 53251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$non_pic_object" = none; then 53261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot find name of object for \`$arg'" 53271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Extract subdirectory from the argument. 53301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$arg" "/" "" 53311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xdir="$func_dirname_result" 53321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pic_object" != none; then 53341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Prepend the subdirectory the object is found in. 53351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_object="$xdir$pic_object" 53361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$prev" = dlfiles; then 53381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 53391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlfiles " $pic_object" 53401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 53411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 53421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 53431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If libtool objects are unsupported, then we need to preload. 53441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=dlprefiles 53451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # CHECK ME: I think I busted this. -Ossama 53491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$prev" = dlprefiles; then 53501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Preload the old-style object. 53511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlprefiles " $pic_object" 53521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 53531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # A PIC object. 53561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libobjs " $pic_object" 53571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg="$pic_object" 53581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Non-PIC object. 53611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$non_pic_object" != none; then 53621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Prepend the subdirectory the object is found in. 53631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich non_pic_object="$xdir$non_pic_object" 53641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # A standard non-PIC object 53661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append non_pic_objects " $non_pic_object" 53671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$pic_object" || test "$pic_object" = none ; then 53681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg="$non_pic_object" 53691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 53711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the PIC object exists, use it instead. 53721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # $xdir was prepended to $pic_object above. 53731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich non_pic_object="$pic_object" 53741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append non_pic_objects " $non_pic_object" 53751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 53771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only an error if not doing a dry-run. 53781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $opt_dry_run; then 53791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Extract subdirectory from the argument. 53801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$arg" "/" "" 53811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xdir="$func_dirname_result" 53821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 53831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lo2o "$arg" 53841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_object=$xdir$objdir/$func_lo2o_result 53851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich non_pic_object=$xdir$func_lo2o_result 53861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libobjs " $pic_object" 53871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append non_pic_objects " $non_pic_object" 53881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 53891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$arg' is not a valid libtool object" 53901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 53931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 53941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "link input file \`$arg' does not exist" 53951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 53961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg=$save_arg 53971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 53981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 53991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich precious_regex) 54011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich precious_files_regex="$arg" 54021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 54031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich release) 54061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich release="-$arg" 54071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 54081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rpath | xrpath) 54111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need an absolute path. 54121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 54131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) ;; 54141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 54151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "only absolute run-paths are allowed" 54161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 54181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$prev" = rpath; then 54191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$rpath " in 54201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $arg "*) ;; 54211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append rpath " $arg" ;; 54221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 54231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 54241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$xrpath " in 54251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $arg "*) ;; 54261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append xrpath " $arg" ;; 54271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 54281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 54291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 54301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shrext) 54331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shrext_cmds="$arg" 54341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 54351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich weak) 54381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append weak_libs " $arg" 54391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 54401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xcclinker) 54431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append linker_flags " $qarg" 54441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " $qarg" 54451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 54461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $qarg" 54471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $qarg" 54481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xcompiler) 54511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " $qarg" 54521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 54531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $qarg" 54541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $qarg" 54551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xlinker) 54581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append linker_flags " $qarg" 54591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " $wl$qarg" 54601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 54611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $wl$qarg" 54621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $wl$qarg" 54631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 54661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$prev=\"\$arg\"" 54671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 54681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 54711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # test -n "$prev" 54721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 54731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prevarg="$arg" 54741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 54751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 54761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -all-static) 54771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$link_static_flag"; then 54781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # See comment for -static flag below, for more details. 54791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $link_static_flag" 54801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $link_static_flag" 54811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 54821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 54851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -allow-undefined) 54861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # FIXME: remove this flag sometime in the future. 54871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`-allow-undefined' must not be used because it is the default" 54881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 54901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -avoid-version) 54911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich avoid_version=yes 54921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 54951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -bindir) 54961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=bindir 54971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 54981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 54991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 55001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -dlopen) 55011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=dlfiles 55021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 55031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 55051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -dlpreopen) 55061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=dlprefiles 55071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 55081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 55101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -export-dynamic) 55111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_dynamic=yes 55121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 55131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 55151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -export-symbols | -export-symbols-regex) 55161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 55171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "more than one -exported-symbols argument is not allowed" 55181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 55191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$arg" = "X-export-symbols"; then 55201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=expsyms 55211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 55221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=expsyms_regex 55231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 55241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 55251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 55271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -framework) 55281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=framework 55291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 55301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 55321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -inst-prefix-dir) 55331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=inst_prefix 55341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 55351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 55371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 55381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # so, if we see these flags be careful not to treat them like -L 55391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L[A-Z][A-Z]*:*) 55401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $with_gcc/$host in 55411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich no/*-*-irix* | /*-*-irix*) 55421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $arg" 55431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $arg" 55441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 55461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 55471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 55491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) 55501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname "-L" '' "$arg" 55511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$func_stripname_result"; then 55521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$#" -gt 0; then 55531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "require no space between \`-L' and \`$1'" 55541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 55551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "need path for \`-L' option" 55561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 55571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 55581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$func_stripname_result" 55591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir=$func_resolve_sysroot_result 55601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need an absolute path. 55611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $dir in 55621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) ;; 55631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 55641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich absdir=`cd "$dir" && pwd` 55651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$absdir" && \ 55661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot determine absolute directory name of \`$dir'" 55671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir="$absdir" 55681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 55701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$deplibs " in 55711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" -L$dir "* | *" $arg "*) 55721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Will only happen for absolute or sysroot arguments 55731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 55751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Preserve sysroot, but never include relative directories 55761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $dir in 55771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 55781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append deplibs " -L$dir" ;; 55791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 55801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append lib_search_path " $dir" 55811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 55831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 55841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 55851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 55861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case :$dllsearchpath: in 55871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *":$dir:"*) ;; 55881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ::) dllsearchpath=$dir;; 55891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append dllsearchpath ":$dir";; 55901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 55911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case :$dllsearchpath: in 55921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *":$testbindir:"*) ;; 55931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ::) dllsearchpath=$testbindir;; 55941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append dllsearchpath ":$testbindir";; 55951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 55961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 55971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 55981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 55991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 56011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -l*) 56021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 56031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 56041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 56051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # These systems don't actually have a C or math library (as such) 56061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-os2*) 56091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # These systems don't actually have a C library (as such) 56101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$arg" = "X-lc" && continue 56111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 56131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do not include libc due to us having libc/libc_r. 56141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$arg" = "X-lc" && continue 56151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-rhapsody* | *-*-darwin1.[012]) 56171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Rhapsody C and math libraries are in the System framework 56181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append deplibs " System.ltframework" 56191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-sco3.2v5* | *-*-sco5v6*) 56221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Causes problems with __ctype 56231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$arg" = "X-lc" && continue 56241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 56261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Compiler inserts libc in the correct place for threads to work 56271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$arg" = "X-lc" && continue 56281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 56301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "X$arg" = "X-lc_r"; then 56311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 56321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 56331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do not include libc_r directly, use -pthread flag. 56341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 56371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 56381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append deplibs " $arg" 56391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 56421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -module) 56431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich module=yes 56441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 56471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Tru64 UNIX uses -model [arg] to determine the layout of C++ 56481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # classes, name mangling, and exception handling. 56491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Darwin uses the -arch flag to determine output architecture. 56501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -model|-arch|-isysroot|--sysroot) 56511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " $arg" 56521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $arg" 56531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $arg" 56541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=xcompiler 56551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 56581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ 56591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 56601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " $arg" 56611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $arg" 56621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $arg" 56631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$new_inherited_linker_flags " in 56641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $arg "*) ;; 56651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich * ) func_append new_inherited_linker_flags " $arg" ;; 56661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 56671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 56701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -multi_module) 56711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich single_module="${wl}-multi_module" 56721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 56751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -no-fast-install) 56761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fast_install=no 56771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 56801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -no-install) 56811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 56821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 56831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The PATH hackery in wrapper scripts is required on Windows 56841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # and Darwin in order for the loader to find any dlls it needs. 56851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-no-install' is ignored for $host" 56861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "assuming \`-no-fast-install' instead" 56871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fast_install=no 56881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) no_install=yes ;; 56901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 56911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 56941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -no-undefined) 56951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich allow_undefined=no 56961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 56971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 56981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 56991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -objectlist) 57001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=objectlist 57011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -o) prev=output ;; 57051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -precious-files-regex) 57071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=precious_regex 57081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -release) 57121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=release 57131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -rpath) 57171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=rpath 57181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -R) 57221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=xrpath 57231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -R*) 57271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '-R' '' "$arg" 57281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir=$func_stripname_result 57291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need an absolute path. 57301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $dir in 57311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) ;; 57321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich =*) 57331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '=' '' "$dir" 57341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir=$lt_sysroot$func_stripname_result 57351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 57371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "only absolute run-paths are allowed" 57381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 57401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$xrpath " in 57411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $dir "*) ;; 57421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append xrpath " $dir" ;; 57431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 57441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -shared) 57481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The effects of -shared are defined in a previous loop. 57491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -shrext) 57531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=shrext 57541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -static | -static-libtool-libs) 57581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The effects of -static are defined in a previous loop. 57591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We used to do the same as -all-static on platforms that 57601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # didn't have a PIC flag, but the assumption that the effects 57611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # would be equivalent was wrong. It would break on at least 57621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Digital Unix and AIX. 57631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -thread-safe) 57671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich thread_safe=yes 57681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -version-info) 57721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=vinfo 57731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -version-number) 57771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=vinfo 57781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich vinfo_number=yes 57791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -weak) 57831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=weak 57841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 57851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 57861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 57871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Wc,*) 57881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '-Wc,' '' "$arg" 57891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich args=$func_stripname_result 57901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg= 57911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_ifs="$IFS"; IFS=',' 57921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for flag in $args; do 57931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 57941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$flag" 57951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append arg " $func_quote_for_eval_result" 57961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " $func_quote_for_eval_result" 57971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 57981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 57991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname ' ' '' "$arg" 58001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg=$func_stripname_result 58011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 58021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Wl,*) 58041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '-Wl,' '' "$arg" 58051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich args=$func_stripname_result 58061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg= 58071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_ifs="$IFS"; IFS=',' 58081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for flag in $args; do 58091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 58101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$flag" 58111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append arg " $wl$func_quote_for_eval_result" 58121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " $wl$func_quote_for_eval_result" 58131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append linker_flags " $func_quote_for_eval_result" 58141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 58151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 58161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname ' ' '' "$arg" 58171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg=$func_stripname_result 58181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 58191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Xcompiler) 58211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=xcompiler 58221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 58231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 58241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -Xlinker) 58261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=xlinker 58271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 58281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 58291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -XCClinker) 58311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=xcclinker 58321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 58331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 58341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -msg_* for osf cc 58361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -msg_*) 58371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$arg" 58381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg="$func_quote_for_eval_result" 58391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 58401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Flags to be passed through unchanged, with rationale: 58421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 58431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -r[0-9][0-9]* specify processor for the SGI compiler 58441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 58451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # +DA*, +DD* enable 64-bit mode for the HP compiler 58461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -q* compiler args for the IBM compiler 58471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 58481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -F/path path to uninstalled frameworks, gcc on darwin 58491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 58501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # @file GCC response files 58511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -tp=* Portland pgcc target processor selection 58521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # --sysroot=* for sysroot support 58531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 58541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 58551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 58561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -O*|-flto*|-fwhopr*|-fuse-linker-plugin) 58571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$arg" 58581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg="$func_quote_for_eval_result" 58591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $arg" 58601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $arg" 58611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " $arg" 58621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 58631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 58641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Some other compiler flag. 58661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -* | +*) 58671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$arg" 58681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg="$func_quote_for_eval_result" 58691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 58701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.$objext) 58721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # A standard object. 58731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append objs " $arg" 58741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 58751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo) 58771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # A libtool-controlled object. 58781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check to see that this really is a libtool object. 58801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_lalib_unsafe_p "$arg"; then 58811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_object= 58821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich non_pic_object= 58831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Read the .lo file 58851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$arg" 58861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$pic_object" || 58881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$non_pic_object" || 58891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$pic_object" = none && 58901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$non_pic_object" = none; then 58911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot find name of object for \`$arg'" 58921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 58931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Extract subdirectory from the argument. 58951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$arg" "/" "" 58961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xdir="$func_dirname_result" 58971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 58981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pic_object" != none; then 58991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Prepend the subdirectory the object is found in. 59001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_object="$xdir$pic_object" 59011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$prev" = dlfiles; then 59031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 59041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlfiles " $pic_object" 59051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 59061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 59071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 59081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If libtool objects are unsupported, then we need to preload. 59091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev=dlprefiles 59101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # CHECK ME: I think I busted this. -Ossama 59141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$prev" = dlprefiles; then 59151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Preload the old-style object. 59161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlprefiles " $pic_object" 59171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 59181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # A PIC object. 59211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libobjs " $pic_object" 59221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg="$pic_object" 59231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Non-PIC object. 59261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$non_pic_object" != none; then 59271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Prepend the subdirectory the object is found in. 59281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich non_pic_object="$xdir$non_pic_object" 59291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # A standard non-PIC object 59311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append non_pic_objects " $non_pic_object" 59321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$pic_object" || test "$pic_object" = none ; then 59331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg="$non_pic_object" 59341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 59361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the PIC object exists, use it instead. 59371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # $xdir was prepended to $pic_object above. 59381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich non_pic_object="$pic_object" 59391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append non_pic_objects " $non_pic_object" 59401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 59421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only an error if not doing a dry-run. 59431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $opt_dry_run; then 59441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Extract subdirectory from the argument. 59451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$arg" "/" "" 59461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xdir="$func_dirname_result" 59471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lo2o "$arg" 59491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pic_object=$xdir$objdir/$func_lo2o_result 59501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich non_pic_object=$xdir$func_lo2o_result 59511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libobjs " $pic_object" 59521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append non_pic_objects " $non_pic_object" 59531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 59541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$arg' is not a valid libtool object" 59551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 59581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.$libext) 59601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # An archive. 59611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append deplibs " $arg" 59621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append old_deplibs " $arg" 59631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 59641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 59651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 59671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # A libtool-controlled library. 59681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$arg" 59701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$prev" = dlfiles; then 59711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This library was specified with -dlopen. 59721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlfiles " $func_resolve_sysroot_result" 59731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 59741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$prev" = dlprefiles; then 59751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The library was specified with -dlpreopen. 59761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlprefiles " $func_resolve_sysroot_result" 59771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prev= 59781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 59791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append deplibs " $func_resolve_sysroot_result" 59801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 59821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 59831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Some other compiler argument. 59851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 59861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Unknown arguments in both finalize_command and compile_command need 59871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # to be aesthetically quoted because they are evaled later. 59881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$arg" 59891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich arg="$func_quote_for_eval_result" 59901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 59911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac # arg 59921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 59931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now actually substitute the argument into the commands. 59941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$arg"; then 59951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $arg" 59961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $arg" 59971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 59981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # argument parsing loop 59991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$prev" && \ 60011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "the \`$prevarg' option requires an argument" 60021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 60041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval arg=\"$export_dynamic_flag_spec\" 60051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $arg" 60061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $arg" 60071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 60081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldlibs= 60101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # calculate the name of the file, without its directory 60111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$output" 60121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich outputname="$func_basename_result" 60131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobjs_save="$libobjs" 60141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$shlibpath_var"; then 60161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # get the directories listed in $shlibpath_var 60171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 60181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 60191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shlib_search_path= 60201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 60211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 60221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 60231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$output" "/" "" 60251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output_objdir="$func_dirname_result$objdir" 60261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$output_objdir/" 60271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tool_output_objdir=$func_to_tool_file_result 60281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Create the object directory. 60291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mkdir_p "$output_objdir" 60301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Determine the type of output 60321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $output in 60331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich "") 60341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "you must specify an output file" 60351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 60361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.$libext) linkmode=oldlib ;; 60371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo | *.$objext) linkmode=obj ;; 60381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) linkmode=lib ;; 60391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) linkmode=prog ;; # Anything else should be a program. 60401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 60411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich specialdeplibs= 60431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libs= 60451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Find all interdependent deplibs by searching for libraries 60461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # that are linked more than once (e.g. -la -lb -la) 60471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $deplibs; do 60481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $opt_preserve_dup_deps ; then 60491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$libs " in 60501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) func_append specialdeplibs " $deplib" ;; 60511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 60521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 60531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libs " $deplib" 60541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 60551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = lib; then 60571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libs="$predeps $libs $compiler_lib_search_path $postdeps" 60581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Compute libraries that are listed more than once in $predeps 60601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # $postdeps and mark them as special (i.e., whose duplicates are 60611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # not to be eliminated). 60621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pre_post_deps= 60631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $opt_duplicate_compiler_generated_deps; then 60641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for pre_post_dep in $predeps $postdeps; do 60651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$pre_post_deps " in 60661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 60671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 60681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append pre_post_deps " $pre_post_dep" 60691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 60701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 60711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pre_post_deps= 60721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 60731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs= 60751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdependency_libs= 60761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newlib_search_path= 60771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich need_relink=no # whether we're linking any uninstalled libtool libraries 60781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich notinst_deplibs= # not-installed libtool libraries 60791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich notinst_path= # paths that contain not-installed libtool libraries 60801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 60811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $linkmode in 60821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib) 60831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich passes="conv dlpreopen link" 60841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for file in $dlfiles $dlprefiles; do 60851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $file in 60861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) ;; 60871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 60881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 60891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 60901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 60911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 60921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 60931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prog) 60941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs= 60951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs= 60961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich alldeplibs=no 60971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdlfiles= 60981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdlprefiles= 60991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich passes="conv scan dlopen dlpreopen link" 61001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 61011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) passes="conv" 61021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 61031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 61041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 61051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for pass in $passes; do 61061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The preopen pass in lib mode reverses $deplibs; put it back here 61071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # so that -L comes before libs that need it for instance... 61081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" = "lib,link"; then 61091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ## FIXME: Find the place where the list is rebuilt in the wrong 61101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ## order, and fix it there properly 61111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_deplibs= 61121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $deplibs; do 61131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_deplibs="$deplib $tmp_deplibs" 61141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 61151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$tmp_deplibs" 61161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 61171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 61181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" = "lib,link" || 61191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$linkmode,$pass" = "prog,scan"; then 61201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libs="$deplibs" 61211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs= 61221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 61231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = prog; then 61241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $pass in 61251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlopen) libs="$dlfiles" ;; 61261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlpreopen) libs="$dlprefiles" ;; 61271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 61281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 61291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 61301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" = "lib,dlpreopen"; then 61311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Collect and forward deplibs of preopened libtool libs 61321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $dlprefiles; do 61331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Ignore non-libtool-libs 61341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dependency_libs= 61351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$lib" 61361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $lib in 61371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) func_source "$func_resolve_sysroot_result" ;; 61381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 61391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 61401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Collect preopened libtool deplibs, except any this library 61411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # has declared as weak libs 61421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $dependency_libs; do 61431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$deplib" 61441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplib_base=$func_basename_result 61451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $weak_libs " in 61461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib_base "*) ;; 61471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append deplibs " $deplib" ;; 61481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 61491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 61501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 61511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libs="$dlprefiles" 61521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 61531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = dlopen; then 61541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Collect dlpreopened libraries 61551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_deplibs="$deplibs" 61561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs= 61571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 61581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 61591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $libs; do 61601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib= 61611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich found=no 61621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplib in 61631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ 61641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 61651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" = "prog,link"; then 61661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$deplib $compile_deplibs" 61671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$deplib $finalize_deplibs" 61681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 61691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " $deplib" 61701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = lib ; then 61711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$new_inherited_linker_flags " in 61721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) ;; 61731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich * ) func_append new_inherited_linker_flags " $deplib" ;; 61741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 61751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 61761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 61771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 61781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 61791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -l*) 61801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" != lib && test "$linkmode" != prog; then 61811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-l' is ignored for archives/objects" 61821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 61831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 61841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '-l' '' "$deplib" 61851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name=$func_stripname_result 61861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = lib; then 61871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 61881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 61891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 61901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 61911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for searchdir in $searchdirs; do 61921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for search_ext in .la $std_shrext .so .a; do 61931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Search the libtool library 61941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib="$searchdir/lib${name}${search_ext}" 61951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$lib"; then 61961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$search_ext" = ".la"; then 61971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich found=yes 61981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 61991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich found=no 62001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 2 62021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 62041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 62051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$found" != yes; then 62061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # deplib doesn't seem to be a libtool library 62071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" = "prog,link"; then 62081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$deplib $compile_deplibs" 62091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$deplib $finalize_deplibs" 62101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 62111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 62121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 62131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 62151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else # deplib is a libtool library 62161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 62171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need to do some special things here, and not later. 62181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 62191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $predeps $postdeps " in 62201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) 62211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_lalib_p "$lib"; then 62221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich library_names= 62231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich old_library= 62241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$lib" 62251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for l in $old_library $library_names; do 62261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ll="$l" 62271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 62281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$ll" = "X$old_library" ; then # only static version available 62291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich found=no 62301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$lib" "" "." 62311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ladir="$func_dirname_result" 62321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib=$ladir/$old_library 62331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" = "prog,link"; then 62341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$deplib $compile_deplibs" 62351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$deplib $finalize_deplibs" 62361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 62371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 62381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 62391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 62411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 62441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) ;; 62451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 62461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; # -l 62491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.ltframework) 62501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" = "prog,link"; then 62511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$deplib $compile_deplibs" 62521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$deplib $finalize_deplibs" 62531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 62541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 62551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = lib ; then 62561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$new_inherited_linker_flags " in 62571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) ;; 62581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich * ) func_append new_inherited_linker_flags " $deplib" ;; 62591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 62601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 62631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 62641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) 62651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $linkmode in 62661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib) 62671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 62681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$pass" = conv && continue 62691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdependency_libs="$deplib $newdependency_libs" 62701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '-L' '' "$deplib" 62711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$func_stripname_result" 62721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newlib_search_path " $func_resolve_sysroot_result" 62731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 62741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prog) 62751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = conv; then 62761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 62771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 62781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = scan; then 62801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 62811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 62821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$deplib $compile_deplibs" 62831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$deplib $finalize_deplibs" 62841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 62851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '-L' '' "$deplib" 62861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$func_stripname_result" 62871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newlib_search_path " $func_resolve_sysroot_result" 62881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 62891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 62901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-L' is ignored for archives/objects" 62911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 62921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac # linkmode 62931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 62941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; # -L 62951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -R*) 62961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = link; then 62971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '-R' '' "$deplib" 62981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$func_stripname_result" 62991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir=$func_resolve_sysroot_result 63001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make sure the xrpath contains only unique directories. 63011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$xrpath " in 63021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $dir "*) ;; 63031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append xrpath " $dir" ;; 63041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 63051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 63061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 63071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 63081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 63091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 63101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$deplib" 63111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib=$func_resolve_sysroot_result 63121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 63131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.$libext) 63141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = conv; then 63151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 63161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 63171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 63181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $linkmode in 63191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib) 63201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Linking convenience modules into shared libraries is allowed, 63211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # but linking other static libraries is non-portable. 63221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $dlpreconveniencelibs " in 63231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) ;; 63241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 63251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich valid_a_lib=no 63261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplibs_check_method in 63271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich match_pattern*) 63281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $deplibs_check_method; shift 63291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 63301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 63311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich | $EGREP "$match_pattern_regex" > /dev/null; then 63321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich valid_a_lib=yes 63331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 63341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 63351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pass_all) 63361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich valid_a_lib=yes 63371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 63381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 63391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$valid_a_lib" != yes; then 63401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 63411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: Trying to link with static lib archive $deplib." 63421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** I have the capability to make that library automatically link in when" 63431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** you link to this library. But I can only do this if you have a" 63441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** shared version of the library, which you do not appear to have" 63451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** because the file extensions .$libext of this argument makes me believe" 63461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** that it is just a static archive that I should not use here." 63471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 63481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 63491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: Linking the shared library $output against the" 63501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** static library $deplib is not portable!" 63511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 63521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 63531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 63541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 63551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 63561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 63571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prog) 63581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" != link; then 63591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 63601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 63611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$deplib $compile_deplibs" 63621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$deplib $finalize_deplibs" 63631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 63641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 63651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 63661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac # linkmode 63671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; # *.$libext 63681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo | *.$objext) 63691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = conv; then 63701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 63711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$linkmode" = prog; then 63721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 63731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If there is no dlopen support or we're linking statically, 63741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # we need to preload. 63751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlprefiles " $deplib" 63761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$deplib $compile_deplibs" 63771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$deplib $finalize_deplibs" 63781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 63791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlfiles " $deplib" 63801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 63811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 63821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 63831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 63841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich %DEPLIBS%) 63851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich alldeplibs=yes 63861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 63871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 63881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac # case $deplib 63891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 63901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$found" = yes || test -f "$lib"; then : 63911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 63921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 63931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 63941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 63951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check to see that this really is a libtool archive. 63961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lalib_unsafe_p "$lib" \ 63971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich || func_fatal_error "\`$lib' is not a valid libtool archive" 63981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 63991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$lib" "" "." 64001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ladir="$func_dirname_result" 64011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 64021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlname= 64031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlopen= 64041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlpreopen= 64051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libdir= 64061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich library_names= 64071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich old_library= 64081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich inherited_linker_flags= 64091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the library was installed with an old release of libtool, 64101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # it will not redefine variables installed, or shouldnotlink 64111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich installed=yes 64121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shouldnotlink=no 64131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich avoidtemprpath= 64141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 64151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 64161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Read the .la file 64171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source "$lib" 64181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 64191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Convert "-framework foo" to "foo.ltframework" 64201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$inherited_linker_flags"; then 64211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 64221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 64231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $new_inherited_linker_flags " in 64241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $tmp_inherited_linker_flag "*) ;; 64251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 64261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 64271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 64281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 64291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 64301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" = "lib,link" || 64311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$linkmode,$pass" = "prog,scan" || 64321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { test "$linkmode" != prog && test "$linkmode" != lib; }; then 64331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$dlopen" && func_append dlfiles " $dlopen" 64341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 64351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 64361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 64371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = conv; then 64381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only check for convenience libraries 64391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$lib $deplibs" 64401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$libdir"; then 64411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$old_library"; then 64421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot find name of link library for \`$lib'" 64431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 64441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # It is a libtool convenience library, so add in its objects. 64451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append convenience " $ladir/$objdir/$old_library" 64461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append old_convenience " $ladir/$objdir/$old_library" 64471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$linkmode" != prog && test "$linkmode" != lib; then 64481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$lib' is not a convenience library" 64491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 64501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_libs= 64511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $dependency_libs; do 64521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 64531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $opt_preserve_dup_deps ; then 64541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$tmp_libs " in 64551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) func_append specialdeplibs " $deplib" ;; 64561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 64571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 64581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append tmp_libs " $deplib" 64591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 64601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 64611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # $pass = conv 64621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 64631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 64641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Get the name of the library we link against. 64651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich linklib= 64661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$old_library" && 64671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { test "$prefer_static_libs" = yes || 64681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$prefer_static_libs,$installed" = "built,no"; }; then 64691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich linklib=$old_library 64701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 64711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for l in $old_library $library_names; do 64721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich linklib="$l" 64731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 64741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 64751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$linklib"; then 64761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot find name of link library for \`$lib'" 64771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 64781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 64791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This library was specified with -dlopen. 64801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = dlopen; then 64811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$libdir"; then 64821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 64831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 64841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$dlname" || 64851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$dlopen_support" != yes || 64861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$build_libtool_libs" = no; then 64871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If there is no dlname, no dlopen support or we're linking 64881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # statically, we need to preload. We also need to preload any 64891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # dependent libraries so libltdl's deplib preloader doesn't 64901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # bomb out in the load deplibs phase. 64911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlprefiles " $lib $dependency_libs" 64921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 64931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlfiles " $lib" 64941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 64951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 64961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # $pass = dlopen 64971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 64981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need an absolute path. 64991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $ladir in 65001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 65011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 65021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich abs_ladir=`cd "$ladir" && pwd` 65031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$abs_ladir"; then 65041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "cannot determine absolute directory name of \`$ladir'" 65051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "passing it literally to the linker, although it might fail" 65061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich abs_ladir="$ladir" 65071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 65081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 65091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 65101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$lib" 65111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich laname="$func_basename_result" 65121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 65131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Find the relevant object directory and library name. 65141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$installed" = Xyes; then 65151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 65161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "library \`$lib' was moved." 65171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir="$ladir" 65181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich absdir="$abs_ladir" 65191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libdir="$abs_ladir" 65201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 65211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir="$lt_sysroot$libdir" 65221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich absdir="$lt_sysroot$libdir" 65231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 65241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 65251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 65261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 65271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir="$ladir" 65281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich absdir="$abs_ladir" 65291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove this search path later 65301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append notinst_path " $abs_ladir" 65311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 65321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir="$ladir/$objdir" 65331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich absdir="$abs_ladir/$objdir" 65341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove this search path later 65351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append notinst_path " $abs_ladir" 65361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 65371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # $installed = yes 65381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname 'lib' '.la' "$laname" 65391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name=$func_stripname_result 65401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 65411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This library was specified with -dlpreopen. 65421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = dlpreopen; then 65431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$libdir" && test "$linkmode" = prog; then 65441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 65451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 65461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$host" in 65471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # special handling for platforms with PE-DLLs. 65481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw* | *cegcc* ) 65491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Linker will automatically link against shared library if both 65501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # static and shared are present. Therefore, ensure we extract 65511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # symbols from the import library if a shared library is present 65521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # (otherwise, the dlopen module name will be incorrect). We do 65531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # this by putting the import library name into $newdlprefiles. 65541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We recover the dlopen module name by 'saving' the la file 65551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # name in a special purpose variable, and (later) extracting the 65561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # dlname from the la file. 65571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dlname"; then 65581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_tr_sh "$dir/$linklib" 65591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 65601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlprefiles " $dir/$linklib" 65611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 65621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlprefiles " $dir/$old_library" 65631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Keep a list of preopened convenience libraries to check 65641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # that they are being used correctly in the link pass. 65651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$libdir" && \ 65661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlpreconveniencelibs " $dir/$old_library" 65671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 65681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 65691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich * ) 65701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Prefer using a static library (so that no silly _DYNAMIC symbols 65711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # are required to link). 65721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$old_library"; then 65731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlprefiles " $dir/$old_library" 65741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Keep a list of preopened convenience libraries to check 65751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # that they are being used correctly in the link pass. 65761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$libdir" && \ 65771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dlpreconveniencelibs " $dir/$old_library" 65781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Otherwise, use the dlname, so that lt_dlopen finds it. 65791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -n "$dlname"; then 65801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlprefiles " $dir/$dlname" 65811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 65821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlprefiles " $dir/$linklib" 65831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 65841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 65851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 65861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # $pass = dlpreopen 65871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 65881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$libdir"; then 65891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Link the convenience library 65901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = lib; then 65911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$dir/$old_library $deplibs" 65921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$linkmode,$pass" = "prog,link"; then 65931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$dir/$old_library $compile_deplibs" 65941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$dir/$old_library $finalize_deplibs" 65951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 65961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$lib $deplibs" # used for prog,scan pass 65971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 65981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 65991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 66001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 66011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 66021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = prog && test "$pass" != link; then 66031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newlib_search_path " $ladir" 66041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$lib $deplibs" 66051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 66061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich linkalldeplibs=no 66071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$link_all_deplibs" != no || test -z "$library_names" || 66081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$build_libtool_libs" = no; then 66091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich linkalldeplibs=yes 66101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 66111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 66121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_libs= 66131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $dependency_libs; do 66141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplib in 66151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) func_stripname '-L' '' "$deplib" 66161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$func_stripname_result" 66171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newlib_search_path " $func_resolve_sysroot_result" 66181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 66191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 66201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Need to link against all dependency_libs? 66211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkalldeplibs" = yes; then 66221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 66231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 66241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Need to hardcode shared library paths 66251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # or/and link against static libraries 66261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdependency_libs="$deplib $newdependency_libs" 66271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 66281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $opt_preserve_dup_deps ; then 66291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$tmp_libs " in 66301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) func_append specialdeplibs " $deplib" ;; 66311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 66321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 66331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append tmp_libs " $deplib" 66341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # for deplib 66351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 66361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # $linkmode = prog... 66371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 66381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" = "prog,link"; then 66391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$library_names" && 66401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { { test "$prefer_static_libs" = no || 66411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$prefer_static_libs,$installed" = "built,yes"; } || 66421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$old_library"; }; then 66431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need to hardcode the library path 66441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 66451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make sure the rpath contains only unique directories. 66461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$temp_rpath:" in 66471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *"$absdir:"*) ;; 66481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append temp_rpath "$absdir:" ;; 66491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 66501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 66511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 66521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Hardcode the library path. 66531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Skip directories that are in the system default run-time 66541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # search path. 66551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $sys_lib_dlsearch_path " in 66561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $absdir "*) ;; 66571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 66581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$compile_rpath " in 66591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $absdir "*) ;; 66601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append compile_rpath " $absdir" ;; 66611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 66621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 66631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 66641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $sys_lib_dlsearch_path " in 66651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 66661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 66671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$finalize_rpath " in 66681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 66691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append finalize_rpath " $libdir" ;; 66701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 66711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 66721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 66731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # $linkmode,$pass = prog,link... 66741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 66751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$alldeplibs" = yes && 66761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { test "$deplibs_check_method" = pass_all || 66771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { test "$build_libtool_libs" = yes && 66781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$library_names"; }; }; then 66791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We only need to search for static libraries 66801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 66811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 66821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 66831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 66841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link_static=no # Whether the deplib will be linked statically 66851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich use_static_libs=$prefer_static_libs 66861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$use_static_libs" = built && test "$installed" = yes; then 66871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich use_static_libs=no 66881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 66891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$library_names" && 66901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { test "$use_static_libs" = no || test -z "$old_library"; }; then 66911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 66921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw* | *cegcc*) 66931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # No point in relinking DLLs because paths are not encoded 66941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append notinst_deplibs " $lib" 66951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich need_relink=no 66961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 66971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 66981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$installed" = no; then 66991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append notinst_deplibs " $lib" 67001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich need_relink=yes 67011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 67021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 67031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 67041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This is a shared library 67051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 67061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Warn about portability, can't link against -module's on some 67071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # systems (darwin). Don't bleat about dlopened modules though! 67081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlopenmodule="" 67091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for dlpremoduletest in $dlprefiles; do 67101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$dlpremoduletest" = "X$lib"; then 67111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlopenmodule="$dlpremoduletest" 67121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 67131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 67141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 67151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 67161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 67171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = prog; then 67181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: Linking the executable $output against the loadable module" 67191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 67201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: Linking the shared library $output against the loadable module" 67211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 67221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** $linklib is not portable!" 67231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 67241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = lib && 67251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$hardcode_into_libs" = yes; then 67261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Hardcode the library path. 67271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Skip directories that are in the system default run-time 67281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # search path. 67291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $sys_lib_dlsearch_path " in 67301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $absdir "*) ;; 67311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 67321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$compile_rpath " in 67331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $absdir "*) ;; 67341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append compile_rpath " $absdir" ;; 67351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 67361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 67371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 67381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $sys_lib_dlsearch_path " in 67391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 67401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 67411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$finalize_rpath " in 67421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 67431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append finalize_rpath " $libdir" ;; 67441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 67451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 67461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 67471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 67481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 67491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$old_archive_from_expsyms_cmds"; then 67501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # figure out the soname 67511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $library_names 67521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 67531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich realname="$1" 67541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 67551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libname=`eval "\\$ECHO \"$libname_spec\""` 67561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # use dlname if we got it. it's perfectly good, no? 67571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dlname"; then 67581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich soname="$dlname" 67591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -n "$soname_spec"; then 67601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # bleh windows 67611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 67621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | mingw* | *cegcc*) 67631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $current - $age 67641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=$func_arith_result 67651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix="-$major" 67661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 67671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 67681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval soname=\"$soname_spec\" 67691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 67701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich soname="$realname" 67711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 67721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 67731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make a new name for the extract_expsyms_cmds to use 67741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich soroot="$soname" 67751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$soroot" 67761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich soname="$func_basename_result" 67771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname 'lib' '.dll' "$soname" 67781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newlib=libimp-$func_stripname_result.a 67791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 67801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the library has no export list, then create one now 67811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$output_objdir/$soname-def"; then : 67821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 67831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "extracting exported symbol list from \`$soname'" 67841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 67851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 67861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 67871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Create $newlib 67881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$output_objdir/$newlib"; then :; else 67891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "generating import library for \`$soname'" 67901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 67911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 67921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # make sure the library variables are pointing to the new library 67931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir=$output_objdir 67941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich linklib=$newlib 67951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # test -n "$old_archive_from_expsyms_cmds" 67961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 67971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = prog || test "$opt_mode" != relink; then 67981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_shlibpath= 67991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_dir= 68001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add= 68011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib_linked=yes 68021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $hardcode_action in 68031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich immediate | unsupported) 68041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$hardcode_direct" = no; then 68051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="$dir/$linklib" 68061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 68071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 68081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-sysv4*uw2*) add_dir="-L$dir" ;; 68091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 68101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-unixware7*) add_dir="-L$dir" ;; 68111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-darwin* ) 68121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # if the lib is a (non-dlopened) module then we can not 68131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # link against it, someone is ignoring the earlier warnings 68141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if /usr/bin/file -L $add 2> /dev/null | 68151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $GREP ": [^:]* bundle" >/dev/null ; then 68161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$dlopenmodule" != "X$lib"; then 68171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: lib $linklib is a module, not a shared library" 68181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$old_library" ; then 68191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 68201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** And there doesn't seem to be a static archive available" 68211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** The link will probably fail, sorry" 68221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 68231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="$dir/$old_library" 68241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -n "$old_library"; then 68261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="$dir/$old_library" 68271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 68301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$hardcode_minus_L" = no; then 68311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 68321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-sunos*) add_shlibpath="$dir" ;; 68331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 68341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_dir="-L$dir" 68351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="-l$name" 68361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$hardcode_shlibpath_var" = no; then 68371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_shlibpath="$dir" 68381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="-l$name" 68391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 68401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib_linked=no 68411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 68431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink) 68441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$hardcode_direct" = yes && 68451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$hardcode_direct_absolute" = no; then 68461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="$dir/$linklib" 68471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$hardcode_minus_L" = yes; then 68481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_dir="-L$absdir" 68491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Try looking first in the location we're being installed to. 68501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$inst_prefix_dir"; then 68511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $libdir in 68521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]*) 68531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append add_dir " -L$inst_prefix_dir$libdir" 68541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 68551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 68561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="-l$name" 68581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$hardcode_shlibpath_var" = yes; then 68591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_shlibpath="$dir" 68601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="-l$name" 68611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 68621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib_linked=no 68631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 68651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) lib_linked=no ;; 68661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 68671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 68681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$lib_linked" != yes; then 68691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_configuration "unsupported hardcode properties" 68701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 68721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$add_shlibpath"; then 68731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case :$compile_shlibpath: in 68741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *":$add_shlibpath:"*) ;; 68751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append compile_shlibpath "$add_shlibpath:" ;; 68761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 68771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = prog; then 68791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 68801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$add" && compile_deplibs="$add $compile_deplibs" 68811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 68821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$add_dir" && deplibs="$add_dir $deplibs" 68831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$add" && deplibs="$add $deplibs" 68841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$hardcode_direct" != yes && 68851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$hardcode_minus_L" != yes && 68861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$hardcode_shlibpath_var" = yes; then 68871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case :$finalize_shlibpath: in 68881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *":$libdir:"*) ;; 68891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append finalize_shlibpath "$libdir:" ;; 68901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 68911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 68941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 68951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = prog || test "$opt_mode" = relink; then 68961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_shlibpath= 68971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_dir= 68981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add= 68991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Finalize command for both is simple: just hardcode it. 69001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$hardcode_direct" = yes && 69011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$hardcode_direct_absolute" = no; then 69021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="$libdir/$linklib" 69031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$hardcode_minus_L" = yes; then 69041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_dir="-L$libdir" 69051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="-l$name" 69061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$hardcode_shlibpath_var" = yes; then 69071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case :$finalize_shlibpath: in 69081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *":$libdir:"*) ;; 69091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append finalize_shlibpath "$libdir:" ;; 69101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 69111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="-l$name" 69121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$hardcode_automatic" = yes; then 69131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$inst_prefix_dir" && 69141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -f "$inst_prefix_dir$libdir/$linklib" ; then 69151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="$inst_prefix_dir$libdir/$linklib" 69161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 69171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="$libdir/$linklib" 69181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 69201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We cannot seem to hardcode it, guess we'll fake it. 69211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add_dir="-L$libdir" 69221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Try looking first in the location we're being installed to. 69231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$inst_prefix_dir"; then 69241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $libdir in 69251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]*) 69261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append add_dir " -L$inst_prefix_dir$libdir" 69271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 69281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 69291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich add="-l$name" 69311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 69331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = prog; then 69341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 69351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 69361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 69371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$add_dir" && deplibs="$add_dir $deplibs" 69381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$add" && deplibs="$add $deplibs" 69391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$linkmode" = prog; then 69421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Here we assume that one of hardcode_direct or hardcode_minus_L 69431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # is not unsupported. This is valid on all known static and 69441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # shared platforms. 69451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$hardcode_direct" != unsupported; then 69461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$old_library" && linklib="$old_library" 69471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$dir/$linklib $compile_deplibs" 69481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$dir/$linklib $finalize_deplibs" 69491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 69501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="-l$name -L$dir $compile_deplibs" 69511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="-l$name -L$dir $finalize_deplibs" 69521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$build_libtool_libs" = yes; then 69541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Not a shared library 69551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$deplibs_check_method" != pass_all; then 69561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We're trying link a shared library against a static one 69571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # but the system doesn't support it. 69581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 69591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Just print a warning and add the library to dependency_libs so 69601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # that the program can be linked against the static library. 69611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 69621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: This system can not link to static lib archive $lib." 69631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** I have the capability to make that library automatically link in when" 69641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** you link to this library. But I can only do this if you have a" 69651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** shared version of the library, which you do not appear to have." 69661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$module" = yes; then 69671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** But as you try to build a module library, libtool will still create " 69681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** a static module, that should work as long as the dlopening application" 69691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 69701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$global_symbol_pipe"; then 69711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 69721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** However, this would only work if libtool was able to extract symbol" 69731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 69741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** not find such a program. So, this module is probably useless." 69751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** \`nm' from GNU binutils and a full rebuild may help." 69761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_old_libs" = no; then 69781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=module 69791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_old_libs=yes 69801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 69811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=no 69821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 69851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$dir/$old_library $deplibs" 69861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link_static=yes 69871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 69881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # link shared/static library? 69891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 69901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = lib; then 69911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dependency_libs" && 69921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { test "$hardcode_into_libs" != yes || 69931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$build_old_libs" = yes || 69941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$link_static" = yes; }; then 69951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Extract -R from dependency_libs 69961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich temp_deplibs= 69971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for libdir in $dependency_libs; do 69981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $libdir in 69991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -R*) func_stripname '-R' '' "$libdir" 70001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich temp_xrpath=$func_stripname_result 70011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $xrpath " in 70021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $temp_xrpath "*) ;; 70031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append xrpath " $temp_xrpath";; 70041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac;; 70051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append temp_deplibs " $libdir";; 70061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 70071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 70081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dependency_libs="$temp_deplibs" 70091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 70101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 70111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newlib_search_path " $absdir" 70121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Link against this library 70131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 70141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # ... and its dependency_libs 70151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_libs= 70161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $dependency_libs; do 70171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdependency_libs="$deplib $newdependency_libs" 70181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplib in 70191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) func_stripname '-L' '' "$deplib" 70201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$func_stripname_result";; 70211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_resolve_sysroot "$deplib" ;; 70221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 70231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $opt_preserve_dup_deps ; then 70241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$tmp_libs " in 70251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $func_resolve_sysroot_result "*) 70261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append specialdeplibs " $func_resolve_sysroot_result" ;; 70271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 70281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 70291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append tmp_libs " $func_resolve_sysroot_result" 70301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 70311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 70321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$link_all_deplibs" != no; then 70331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add the search paths of all dependency libraries 70341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $dependency_libs; do 70351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich path= 70361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplib in 70371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) path="$deplib" ;; 70381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 70391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$deplib" 70401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplib=$func_resolve_sysroot_result 70411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$deplib" "" "." 70421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir=$func_dirname_result 70431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We need an absolute path. 70441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $dir in 70451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 70461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 70471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich absdir=`cd "$dir" && pwd` 70481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$absdir"; then 70491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "cannot determine absolute directory name of \`$dir'" 70501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich absdir="$dir" 70511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 70521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 70531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 70541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $GREP "^installed=no" $deplib > /dev/null; then 70551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 70561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-darwin*) 70571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich depdepl= 70581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 70591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$deplibrary_names" ; then 70601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for tmp in $deplibrary_names ; do 70611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich depdepl=$tmp 70621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 70631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$absdir/$objdir/$depdepl" ; then 70641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich depdepl="$absdir/$objdir/$depdepl" 70651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 70661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$darwin_install_name"; then 70671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 70681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 70691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 70701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" 70711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich path= 70721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 70731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 70741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 70751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 70761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich path="-L$absdir/$objdir" 70771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 70781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 70791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 70801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 70811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$libdir" && \ 70821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$deplib' is not a valid libtool archive" 70831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$absdir" != "$libdir" && \ 70841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`$deplib' seems to be moved" 70851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 70861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich path="-L$absdir" 70871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 70881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 70891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 70901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $deplibs " in 70911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $path "*) ;; 70921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) deplibs="$path $deplibs" ;; 70931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 70941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 70951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # link_all_deplibs != no 70961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi # linkmode = lib 70971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # for deplib in $libs 70981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = link; then 70991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = "prog"; then 71001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 71011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 71021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 71031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 71041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 71051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 71061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dependency_libs="$newdependency_libs" 71071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" = dlpreopen; then 71081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Link the dlpreopened libraries before other libraries 71091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $save_deplibs; do 71101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$deplib $deplibs" 71111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 71121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 71131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" != dlopen; then 71141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$pass" != conv; then 71151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make sure lib_search_path contains only unique directories. 71161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib_search_path= 71171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for dir in $newlib_search_path; do 71181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$lib_search_path " in 71191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $dir "*) ;; 71201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append lib_search_path " $dir" ;; 71211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 71221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 71231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newlib_search_path= 71241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 71251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 71261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode,$pass" != "prog,link"; then 71271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich vars="deplibs" 71281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 71291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich vars="compile_deplibs finalize_deplibs" 71301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 71311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for var in $vars dependency_libs; do 71321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add libraries to $var in reverse order 71331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval tmp_libs=\"\$$var\" 71341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_libs= 71351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $tmp_libs; do 71361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # FIXME: Pedantically, this is the right thing to do, so 71371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # that some nasty dependency loop isn't accidentally 71381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # broken: 71391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich #new_libs="$deplib $new_libs" 71401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Pragmatically, this seems to cause very few problems in 71411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # practice: 71421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplib in 71431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) new_libs="$deplib $new_libs" ;; 71441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -R*) ;; 71451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 71461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # And here is the reason: when a library appears more 71471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # than once as an explicit dependence of a library, or 71481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # is implicitly linked in more than once by the 71491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # compiler, it is considered special, and multiple 71501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # occurrences thereof are not removed. Compare this 71511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # with having the same library being listed as a 71521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # dependency of multiple other libraries: in this case, 71531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # we know (pedantically, we assume) the library does not 71541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # need to be listed more than once, so we keep only the 71551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # last copy. This is not always right, but it is rare 71561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # enough that we require users that really mean to play 71571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # such unportable linking tricks to link the library 71581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # using -Wl,-lname, so that libtool does not consider it 71591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # for duplicate removal. 71601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $specialdeplibs " in 71611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) new_libs="$deplib $new_libs" ;; 71621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 71631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $new_libs " in 71641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) ;; 71651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) new_libs="$deplib $new_libs" ;; 71661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 71671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 71681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 71691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 71701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 71711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 71721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_libs= 71731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $new_libs; do 71741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplib in 71751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) 71761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $tmp_libs " in 71771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) ;; 71781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append tmp_libs " $deplib" ;; 71791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 71801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 71811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append tmp_libs " $deplib" ;; 71821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 71831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 71841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval $var=\"$tmp_libs\" 71851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # for var 71861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 71871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Last step: remove runtime libs from dependency_libs 71881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # (they stay in deplibs) 71891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_libs= 71901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for i in $dependency_libs ; do 71911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $predeps $postdeps $compiler_lib_search_path " in 71921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $i "*) 71931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich i="" 71941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 71951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 71961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$i" ; then 71971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append tmp_libs " $i" 71981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 71991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 72001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dependency_libs=$tmp_libs 72011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # for pass 72021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = prog; then 72031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlfiles="$newdlfiles" 72041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 72051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$linkmode" = prog || test "$linkmode" = lib; then 72061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlprefiles="$newdlprefiles" 72071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 72081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $linkmode in 72101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldlib) 72111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 72121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-dlopen' is ignored for archives" 72131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 72141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $deplibs" in 72161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *\ -l* | *\ -L*) 72171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-l' and \`-L' are ignored for archives" ;; 72181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 72191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$rpath" && \ 72211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-rpath' is ignored for archives" 72221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$xrpath" && \ 72241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-R' is ignored for archives" 72251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$vinfo" && \ 72271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-version-info/-version-number' is ignored for archives" 72281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$release" && \ 72301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-release' is ignored for archives" 72311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$export_symbols$export_symbols_regex" && \ 72331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-export-symbols' is ignored for archives" 72341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now set the variables for building old libraries. 72361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=no 72371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldlibs="$output" 72381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append objs "$old_deplibs" 72391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 72401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib) 72421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make sure we only generate libraries of the form `libNAME.la'. 72431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $outputname in 72441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib*) 72451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname 'lib' '.la' "$outputname" 72461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name=$func_stripname_result 72471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval shared_ext=\"$shrext_cmds\" 72481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval libname=\"$libname_spec\" 72491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 72501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 72511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$module" = no && \ 72521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "libtool library \`$output' must begin with \`lib'" 72531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$need_lib_prefix" != no; then 72551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add the "lib" prefix for modules if required 72561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '.la' "$outputname" 72571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name=$func_stripname_result 72581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval shared_ext=\"$shrext_cmds\" 72591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval libname=\"$libname_spec\" 72601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 72611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '.la' "$outputname" 72621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libname=$func_stripname_result 72631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 72641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 72651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 72661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$objs"; then 72681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$deplibs_check_method" != pass_all; then 72691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 72701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 72711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 72721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 72731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** objects $objs is not portable!" 72741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libobjs " $objs" 72751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 72761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 72771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$dlself" != no && \ 72791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-dlopen self' is ignored for libtool libraries" 72801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $rpath 72821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 72831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$#" -gt 1 && \ 72841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "ignoring multiple \`-rpath's for a libtool library" 72851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich install_libdir="$1" 72871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 72881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldlibs= 72891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$rpath"; then 72901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = yes; then 72911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Building a libtool convenience library. 72921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Some compilers have problems with a `.al' extension so 72931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # convenience libraries should have the same extension an 72941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # archive normally would. 72951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldlibs="$output_objdir/$libname.$libext $oldlibs" 72961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=convenience 72971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_old_libs=yes 72981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 72991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$vinfo" && \ 73011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 73021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$release" && \ 73041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-release' is ignored for convenience libraries" 73051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 73061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Parse the version information argument. 73081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_ifs="$IFS"; IFS=':' 73091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $vinfo 0 0 0 73101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 73111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 73121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$7" && \ 73141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "too many parameters to \`-version-info'" 73151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # convert absolute version numbers to libtool ages 73171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # this retains compatibility with .la files and attempts 73181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # to make the code below a bit more comprehensible 73191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $vinfo_number in 73211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich yes) 73221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich number_major="$1" 73231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich number_minor="$2" 73241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich number_revision="$3" 73251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # 73261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # There are really only two kinds -- those that 73271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # use the current revision as the major version 73281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # and those that subtract age and use age as 73291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # a minor version. But, then there is irix 73301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # which has an extra 1 added just for fun 73311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # 73321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $version_type in 73331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # correct linux to gnu/linux during the next big refactor 73341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin|linux|osf|windows|none) 73351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $number_major + $number_minor 73361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich current=$func_arith_result 73371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich age="$number_minor" 73381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich revision="$number_revision" 73391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 73401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich freebsd-aout|freebsd-elf|qnx|sunos) 73411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich current="$number_major" 73421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich revision="$number_minor" 73431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich age="0" 73441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 73451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich irix|nonstopux) 73461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $number_major + $number_minor 73471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich current=$func_arith_result 73481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich age="$number_minor" 73491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich revision="$number_minor" 73501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_irix_increment=no 73511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 73521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 73531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 73541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich no) 73551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich current="$1" 73561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich revision="$2" 73571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich age="$3" 73581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 73591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 73601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check that each of the things are valid numbers. 73621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $current in 73631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 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]) ;; 73641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 73651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "CURRENT \`$current' must be a nonnegative integer" 73661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$vinfo' is not valid version information" 73671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 73681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 73691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $revision in 73711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 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]) ;; 73721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 73731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "REVISION \`$revision' must be a nonnegative integer" 73741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$vinfo' is not valid version information" 73751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 73761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 73771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $age in 73791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 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]) ;; 73801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 73811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "AGE \`$age' must be a nonnegative integer" 73821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$vinfo' is not valid version information" 73831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 73841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 73851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$age" -gt "$current"; then 73871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_error "AGE \`$age' is greater than the current interface number \`$current'" 73881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$vinfo' is not valid version information" 73891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 73901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Calculate the version variables. 73921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major= 73931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix= 73941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich verstring= 73951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $version_type in 73961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich none) ;; 73971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 73981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin) 73991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Like Linux, but with the current version available in 74001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # verstring for coding it into the library header 74011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $current - $age 74021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=.$func_arith_result 74031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix="$major.$age.$revision" 74041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Darwin ld doesn't like 0 for these options... 74051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $current + 1 74061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich minor_current=$func_arith_result 74071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 74081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 74091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich freebsd-aout) 74121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=".$current" 74131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix=".$current.$revision"; 74141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich freebsd-elf) 74171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=".$current" 74181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix=".$current" 74191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich irix | nonstopux) 74221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$lt_irix_increment" = "Xno"; then 74231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $current - $age 74241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 74251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $current - $age + 1 74261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 74271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=$func_arith_result 74281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $version_type in 74301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich nonstopux) verstring_prefix=nonstopux ;; 74311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) verstring_prefix=sgi ;; 74321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 74331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich verstring="$verstring_prefix$major.$revision" 74341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add in all the interfaces that we are compatible with. 74361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich loop=$revision 74371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while test "$loop" -ne 0; do 74381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $revision - $loop 74391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich iface=$func_arith_result 74401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $loop - 1 74411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich loop=$func_arith_result 74421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich verstring="$verstring_prefix$major.$iface:$verstring" 74431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 74441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Before this point, $major must not contain `.'. 74461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=.$major 74471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix="$major.$revision" 74481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich linux) # correct to gnu/linux during the next big refactor 74511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $current - $age 74521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=.$func_arith_result 74531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix="$major.$age.$revision" 74541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich osf) 74571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $current - $age 74581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=.$func_arith_result 74591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix=".$current.$age.$revision" 74601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich verstring="$current.$age.$revision" 74611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add in all the interfaces that we are compatible with. 74631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich loop=$age 74641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while test "$loop" -ne 0; do 74651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $current - $loop 74661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich iface=$func_arith_result 74671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $loop - 1 74681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich loop=$func_arith_result 74691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich verstring="$verstring:${iface}.0" 74701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 74711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make executables depend on our current version. 74731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append verstring ":${current}.0" 74741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich qnx) 74771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=".$current" 74781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix=".$current" 74791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich sunos) 74821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=".$current" 74831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix=".$current.$revision" 74841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich windows) 74871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Use '-' rather than '.', since we only want one 74881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # extension on DOS 8.3 filesystems. 74891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $current - $age 74901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=$func_arith_result 74911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix="-$major" 74921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 74951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_configuration "unknown library version type \`$version_type'" 74961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 74971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 74981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 74991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Clear the version info if we defaulted, and they specified a release. 75001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$vinfo" && test -n "$release"; then 75011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major= 75021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $version_type in 75031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich darwin) 75041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # we can't check for "0.0" in archive_cmds due to quoting 75051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # problems, so we reset it completely 75061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich verstring= 75071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 75081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 75091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich verstring="0.0" 75101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 75111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 75121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$need_version" = no; then 75131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix= 75141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 75151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix=".0.0" 75161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 75191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove version info from name if versioning should be avoided 75201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$avoid_version" = yes && test "$need_version" = no; then 75211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major= 75221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix= 75231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich verstring="" 75241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 75261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Check to see if the archive will have undefined symbols. 75271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$allow_undefined" = yes; then 75281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$allow_undefined_flag" = unsupported; then 75291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "undefined symbols not allowed in $host shared libraries" 75301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=no 75311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_old_libs=yes 75321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 75341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Don't allow undefined symbols. 75351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich allow_undefined_flag="$no_undefined_flag" 75361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 75381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 75401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_generate_dlsyms "$libname" "$libname" "yes" 75411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libobjs " $symfileobj" 75421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$libobjs" = "X " && libobjs= 75431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 75441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$opt_mode" != relink; then 75451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove our outputs, but don't remove object files since they 75461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # may have been created when compiling PIC objects. 75471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich removelist= 75481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tempremovelist=`$ECHO "$output_objdir/*"` 75491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for p in $tempremovelist; do 75501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $p in 75511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.$objext | *.gcno) 75521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 75531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 75541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$precious_files_regex" != "X"; then 75551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 75561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich then 75571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 75581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append removelist " $p" 75611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 75621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) ;; 75631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 75641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 75651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$removelist" && \ 75661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "${RM}r \$removelist" 75671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 75691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now set the variables for building old libraries. 75701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 75711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append oldlibs " $output_objdir/$libname.$libext" 75721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 75731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Transform .lo files to .o files. 75741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 75751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 75771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Eliminate all temporary directories. 75781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich #for path in $notinst_path; do 75791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 75801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 75811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 75821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich #done 75831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 75841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$xrpath"; then 75851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the user specified any rpath flags, then add them. 75861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich temp_xrpath= 75871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for libdir in $xrpath; do 75881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_replace_sysroot "$libdir" 75891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append temp_xrpath " -R$func_replace_sysroot_result" 75901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$finalize_rpath " in 75911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 75921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append finalize_rpath " $libdir" ;; 75931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 75941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 75951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 75961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dependency_libs="$temp_xrpath $dependency_libs" 75971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 75991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 76001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make sure dlfiles contains only unique files that won't be dlpreopened 76011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich old_dlfiles="$dlfiles" 76021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlfiles= 76031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $old_dlfiles; do 76041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $dlprefiles $dlfiles " in 76051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $lib "*) ;; 76061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append dlfiles " $lib" ;; 76071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 76081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 76091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 76101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make sure dlprefiles contains only unique files 76111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich old_dlprefiles="$dlprefiles" 76121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlprefiles= 76131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $old_dlprefiles; do 76141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$dlprefiles " in 76151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $lib "*) ;; 76161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append dlprefiles " $lib" ;; 76171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 76181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 76191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 76201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = yes; then 76211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$rpath"; then 76221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 76231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 76241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # these systems don't actually have a c library (as such)! 76251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 76261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-rhapsody* | *-*-darwin1.[012]) 76271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Rhapsody C library is in the System framework 76281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append deplibs " System.ltframework" 76291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 76301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-netbsd*) 76311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Don't link with libc until the a.out ld.so is fixed. 76321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 76331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 76341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do not include libc due to us having libc/libc_r. 76351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 76361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-sco3.2v5* | *-*-sco5v6*) 76371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Causes problems with __ctype 76381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 76391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 76401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Compiler inserts libc in the correct place for threads to work 76411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 76421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 76431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add libc to deplibs on all other systems if necessary. 76441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_need_lc" = "yes"; then 76451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append deplibs " -lc" 76461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 76471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 76481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 76491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 76501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 76511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Transform deplibs into only deplibs that can be linked in shared. 76521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name_save=$name 76531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libname_save=$libname 76541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich release_save=$release 76551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix_save=$versuffix 76561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major_save=$major 76571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # I'm not sure if I'm treating the release correctly. I think 76581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # release should show up in the -l (ie -lgmp5) so we don't want to 76591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # add it in twice. Is that correct? 76601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich release="" 76611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix="" 76621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major="" 76631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdeplibs= 76641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich droppeddeps=no 76651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplibs_check_method in 76661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich pass_all) 76671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Don't check for shared/static. Everything works. 76681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This might be a little naive. We might want to check 76691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # whether the library exists or not. But this is on 76701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # osf3 & osf4 and I'm not really sure... Just 76711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # implementing what was already the behavior. 76721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdeplibs=$deplibs 76731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 76741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test_compile) 76751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This code stresses the "libraries are programs" paradigm to its 76761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # limits. Maybe even breaks it. We compile a program, linking it 76771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # against the deplibs as a proxy for the library. Then we can check 76781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # whether they linked in statically or dynamically with ldd. 76791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM conftest.c 76801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cat > conftest.c <<EOF 76811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich int main() { return 0; } 76821d1011a3c5049a7f9eef99d22f3704e4367579ccNick KralevichEOF 76831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM conftest 76841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 76851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ldd_output=`ldd conftest` 76861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for i in $deplibs; do 76871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $i in 76881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -l*) 76891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname -l '' "$i" 76901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name=$func_stripname_result 76911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 76921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $predeps $postdeps " in 76931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $i "*) 76941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $i" 76951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich i="" 76961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 76971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 76981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 76991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$i" ; then 77001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libname=`eval "\\$ECHO \"$libname_spec\""` 77011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 77021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $deplib_matches; shift 77031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplib_match=$1 77041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 77051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $i" 77061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 77071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich droppeddeps=yes 77081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 77091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: dynamic linker does not accept needed library $i." 77101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** I have the capability to make that library automatically link in when" 77111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** you link to this library. But I can only do this if you have a" 77121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** shared version of the library, which I believe you do not have" 77131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** because a test_compile did reveal that the linker did not use it for" 77141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** its dynamic dependency list that programs get resolved with at runtime." 77151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 77161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 77171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 77181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 77191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $i" 77201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 77211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 77221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 77231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 77241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Error occurred in the first compile. Let's try to salvage 77251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the situation: Compile a separate program for each library. 77261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for i in $deplibs; do 77271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $i in 77281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -l*) 77291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname -l '' "$i" 77301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name=$func_stripname_result 77311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM conftest 77321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 77331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ldd_output=`ldd conftest` 77341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 77351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $predeps $postdeps " in 77361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $i "*) 77371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $i" 77381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich i="" 77391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 77401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 77411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 77421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$i" ; then 77431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libname=`eval "\\$ECHO \"$libname_spec\""` 77441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 77451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $deplib_matches; shift 77461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplib_match=$1 77471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 77481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $i" 77491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 77501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich droppeddeps=yes 77511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 77521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: dynamic linker does not accept needed library $i." 77531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** I have the capability to make that library automatically link in when" 77541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** you link to this library. But I can only do this if you have a" 77551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** shared version of the library, which you do not appear to have" 77561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** because a test_compile did reveal that the linker did not use this one" 77571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** as a dynamic dependency that programs can get resolved with at runtime." 77581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 77591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 77601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 77611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich droppeddeps=yes 77621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 77631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 77641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** make it link in! You will probably need to install it or some" 77651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** library that it depends on before this library will be fully" 77661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** functional. Installing it before continuing would be even better." 77671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 77681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 77691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 77701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $i" 77711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 77721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 77731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 77741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 77751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 77761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file_magic*) 77771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $deplibs_check_method; shift 77781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 77791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for a_deplib in $deplibs; do 77801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $a_deplib in 77811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -l*) 77821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname -l '' "$a_deplib" 77831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name=$func_stripname_result 77841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 77851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $predeps $postdeps " in 77861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $a_deplib "*) 77871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $a_deplib" 77881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich a_deplib="" 77891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 77901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 77911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 77921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$a_deplib" ; then 77931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libname=`eval "\\$ECHO \"$libname_spec\""` 77941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$file_magic_glob"; then 77951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 77961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 77971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libnameglob=$libname 77981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 77991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` 78001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 78011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$want_nocaseglob" = yes; then 78021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shopt -s nocaseglob 78031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 78041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $nocaseglob 78051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 78061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 78071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 78081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for potent_lib in $potential_libs; do 78091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Follow soft links. 78101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ls -lLd "$potent_lib" 2>/dev/null | 78111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $GREP " -> " >/dev/null; then 78121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 78131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 78141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The statement above tries to avoid entering an 78151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # endless loop below, in case of cyclic links. 78161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We might still enter an endless loop, since a link 78171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # loop can be closed while we follow links, 78181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # but so what? 78191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich potlib="$potent_lib" 78201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while test -h "$potlib" 2>/dev/null; do 78211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 78221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $potliblink in 78231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 78241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 78251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 78261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 78271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 78281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $SED -e 10q | 78291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $EGREP "$file_magic_regex" > /dev/null; then 78301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $a_deplib" 78311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich a_deplib="" 78321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 2 78331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 78341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 78351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 78361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 78371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$a_deplib" ; then 78381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich droppeddeps=yes 78391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 78401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 78411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** I have the capability to make that library automatically link in when" 78421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** you link to this library. But I can only do this if you have a" 78431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** shared version of the library, which you do not appear to have" 78441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** because I did check the linker path looking for a file starting" 78451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$potlib" ; then 78461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 78471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 78481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** with $libname and none of the candidates passed a file format test" 78491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** using a file magic. Last file checked: $potlib" 78501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 78511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 78521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 78531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 78541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add a -L argument. 78551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $a_deplib" 78561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 78571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 78581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # Gone through all deplibs. 78591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 78601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich match_pattern*) 78611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $deplibs_check_method; shift 78621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 78631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for a_deplib in $deplibs; do 78641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $a_deplib in 78651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -l*) 78661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname -l '' "$a_deplib" 78671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name=$func_stripname_result 78681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 78691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $predeps $postdeps " in 78701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $a_deplib "*) 78711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $a_deplib" 78721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich a_deplib="" 78731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 78741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 78751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 78761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$a_deplib" ; then 78771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libname=`eval "\\$ECHO \"$libname_spec\""` 78781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 78791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 78801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for potent_lib in $potential_libs; do 78811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich potlib="$potent_lib" # see symlink-check above in file_magic test 78821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 78831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $EGREP "$match_pattern_regex" > /dev/null; then 78841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $a_deplib" 78851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich a_deplib="" 78861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 2 78871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 78881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 78891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 78901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 78911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$a_deplib" ; then 78921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich droppeddeps=yes 78931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 78941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 78951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** I have the capability to make that library automatically link in when" 78961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** you link to this library. But I can only do this if you have a" 78971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** shared version of the library, which you do not appear to have" 78981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** because I did check the linker path looking for a file starting" 78991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$potlib" ; then 79001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 79011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 79021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** with $libname and none of the candidates passed a file format test" 79031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** using a regex pattern. Last file checked: $potlib" 79041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 79071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 79081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add a -L argument. 79091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdeplibs " $a_deplib" 79101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 79111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 79121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done # Gone through all deplibs. 79131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 79141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich none | unknown | *) 79151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdeplibs="" 79161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 79171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 79181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for i in $predeps $postdeps ; do 79191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # can't use Xsed below, because $i might contain '/' 79201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 79211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 79221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $tmp_deplibs in 79241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[!\ \ ]*) 79251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 79261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$deplibs_check_method" = "Xnone"; then 79271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** Warning: inter-library dependencies are not supported in this platform." 79281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 79291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** Warning: inter-library dependencies are not known to be supported." 79301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** All declared inter-library dependencies are being dropped." 79321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich droppeddeps=yes 79331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 79341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 79351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 79361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 79371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich versuffix=$versuffix_save 79381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich major=$major_save 79391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich release=$release_save 79401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libname=$libname_save 79411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name=$name_save 79421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 79431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 79441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-rhapsody* | *-*-darwin1.[012]) 79451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # On Rhapsody replace the C library with the System framework 79461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 79471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 79481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 79491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 79501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$droppeddeps" = yes; then 79511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$module" = yes; then 79521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 79531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** Warning: libtool could not satisfy all declared inter-library" 79541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 79551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** a static module, that should work as long as the dlopening" 79561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** application is linked with the -dlopen flag." 79571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$global_symbol_pipe"; then 79581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 79591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** However, this would only work if libtool was able to extract symbol" 79601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 79611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** not find such a program. So, this module is probably useless." 79621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** \`nm' from GNU binutils and a full rebuild may help." 79631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_old_libs" = no; then 79651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldlibs="$output_objdir/$libname.$libext" 79661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=module 79671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_old_libs=yes 79681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 79691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=no 79701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 79721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** The inter-library dependencies that have been dropped here will be" 79731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** automatically added whenever a program is linked with this library" 79741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** or is declared to -dlopen it." 79751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 79761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$allow_undefined" = no; then 79771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 79781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** Since this library must not contain undefined symbols," 79791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** because either the platform does not support them or" 79801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** it was explicitly requested with -no-undefined," 79811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "*** libtool will only create a static version of it." 79821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_old_libs" = no; then 79831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldlibs="$output_objdir/$libname.$libext" 79841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=module 79851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_old_libs=yes 79861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 79871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=no 79881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Done checking deplibs! 79931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs=$newdeplibs 79941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 79951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Time to change all our "foo.ltframework" stuff back to "-framework foo" 79961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 79971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-darwin*) 79981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 79991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 80001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 80011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 80021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 80031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 80041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # move library search paths that coincide with paths to not yet 80051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # installed libraries to the beginning of the library search list 80061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_libs= 80071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for path in $notinst_path; do 80081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $new_libs " in 80091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" -L$path/$objdir "*) ;; 80101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 80111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $deplibs " in 80121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" -L$path/$objdir "*) 80131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append new_libs " -L$path/$objdir" ;; 80141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 80151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 80161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 80171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 80181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $deplibs; do 80191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplib in 80201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) 80211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $new_libs " in 80221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) ;; 80231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append new_libs " $deplib" ;; 80241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 80251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 80261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append new_libs " $deplib" ;; 80271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 80281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 80291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$new_libs" 80301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 80311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # All the library-specific variables (install_libdir is set above). 80321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich library_names= 80331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich old_library= 80341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlname= 80351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 80361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Test again, we may have decided not to build it any more 80371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = yes; then 80381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remove ${wl} instances when linking with ld. 80391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # FIXME: should test the right _cmds variable. 80401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $archive_cmds in 80411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *\$LD\ *) wl= ;; 80421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 80431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$hardcode_into_libs" = yes; then 80441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Hardcode the library paths 80451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich hardcode_libdirs= 80461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dep_rpath= 80471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rpath="$finalize_rpath" 80481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$opt_mode" != relink && rpath="$compile_rpath$rpath" 80491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for libdir in $rpath; do 80501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_flag_spec"; then 80511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_separator"; then 80521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_replace_sysroot "$libdir" 80531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libdir=$func_replace_sysroot_result 80541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$hardcode_libdirs"; then 80551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich hardcode_libdirs="$libdir" 80561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 80571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Just accumulate the unique libdirs. 80581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 80591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 80601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 80611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 80621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 80631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 80641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 80651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 80661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 80671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval flag=\"$hardcode_libdir_flag_spec\" 80681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append dep_rpath " $flag" 80691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 80701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -n "$runpath_var"; then 80711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$perm_rpath " in 80721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 80731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append perm_rpath " $libdir" ;; 80741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 80751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 80761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 80771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Substitute the hardcoded libdirs into the rpath. 80781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_separator" && 80791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$hardcode_libdirs"; then 80801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libdir="$hardcode_libdirs" 80811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" 80821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 80831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$runpath_var" && test -n "$perm_rpath"; then 80841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We should set the runpath_var. 80851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rpath= 80861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for dir in $perm_rpath; do 80871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rpath "$dir:" 80881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 80891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 80901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 80911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 80921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 80931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 80941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shlibpath="$finalize_shlibpath" 80951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 80961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$shlibpath"; then 80971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 80981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 80991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 81001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Get the real and link names of the library. 81011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval shared_ext=\"$shrext_cmds\" 81021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval library_names=\"$library_names_spec\" 81031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set dummy $library_names 81041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 81051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich realname="$1" 81061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 81071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 81081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$soname_spec"; then 81091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval soname=\"$soname_spec\" 81101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 81111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich soname="$realname" 81121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 81131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$dlname"; then 81141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlname=$soname 81151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 81161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 81171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lib="$output_objdir/$realname" 81181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich linknames= 81191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for link 81201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 81211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append linknames " $link" 81221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 81231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 81241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Use standard objects if they are pic 81251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 81261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$libobjs" = "X " && libobjs= 81271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 81281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich delfiles= 81291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols" && test -n "$include_expsyms"; then 81301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 81311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols="$output_objdir/$libname.uexp" 81321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append delfiles " $export_symbols" 81331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 81341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 81351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich orig_export_symbols= 81361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host_os in 81371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cygwin* | mingw* | cegcc*) 81381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 81391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # exporting using user supplied symfile 81401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 81411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # and it's NOT already a .def file. Must figure out 81421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # which of the given symbols are data symbols and tag 81431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # them as such. So, trigger use of export_symbols_cmds. 81441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # export_symbols gets reassigned inside the "prepare 81451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the list of exported symbols" if statement, so the 81461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # include_expsyms logic still works. 81471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich orig_export_symbols="$export_symbols" 81481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols= 81491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich always_export_symbols=yes 81501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 81511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 81521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 81531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 81541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 81551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Prepare the list of exported symbols 81561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$export_symbols"; then 81571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 81581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "generating symbol list for \`$libname.la'" 81591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols="$output_objdir/$libname.exp" 81601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM $export_symbols 81611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$export_symbols_cmds 81621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_ifs="$IFS"; IFS='~' 81631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for cmd1 in $cmds; do 81641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 81651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Take the normal branch if the nm_file_list_spec branch 81661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # doesn't work or if tool conversion is not needed. 81671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $nm_file_list_spec~$to_tool_file_cmd in 81681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 81691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich try_normal_branch=yes 81701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval cmd=\"$cmd1\" 81711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_len " $cmd" 81721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len=$func_len_result 81731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 81741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 81751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich try_normal_branch=no 81761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 81771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 81781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$try_normal_branch" = yes \ 81791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich && { test "$len" -lt "$max_cmd_len" \ 81801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich || test "$max_cmd_len" -le -1; } 81811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich then 81821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$cmd" 'exit $?' 81831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich skipped_export=false 81841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -n "$nm_file_list_spec"; then 81851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$output" 81861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output_la=$func_basename_result 81871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_libobjs=$libobjs 81881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_output=$output 81891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=${output_objdir}/${output_la}.nm 81901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$output" 81911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobjs=$nm_file_list_spec$func_to_tool_file_result 81921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append delfiles " $output" 81931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "creating $NM input file list: $output" 81941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for obj in $save_libobjs; do 81951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$obj" 81961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$func_to_tool_file_result" 81971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done > "$output" 81981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval cmd=\"$cmd1\" 81991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$cmd" 'exit $?' 82001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=$save_output 82011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobjs=$save_libobjs 82021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich skipped_export=false 82031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 82041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The command line is too long to execute in one step. 82051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "using reloadable object file for export list..." 82061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich skipped_export=: 82071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Break out early, otherwise skipped_export may be 82081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # set to false by a later but shorter cmd. 82091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 82101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 82121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 82131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 82141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 82151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 82161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 82201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols" && test -n "$include_expsyms"; then 82211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_export_symbols="$export_symbols" 82221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 82231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 82241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 82261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 82271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The given exports_symbols file has to be filtered, so filter it. 82281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 82291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # FIXME: $output_objdir/$libname.filter potentially contains lots of 82301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # 's' commands which not all seds can handle. GNU sed should be fine 82311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # though. Also, the filter scales superlinearly with the number of 82321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # global variables. join(1) would be nice here, but unfortunately 82331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # isn't a blessed tool. 82341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 82351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append delfiles " $export_symbols $output_objdir/$libname.filter" 82361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols=$output_objdir/$libname.def 82371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 82381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 82401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_deplibs= 82411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for test_deplib in $deplibs; do 82421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $convenience " in 82431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $test_deplib "*) ;; 82441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 82451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append tmp_deplibs " $test_deplib" 82461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 82471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 82481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 82491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich deplibs="$tmp_deplibs" 82501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 82511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$convenience"; then 82521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$whole_archive_flag_spec" && 82531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$compiler_needs_object" = yes && 82541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$libobjs"; then 82551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # extract the archives, so we have objects to list. 82561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # TODO: could optimize this to just extract one archive. 82571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich whole_archive_flag_spec= 82581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$whole_archive_flag_spec"; then 82601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_libobjs=$libobjs 82611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 82621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$libobjs" = "X " && libobjs= 82631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 82641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich gentop="$output_objdir/${outputname}x" 82651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append generated " $gentop" 82661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 82671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_extract_archives $gentop $convenience 82681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libobjs " $func_extract_archives_result" 82691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$libobjs" = "X " && libobjs= 82701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 82731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 82741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval flag=\"$thread_safe_flag_spec\" 82751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append linker_flags " $flag" 82761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 82781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make a backup of the uninstalled library when relinking 82791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$opt_mode" = relink; then 82801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 82811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 82831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do each of the archive commands. 82841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$module" = yes && test -n "$module_cmds" ; then 82851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 82861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval test_cmds=\"$module_expsym_cmds\" 82871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$module_expsym_cmds 82881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 82891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval test_cmds=\"$module_cmds\" 82901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$module_cmds 82911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 82921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 82931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 82941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval test_cmds=\"$archive_expsym_cmds\" 82951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$archive_expsym_cmds 82961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 82971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval test_cmds=\"$archive_cmds\" 82981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$archive_cmds 82991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 83001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 83011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 83021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$skipped_export" != "X:" && 83031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_len " $test_cmds" && 83041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len=$func_len_result && 83051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 83061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich : 83071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 83081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The command line is too long to link in one step, link piecewise 83091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # or, if using GNU ld and skipped_export is not :, use a linker 83101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # script. 83111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 83121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Save the value of $output and $libobjs because we want to 83131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # use them later. If we have whole_archive_flag_spec, we 83141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # want to use save_libobjs as it was before 83151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # whole_archive_flag_spec was expanded, because we can't 83161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # assume the linker understands whole_archive_flag_spec. 83171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This may have to be revisited, in case too many 83181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # convenience libraries get linked in and end up exceeding 83191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the spec. 83201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 83211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_libobjs=$libobjs 83221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 83231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_output=$output 83241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$output" 83251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output_la=$func_basename_result 83261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 83271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Clear the reloadable object creation command queue and 83281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # initialize k to one. 83291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test_cmds= 83301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_cmds= 83311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich objlist= 83321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich last_robj= 83331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich k=1 83341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 83351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 83361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=${output_objdir}/${output_la}.lnkscript 83371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "creating GNU ld script: $output" 83381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo 'INPUT (' > $output 83391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for obj in $save_libobjs 83401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 83411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$obj" 83421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$func_to_tool_file_result" >> $output 83431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 83441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo ')' >> $output 83451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append delfiles " $output" 83461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$output" 83471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=$func_to_tool_file_result 83481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 83491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=${output_objdir}/${output_la}.lnk 83501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "creating linker input file list: $output" 83511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich : > $output 83521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich set x $save_libobjs 83531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 83541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich firstobj= 83551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$compiler_needs_object" = yes; then 83561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich firstobj="$1 " 83571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich shift 83581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 83591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for obj 83601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 83611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$obj" 83621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$func_to_tool_file_result" >> $output 83631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 83641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append delfiles " $output" 83651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$output" 83661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 83671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 83681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$save_libobjs"; then 83691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "creating reloadable object files..." 83701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=$output_objdir/$output_la-${k}.$objext 83711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval test_cmds=\"$reload_cmds\" 83721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_len " $test_cmds" 83731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len0=$func_len_result 83741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len=$len0 83751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 83761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Loop over the list of objects to be linked. 83771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for obj in $save_libobjs 83781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 83791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_len " $obj" 83801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $len + $func_len_result 83811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len=$func_arith_result 83821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$objlist" = X || 83831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$len" -lt "$max_cmd_len"; then 83841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append objlist " $obj" 83851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 83861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The command $test_cmds is almost too long, add a 83871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # command to the queue. 83881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$k" -eq 1 ; then 83891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The first file doesn't have a previous command to add. 83901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich reload_objs=$objlist 83911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval concat_cmds=\"$reload_cmds\" 83921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 83931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # All subsequent reloadable object files will link in 83941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the last one created. 83951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich reload_objs="$objlist $last_robj" 83961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 83971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 83981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich last_robj=$output_objdir/$output_la-${k}.$objext 83991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $k + 1 84001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich k=$func_arith_result 84011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=$output_objdir/$output_la-${k}.$objext 84021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich objlist=" $obj" 84031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_len " $last_robj" 84041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $len0 + $func_len_result 84051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len=$func_arith_result 84061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 84081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Handle the remaining objects by creating one last 84091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # reloadable object file. All subsequent reloadable object 84101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # files will link in the last one created. 84111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 84121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich reload_objs="$objlist $last_robj" 84131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 84141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$last_robj"; then 84151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 84161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append delfiles " $output" 84181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 84201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output= 84211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ${skipped_export-false}; then 84241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "generating symbol list for \`$libname.la'" 84251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols="$output_objdir/$libname.exp" 84261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM $export_symbols 84271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobjs=$output 84281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Append the command to create the export file. 84291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 84301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 84311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$last_robj"; then 84321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 84331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$save_libobjs" && 84371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "creating a temporary reloadable object file: $output" 84381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Loop through the commands generated above and execute them. 84401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_ifs="$IFS"; IFS='~' 84411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for cmd in $concat_cmds; do 84421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 84431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_silent || { 84441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_expand "$cmd" 84451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "func_echo $func_quote_for_expand_result" 84461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 84471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || eval "$cmd" || { 84481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_exit=$? 84491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Restore the uninstalled library and exit 84511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$opt_mode" = relink; then 84521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ( cd "$output_objdir" && \ 84531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM "${realname}T" && \ 84541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $MV "${realname}U" "$realname" ) 84551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $lt_exit 84581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 84591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 84601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 84611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols_regex" && ${skipped_export-false}; then 84631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 84641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 84651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if ${skipped_export-false}; then 84691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols" && test -n "$include_expsyms"; then 84701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tmp_export_symbols="$export_symbols" 84711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 84721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 84731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$orig_export_symbols"; then 84761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The given exports_symbols file has to be filtered, so filter it. 84771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 84781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # FIXME: $output_objdir/$libname.filter potentially contains lots of 84791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # 's' commands which not all seds can handle. GNU sed should be fine 84801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # though. Also, the filter scales superlinearly with the number of 84811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # global variables. join(1) would be nice here, but unfortunately 84821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # isn't a blessed tool. 84831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 84841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append delfiles " $export_symbols $output_objdir/$libname.filter" 84851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich export_symbols=$output_objdir/$libname.def 84861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 84871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobjs=$output 84911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Restore the value of output. 84921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=$save_output 84931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 84941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 84951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 84961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$libobjs" = "X " && libobjs= 84971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 84981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Expand the library linking commands again to reset the 84991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # value of $libobjs for piecewise linking. 85001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do each of the archive commands. 85021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$module" = yes && test -n "$module_cmds" ; then 85031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 85041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$module_expsym_cmds 85051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 85061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$module_cmds 85071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 85091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 85101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$archive_expsym_cmds 85111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 85121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$archive_cmds 85131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$delfiles"; then 85181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Append the command to remove temporary files to $cmds. 85191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval cmds=\"\$cmds~\$RM $delfiles\" 85201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add any objects from preloaded convenience libraries 85231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dlprefiles"; then 85241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich gentop="$output_objdir/${outputname}x" 85251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append generated " $gentop" 85261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_extract_archives $gentop $dlprefiles 85281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append libobjs " $func_extract_archives_result" 85291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "X$libobjs" = "X " && libobjs= 85301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_ifs="$IFS"; IFS='~' 85331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for cmd in $cmds; do 85341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 85351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval cmd=\"$cmd\" 85361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_silent || { 85371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_expand "$cmd" 85381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval "func_echo $func_quote_for_expand_result" 85391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 85401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || eval "$cmd" || { 85411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich lt_exit=$? 85421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Restore the uninstalled library and exit 85441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$opt_mode" = relink; then 85451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ( cd "$output_objdir" && \ 85461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM "${realname}T" && \ 85471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $MV "${realname}U" "$realname" ) 85481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $lt_exit 85511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 85521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 85531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich IFS="$save_ifs" 85541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Restore the uninstalled library and exit 85561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$opt_mode" = relink; then 85571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 85581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$convenience"; then 85601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$whole_archive_flag_spec"; then 85611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '${RM}r "$gentop"' 85621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 85661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Create links to the real library. 85691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for linkname in $linknames; do 85701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$realname" != "$linkname"; then 85711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 85721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 85741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If -module or -export-dynamic was specified, set the dlname. 85761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$module" = yes || test "$export_dynamic" = yes; then 85771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # On all known operating systems, these are identical. 85781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlname="$soname" 85791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 85821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich obj) 85841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 85851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-dlopen' is ignored for objects" 85861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 85871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $deplibs" in 85891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *\ -l* | *\ -L*) 85901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-l' and \`-L' are ignored for objects" ;; 85911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 85921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$rpath" && \ 85941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-rpath' is ignored for objects" 85951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$xrpath" && \ 85971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-R' is ignored for objects" 85981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 85991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$vinfo" && \ 86001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-version-info' is ignored for objects" 86011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$release" && \ 86031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-release' is ignored for objects" 86041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $output in 86061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo) 86071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$objs$old_deplibs" && \ 86081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "cannot build library object \`$output' from non-libtool objects" 86091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobj=$output 86111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_lo2o "$libobj" 86121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich obj=$func_lo2o_result 86131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 86141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 86151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libobj= 86161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich obj="$output" 86171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 86181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 86191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Delete the old objects. 86211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM $obj $libobj 86221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Objects from convenience libraries. This assumes 86241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # single-version convenience libraries. Whenever we create 86251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # different ones for PIC/non-PIC, this we'll have to duplicate 86261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the extraction. 86271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich reload_conv_objs= 86281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich gentop= 86291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # reload_cmds runs $LD directly, so let us get rid of 86301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # -Wl from whole_archive_flag_spec and hope we can get by with 86311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # turning comma into space.. 86321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich wl= 86331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$convenience"; then 86351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$whole_archive_flag_spec"; then 86361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 86371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 86381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 86391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich gentop="$output_objdir/${obj}x" 86401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append generated " $gentop" 86411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_extract_archives $gentop $convenience 86431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich reload_conv_objs="$reload_objs $func_extract_archives_result" 86441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 86451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 86461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If we're not building shared, we need to use non_pic_objs 86481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" 86491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Create the old-style object. 86511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 86521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output="$obj" 86541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$reload_cmds" 'exit $?' 86551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Exit if we aren't doing a library object file. 86571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$libobj"; then 86581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$gentop"; then 86591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '${RM}r "$gentop"' 86601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 86611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 86631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 86641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" != yes; then 86661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$gentop"; then 86671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '${RM}r "$gentop"' 86681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 86691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Create an invalid libtool object if no PIC, so that we don't 86711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # accidentally link it into a program. 86721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # $show "echo timestamp > $libobj" 86731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 86741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 86751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 86761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$pic_flag" || test "$pic_mode" != default; then 86781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only do commands if we really have different PIC objects. 86791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich reload_objs="$libobjs $reload_conv_objs" 86801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output="$libobj" 86811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$reload_cmds" 'exit $?' 86821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 86831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$gentop"; then 86851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '${RM}r "$gentop"' 86861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 86871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 86891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 86901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich prog) 86921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 86931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin*) func_stripname '' '.exe' "$output" 86941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=$func_stripname_result.exe;; 86951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 86961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$vinfo" && \ 86971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-version-info' is ignored for programs" 86981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 86991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$release" && \ 87001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`-release' is ignored for programs" 87011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 87021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$preload" = yes \ 87031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich && test "$dlopen_support" = unknown \ 87041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich && test "$dlopen_self" = unknown \ 87051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich && test "$dlopen_self_static" = unknown && \ 87061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 87071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 87081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 87091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-rhapsody* | *-*-darwin1.[012]) 87101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # On Rhapsody replace the C library is the System framework 87111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 87121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 87131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 87141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 87151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 87161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 87171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-darwin*) 87181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Don't allow lazy linking, it breaks C++ global constructors 87191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # But is supposedly fixed on 10.4 or later (yay!). 87201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$tagname" = CXX ; then 87211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 87221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 10.[0123]) 87231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " ${wl}-bind_at_load" 87241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " ${wl}-bind_at_load" 87251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 87261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 87271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 87281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Time to change all our "foo.ltframework" stuff back to "-framework foo" 87291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 87301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 87311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 87321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 87331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 87341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 87351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # move library search paths that coincide with paths to not yet 87361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # installed libraries to the beginning of the library search list 87371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich new_libs= 87381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for path in $notinst_path; do 87391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $new_libs " in 87401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" -L$path/$objdir "*) ;; 87411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 87421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $compile_deplibs " in 87431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" -L$path/$objdir "*) 87441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append new_libs " -L$path/$objdir" ;; 87451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 87461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 87471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 87481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 87491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $compile_deplibs; do 87501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplib in 87511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) 87521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $new_libs " in 87531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $deplib "*) ;; 87541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append new_libs " $deplib" ;; 87551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 87561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 87571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append new_libs " $deplib" ;; 87581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 87591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 87601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_deplibs="$new_libs" 87611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 87621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 87631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append compile_command " $compile_deplibs" 87641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append finalize_command " $finalize_deplibs" 87651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 87661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$rpath$xrpath"; then 87671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If the user specified any rpath flags, then add them. 87681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for libdir in $rpath $xrpath; do 87691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This is the magic to use -rpath. 87701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$finalize_rpath " in 87711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 87721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append finalize_rpath " $libdir" ;; 87731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 87741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 87751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 87761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 87771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now hardcode the library paths 87781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rpath= 87791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich hardcode_libdirs= 87801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for libdir in $compile_rpath $finalize_rpath; do 87811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_flag_spec"; then 87821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_separator"; then 87831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$hardcode_libdirs"; then 87841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich hardcode_libdirs="$libdir" 87851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 87861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Just accumulate the unique libdirs. 87871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 87881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 87891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 87901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 87911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 87921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 87931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 87941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 87951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 87961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval flag=\"$hardcode_libdir_flag_spec\" 87971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rpath " $flag" 87981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 87991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -n "$runpath_var"; then 88001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$perm_rpath " in 88011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 88021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append perm_rpath " $libdir" ;; 88031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 88041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 88061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 88071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 88081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case :$dllsearchpath: in 88091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *":$libdir:"*) ;; 88101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ::) dllsearchpath=$libdir;; 88111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append dllsearchpath ":$libdir";; 88121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 88131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case :$dllsearchpath: in 88141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *":$testbindir:"*) ;; 88151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ::) dllsearchpath=$testbindir;; 88161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append dllsearchpath ":$testbindir";; 88171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 88181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 88191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 88201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 88211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Substitute the hardcoded libdirs into the rpath. 88221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_separator" && 88231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$hardcode_libdirs"; then 88241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libdir="$hardcode_libdirs" 88251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval rpath=\" $hardcode_libdir_flag_spec\" 88261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_rpath="$rpath" 88281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 88291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rpath= 88301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich hardcode_libdirs= 88311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for libdir in $finalize_rpath; do 88321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_flag_spec"; then 88331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_separator"; then 88341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$hardcode_libdirs"; then 88351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich hardcode_libdirs="$libdir" 88361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 88371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Just accumulate the unique libdirs. 88381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 88391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 88401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 88411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 88421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 88431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 88441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 88451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 88471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval flag=\"$hardcode_libdir_flag_spec\" 88481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rpath " $flag" 88491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -n "$runpath_var"; then 88511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$finalize_perm_rpath " in 88521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $libdir "*) ;; 88531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append finalize_perm_rpath " $libdir" ;; 88541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 88551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 88571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Substitute the hardcoded libdirs into the rpath. 88581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$hardcode_libdir_separator" && 88591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$hardcode_libdirs"; then 88601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libdir="$hardcode_libdirs" 88611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval rpath=\" $hardcode_libdir_flag_spec\" 88621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_rpath="$rpath" 88641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 88651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$libobjs" && test "$build_old_libs" = yes; then 88661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Transform all the library objects into standard objects. 88671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 88681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 88691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 88711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 88721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 88731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # template prelinking step 88741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$prelink_cmds"; then 88751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$prelink_cmds" 'exit $?' 88761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 88781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich wrappers_required=yes 88791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 88801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cegcc* | *mingw32ce*) 88811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 88821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich wrappers_required=no 88831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 88841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw* ) 88851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" != yes; then 88861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich wrappers_required=no 88871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 88891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 88901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 88911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich wrappers_required=no 88921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 88931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 88941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 88951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$wrappers_required" = no; then 88961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Replace the output file specification. 88971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 88981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link_command="$compile_command$compile_rpath" 88991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We have no uninstalled library dependencies, so finalize right now. 89011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit_status=0 89021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$link_command" 'exit_status=$?' 89031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$postlink_cmds"; then 89051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$output" 89061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 89071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$postlink_cmds" 'exit $?' 89081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Delete the generated files. 89111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -f "$output_objdir/${outputname}S.${objext}"; then 89121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 89131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $exit_status 89161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$compile_shlibpath$finalize_shlibpath"; then 89191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 89201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$finalize_shlibpath"; then 89221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 89231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_var= 89261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_var= 89271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$runpath_var"; then 89281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$perm_rpath"; then 89291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We should set the runpath_var. 89301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rpath= 89311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for dir in $perm_rpath; do 89321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rpath "$dir:" 89331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 89341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 89351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$finalize_perm_rpath"; then 89371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We should set the runpath_var. 89381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rpath= 89391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for dir in $finalize_perm_rpath; do 89401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rpath "$dir:" 89411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 89421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 89431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$no_install" = yes; then 89471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # We don't need to create a wrapper script. 89481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link_command="$compile_var$compile_command$compile_rpath" 89491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Replace the output file specification. 89501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 89511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Delete the old output file. 89521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM $output 89531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Link the executable and exit 89541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$link_command" 'exit $?' 89551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$postlink_cmds"; then 89571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$output" 89581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 89591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$postlink_cmds" 'exit $?' 89601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 89631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$hardcode_action" = relink; then 89661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Fast installation is not supported 89671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link_command="$compile_var$compile_command$compile_rpath" 89681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="$finalize_var$finalize_command$finalize_rpath" 89691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "this platform does not like uninstalled shared libraries" 89711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_warning "\`$output' will be relinked during installation" 89721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 89731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$fast_install" != no; then 89741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link_command="$finalize_var$compile_command$finalize_rpath" 89751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$fast_install" = yes; then 89761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 89771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 89781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # fast_install is set to needless 89791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command= 89801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 89821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link_command="$compile_var$compile_command$compile_rpath" 89831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="$finalize_var$finalize_command$finalize_rpath" 89841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 89861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Replace the output file specification. 89881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 89891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Delete the old output files. 89911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 89921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$link_command" 'exit $?' 89941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 89951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$postlink_cmds"; then 89961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$output_objdir/$outputname" 89971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 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'` 89981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$postlink_cmds" 'exit $?' 89991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 90001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 90011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now create the wrapper script. 90021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "creating $output" 90031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 90041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Quote the relink command for shipping. 90051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$relink_command"; then 90061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Preserve any variables that may affect compiler behavior 90071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for var in $variables_saved_for_relink; do 90081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if eval test -z \"\${$var+set}\"; then 90091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 90101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif eval var_value=\$$var; test -z "$var_value"; then 90111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="$var=; export $var; $relink_command" 90121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 90131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$var_value" 90141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 90151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 90161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 90171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="(cd `pwd`; $relink_command)" 90181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 90191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 90201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 90211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only actually do things if not in dry run mode. 90221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 90231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # win32 will think the script is a binary if it has 90241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # a .exe suffix, so we strip it off here. 90251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $output in 90261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.exe) func_stripname '' '.exe' "$output" 90271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output=$func_stripname_result ;; 90281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 90291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # test for cygwin because mv fails w/o .exe extensions 90301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 90311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin*) 90321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exeext=.exe 90331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '.exe' "$outputname" 90341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich outputname=$func_stripname_result ;; 90351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) exeext= ;; 90361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 90371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host in 90381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin* | *mingw* ) 90391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname_and_basename "$output" "" "." 90401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output_name=$func_basename_result 90411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output_path=$func_dirname_result 90421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cwrappersource="$output_path/$objdir/lt-$output_name.c" 90431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cwrapper="$output_path/$output_name.exe" 90441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM $cwrappersource $cwrapper 90451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 90461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 90471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_emit_cwrapperexe_src > $cwrappersource 90481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 90491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # The wrapper executable is built using the $host compiler, 90501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # because it contains $host paths and files. If cross- 90511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # compiling, it, like the target executable, must be 90521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # executed on the $host or under an emulation environment. 90531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 90541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 90551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $STRIP $cwrapper 90561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 90571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 90581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now, create the wrapper script for func_source use: 90591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_ltwrapper_scriptname $cwrapper 90601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM $func_ltwrapper_scriptname_result 90611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 90621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 90631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # note: this script will not be executed, so do not chmod. 90641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "x$build" = "x$host" ; then 90651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 90661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 90671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_emit_wrapper no > $func_ltwrapper_scriptname_result 90681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 90691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 90701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 90711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich * ) 90721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM $output 90731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 90741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 90751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_emit_wrapper no > $output 90761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich chmod +x $output 90771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 90781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 90791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 90801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 90811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 90821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 90831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 90841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # See if we need to build an old-fashioned archive. 90851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for oldlib in $oldlibs; do 90861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 90871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = convenience; then 90881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldobjs="$libobjs_save $symfileobj" 90891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich addlibs="$convenience" 90901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=no 90911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 90921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$build_libtool_libs" = module; then 90931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldobjs="$libobjs_save" 90941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich build_libtool_libs=no 90951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 90961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldobjs="$old_deplibs $non_pic_objects" 90971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$preload" = yes && test -f "$symfileobj"; then 90981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append oldobjs " $symfileobj" 90991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 91001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 91011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich addlibs="$old_convenience" 91021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 91031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 91041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$addlibs"; then 91051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich gentop="$output_objdir/${outputname}x" 91061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append generated " $gentop" 91071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 91081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_extract_archives $gentop $addlibs 91091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append oldobjs " $func_extract_archives_result" 91101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 91111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 91121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do each command in the archive commands. 91131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 91141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$old_archive_from_new_cmds 91151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 91161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 91171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add any objects from preloaded convenience libraries 91181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$dlprefiles"; then 91191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich gentop="$output_objdir/${outputname}x" 91201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append generated " $gentop" 91211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 91221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_extract_archives $gentop $dlprefiles 91231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append oldobjs " $func_extract_archives_result" 91241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 91251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 91261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # POSIX demands no paths to be encoded in archives. We have 91271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # to avoid creating archives with duplicate basenames if we 91281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # might have to extract them afterwards, e.g., when creating a 91291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # static archive out of a convenience library, or when linking 91301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the entirety of a libtool archive into another (currently 91311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # not supported by libtool). 91321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if (for obj in $oldobjs 91331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 91341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$obj" 91351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$func_basename_result" 91361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done | sort | sort -uc >/dev/null 2>&1); then 91371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich : 91381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 91391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich echo "copying selected object files to avoid basename conflicts..." 91401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich gentop="$output_objdir/${outputname}x" 91411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append generated " $gentop" 91421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mkdir_p "$gentop" 91431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_oldobjs=$oldobjs 91441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldobjs= 91451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich counter=1 91461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for obj in $save_oldobjs 91471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 91481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$obj" 91491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich objbase="$func_basename_result" 91501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $oldobjs " in 91511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich " ") oldobjs=$obj ;; 91521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[\ /]"$objbase "*) 91531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich while :; do 91541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Make sure we don't pick an alternate name that also 91551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # overlaps. 91561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newobj=lt$counter-$objbase 91571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $counter + 1 91581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich counter=$func_arith_result 91591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $oldobjs " in 91601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *[\ /]"$newobj "*) ;; 91611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) if test ! -f "$gentop/$newobj"; then break; fi ;; 91621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 91631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 91641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 91651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append oldobjs " $gentop/$newobj" 91661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 91671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append oldobjs " $obj" ;; 91681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 91691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 91701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 91711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 91721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tool_oldlib=$func_to_tool_file_result 91731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval cmds=\"$old_archive_cmds\" 91741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 91751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_len " $cmds" 91761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len=$func_len_result 91771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 91781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$old_archive_cmds 91791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -n "$archiver_list_spec"; then 91801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "using command file archive linking..." 91811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for obj in $oldobjs 91821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 91831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$obj" 91841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO "$func_to_tool_file_result" 91851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done > $output_objdir/$libname.libcmd 91861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_to_tool_file "$output_objdir/$libname.libcmd" 91871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldobjs=" $archiver_list_spec$func_to_tool_file_result" 91881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich cmds=$old_archive_cmds 91891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 91901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the command line is too long to link in one step, link in parts 91911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "using piecewise archive linking..." 91921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_RANLIB=$RANLIB 91931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich RANLIB=: 91941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich objlist= 91951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich concat_cmds= 91961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich save_oldobjs=$oldobjs 91971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldobjs= 91981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Is there a better way of finding the last object in the list? 91991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for obj in $save_oldobjs 92001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 92011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich last_oldobj=$obj 92021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 92031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval test_cmds=\"$old_archive_cmds\" 92041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_len " $test_cmds" 92051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len0=$func_len_result 92061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len=$len0 92071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for obj in $save_oldobjs 92081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 92091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_len " $obj" 92101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_arith $len + $func_len_result 92111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len=$func_arith_result 92121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append objlist " $obj" 92131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$len" -lt "$max_cmd_len"; then 92141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich : 92151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 92161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the above command should be used before it gets too long 92171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldobjs=$objlist 92181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$obj" = "$last_oldobj" ; then 92191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich RANLIB=$save_RANLIB 92201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 92211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 92221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 92231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich objlist= 92241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich len=$len0 92251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 92261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 92271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich RANLIB=$save_RANLIB 92281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich oldobjs=$objlist 92291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$oldobjs" = "X" ; then 92301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval cmds=\"\$concat_cmds\" 92311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 92321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 92331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 92341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 92351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 92361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$cmds" 'exit $?' 92371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 92381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 92391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$generated" && \ 92401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "${RM}r$generated" 92411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 92421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Now create the libtool archive. 92431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $output in 92441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 92451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich old_library= 92461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$build_old_libs" = yes && old_library="$libname.$libext" 92471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_verbose "creating $output" 92481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 92491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Preserve any variables that may affect compiler behavior 92501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for var in $variables_saved_for_relink; do 92511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if eval test -z \"\${$var+set}\"; then 92521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 92531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif eval var_value=\$$var; test -z "$var_value"; then 92541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="$var=; export $var; $relink_command" 92551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 92561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_quote_for_eval "$var_value" 92571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 92581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 92591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 92601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Quote the link command for shipping. 92611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 92621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 92631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$hardcode_automatic" = yes ; then 92641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command= 92651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 92661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 92671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only create the output if not a dry run. 92681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_dry_run || { 92691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for installed in no yes; do 92701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$installed" = yes; then 92711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -z "$install_libdir"; then 92721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich break 92731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 92741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich output="$output_objdir/$outputname"i 92751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Replace all uninstalled libtool libraries with the installed ones 92761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdependency_libs= 92771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for deplib in $dependency_libs; do 92781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $deplib in 92791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 92801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$deplib" 92811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name="$func_basename_result" 92821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_resolve_sysroot "$deplib" 92831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` 92841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$libdir" && \ 92851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$deplib' is not a valid libtool archive" 92861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 92871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 92881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -L*) 92891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname -L '' "$deplib" 92901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_replace_sysroot "$func_stripname_result" 92911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdependency_libs " -L$func_replace_sysroot_result" 92921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 92931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -R*) 92941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname -R '' "$deplib" 92951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_replace_sysroot "$func_stripname_result" 92961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdependency_libs " -R$func_replace_sysroot_result" 92971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 92981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append newdependency_libs " $deplib" ;; 92991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 93001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 93011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dependency_libs="$newdependency_libs" 93021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdlfiles= 93031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 93041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $dlfiles; do 93051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $lib in 93061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 93071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$lib" 93081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name="$func_basename_result" 93091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 93101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$libdir" && \ 93111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$lib' is not a valid libtool archive" 93121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 93131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 93141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append newdlfiles " $lib" ;; 93151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 93161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 93171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlfiles="$newdlfiles" 93181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdlprefiles= 93191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $dlprefiles; do 93201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $lib in 93211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 93221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Only pass preopened files to the pseudo-archive (for 93231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # eventual linking with the app. that links it) if we 93241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # didn't already link the preopened objects directly into 93251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # the library: 93261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$lib" 93271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name="$func_basename_result" 93281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 93291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$libdir" && \ 93301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_error "\`$lib' is not a valid libtool archive" 93311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 93321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 93331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 93341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 93351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlprefiles="$newdlprefiles" 93361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 93371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdlfiles= 93381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $dlfiles; do 93391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $lib in 93401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 93411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) abs=`pwd`"/$lib" ;; 93421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 93431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlfiles " $abs" 93441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 93451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlfiles="$newdlfiles" 93461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich newdlprefiles= 93471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for lib in $dlprefiles; do 93481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $lib in 93491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 93501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) abs=`pwd`"/$lib" ;; 93511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 93521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append newdlprefiles " $abs" 93531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 93541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dlprefiles="$newdlprefiles" 93551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 93561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $RM $output 93571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # place dlname in correct position for cygwin 93581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # In fact, it would be nice if we could use this code for all target 93591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # systems that can't hard-code library paths into their executables 93601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # and that have no shared library path variable independent of PATH, 93611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # but it turns out we can't easily determine that from inspecting 93621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # libtool variables, so we have to hard-code the OSs to which it 93631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # applies here; at the moment, that means platforms that use the PE 93641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # object format with DLL files. See the long comment at the top of 93651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # tests/bindir.at for full details. 93661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tdlname=$dlname 93671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $host,$output,$installed,$module,$dlname in 93681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 93691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # If a -bindir argument was supplied, place the dll there. 93701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "x$bindir" != x ; 93711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich then 93721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_relative_path "$install_libdir" "$bindir" 93731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tdlname=$func_relative_path_result$dlname 93741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 93751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Otherwise fall back on heuristic. 93761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich tdlname=../bin/$dlname 93771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 93781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 93791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 93801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO > $output "\ 93811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# $outputname - a libtool library file 93821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 93831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# 93841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Please DO NOT delete this file! 93851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# It is necessary for linking the library. 93861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 93871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# The name that we can dlopen(3). 93881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdlname='$tdlname' 93891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 93901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Names of this library. 93911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlibrary_names='$library_names' 93921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 93931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# The name of the static archive. 93941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichold_library='$old_library' 93951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 93961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Linker flags that can not go in dependency_libs. 93971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichinherited_linker_flags='$new_inherited_linker_flags' 93981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 93991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Libraries that this one depends upon. 94001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdependency_libs='$dependency_libs' 94011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Names of additional weak libraries provided by this library 94031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichweak_library_names='$weak_libs' 94041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Version information for $libname. 94061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichcurrent=$current 94071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichage=$age 94081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichrevision=$revision 94091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Is this an already installed library? 94111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichinstalled=$installed 94121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Should we warn about portability when linking against -modules? 94141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichshouldnotlink=$module 94151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Files to dlopen/dlpreopen 94171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdlopen='$dlfiles' 94181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichdlpreopen='$dlprefiles' 94191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Directory that this library needs to be installed in: 94211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichlibdir='$install_libdir'" 94221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$installed" = no && test "$need_relink" = yes; then 94231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $ECHO >> $output "\ 94241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichrelink_command=\"$relink_command\"" 94251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 94261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 94271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich } 94281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do a symbolic link so that the libtool archive can be found in 94301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # LD_LIBRARY_PATH before the program is installed. 94311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 94321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 94331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 94341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_SUCCESS 94351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 94361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ test "$opt_mode" = link || test "$opt_mode" = relink; } && 94381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mode_link ${1+"$@"} 94391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# func_mode_uninstall arg... 94421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfunc_mode_uninstall () 94431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ 94441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich $opt_debug 94451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich RM="$nonopt" 94461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich files= 94471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rmforce= 94481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit_status=0 94491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # This variable tells wrapper scripts just to set variables rather 94511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # than running their programs. 94521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich libtool_install_magic="$magic" 94531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for arg 94551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich do 94561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $arg in 94571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -f) func_append RM " $arg"; rmforce=yes ;; 94581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich -*) func_append RM " $arg" ;; 94591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append files " $arg" ;; 94601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 94611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 94621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -z "$RM" && \ 94641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "you must specify an RM program" 94651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rmdirs= 94671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for file in $files; do 94691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_dirname "$file" "" "." 94701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich dir="$func_dirname_result" 94711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$dir" = X.; then 94721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich odir="$objdir" 94731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 94741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich odir="$dir/$objdir" 94751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 94761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_basename "$file" 94771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich name="$func_basename_result" 94781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$opt_mode" = uninstall && odir="$dir" 94791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Remember odir for removal later, being careful to avoid duplicates 94811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$opt_mode" = clean; then 94821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $rmdirs " in 94831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $odir "*) ;; 94841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) func_append rmdirs " $odir" ;; 94851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 94861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 94871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 94881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Don't error if the file doesn't exist and rm -f was used. 94891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if { test -L "$file"; } >/dev/null 2>&1 || 94901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich { test -h "$file"; } >/dev/null 2>&1 || 94911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -f "$file"; then 94921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich : 94931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test -d "$file"; then 94941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit_status=1 94951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 94961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich elif test "$rmforce" = yes; then 94971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich continue 94981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 94991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich rmfiles="$file" 95011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $name in 95031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.la) 95041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Possibly a libtool archive, so verify it. 95051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_lalib_p "$file"; then 95061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source $dir/$name 95071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Delete the libtool libraries and symlinks. 95091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for n in $library_names; do 95101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rmfiles " $odir/$n" 95111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 95121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$old_library" && func_append rmfiles " $odir/$old_library" 95131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case "$opt_mode" in 95151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich clean) 95161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case " $library_names " in 95171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *" $dlname "*) ;; 95181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 95191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 95201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 95211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 95221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich uninstall) 95231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$library_names"; then 95241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do each command in the postuninstall commands. 95251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 95261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$old_library"; then 95291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do each command in the old_postuninstall commands. 95301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 95311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # FIXME: should reinstall the best remaining shared library. 95331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 95341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 95351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 95371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.lo) 95391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Possibly a libtool object, so verify it. 95401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_lalib_p "$file"; then 95411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Read the .lo file 95431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source $dir/$name 95441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add PIC object to the list of files to remove. 95461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$pic_object" && 95471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$pic_object" != none; then 95481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rmfiles " $dir/$pic_object" 95491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Add non-PIC object to the list of files to remove. 95521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -n "$non_pic_object" && 95531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich test "$non_pic_object" != none; then 95541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rmfiles " $dir/$non_pic_object" 95551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95561d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95571d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 95581d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95591d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *) 95601d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$opt_mode" = clean ; then 95611d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich noexename=$name 95621d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich case $file in 95631d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich *.exe) 95641d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '.exe' "$file" 95651d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich file=$func_stripname_result 95661d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_stripname '' '.exe' "$name" 95671d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich noexename=$func_stripname_result 95681d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # $file with .exe has already been added to rmfiles, 95691d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # add $file without .exe 95701d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rmfiles " $file" 95711d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 95721d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 95731d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Do a test to see if this is a libtool program. 95741d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_ltwrapper_p "$file"; then 95751d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if func_ltwrapper_executable_p "$file"; then 95761d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_ltwrapper_scriptname "$file" 95771d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command= 95781d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source $func_ltwrapper_scriptname_result 95791d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rmfiles " $func_ltwrapper_scriptname_result" 95801d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich else 95811d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich relink_command= 95821d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_source $dir/$noexename 95831d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95841d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 95851d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # note $name still contains .exe if it was in $file originally 95861d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # as does the version of $file that was added into $rmfiles 95871d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rmfiles " $odir/$name $odir/${name}S.${objext}" 95881d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "$fast_install" = yes && test -n "$relink_command"; then 95891d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rmfiles " $odir/lt-$name" 95901d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95911d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test "X$noexename" != "X$name" ; then 95921d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_append rmfiles " $odir/lt-${noexename}.c" 95931d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95941d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95951d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 95961d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich ;; 95971d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich esac 95981d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "$RM $rmfiles" 'exit_status=1' 95991d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 96001d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96011d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich # Try to remove the ${objdir}s in the directories where we deleted files 96021d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich for dir in $rmdirs; do 96031d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich if test -d "$dir"; then 96041d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_show_eval "rmdir $dir >/dev/null 2>&1" 96051d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich fi 96061d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich done 96071d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96081d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $exit_status 96091d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 96101d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96111d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && 96121d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_mode_uninstall ${1+"$@"} 96131d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96141d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtest -z "$opt_mode" && { 96151d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich help="$generic_help" 96161d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "you must specify a MODE" 96171d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich} 96181d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96191d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichtest -z "$exec_cmd" && \ 96201d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich func_fatal_help "invalid operation mode \`$opt_mode'" 96211d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96221d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichif test -n "$exec_cmd"; then 96231d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich eval exec "$exec_cmd" 96241d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich exit $EXIT_FAILURE 96251d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichfi 96261d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96271d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichexit $exit_status 96281d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96291d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96301d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# The TAGs below are defined such that we never get into a situation 96311d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# in which we disable both kinds of libraries. Given conflicting 96321d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# choices, we go for a static library, that is the most portable, 96331d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# since we can't tell whether shared libraries were disabled because 96341d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# the user asked for that or because the platform doesn't support 96351d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# them. This is particularly important on AIX, because we don't 96361d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# support having both static and shared libraries enabled at the same 96371d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# time on that platform, so we default to a shared-only configuration. 96381d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# If a disable-shared tag is given, we'll fallback to a static-only 96391d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# configuration. But we'll never go from static-only to shared-only. 96401d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96411d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 96421d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbuild_libtool_libs=no 96431d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbuild_old_libs=yes 96441d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ### END LIBTOOL TAG CONFIG: disable-shared 96451d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96461d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ### BEGIN LIBTOOL TAG CONFIG: disable-static 96471d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevichbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 96481d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# ### END LIBTOOL TAG CONFIG: disable-static 96491d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 96501d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# Local Variables: 96511d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# mode:shell-script 96521d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# sh-indentation:2 96531d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# End: 96541d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich# vi:sw=2 96551d1011a3c5049a7f9eef99d22f3704e4367579ccNick Kralevich 9656